storage source pure
2
var ErrInvalidRootLength, ErrInvalidKeyLength, ErrInvalidPathLength, ErrInvalidValueLength, ErrValueMismatch
1var (
2 ErrInvalidRootLength = errors.New("storage: root must be 32 bytes")
3 ErrInvalidKeyLength = errors.New("storage: key must be 32 bytes")
4 ErrInvalidPathLength = errors.New("storage: path must be 32 bytes")
5 ErrInvalidValueLength = errors.New("storage: value must be 32 bytes")
6 ErrValueMismatch = errors.New("storage: value mismatch")
7)9
func CheckValue
CheckValue verifies only the value reported by the proof object. This is useful when a caller receives an expected 32-byte commitment separately.
func EncodeProof
func EncodeStorageValue
EncodeStorageValue returns the leaf payload expected by the storage trie.
func IBCCommitmentKey
IBCCommitmentKey mirrors Union's ethereum::ibc_commitment_key for mapping(bytes32 => bytes32) commitments at slot 0.
Union reference: https://github.com/unionlabs/union/blob/main/lib/unionlabs/src/ethereum.rs
func StoragePath
StoragePath returns the MPT path used for an EVM storage slot.
func VerifyAbsence
VerifyAbsence verifies that proof.Key is absent under storageRoot. The Value field is intentionally ignored for absence proofs because eth_getProof returns zero for missing slots.
func VerifyProof
VerifyProof verifies that proof.Key stores proof.Value under storageRoot. Ethereum storage tries are keyed by keccak256(slot), and the leaf payload is the RLP encoding of the storage value with leading zero bytes removed.
func WordFromUint64
func DecodeProof
DecodeProof decodes Union's ethereum_light_client_types::StorageProof bincode wire form into the normalized Proof shape used by this package.
Wire layout with fixed-int/little-endian bincode:
- key: U256 as 32 little-endian bytes
- value: U256 as 32 little-endian bytes
- proof: Vec<Bytes> as u64 length followed by repeated byte vectors
1
type Proof
structProof is the storage proof shape returned by eth_getProof for one slot, normalized to bytes. Key and Value are 32-byte EVM words. Proof contains the raw RLP-encoded trie nodes from root to leaf.
It is also the normalized form of Union's ethereum_light_client_types::StorageProof wire type: https://github.com/unionlabs/union/blob/main/lib/ethereum-light-client-types/src/storage_proof.rs
6
- bytes stdlib
- crypto/keccak256 stdlib
- encoding/binary stdlib
- errors stdlib
- gno.land/p/onbloc/encoding/rlp package
- gno.land/p/onbloc/verifier/evm/mpt package