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

Commit 8bc9812

Browse files
authored
fix: must not use next tx's tlpb to assign cur tx's tlpb (#789)
1 parent a89e567 commit 8bc9812

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

zkevm-circuits/src/tx_circuit.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2257,6 +2257,7 @@ impl<F: Field> TxCircuit<F> {
22572257
let mut is_padding_tx;
22582258
let mut num_all_txs_acc = 0;
22592259
let mut total_l1_popped_before = start_l1_queue_index;
2260+
let mut total_l1_popped_after = start_l1_queue_index;
22602261
// Empty entry
22612262
config.assign_row(
22622263
&mut region,
@@ -2312,9 +2313,10 @@ impl<F: Field> TxCircuit<F> {
23122313
if tx.tx_type.is_l1_msg() {
23132314
let queue_index = tx.nonce;
23142315
num_all_txs_acc = queue_index - total_l1_popped_before + 1;
2315-
total_l1_popped_before = queue_index + 1;
2316+
total_l1_popped_after = queue_index + 1;
23162317
} else {
2317-
// total_l1_popped_before do not change
2318+
// next tx's total_l1_popped_before do not change
2319+
total_l1_popped_after = total_l1_popped_before;
23182320
num_all_txs_acc = 1;
23192321
}
23202322
};
@@ -2326,9 +2328,10 @@ impl<F: Field> TxCircuit<F> {
23262328
if tx.tx_type.is_l1_msg() {
23272329
let queue_index = tx.nonce;
23282330
num_all_txs_acc += queue_index - total_l1_popped_before + 1;
2329-
total_l1_popped_before = queue_index + 1;
2331+
total_l1_popped_after = queue_index + 1;
23302332
} else {
2331-
// total_l1_popped_before do not change
2333+
// next tx's total_l1_popped_before do not change
2334+
total_l1_popped_after = total_l1_popped_before;
23322335
num_all_txs_acc += 1;
23332336
}
23342337
}
@@ -2627,6 +2630,8 @@ impl<F: Field> TxCircuit<F> {
26272630
|| Value::known(sv_address),
26282631
)?;
26292632
}
2633+
// set next tx's total_l1_popped_before
2634+
total_l1_popped_before = total_l1_popped_after;
26302635
}
26312636

26322637
log::debug!("assigning calldata, offset {}", offset);

0 commit comments

Comments
 (0)