foundry-rs / foundry-rs/foundry

Add `eth_getProof` cheatcode

Open
#9,886 3 comments 0 reactions 0 assignees View on GitHub
A-cheatcodes T-feature T-to-discuss
Dominant language
Rust
Stars
10.6k
Forks
2.6k
Avg merge
18h 20m
Merged PRs (30d)
510

Description

### 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_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.