-
Notifications
You must be signed in to change notification settings - Fork 440
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
Upgrade to wasmvm 1.3.0-rc.0 #1486
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1486 +/- ##
==========================================
- Coverage 57.86% 57.78% -0.08%
==========================================
Files 63 63
Lines 8344 8348 +4
==========================================
- Hits 4828 4824 -4
- Misses 3112 3116 +4
- Partials 404 408 +4
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! Thanks a lot for taking this task. 💐
I have added some comment about the test mock to discuss. Otherwise excellent!
@@ -217,7 +217,7 @@ func (k Keeper) importCode(ctx sdk.Context, codeID uint64, codeInfo types.CodeIn | |||
return types.ErrCreateFailed.Wrap(errorsmod.Wrap(err, "uncompress wasm archive").Error()) | |||
} | |||
} | |||
newCodeHash, err := k.wasmVM.Create(wasmCode) | |||
newCodeHash, err := k.wasmVM.StoreCodeUnchecked(wasmCode) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
@@ -106,7 +106,7 @@ func restoreV1(_ sdk.Context, k *Keeper, compressedCode []byte) error { | |||
} | |||
|
|||
// FIXME: check which codeIDs the checksum matches?? | |||
_, err = k.wasmVM.Create(wasmCode) | |||
_, err = k.wasmVM.StoreCodeUnchecked(wasmCode) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -88,6 +89,20 @@ func (m *MockWasmer) Create(codeID wasmvm.WasmCode) (wasmvm.Checksum, error) { | |||
return m.CreateFn(codeID) | |||
} | |||
|
|||
func (m *MockWasmer) StoreCode(codeID wasmvm.WasmCode) (wasmvm.Checksum, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was wondering if we want to use Create
at all now in this mock. The method is required to be compatible with the interface but why not always panic with "Deprecated: use StoreCode instead"? There should not be any reason to use it in tests anymore. WDYT?
Please add a deprecated annotation to the method, too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea!
x/wasm/types/test_fixtures.go
Outdated
sdk "github.com/cosmos/cosmos-sdk/types" | ||
) | ||
|
||
//go:embed testdata/reflect.wasm | ||
var wasmCode []byte |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would be good to rename this to reflectWasmCode
or something more verbose. There are some contracts used in this project
x/wasm/types/wasmer_engine.go
Outdated
StoreCode(code wasmvm.WasmCode) (wasmvm.Checksum, error) | ||
|
||
// Create will compile the wasm code, and store the resulting pre-compile | ||
// as well as the original code. Both can be referenced later via CodeID |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: here and above
// as well as the original code. Both can be referenced later via CodeID | |
// as well as the original code. Both can be referenced later via checksum |
PinFn func(checksum wasmvm.Checksum) error | ||
UnpinFn func(checksum wasmvm.Checksum) error | ||
GetMetricsFn func() (*wasmvmtypes.Metrics, error) | ||
CreateFn func(codeID wasmvm.WasmCode) (wasmvm.Checksum, error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove? Please see my comment below
LGTM. What iss missing for 1.3 is support for the new message and query types: #1296 (comment) |
* Upgrade to wasmvm 1.3.0-rc.0 * Fix comments (cherry picked from commit 1a5a2d9) # Conflicts: # README.md # go.sum # x/wasm/client/cli/gov_tx.go # x/wasm/keeper/genesis_test.go # x/wasm/keeper/snapshotter_integration_test.go
* Upgrade to wasmvm 1.3.0-rc.0 (#1486) * Upgrade to wasmvm 1.3.0-rc.0 * Fix comments (cherry picked from commit 1a5a2d9) # Conflicts: # README.md # go.sum # x/wasm/client/cli/gov_tx.go # x/wasm/keeper/genesis_test.go # x/wasm/keeper/snapshotter_integration_test.go * Resolve conflicts --------- Co-authored-by: pinosu <[email protected]> Co-authored-by: Alex Peters <[email protected]>
Part of #1296
sha256.Sum256(raw)
; check for other places