Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: disable applying MPT for non-scroll to fix panic in integration-tests #1034

Merged
merged 2 commits into from
Nov 22, 2023

Conversation

silathdiir
Copy link

@silathdiir silathdiir commented Nov 16, 2023

Description

Fix to disable witness::block_mocking_apply_mpt for non-scroll.

integration-tests failed with below backtrace (when testing geth mainnet without this fix):

  18:     0x563da8d18136 - mpt_zktrie::state::witness::WitnessGenerator::handle_new_state::h27b6c80bd6924970
  19:     0x563da92a85f4 - zkevm_circuits::witness::mpt::MptUpdates::mock_fill_state_roots::h553bdbb32ff29c30

Test

Run below block and tx tests with this fix, it could work.

Block number 18509878 contains BASEFEE opcode (and returns circuit error of gas-left in BeginTx):

GETH0_URL=http://* \
    RUST_BACKTRACE=full \
    RUST_LOG=debug \
    CIRCUIT=evm \
    START_BLOCK=18509878 \
    END_BLOCK=18509878 \
    cargo test --release test_circuit_all_block

[2023-11-16T07:23:54Z INFO  halo2_proofs::dev] MockProver synthesize took 132.965810814s
[2023-11-16T07:32:06Z INFO  mainnet] test evm circuit, block number: 18509878 err num 3
[2023-11-16T07:32:06Z ERROR mainnet] circuit err: Constraint 234 ('BeginTx: State transition (to) constraint of gas_left') in gate 13 ('BeginTx') is not satisfied in Region 14 ('Execution step') at offset 21407
    - Column('Advice', 64 - EVM_q_step)@0 = 1
    
[2023-11-16T07:32:06Z ERROR mainnet] circuit err: Constraint 234 ('BeginTx: State transition (to) constraint of gas_left') in gate 13 ('BeginTx') is not satisfied in Region 14 ('Execution step') at offset 69866
    - Column('Advice', 64 - EVM_q_step)@0 = 1
    
[2023-11-16T07:32:06Z ERROR mainnet] circuit err: Constraint 234 ('BeginTx: State transition (to) constraint of gas_left') in gate 13 ('BeginTx') is not satisfied in Region 14 ('Execution step') at offset 89113
    - Column('Advice', 64 - EVM_q_step)@0 = 1
    
test test_circuit_all_block ... ok

TX hash 0bc527d39e95e6e25fcc95898aeb9057ca88bc61f6a402de1a2a6463bc414974 contains BASEFEE opcode (block number 18509901 different with above):

GETH0_URL=http://* \
    RUST_BACKTRACE=full \
    RUST_LOG=debug \
    CIRCUIT=evm \
    TX_ID=0bc527d39e95e6e25fcc95898aeb9057ca88bc61f6a402de1a2a6463bc414974 \
    cargo test --release test_mock_prove_tx

[2023-11-16T07:23:01Z INFO  halo2_proofs::dev] MockProver synthesize took 3.368390473s
test test_mock_prove_tx has been running for over 60 seconds
[2023-11-16T07:31:32Z INFO  mainnet] prove done
test test_mock_prove_tx ... ok

