This repository has been archived by the owner on Jul 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 858
Port mpt-witness-generator back to zkevm-circuits #1566
Labels
T-feature
Type: new features
Comments
@ChihChengLiang Great summary! One additional thing is that MPTWG is in Go (and there is Rust binding to it) - does this change things a bit? |
Good question. We already have geth-utils crate in this repo, which is a Go implementation with a Rust binding. So I think it should be fine to do that. Eventually, we want to port MPTWG to Rust for consistency. Here's a possible way to do it.
|
Before actively working on this, check if @Brechtpd plans to refactor some of the code. |
We can move it, Brecht doesn't plan to refactor it. |
github-merge-queue bot
pushed a commit
that referenced
this issue
Sep 9, 2023
### Description MPT witness generator was developed [here](https://github.com/privacy-scaling-explorations/mpt-witness-generator). We now port them to here. ### Issue Link #1566 ### Type of change New feature (non-breaking change which adds functionality) ### Contents - All repo contents from https://github.com/privacy-scaling-explorations/mpt-witness-generator ### Rationale - We port the raw repo content here. No modification except removing `.git` folder. This way, we don't hide any modifications in the big diffs. - We expect further changes in the following PR ### How Has This Been Tested? No test Co-authored-by: adria0.eth <5526331+adria0@users.noreply.github.com>
This was referenced Oct 12, 2023
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Describe the feature you would like
We've merged the MPT circuit, but it has yet to be able to generate witnesses for our EVM computation. So, our next step is to add the witness generation feature in the circuit input builder, as described in #811.
But #811 was written in the context before the mpt-witness-generator (MPTWG hereafter) became an independent repo.
MPTWG as an external dependency would cause issues, and we should move it back to this repo as a crate.
Additional context
Before we explain why it causes issues, let me share my understanding of the current status.
We currently test the MPT circuit by feeding a list of generated witnesses to the MPT circuit.
zkevm-circuits/zkevm-circuits/src/mpt_circuit.rs
Lines 813 to 826 in 5d01150
The generated witnesses are in the form of JSON files located at https://github.com/privacy-scaling-explorations/zkevm-circuits/blob/484c1ae8cdb16ce0d1d8a8645f29a968206bb4fe/zkevm-circuits/src/mpt_circuit/tests
We can run this command to run the MPT tests.
The JSON witnesses are generated using MPTWG. To generate witnesses, run
cd witness
thengo test gen_witness_from_infura_blockchain_test.go prepare_witness.go leaf.go extension_node.go modified_extension_node.go nodes.go test_tools.go branch.go util.go
.This causes some problems. Say we want to update the MPTWG. The flow would be
But for step 2, we have to carefully run the MPTWG and generate new JSON files in the zkevm-circuit PR. Note that these JSON files are matrices of hax compressed in one line, which is not easy to review.
The proposed approach is we
The text was updated successfully, but these errors were encountered: