-
Notifications
You must be signed in to change notification settings - Fork 272
Conversation
d8f9dbf
to
7f5edba
Compare
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! Nice work!
@z2trillion could you help as a second reviewer for this PR? |
@noel2004 have a question on the mpt_counter. In the current code, the mpt_counter increases with keys lexicographic ordering. So we have two option |
From my point of view, option 2 has always been the one considered for the design, because it's simpler. We already process stack and memory in key order instead of chronological order (in the state circuit), and we know that the result is equivalent to processing the updates chronologically (in terms of read consistency). So it doesn't seem strange to me that we do the same for state/storage updates. Why do you think approach 2 is not easy to debug? Here's a rough description of the witness generation process, taken from privacy-scaling-explorations/zkevm-circuits#222:
Following approach (2) we will encounter intermediate state roots that never happened in geth (because of the reordering), so we'll have a partial mpt which we will be updating following the lexicographic ordering, to get the intermediate proofs between updates. |
ok i understand the design. "we will encounter intermediate state roots that never happened in geth" is what i think as "counter intuitive". For the "uneasy to debug", i thought of bug case where the replay final root is not same with real final root, yeah, it is only bug after it is fixed it will be ok later. No problem~ Thanks for the explanation |
Introduce MPT table lookups from the state circuit for Storage and Account operations.