MsgStoreCode
Uploading the Wasm light client contract to the Wasm VM storage is achieved by means of MsgStoreCode
:
Signer
is an invalid Bech32 address, or it does not match the designated authority address.WasmByteCode
is empty or it exceeds the maximum size, currently set to 3MB.
MsgStoreCode
are allowed to be instantiated. An attempt to create a light client from contracts uploaded via other means (e.g. through x/wasm
if the module shares the same Wasm VM instance with 08-wasm) will fail. Due to the idempotent nature of the Wasm VM’s StoreCode
function, it is possible to store the same byte code multiple times.
When execution of MsgStoreCode
succeeds, the checksum of the contract (i.e. the sha256 hash of the contract’s byte code) is stored in an allow list. When a relayer submits MsgCreateClient
with 08-wasm’s ClientState
, the client state includes the checksum of the Wasm byte code that should be called. Then 02-client calls 08-wasm’s implementation of Initialize
function (which is an interface function part of ClientState
), and it will check that the checksum in the client state matches one of the checksums in the allow list. If a match is found, the light client is initialized; otherwise, the transaction is aborted.
MsgMigrateContract
Migrating a contract to a new Wasm byte code is achieved by means of MsgMigrateContract
:
Signer
is an invalid Bech32 address, or it does not match the designated authority address.ClientId
is not a valid identifier prefixed by08-wasm
.Checksum
is not exactly 32 bytes long or it is not found in the list of allowed checksums (a new checksum is added to the list when executingMsgStoreCode
), or it matches the current checksum of the contract.
MsgRemoveChecksum
Removing a checksum from the list of allowed checksums is achieved by means of MsgRemoveChecksum
:
Signer
is an invalid Bech32 address, or it does not match the designated authority address.Checksum
is not exactly 32 bytes long or it is not found in the list of allowed checksums (a new checksum is added to the list when executingMsgStoreCode
).
Initialize
function.