From 4116da557a7563199a5b4ec33cc6adf628b761e5 Mon Sep 17 00:00:00 2001 From: Rohit Narurkar Date: Mon, 9 Sep 2024 11:31:12 +0100 Subject: [PATCH] chore: add sanity check to assert post-curie traces --- bus-mapping/src/evm/opcodes/begin_end_tx.rs | 87 ++++++++++--------- .../src/evm_circuit/execution/begin_tx.rs | 2 +- 2 files changed, 47 insertions(+), 42 deletions(-) diff --git a/bus-mapping/src/evm/opcodes/begin_end_tx.rs b/bus-mapping/src/evm/opcodes/begin_end_tx.rs index 39d3f5f5e2..aace0978d4 100644 --- a/bus-mapping/src/evm/opcodes/begin_end_tx.rs +++ b/bus-mapping/src/evm/opcodes/begin_end_tx.rs @@ -95,7 +95,7 @@ pub fn gen_begin_tx_steps(state: &mut CircuitInputStateRef) -> Result + // + // We expect a post-curie block. let chain_id = state.block.chain_id; let block_number = state.tx.block_num; - if is_curie_enabled(chain_id, block_number) { - state.push_op( - exec_step, - RW::READ, - StorageOp::new( - *l1_gas_price_oracle::ADDRESS, - *l1_gas_price_oracle::L1_BLOB_BASEFEE_SLOT, - l1_blob_basefee, - l1_blob_basefee, - tx_id, - l1_blob_basefee_committed, - ), - )?; - state.push_op( - exec_step, - RW::READ, - StorageOp::new( - *l1_gas_price_oracle::ADDRESS, - *l1_gas_price_oracle::COMMIT_SCALAR_SLOT, - commit_scalar, - commit_scalar, - tx_id, - commit_scalar_committed, - ), - )?; - state.push_op( - exec_step, - RW::READ, - StorageOp::new( - *l1_gas_price_oracle::ADDRESS, - *l1_gas_price_oracle::BLOB_SCALAR_SLOT, - blob_scalar, - blob_scalar, - tx_id, - blob_scalar_committed, - ), - )?; - } + debug_assert!( + is_curie_enabled(chain_id, block_number), + "block {block_number} is pre-curie", + ); + + state.push_op( + exec_step, + RW::READ, + StorageOp::new( + *l1_gas_price_oracle::ADDRESS, + *l1_gas_price_oracle::L1_BLOB_BASEFEE_SLOT, + l1_blob_basefee, + l1_blob_basefee, + tx_id, + l1_blob_basefee_committed, + ), + )?; + state.push_op( + exec_step, + RW::READ, + StorageOp::new( + *l1_gas_price_oracle::ADDRESS, + *l1_gas_price_oracle::COMMIT_SCALAR_SLOT, + commit_scalar, + commit_scalar, + tx_id, + commit_scalar_committed, + ), + )?; + state.push_op( + exec_step, + RW::READ, + StorageOp::new( + *l1_gas_price_oracle::ADDRESS, + *l1_gas_price_oracle::BLOB_SCALAR_SLOT, + blob_scalar, + blob_scalar, + tx_id, + blob_scalar_committed, + ), + )?; Ok(()) } diff --git a/zkevm-circuits/src/evm_circuit/execution/begin_tx.rs b/zkevm-circuits/src/evm_circuit/execution/begin_tx.rs index e39dd0a1fa..be786f8da2 100644 --- a/zkevm-circuits/src/evm_circuit/execution/begin_tx.rs +++ b/zkevm-circuits/src/evm_circuit/execution/begin_tx.rs @@ -858,7 +858,7 @@ impl ExecutionGadget for BeginTxGadget { // if scroll: // KeccakCodeHash // else: - // 3 or 6 l1 fee rw + // 6 l1 fee rw // RwCounterEndOfReversion // IsPersistent // IsSuccess