Skip to content
This repository was archived by the owner on Apr 18, 2025. It is now read-only.

Commit 9ab71ab

Browse files
committed
fix: fix tx circuit
1 parent 4453825 commit 9ab71ab

File tree

6 files changed

+9
-13
lines changed

6 files changed

+9
-13
lines changed

bus-mapping/src/circuit_input_builder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ impl<'a> CircuitInputBuilder {
558558
let mut tx = self.new_tx(eth_tx, !geth_trace.failed)?;
559559

560560
// Sanity check for transaction L1 fee.
561-
let tx_l1_fee = if tx.tx_type.is_l1_msg() {
561+
let tx_l1_fee = if tx.tx_type.is_l1_msg() || tx.tx_type.is_l1_block_hashes() {
562562
0
563563
} else {
564564
tx.l1_fee()

bus-mapping/src/circuit_input_builder/transaction.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ impl Transaction {
369369
);
370370

371371
let tx_type = TxType::get_tx_type(eth_tx);
372-
let (l1_fee, l1_fee_committed) = if tx_type.is_l1_msg() {
372+
let (l1_fee, l1_fee_committed) = if tx_type.is_l1_msg() || tx_type.is_l1_block_hashes() {
373373
Default::default()
374374
} else {
375375
(

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,7 @@ impl<F: Field> ExecutionGadget<F> for BeginTxGadget<F> {
181181
let tx_caller_address_is_zero = IsZeroGadget::construct(cb, tx_caller_address.expr());
182182
cb.require_equal(
183183
"CallerAddress != 0 (not a padding tx)",
184-
and::expr([
185-
not::expr(tx_l1_block_hashes.is_l1_block_hashes()),
186-
tx_caller_address_is_zero.expr(),
187-
]),
184+
tx_caller_address_is_zero.expr(),
188185
false.expr(),
189186
);
190187
let tx_callee_address_is_zero = IsZeroGadget::construct(cb, tx_callee_address.expr());

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ impl<F: Field> ExecutionGadget<F> for EndTxGadget<F> {
140140
let effective_fee = cb.query_word_rlc();
141141

142142
cb.condition(tx_l1_custom_tx.expr(), |cb| {
143-
cb.require_zero("l1fee is 0 for l1msg", tx_l1_fee.expr());
143+
cb.require_zero("l1fee is 0 for l1msg and l1 block hashesg", tx_l1_fee.expr());
144144
});
145145
cb.require_equal(
146146
"tx_fee == l1_fee + l2_fee",
@@ -405,7 +405,7 @@ impl<F: Field> ExecutionGadget<F> for EndTxGadget<F> {
405405
)?;
406406

407407
let tx_l1_fee = if tx.tx_type.is_l1_custom_tx() {
408-
log::trace!("tx is l1msg and l1 fee is 0");
408+
log::trace!("tx is l1msg or l1 block hashes and l1 fee is 0");
409409
0
410410
} else {
411411
tx.l1_fee.tx_l1_fee(tx.tx_data_gas_cost).0

zkevm-circuits/src/super_circuit/test.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ fn test_super_circuit<
105105
);
106106

107107
block.txs[0].tx_type = TxType::L1BlockHashes;
108-
block.txs[0].caller_address = address!("0x0000000000000000000000000000000000000000");
109108

110109
let active_row_num =SuperCircuit::<
111110
Fr,

zkevm-circuits/src/tx_circuit.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,14 +1180,14 @@ impl<F: Field> SubCircuitConfig<F> for TxCircuitConfig<F> {
11801180
});
11811181

11821182
meta.lookup_any("l1 block hashes calldata in block table", |meta| {
1183-
let is_tag_block_num = meta.query_advice(is_tag_block_num, Rotation::cur());
1184-
let block_num = meta.query_advice(tx_table.value, Rotation::cur());
1185-
let calldata_rlc = meta.query_advice(calldata_rlc, Rotation::cur());
1183+
let is_tag_good = meta.query_advice(is_calldata, Rotation::cur());
1184+
let block_num = meta.query_advice(tx_table.value, Rotation(16));
1185+
let calldata_rlc = meta.query_advice(tx_table.value, Rotation::cur());
11861186

11871187
let input_expr = vec![L1BlockHashesCalldata.expr(), block_num, calldata_rlc];
11881188
let table_expr = block_table.table_exprs(meta);
11891189
let condition = and::expr([
1190-
is_tag_block_num,
1190+
is_tag_good,
11911191
meta.query_advice(is_l1_block_hashes, Rotation::cur()),
11921192
meta.query_fixed(q_enable, Rotation::cur()),
11931193
]);

0 commit comments

Comments
 (0)