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

Inspect rw lookup index mismatch error related to contract creation #1474

Closed
hero78119 opened this issue Jun 15, 2023 · 0 comments · Fixed by #1482
Closed

Inspect rw lookup index mismatch error related to contract creation #1474

hero78119 opened this issue Jun 15, 2023 · 0 comments · Fixed by #1482
Assignees
Labels
T-bug Type: bug

Comments

@hero78119
Copy link
Member

What command(s) is the bug in?

RUST_LOG=DEBUG RUST_BACKTRACE=1 cargo test --features test --features warn-unimplemented --package zkevm-circuits --lib -- evm_circuit::execution::begin_tx::test::begin_tx_deploy_nonce_2bytes

Describe the bug

Example unittest pass, but once enable RUST_LOG=DEBUG there will be error message.

In bus mapping, once its contract creation, there are pushing memory read op https://github.com/privacy-scaling-explorations/zkevm-circuits/blob/main/bus-mapping/src/evm/opcodes/return_revert.rs#L52-L60 but in circuit return_revert.rs there is no respective memory lookup operation, so the lookup by index check is failed.

Within the fix, we also should check whether it also imply potiential soundness or not.

Concrete steps to reproduce the bug. If it's able reproduce via testool, please share test_id from jenkins report

No response

@hero78119 hero78119 added the T-bug Type: bug label Jun 15, 2023
@KimiWu123 KimiWu123 self-assigned this Jun 16, 2023
@ChihChengLiang ChihChengLiang linked a pull request Jun 19, 2023 that will close this issue
4 tasks
github-merge-queue bot pushed a commit that referenced this issue Jun 21, 2023
### Description

address #1474 and also found #1483 when investigating this issue.

### Issue Link

#1474 

### Type of change

- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] This change requires a documentation update

### Contents

- The root cause is that there are memory operations in block.get_rws()
but there is only single `copy lookup` expression while copy table
lookup happens in opcode execution. Which makes the indexes of
`assigned_rw_values` and `step.bus_mapping_instance` are inconsistent.
- Add a new function `get_rws_for_check_rw_lookup` specific for
`check_rw_lookup`. This function could bypass memory operations if any
copy table lookup happens, and it makes the indexes of
`assigned_rw_values` and `step.bus_mapping_instance` consistent.

### Rationale

- Add a new function instead of modifying `get_rws()` is because trying
to minimize the impact to our codebase since this is a check function.

---------

Co-authored-by: Ming <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
T-bug Type: bug
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants