zkevm-specs icon indicating copy to clipboard operation
zkevm-specs copied to clipboard

Missing check `curr.rw_counter + reversible_write_counter == rw_counter_end_of_reversion` when the step is failing

Open han0110 opened this issue 2 years ago • 4 comments

To ensure rw_counter_end_of_reversion is correct in the timeline, in the end of failing step we need to check if there is a gap of rw_counter to the next step, where the gap size is exactly the reversible_write_counter. And in the end of the gap, the rw_counter should be rw_counter_end_of_reversion.

Need to add this check into Instruction.step_state_transition_to_restored_context:

if not is_success:
    assert rw_counter_end_of_reversion == curr.rw_counter + reversible_write_counter

han0110 avatar Dec 20 '22 06:12 han0110

I will take a look at this one !

DreamWuGit avatar Dec 25 '22 13:12 DreamWuGit

for circuit side work https://github.com/privacy-scaling-explorations/zkevm-circuits/pull/1030, it should be assert rw_counter_end_of_reversion == curr.rw_counter + rw_counter_offset + reversible_write_counter - 1 as buss mapping set rw_counter_end_of_reversion = current_rw_counter -1 for call in https://github.com/privacy-scaling-explorations/zkevm-circuits/blob/main/bus-mapping/src/circuit_input_builder/input_state_ref.rs#L798 I am thinking also need to add check for root call failure, what do you think? @han0110

DreamWuGit avatar Jan 06 '23 02:01 DreamWuGit

I am thinking also need to add check for root call failure

That's right! We need to check this when it's reverting step no matter it's root or not. Thanks for catching this!

han0110 avatar Jan 06 '23 07:01 han0110

This issue has been resolved in the circuits via https://github.com/privacy-scaling-explorations/zkevm-circuits/pull/1030 and https://github.com/privacy-scaling-explorations/zkevm-circuits/pull/1177 but it's still missing in the specs.

ed255 avatar Jun 02 '23 09:06 ed255