#9886·foundry

Add `eth_getProof` cheatcode

Author: valerioleoCreated Feb 14, 2025Updated Sep 17, 2026
LabelsT-featureA-cheatcodesT-to-discuss

Component

Forge

Describe the feature you would like

As per title, it would be amazing if we could call eth_getProof from within the tests.

One immediate use case is to test ZK contracts using proof of knowledge of some particular data in the storage. For example, imagine an ERC20 with all encrypted balances balances mapping(address -> encryptedUint256). I want to generate a ZK proof that I know Alice's balance in cleartext.

To do so, the proof parameters are:

  • the public Merkle root of the balance storage slot, together with leaves
  • the private input of the cleartext balance of Alice

The proof hashes the cleartext balance and tries to reconstruct the balances trie, which if is all correct will equal the root.

Additional context

No response