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

feat(state): constrain non-exist proof for account and storage#1046

Merged
ed255 merged 12 commits into
mainfrom
feature/non-exist-account-update
Jan 13, 2023
Merged

feat(state): constrain non-exist proof for account and storage#1046
ed255 merged 12 commits into
mainfrom
feature/non-exist-account-update

Conversation

@ed255
Copy link
Copy Markdown
Contributor

@ed255 ed255 commented Jan 9, 2023

Add BatchedIsZeroChip in gadgets
Update the following opcode gadgets to handle non-existing accounts via code_hash == 0:

  • BALANCE
  • EXTCODEHASH
  • EXTCODESIZE
  • callop (CALLCODE, DELEGATECALL, STATICCALL, CALL)

Missing:

Important note: By handling the non-existence proofs from the state circuit (which requires detecting the special case of storage 0->0 or account,code_hash 0->0 to swap the proof type to non existence in the MPT lookup), the state circuit degree has increased from 9 to 12. I could keep it at 9 by introducing an intermediate column and splitting the degree >9 expression. Is it a problem to keep the degree at 12? Should I keep it at 9 in an update to this PR?

Update: I've brought back the degree to 9, at the cost of introducing a new column in the State circuit (to hold an intermediary witness and splitting the highest degree expression).

Corresponding specs PR privacy-ethereum/zkevm-specs#354

@github-actions github-actions Bot added crate-gadgets Issues related to the gadgets workspace member crate-zkevm-circuits Issues related to the zkevm-circuits workspace member labels Jan 9, 2023
@ed255 ed255 marked this pull request as draft January 9, 2023 16:41
@ed255 ed255 force-pushed the feature/non-exist-account-update branch from 44acc27 to ea91f0c Compare January 11, 2023 14:18
@github-actions github-actions Bot added the crate-bus-mapping Issues related to the bus-mapping workspace member label Jan 11, 2023
@ed255 ed255 force-pushed the feature/non-exist-account-update branch from ea91f0c to 45d2285 Compare January 11, 2023 14:35
@ed255 ed255 marked this pull request as ready for review January 11, 2023 14:39
@ed255 ed255 force-pushed the feature/non-exist-account-update branch from af4df08 to e3d5b23 Compare January 11, 2023 14:57
@ed255 ed255 requested review from han0110 and z2trillion January 11, 2023 17:03
Copy link
Copy Markdown
Contributor

@han0110 han0110 left a comment

Choose a reason for hiding this comment

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

All LGTM! Nice work! Only left some nitpicks.

Comment thread zkevm-circuits/src/evm_circuit.rs Outdated
Comment thread zkevm-circuits/src/evm_circuit/execution/balance.rs Outdated
Comment thread zkevm-circuits/src/state_circuit/test.rs Outdated
Comment thread zkevm-circuits/src/state_circuit/test.rs Outdated
@ed255 ed255 force-pushed the feature/non-exist-account-update branch from 5813447 to f599330 Compare January 12, 2023 10:45
@ed255
Copy link
Copy Markdown
Contributor Author

ed255 commented Jan 12, 2023

@icemelon @z2trillion could someone from scroll do a second review to this PR? Thanks!

@ed255 ed255 mentioned this pull request Jan 12, 2023
10 tasks
Copy link
Copy Markdown
Contributor

@z2trillion z2trillion left a comment

Choose a reason for hiding this comment

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

Only had some minor changes requested. Overall this looks great.

Comment thread bus-mapping/src/evm/opcodes/balance.rs
Comment thread bus-mapping/src/evm/opcodes/extcodehash.rs
Comment thread bus-mapping/src/evm/opcodes/extcodesize.rs
Comment thread zkevm-circuits/src/evm_circuit/execution/callop.rs Outdated
Comment thread zkevm-circuits/src/evm_circuit/execution/extcodesize.rs Outdated
Comment thread zkevm-circuits/src/state_circuit.rs Outdated
@ed255 ed255 force-pushed the feature/non-exist-account-update branch from f599330 to 8c84bc3 Compare January 13, 2023 09:11
Copy link
Copy Markdown
Contributor

@z2trillion z2trillion left a comment

Choose a reason for hiding this comment

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

thanks!

@ed255 ed255 force-pushed the feature/non-exist-account-update branch from 8c84bc3 to b7d4243 Compare January 13, 2023 15:44
@ed255 ed255 merged commit aaaf13e into main Jan 13, 2023
@lispc lispc mentioned this pull request Jan 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

crate-bus-mapping Issues related to the bus-mapping workspace member crate-gadgets Issues related to the gadgets workspace member crate-zkevm-circuits Issues related to the zkevm-circuits workspace member

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

3 participants