Skip to content

Commit 0879801

Browse files
authored
chore: add sanity check to assert post-curie traces (#1417)
1 parent 6e6ee0e commit 0879801

File tree

2 files changed

+47
-42
lines changed

2 files changed

+47
-42
lines changed

bus-mapping/src/evm/opcodes/begin_end_tx.rs

+46-41
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ pub fn gen_begin_tx_steps(state: &mut CircuitInputStateRef) -> Result<Vec<ExecSt
9595
}
9696
}
9797
} else {
98-
// else, add 3 ( or 6 after curie) RW read operations for transaction L1 fee.
98+
// else, add 6 RW read operations for transaction L1 fee.
9999
gen_tx_l1_fee_ops(state, &mut exec_step)?;
100100
}
101101

@@ -727,7 +727,7 @@ fn write_tx_receipt(
727727
Ok(())
728728
}
729729

730-
// Add 3(or 6 after curie) RW read operations for transaction L1 fee.
730+
// Add 6 RW read operations for transaction L1 fee.
731731
fn gen_tx_l1_fee_ops(
732732
state: &mut CircuitInputStateRef,
733733
exec_step: &mut ExecStep,
@@ -786,47 +786,52 @@ fn gen_tx_l1_fee_ops(
786786
),
787787
)?;
788788

789-
// curie operations
789+
// Sanity check: we do not support pre-curie blocks as of <https://github.com/scroll-tech/zkevm-circuits/pull/1415>
790+
//
791+
// We expect a post-curie block.
790792
let chain_id = state.block.chain_id;
791793
let block_number = state.tx.block_num;
792-
if is_curie_enabled(chain_id, block_number) {
793-
state.push_op(
794-
exec_step,
795-
RW::READ,
796-
StorageOp::new(
797-
*l1_gas_price_oracle::ADDRESS,
798-
*l1_gas_price_oracle::L1_BLOB_BASEFEE_SLOT,
799-
l1_blob_basefee,
800-
l1_blob_basefee,
801-
tx_id,
802-
l1_blob_basefee_committed,
803-
),
804-
)?;
805-
state.push_op(
806-
exec_step,
807-
RW::READ,
808-
StorageOp::new(
809-
*l1_gas_price_oracle::ADDRESS,
810-
*l1_gas_price_oracle::COMMIT_SCALAR_SLOT,
811-
commit_scalar,
812-
commit_scalar,
813-
tx_id,
814-
commit_scalar_committed,
815-
),
816-
)?;
817-
state.push_op(
818-
exec_step,
819-
RW::READ,
820-
StorageOp::new(
821-
*l1_gas_price_oracle::ADDRESS,
822-
*l1_gas_price_oracle::BLOB_SCALAR_SLOT,
823-
blob_scalar,
824-
blob_scalar,
825-
tx_id,
826-
blob_scalar_committed,
827-
),
828-
)?;
829-
}
794+
debug_assert!(
795+
is_curie_enabled(chain_id, block_number),
796+
"block {block_number} is pre-curie",
797+
);
798+
799+
state.push_op(
800+
exec_step,
801+
RW::READ,
802+
StorageOp::new(
803+
*l1_gas_price_oracle::ADDRESS,
804+
*l1_gas_price_oracle::L1_BLOB_BASEFEE_SLOT,
805+
l1_blob_basefee,
806+
l1_blob_basefee,
807+
tx_id,
808+
l1_blob_basefee_committed,
809+
),
810+
)?;
811+
state.push_op(
812+
exec_step,
813+
RW::READ,
814+
StorageOp::new(
815+
*l1_gas_price_oracle::ADDRESS,
816+
*l1_gas_price_oracle::COMMIT_SCALAR_SLOT,
817+
commit_scalar,
818+
commit_scalar,
819+
tx_id,
820+
commit_scalar_committed,
821+
),
822+
)?;
823+
state.push_op(
824+
exec_step,
825+
RW::READ,
826+
StorageOp::new(
827+
*l1_gas_price_oracle::ADDRESS,
828+
*l1_gas_price_oracle::BLOB_SCALAR_SLOT,
829+
blob_scalar,
830+
blob_scalar,
831+
tx_id,
832+
blob_scalar_committed,
833+
),
834+
)?;
830835

831836
Ok(())
832837
}

zkevm-circuits/src/evm_circuit/execution/begin_tx.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -858,7 +858,7 @@ impl<F: Field> ExecutionGadget<F> for BeginTxGadget<F> {
858858
// if scroll:
859859
// KeccakCodeHash
860860
// else:
861-
// 3 or 6 l1 fee rw
861+
// 6 l1 fee rw
862862
// RwCounterEndOfReversion
863863
// IsPersistent
864864
// IsSuccess

0 commit comments

Comments
 (0)