This repository was archived by the owner on Jul 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 840
Circuit for opcode calldatacopy #297
Merged
ChihChengLiang
merged 21 commits into
privacy-scaling-explorations:main
from
scroll-tech:op-calldatacopy
Feb 22, 2022
Merged
Circuit for opcode calldatacopy #297
ChihChengLiang
merged 21 commits into
privacy-scaling-explorations:main
from
scroll-tech:op-calldatacopy
Feb 22, 2022
Conversation
This file contains hidden or 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
2 tasks
88021c7
to
cdbbc77
Compare
2 tasks
d734e90
to
71e730a
Compare
78 tasks
DreamWuGit
approved these changes
Feb 17, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM!
@han0110 @ChihChengLiang could you have a look ? we have ongoing PR reply on part of this ! |
We can prioritize merging this. Can we do rebase again? |
ChihChengLiang
approved these changes
Feb 22, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
crate-zkevm-circuits
Issues related to the zkevm-circuits workspace member
T-opcode
Type: opcode-related and focused PR/Issue
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.
We verify the
CALLDATACOPY
using two gadgets:CallDataCopyGadget
andCopyToMemoryGadget
.CallDataCopyGadget
checks the stack values including memory offset, data offset, and length, and then set the proper state in theCopyToMemoryGadget
.CopyToMemoryGadget
, which associates with an internal ExecutionStateCopyToMemory
, can span over multiple steps, depending on the amount of data to be copied. It can copy data from either transaction call data (root call) or memory (internal call) to the memory in the callee. SinceCopyToMemoryGadget
is an internal state, it only increases the rw counter while keeps the same for the rest of context, such as pc, sp, gas.Here is a diagram showing how
CALLDATACOPY
is handled with these two gadgets.Spec: privacy-scaling-explorations/zkevm-specs#111
We leave the bus-mapping implementation of
CALLDATACOPY
to next PR as it is non-trivial and needs to generate multiple steps (related to #309).