From ba5f76a14fc5bbb964bccd86c9cb71be0ce5115b Mon Sep 17 00:00:00 2001 From: xkx Date: Thu, 29 Jun 2023 16:46:20 +0800 Subject: [PATCH 1/2] fix finding 3 (#575) --- zkevm-circuits/src/rlp_circuit_fsm.rs | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/zkevm-circuits/src/rlp_circuit_fsm.rs b/zkevm-circuits/src/rlp_circuit_fsm.rs index e9632f261a..3983902225 100644 --- a/zkevm-circuits/src/rlp_circuit_fsm.rs +++ b/zkevm-circuits/src/rlp_circuit_fsm.rs @@ -536,7 +536,9 @@ impl RlpCircuitConfig { }, ); - // if (tx_id' == tx_id and format' != format) or (tx_id' != tx_id and tx_id' != 0) + // These two cases are not the very last non-padding RLP instance. + // 1. (tx_id' == tx_id and format' != format) + // 2. (tx_id' != tx_id and tx_id' != 0) cb.condition( sum::expr([ // case 1 @@ -572,6 +574,23 @@ impl RlpCircuitConfig { }, ); + // For the very last non-padding RLP instance, we have + // tx_id' != tx_id && tx_id' == 0 + cb.condition( + and::expr([ + is_padding_in_dt.expr(Rotation::next())(meta), + not::expr(tx_id_check_in_dt.is_equal_expression.expr()), + ]), + |cb| { + // byte_rev_idx == 1 + cb.require_equal( + "byte_rev_idx is 1 at the last index", + meta.query_advice(data_table.byte_rev_idx, Rotation::cur()), + 1.expr(), + ); + }, + ); + cb.gate(meta.query_fixed(q_enabled, Rotation::cur())) }); From a4279a4a58d742a124c6a520c49031a0a6885c5c Mon Sep 17 00:00:00 2001 From: kunxian xia Date: Thu, 29 Jun 2023 20:20:37 +0800 Subject: [PATCH 2/2] fix finding 14 --- zkevm-circuits/src/rlp_circuit_fsm.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/zkevm-circuits/src/rlp_circuit_fsm.rs b/zkevm-circuits/src/rlp_circuit_fsm.rs index 3983902225..04f25e1b74 100644 --- a/zkevm-circuits/src/rlp_circuit_fsm.rs +++ b/zkevm-circuits/src/rlp_circuit_fsm.rs @@ -1243,6 +1243,7 @@ impl RlpCircuitConfig { ]); cb.condition(cond.expr(), |cb| { // assertions. + do_not_emit!(meta, cb); constrain_eq!(meta, cb, is_tag_begin, true); // state transitions