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

Pin code to the wasm VM cache #4093

Merged
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions modules/light-clients/08-wasm/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ func (k Keeper) storeWasmCode(ctx sdk.Context, code []byte) ([]byte, error) {
return nil, errorsmod.Wrap(err, "failed to store contract")
}

// pin the code in the vm
if err := k.wasmVM.Pin(codeHash); err != nil {
return nil, errorsmod.Wrap(err, "pinning contract failed")
}
damiannolan marked this conversation as resolved.
Show resolved Hide resolved

// safety check to assert that code ID returned by WasmVM equals to code hash
if !bytes.Equal(codeHash, expectedHash) {
return nil, errorsmod.Wrapf(types.ErrInvalidCodeID, "expected %s, got %s", hex.EncodeToString(expectedHash), hex.EncodeToString(codeHash))
Expand Down