Base automatically changed from feat/mainnet_run to develop November 20, 2023 08:35
@silathdiir silathdiir force-pushed the remove-mpt-for-not-scroll-geth branch from 4c49478 to 4c69e01 Compare November 20, 2023 08:40
@silathdiir silathdiir changed the title fix: disable applying MPT if non-scroll in integration-tests fix: disable applying MPT for non-scroll in integration-tests Nov 21, 2023
@silathdiir silathdiir changed the title fix: disable applying MPT for non-scroll in integration-tests fix: disable applying MPT for non-scroll to fix panic in integration-tests Nov 21, 2023
@kunxian-xia kunxian-xia merged commit 8dbfa1c into develop Nov 22, 2023
14 checks passed
@kunxian-xia kunxian-xia deleted the remove-mpt-for-not-scroll-geth branch November 22, 2023 04:04
naure added a commit that referenced this pull request Dec 13, 2023
* [FEAT] support mainnet block in mainnet.rs (#814) (#1004)

* patch for L2 node rpc

* constrain max_txs to pass pi circuit

* revert get access set to the same implement as upstream

* update for using prestateTracer for state

* fix coinbase issue

* apply mock fill root

* better form for mock filling mpt

* dep issue

* some trivial optimizations

* grep mpt standlone circuit from test

* update poseidon row params

* fix issues in old_root setting

* update ethblock for some fields

* update more fields

* update keccak inputs

* update prev state root

* update more fields for state root

* update code size

* fix storage issue on missing field

* optimize the pre state handling

* induce relax mode to raise some restrict

* picking coinbase/difficulity from block instead of default constants

* custom diff/coinbase in padding

* fix the max_txs issue in pi_circuit

* clippy and fmt

* support single tx test

* adjust params

* rebuild mpt state in mock tx proven

* fmt

* resume some fields in prestate trace

* test creating supercircuit from dummy witness block

* revert most params

* mitigate an issue in prestate tracer

* add timeout spec for robust API call

* fmt

* add readme for test

* add more comment according to review

---------

Co-authored-by: Steven <[email protected]>

* fix: only enable circuit for `BASEFEE` opcode (without opcode mapping) (#1033)

* Enable `BlockCtxU256Gadget` for `BASEFEE` opcode in `scroll` feature.

* Fix to restrict `DIFFICULTY` execution state only for scroll (to avoid soundness).

* Disable applying MPT if non-scroll in integration-tests. (#1034)

* Add `AccessListGasCost` to `TxContextFieldTag`. (#1041)

* [feat] enum error in GethExecStep  (#1037)

* make error enum

* remove non_exhaustive

* [feat] add feature switch of memory/stack/storage (#1038)

* add feature switch

* add missing

* fix merge

* parallel assignment of evm circuit (#1027)

* done

* retry

* seem done

* fix

* Temp to comment out `Cached assign at ...` log.

* clean-codes

---------

Co-authored-by: Steven Gu <[email protected]>

* Refactor PI Circuit (#1042)

* refactor assign into sub-methods, more docs

* fmt

* fix: doc escape square braces

* fix offset increment

* fix macos build (#1047)

* remove halo2wrong (#1048)

* feat: Add `TxEip2930Gadget` to handle EIP-2930 (for evm-circuit part) (#1045)

* Add `TxEip2930Gadget` to begin-tx to handle EIP-2930 in evm circuit.

* Move `AccessList*` to the front of `BlockNumber` to fix tx-circuit tests.

* Merge `CopyDataType` of access list to `AccessListAddresses` and `AccessListStorageKeys`.

* Delete `is_eip1559_tx` function which should be better to add in the EIP-1559 PR.

* Rename function `access_list_address_and_storage_key_sizes` to `access_list_size`.

* Add `AccessListRLC` to tx-table.

* Fix test.

* Remove `AccessListGasCost`, and try to calculate it by `AccessListAddressesLen` and `AccessListStorageKeysLen`

---------

Co-authored-by: Rohit Narurkar <[email protected]>

* [FEAT] precompile-sha256 (#1032)

* init table16 with generic refactoring

* update cargo

* add required cfgs

* add benchmarking

* customable bench

* fmt

* config gates for sha256 circuit

* complete sha256 circuit

* induce SHA256 in bus mapping

* better challenge spec

* integrate sha256 circuit into super

* readme (wip)

* complete precompile and sha256 table

* clippies

* fmt

* better tests

* fix issues and better printing for circuit layout

* refine and fix issues

* fix digest in table16

* fix layout, clippy and fmt

* complete sha256 table

* fix rw

* fix rlc on padding

* clippy and fmt

* more tests

* test added

* sha256: update row cost per block

* update readme (wip)

* lookup input len

* enable sha256

* more tests cases

* refactoring aux data

* fmt

* fix precompile call test

* fix another callop test

* + update bench to circuit-sha256,
+ update readme

* fix vk issue, add more test

* trivial fixs

* move sha256 circuit into zkevm-circuits

* purge unused sha256 dir

* bump halo2 version

* fix blank comment

* fix fmt (#1049)

* chore: upgrade group/ff/halo2 and rust version (#1022)

* wip

* enforce eth v2.0.7

* update links

* clean up zktrie

* fix keccak circuit

* fix gadgets

* fix bus-mapping

* everything compiles now

* compiles

* compiles

* clean up

* update zktrie links

* update dep for zktrie

* Fix all dep/compliation issues in Sync ff 0.13 (#1056)

* fix all dep issue

* use updated misc-precompile

* fix test issue

* purge lock file by upgrading mpt-circuit

* final update for dep of mpt-circuits

* update deps

* build?

---------

Co-authored-by: Zhang Zhuo <[email protected]>

* upgrade halo2;

* build

* Upgrade rust-toolchain to `nightly-2023-10-27` in CI.

* Fix some byte values (u8) from `u128` to `u64` in `SAR`.

* uncomment unit tests for aggregator

* fix clippy

* uncomment sig circuit and tx circuit

* uncomment rlc gates unit tests

* fix make doc

* uncomment sig/ecc related code

* minor fix

* clippy

* undo last clippy..

* disable some super circuit tests

---------

Co-authored-by: Ho Vei <[email protected]>
Co-authored-by: Ho <[email protected]>
Co-authored-by: Zhang Zhuo <[email protected]>
Co-authored-by: Steven Gu <[email protected]>

* [chore] update rust toolchain to 1.76 nightly; replace  lazy_static/once_cell with std::sync::LazyLock (#1050)

* part1

* part2

* wip

* enforce eth v2.0.7

* update links

* clean up zktrie

* fix keccak circuit

* fix gadgets

* fix bus-mapping

* everything compiles now

* compiles

* compiles

* clean up

* update zktrie links

* update dep for zktrie

* [chore] update rust toolchain to 1.76 nightly

* Fix all dep/compliation issues in Sync ff 0.13 (#1056)

* fix all dep issue

* use updated misc-precompile

* fix test issue

* purge lock file by upgrading mpt-circuit

* final update for dep of mpt-circuits

* update deps

* build?

---------

Co-authored-by: Zhang Zhuo <[email protected]>

* upgrade halo2;

* remove lazy_static and once_cell

* update snark-verifier

* build

* Upgrade rust-toolchain to `nightly-2023-10-27` in CI.

* Fix some byte values (u8) from `u128` to `u64` in `SAR`.

* uncomment unit tests for aggregator

* fix clippy

* uncomment sig circuit and tx circuit

* uncomment rlc gates unit tests

* fix make doc

* uncomment sig/ecc related code

* minor fix

* clippy

* undo last clippy..

* disable some super circuit tests

* update ci script

* fix missing

* post merge

* soundness fix

* fix missing

* fix missing

---------

Co-authored-by: zhenfei <[email protected]>
Co-authored-by: Ho Vei <[email protected]>
Co-authored-by: lightsing <[email protected]>
Co-authored-by: Ho <[email protected]>
Co-authored-by: Steven Gu <[email protected]>

* bus-auto: fixes after merge

* bus-auto: support for parallel assign_regions

---------

Co-authored-by: Ho <[email protected]>
Co-authored-by: Steven <[email protected]>
Co-authored-by: Akase Cho <[email protected]>
Co-authored-by: Zhang Zhuo <[email protected]>
Co-authored-by: Rohit Narurkar <[email protected]>
Co-authored-by: zhenfei <[email protected]>
Co-authored-by: Ho Vei <[email protected]>
Co-authored-by: lightsing <[email protected]>
Co-authored-by: Aurélien Nicolas <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants