You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The checksum included in any type of 08-wasm messages, such as wasm ClientState, should be hex-encoded bytes. The ibc-go 08-wasm light client initially hex-decodes this to a valid checksum.
However, in a subsequent step, the entire payload, containing the checksum, is base64-encoded by the VM before being passed to a CosmWasm contract entry point.
Therefore, the wasm ClientState as client-side type should (de)serialize checksum with hex. Though, in the CosmWasm contract, since the VM passes base64-encoded bytes, we still have to keep using Binary type for the InstantiateMsg so can properly obtain the checksum bytes.
Version
<= 0.53.0
The text was updated successfully, but these errors were encountered:
Following further investigation, we realized that the checksum, whether under the InstantiateMsg or a Wasm ClientState structs, is always base64 deserialized by VM before being passed to the CosmWasm contract entry point. Therefore, our definitions and serde derivations were correct as they were.
The confusion arose when we tried to use the Checksum type from the cosmwasm-std library, which offers hex (de)serialization. Although it is correct to use hex strings to derive checksum bytes from the relayer's perspective, on-chain operations require base64-encoded strings.
A few tests are added by PR #1283 to ensure this is taken into account.
Summary
The checksum included in any type of 08-wasm messages, such as wasm ClientState, should be hex-encoded bytes. The ibc-go 08-wasm light client initially hex-decodes this to a valid checksum.
However, in a subsequent step, the entire payload, containing the checksum, is base64-encoded by the VM before being passed to a CosmWasm contract entry point.
Therefore, the wasm
ClientState
as client-side type should (de)serialize checksum with hex. Though, in the CosmWasm contract, since the VM passes base64-encoded bytes, we still have to keep usingBinary
type for theInstantiateMsg
so can properly obtain the checksum bytes.Version
<= 0.53.0
The text was updated successfully, but these errors were encountered: