zkevm-circuits
zkevm-circuits copied to clipboard
MPT: Connect Witness generation to zkEVM circuits
Depends: #740 and #812
Description:
- Repo https://github.com/privacy-scaling-explorations/mpt-witness-generator (main branch)
- Could require some changes to the API to this bindings.
Another task:
- Review the changes and witness generation #812
Here are some details of this task taken from an old issue. In particular, the MPT witness generation needs to be integrated into the Circuit Input Builder, more or less like this:
- Merge results from all account and storage accesses that happen in a block, and combine their MPT proofs into a Partial State Trie to generate proofs for the circuit.
- [x] Implement a Partial State Trie that supports updates and proof generation https://github.com/privacy-scaling-explorations/mpt-witness-generator
- [ ] Build a Partial State Trie from collected proofs
- [ ] Generate intermediate proofs for StorageOps and AccountOps (Blocked by inputs / witness spec of MPT Circuit https://github.com/appliedzkp/zkevm-circuits/tree/mpt2) - Sort all state/storage accesses by (address, key, rwc) - Use wrapper over MPT witness generation https://github.com/privacy-scaling-explorations/mpt-witness-generator - Storage: For each unique (address, key), get a "before" proof, apply last write, get "after" proof - Account: For each unique (address), get "before" proof, apply write with final values, get "after" proof - Append all hashes used by the MPT into the hash source list.
Related to https://github.com/privacy-scaling-explorations/zkevm-circuits/issues/812