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 857
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…_stored and balance_stored values
…e account in trie)
Some refactoring which I believe decreases code duplication and increases code readability. Some TODOs: - [x] The code required to get the previous rlc/mult data or the inclusion in the parent check is quite complicated because of the different node types. Instead it may be better to use a fixed location to store this data in so a node can simply use this data directly instead of having to figure out on its own where to find the data. This is cleaner because this way each node can decide on its own how these should be handled. - [x] Currently RLP decoding is done using a couple of selectors that are inputs from the prover. Then there are some checks if these are correct, though these are not complete. I think it's easier to think about this if we would just use a lookup to directly verify if these selectors are set correctly so we don't have to worry about edge cases are cases that are hard to constrain using custom gates. - [x] There are currently many cases in the main state maching because each row type is it's own state. However there is not really any reuse between custom gates between these rows, except for branches. It'll likely be quite a bit simple to just have a single state for account, storage and extension and just use multiple rows in those states - [x] May be a good idea to split up branches and extension nodes. (semi done) - [ ] There's a couple of circuit tools that were added in this PR to make writing the MPT circuit more manageable. A lot of these tools can still be greatly improved. - [ ] Number of lookups has been reduced a lot, but there are still many optimization possibilities (have not looked into reducing the expression degree for example). - [x] The circuit uses a fixed layout which uses around 100 columns (of which a lot need to be byte constrained so needs a lot of lookups as well). This makes the circuit quite a bit more dense than probably required, a more flexible way to manager the required data so the width/height can be choses would be very useful I think.
### Description This PR simply merges the current `main` into the MPT branch `mpt2`. This is the first step to get some further MPT changes merged into the MPT branch without making the PRs too big. ``` This PR contains: - Merge `main` into `mpt2` with the necessary changes to the MPT circuit ``` ### 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) - [ ] 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? Intermediate step, so limited testing --------- Signed-off-by: smtmfft <smtm@taiko.xzy> Signed-off-by: smtmfft <smtm@taiko.xyz> Co-authored-by: pinkiebell <40266861+pinkiebell@users.noreply.github.com> Co-authored-by: Haichen Shen <shenhaichen@gmail.com> Co-authored-by: z2trillion <z2trillion@users.noreply.github.com> Co-authored-by: Eduard S <eduardsanou@posteo.net> Co-authored-by: adria0.eth <5526331+adria0@users.noreply.github.com> Co-authored-by: Han <tinghan0110@gmail.com> Co-authored-by: smtmfft <99081233+smtmfft@users.noreply.github.com> Co-authored-by: smtmfft <smtm@taiko.xzy> Co-authored-by: Chih Cheng Liang <chihchengliang@gmail.com> Co-authored-by: DreamWuGit <wwuwwei@126.com> Co-authored-by: Rohit Narurkar <rohit.narurkar@protonmail.com> Co-authored-by: Zhang Zhuo <mycinbrin@gmail.com> Co-authored-by: Ming <hero78119@gmail.com> Co-authored-by: Wu Sung Ming <wusm@sea.com> Co-authored-by: xiaodino <qinyi@taikocha.in> Co-authored-by: Mason Liang <mason@0x.org> Co-authored-by: Steven <asongala@163.com> Co-authored-by: Carlos Pérez <37264926+CPerezz@users.noreply.github.com> Co-authored-by: Paul <108982045+ChengYueJia@users.noreply.github.com> Co-authored-by: AronisAt79 <45406504+AronisAt79@users.noreply.github.com> Co-authored-by: Mason Liang <mason@scroll.io> Co-authored-by: JohnWick2ETH <104916412+JohnWick2ETH@users.noreply.github.com> Co-authored-by: kunxian xia <xiakunxian130@gmail.com> Co-authored-by: Leo Lara <leolara@users.noreply.github.com> Co-authored-by: zengzengzenghuy <85567868+zengzengzenghuy@users.noreply.github.com> Co-authored-by: john xu <john@taiko.xyz> Co-authored-by: Miha Stopar <miha.stopar@xlab.si> Co-authored-by: aguzmant103 <67167307+aguzmant103@users.noreply.github.com> Co-authored-by: Richord <rzhang139@gmail.com> Co-authored-by: Kimi Wu <leonhartwu@gmail.com> Co-authored-by: Mickey <hedgefund996@gmail.com> Co-authored-by: Luozhu <70309026+LuozhuZhang@users.noreply.github.com> Co-authored-by: DoHoon Kim <59155248+DoHoonKim8@users.noreply.github.com> Co-authored-by: jeong0982 <jeong0982@kaist.ac.kr> Co-authored-by: Andy Arditi <andyrdt@gmail.com> Co-authored-by: David Nevado <davidnevadoc@users.noreply.github.com> Co-authored-by: omahs <73983677+omahs@users.noreply.github.com> Co-authored-by: Richord <rrzhang@usc.edu> Co-authored-by: ntampakas <nick@gmx.co.uk> Co-authored-by: ashWhiteHat <phantomofrotten@gmail.com> Co-authored-by: naure <naure@users.noreply.github.com> Co-authored-by: Aurélien Nicolas <info@nau.re> Co-authored-by: testuser-at-490752553772 <m_aronis@hotmail.com> Co-authored-by: xiaodino <ruby@taiko.xyz> Co-authored-by: Thomas Pan <43927782+thomaspanf@users.noreply.github.com> Co-authored-by: Akase Cho <lightsing@users.noreply.github.com> Co-authored-by: Vu <vu.voth@gmail.com> Co-authored-by: Alex Beregszaszi <alex@rtfs.hu> Co-authored-by: Enrico Bottazzi <85900164+enricobottazzi@users.noreply.github.com> Co-authored-by: adria0 <adria0@nowhere>
# Conflicts: # Cargo.lock # circuit-benchmarks/Cargo.toml # eth-types/src/geth_types.rs # gadgets/src/util.rs # keccak256/Cargo.toml # keccak256/src/arith_helpers.rs # keccak256/src/keccak_arith.rs # keccak256/src/lib.rs # keccak256/src/plain.rs # testool/src/compiler.rs # zkevm-circuits/Cargo.toml # zkevm-circuits/src/evm_circuit.rs # zkevm-circuits/src/pi_circuit.rs # zkevm-circuits/src/state_circuit.rs # zkevm-circuits/src/state_circuit/constraint_builder.rs # zkevm-circuits/src/table.rs # zkevm-circuits/src/table/keccak_table.rs # zkevm-circuits/src/table/mpt_table.rs # zkevm-circuits/src/tx_circuit/dev.rs # zkevm-circuits/src/tx_circuit/sign_verify.rs # zkevm-circuits/src/util.rs # zkevm-circuits/src/witness/mpt.rs
### Description - Added some missing MPT constraints - Integrated some EVM tools like degree reduction and lookups using dedicated columns ### 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) - [ ] 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? [_explanation_] --------- Co-authored-by: Cecilia Zhang <zhangyixin319@gmail.com> Co-authored-by: CeciliaZ030 <45245961+CeciliaZ030@users.noreply.github.com>
### 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
bot
added
the
crate-zkevm-circuits
Issues related to the zkevm-circuits workspace member
label
Aug 1, 2023
github-actions
bot
added
T-bench
Type: benchmark improvements
crate-circuit-benchmarks
Issues related to the circuit-benchmarks workspace member
crate-gadgets
Issues related to the gadgets workspace member
labels
Aug 10, 2023
Closed in favour of #1563. I am starting the modified extension node almost from scratch, so it was the easiest just to open a new branch (using the main which has now MPT merged). |
# for free
to subscribe to this conversation on GitHub.
Already have an account?
#.
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Support for modified extension nodes.
This happens when an extension node is replaced by another (shorter or longer) extension node. For example, we have an extension node at
n1 n2 n3 n4 n5 n6
with branch with two leaves at positionsn
andm
. If we add a leaf atn1 n2 n3 n4 n7
wheren5 != n7
, a new extension node is inserted atn1 n2 n3 n4
with a new branch with an extension node at positionn5
(with only one nibblen6
) and a leaf at positionn7
. In this case, the S proof contains the extension node atn1 n2 n3 n4 n5 n6
and no underlying branch and leaf (the modification happens atn1 n2 n3 n4 n7
and only an extension node is find there), thus we need to add a placeholder branch and a placeholder leaf.Type of change