-
Notifications
You must be signed in to change notification settings - Fork 858
StepRws in EVM circuits #1616
StepRws in EVM circuits #1616
Conversation
@ChihChengLiang Hey, let me know what you think of this ! |
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.
Hi @nullity00,
Thanks for taking this issue! I did the first found of review and left some comments. Please take a look.
rws.next(); // 0 - TxId | ||
rws.next(); // 1 - Depth | ||
let rw_end_of_reversion = rws.next().call_context_value().as_usize(); // 2 - RwCounterEndOfReversion | ||
let is_persistent = rws.next().call_context_value().as_usize() != 0; // 3 - IsPersistent |
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.
It's great we write the intention of the read-write, e.g. TxId, Depth, RwCounterEndOfReversion, and IsPersistent.
But I think it defeats the purpose of using StepRws
when adding counters in comments, e.g. 0, 1, 2, 3, or rw_off + x. We should remove the counters in all the changes in this PR.
One purpose of using StepRws is to add new features without changing all the magic numbers that aren't relevant to the feature. If we add the counters on comments, they have to be updated when the new feature is added. It is also to forget to update the comments.
rws.next(); // 0 - TxId | |
rws.next(); // 1 - Depth | |
let rw_end_of_reversion = rws.next().call_context_value().as_usize(); // 2 - RwCounterEndOfReversion | |
let is_persistent = rws.next().call_context_value().as_usize() != 0; // 3 - IsPersistent | |
rws.next(); // TxId | |
rws.next(); // Depth | |
let rw_end_of_reversion = rws.next().call_context_value().as_usize(); // RwCounterEndOfReversion | |
let is_persistent = rws.next().call_context_value().as_usize() != 0; // IsPersistent |
Hi @nullity00, do you see any blocker in this PR? Is there anything we can help? Note that you can use |
Closing due to inactivity. @nullity00 if you would like to retake this let us know and we can open the PR again :) |
### Description Continuing the work originally started in #1616 this PR seeks to introduce `StepRws` across the evm circuits to reduce the need for tracking rw indices through code. ### Issue Link Closes #1586 ### Type of change Refactor (no updates to logic) ### Contents The change has been made to the following files - error_oog_call.rs - error_oog_memory_copy.rs - error_oog_sload_sstore.rs - error_return_data_oo_bound.rs - error_write_protection.rs - extcodecopy.rs - extcodehash.rs - extcodesize.rs - logs.rs - return_revert.rs - returndatacopy.rs - sha3.rs - sload.rs - sstore.rs
Description
Similar to #1582 , We use the
StepRws
struct to automatically track read-write indices.Issue Link
#1586
Type of change
Contents
The change has been made to the following files