Skip to content
This repository was archived by the owner on Jul 5, 2024. It is now read-only.

MPT#398

Merged
Brechtpd merged 304 commits into
mainfrom
mpt2
Aug 10, 2023
Merged

MPT#398
Brechtpd merged 304 commits into
mainfrom
mpt2

Conversation

@miha-stopar
Copy link
Copy Markdown
Collaborator

@miha-stopar miha-stopar commented Mar 21, 2022

This PR aims to provide the first version of Merkle Patricia Trie circuit. The witnesses are currently generated here. Lookups in the Keccak circuit are simulated using internal lookup table.

This branch replaces https://github.com/appliedzkp/zkevm-circuits/commits/merkle-patricia-trie (didn't rebase as it seems cleaner this way, will leave the old branch for a while before deleting it).

@miha-stopar miha-stopar changed the title MPT [WIP] MPT Mar 21, 2022
@miha-stopar miha-stopar marked this pull request as draft March 21, 2022 09:52
@miha-stopar miha-stopar mentioned this pull request Jun 8, 2022
@github-actions github-actions Bot added the crate-zkevm-circuits Issues related to the zkevm-circuits workspace member label Sep 29, 2022
### Description

New descriptors are used which have `Vec<Node>` structure and thus the
conversion in `witness_row.rs` from `[][]byte` to `Vec<Node>` was
removed. Note that `keccak_data` is now part of the `Node` struct - each
node holds the byte streams that need to be hashed.

Additionally, an MPT benchmark was added (some structs needed to be made
public).

### Type of change

- [x] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [x] This change requires a documentation update

### Contents

- All tests updated.
- `prepare_witness` function removed from `witness_row.rs`.
- MPT test updated to not use `prepare_witness`.
- Benchmark added.
@github-actions github-actions Bot added crate-circuit-benchmarks Issues related to the circuit-benchmarks workspace member T-bench Type: benchmark improvements labels Jun 26, 2023
Comment thread zkevm-circuits/src/table/mpt_table.rs Outdated
Comment thread zkevm-circuits/src/mpt_circuit.rs
Comment thread zkevm-circuits/src/mpt_circuit/rlp_gadgets.rs
### Description

Just merges the MPT branch with the master, without fixing any issues
(and so breaks the code). The actual merge is done in
#1531,
the only purpose of this PR is to have a nicer diff for the other PR
without breaking the code in the current `mpt2` branch.

### Issue Link

[_link issue here_]

### Type of change

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [X] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] This change requires a documentation update

### Contents

- [_item_]

### Rationale

[_design decisions and extended information_]

### How Has This Been Tested?
@github-actions github-actions Bot added crate-bus-mapping Issues related to the bus-mapping workspace member CI Issues related to the Continuous Integration mechanisms of the repository. crate-mock Issues related to the mock workspace member crate-integration-tests Issues related to the integration-tests workspace member crate-eth-types Issues related to the eth-types workspace member labels Aug 9, 2023
# Conflicts:
#	.github/workflows/test-features.yml
#	Cargo.lock
#	bus-mapping/src/circuit_input_builder.rs
#	bus-mapping/src/evm/opcodes.rs
#	bus-mapping/src/evm/opcodes/create.rs
#	integration-tests/Cargo.toml
#	integration-tests/src/bin/gen_blockchain_data.rs
#	testool/Cargo.toml
#	zkevm-circuits/src/bytecode_circuit/circuit.rs
#	zkevm-circuits/src/bytecode_circuit/test.rs
#	zkevm-circuits/src/copy_circuit/dev.rs
#	zkevm-circuits/src/evm_circuit.rs
#	zkevm-circuits/src/evm_circuit/execution.rs
#	zkevm-circuits/src/evm_circuit/execution/error_invalid_jump.rs
#	zkevm-circuits/src/evm_circuit/execution/error_write_protection.rs
#	zkevm-circuits/src/evm_circuit/execution/push.rs
#	zkevm-circuits/src/evm_circuit/execution/stop.rs
#	zkevm-circuits/src/keccak_circuit.rs
#	zkevm-circuits/src/keccak_circuit/cell_manager.rs
#	zkevm-circuits/src/keccak_circuit/keccak_packed_multi.rs
#	zkevm-circuits/src/state_circuit.rs
#	zkevm-circuits/src/table.rs
#	zkevm-circuits/src/table/bytecode_table.rs
#	zkevm-circuits/src/table/mpt_table.rs
#	zkevm-circuits/src/util.rs
#	zkevm-circuits/src/util/cell_manager.rs
#	zkevm-circuits/src/witness/block.rs
#	zkevm-circuits/src/witness/bytecode.rs
#	zkevm-circuits/src/witness/mpt.rs
@github-actions github-actions Bot removed crate-bus-mapping Issues related to the bus-mapping workspace member CI Issues related to the Continuous Integration mechanisms of the repository. crate-mock Issues related to the mock workspace member crate-integration-tests Issues related to the integration-tests workspace member crate-eth-types Issues related to the eth-types workspace member labels Aug 9, 2023
Copy link
Copy Markdown
Collaborator

@ChihChengLiang ChihChengLiang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see the PR is getting closer to being merged.
@miha-stopar @Brechtpd @CeciliaZ030 Epic work on MPT!
Question for any of you: Is there anything you think the reviewers can focus on reviewing it? Otherwise, we can approve directly and unblock the merge.

Currently, I only quickly checked the files to see if any leftover files that shouldn't be included. The PR looks great for this part.

@ChihChengLiang ChihChengLiang self-requested a review August 9, 2023 22:02
@Brechtpd
Copy link
Copy Markdown
Collaborator

Brechtpd commented Aug 9, 2023

I think the most important thing is that the non-MPT specific changes are all good to go. If that's okay I think should be okay to merge in so it's easier to keep in sync/improve on/integrate better with the other code afterwards.

For a bit deeper review, I think also good to take a quick look at the main circuit implementation files (mpt_circuit.rs, account_leaf.rs, storage_leaf.rs, extension_branch.rs, branch.rs, extension.rs) to get a feeling how the circuit works.

I think the other files don't need much looking into for now unless to check how something works a bit more deeply. They are used only in the MPT circuit and the code there should be shared better with the other circuits once this PR is merged in (quite a bit of duplication there now to prevent merge conflicts and keep the diff clean).

Copy link
Copy Markdown
Collaborator

@ChihChengLiang ChihChengLiang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!
@Brechtpd Thanks for the reviewing guide!

@Brechtpd Brechtpd added this pull request to the merge queue Aug 10, 2023
Merged via the queue into main with commit 484c1ae Aug 10, 2023
@Brechtpd Brechtpd deleted the mpt2 branch August 10, 2023 11:27
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

crate-circuit-benchmarks Issues related to the circuit-benchmarks workspace member crate-gadgets Issues related to the gadgets workspace member crate-zkevm-circuits Issues related to the zkevm-circuits workspace member T-bench Type: benchmark improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Merge MPT to main

3 participants