Build cross-chain state proof verifier utility - #146
Merged
Lakes41 merged 1 commit intoJul 29, 2026
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #66
Description
This PR adds a local cross-chain state proof verifier to the SDK.
The goal is to make it easier to verify Ethereum account and storage proofs without depending on an RPC provider, external API, or internet connection. This is useful in cross-chain workflows where proof data has already been collected from another EVM network and needs to be checked locally before it is submitted on-chain.
The new
StateProverutility validates EIP-1186 proof data against a trustedstateRoot. It walks through the Merkle Patricia Trie, verifies each referenced node, and checks that the proof resolves to the expected account or storage value.What was added
StateProverundersrc/crypto.How verification works
The caller provides a trusted block
stateRoottogether with the output ofeth_getProof.For account proofs, the verifier:
keccak256.For storage proofs, the verifier:
keccak256.All hashing and proof validation happen locally.
Security and trust model
This utility does not make RPC calls or attempt to retrieve block data automatically. It has no dependency on a provider, transport, wallet client, public client, HTTP request, or WebSocket connection.
The proof is only valid relative to the
stateRootsupplied by the caller. The caller is still responsible for obtaining that state root from a trusted block header and deciding whether the source block has sufficient confirmation or finality.This verifier does not replace on-chain proof validation. It provides a way to prevalidate proof data locally before it is passed to another chain or smart contract.
Tests
Added focused tests covering:
A separate no-network test confirms that proof verification succeeds without calling any network API.
Validation
git diff --checkpasses.keccak256primitive.Additional note
A minimal correction was made to the malformed
vitestentry inpackage.jsonbecause the existing JSON error prevented the test runner from starting. No package was added or upgraded as part of that fix.