Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Integrate scale package into runtime #1824

Merged
merged 9 commits into from
Oct 8, 2021
Merged

chore: Integrate scale package into runtime #1824

merged 9 commits into from
Oct 8, 2021

Conversation

timwu20
Copy link
Contributor

@timwu20 timwu20 commented Oct 1, 2021

Changes

  • removed lib/runtime/extrinsic package, no longer needed
  • revised all scale functionality in ib/runtime to use pkg/scale

Tests

go test ./lib/runtime

Issues

Primary Reviewer

@codecov
Copy link

codecov bot commented Oct 1, 2021

Codecov Report

Merging #1824 (9196d71) into development (3d949f2) will increase coverage by 0.01%.
The diff coverage is 74.13%.

Impacted file tree graph

@@               Coverage Diff               @@
##           development    #1824      +/-   ##
===============================================
+ Coverage        59.40%   59.41%   +0.01%     
===============================================
  Files              194      192       -2     
  Lines            19799    19521     -278     
===============================================
- Hits             11761    11599     -162     
+ Misses            6084     6013      -71     
+ Partials          1954     1909      -45     
Flag Coverage Δ
unit-tests 59.41% <74.13%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
dot/rpc/modules/state.go 80.55% <ø> (ø)
lib/runtime/wasmtime/exports.go 0.00% <0.00%> (ø)
lib/runtime/version.go 70.66% <72.91%> (+2.24%) ⬆️
lib/runtime/wasmer/imports.go 43.42% <75.00%> (-0.08%) ⬇️
lib/runtime/life/resolver.go 63.52% <84.61%> (-0.19%) ⬇️
lib/runtime/life/exports.go 52.05% <91.66%> (+2.05%) ⬆️
dot/rpc/modules/api_mocks.go 100.00% <100.00%> (ø)
lib/runtime/wasmer/exports.go 57.69% <100.00%> (+1.84%) ⬆️
lib/babe/epoch.go 64.51% <0.00%> (-2.16%) ⬇️
lib/blocktree/blocktree.go 56.74% <0.00%> (+1.12%) ⬆️
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3d949f2...9196d71. Read the comment docs.

lib/runtime/life/resolver.go Outdated Show resolved Hide resolved
lib/runtime/version.go Show resolved Hide resolved
lib/runtime/version.go Show resolved Hide resolved
require.NoError(t, err)
tx := append([]byte{2}, enc...)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Am I right in saying that the 2 is appended because its a IncludeDataType extrinsic? If so, since we are deleting that file, will we be able to know what the leading byte represents/what values it can have in the future? I was initially confused at what this 2 was and I'm not sure how I would figure that out with the extrinsic file gone. Maybe this isn't a huge concern but I wanted to ask

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah would be good to document this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll add documentation

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there other possible prefixes that should be documented besides the 2 case? Or can those be found elsewhere if need be?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

they were in the old code that I had removed.

lib/runtime/wasmer/exports.go Outdated Show resolved Hide resolved
lib/runtime/wasmer/imports.go Outdated Show resolved Hide resolved
Copy link
Contributor

@noot noot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, just a comment/concern about the storageAppend func

Copy link
Contributor

@jimjbrettj jimjbrettj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Just minor comment

} else if err != nil {
// error comes from scale now, so do a string check
if err != nil {
if strings.Contains(err.Error(), "EOF") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does errors.Is() work here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no cause I don't use an exposed custom error type. I could probably do that to have some sort of scale.UnmarshalEOFError or something.

Copy link
Contributor

@noot noot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice work!

@timwu20 timwu20 force-pushed the tim-1749 branch 2 times, most recently from 484f81d to 4dc9e15 Compare October 8, 2021 13:49
@timwu20 timwu20 merged commit 45772bf into development Oct 8, 2021
@timwu20 timwu20 deleted the tim-1749 branch October 8, 2021 18:50
@github-actions
Copy link

github-actions bot commented Dec 3, 2021

🎉 This PR is included in version 0.6.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

timwu20 added a commit to timwu20/gossamer that referenced this pull request Dec 6, 2021
* revise APIItems

* update scale integration for version

* rm lib/runtime/extrinsic

* lib/runtime/life updates

* update wasmer

* wip

* update skipped test

* cr feedback, fixed storageAppend

* update test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants