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 ab7d20be20ceb15b9f1f17861ef3c97b5d0353e9 Mon Sep 17 00:00:00 2001 From: kunxian xia Date: Wed, 28 Jun 2023 21:13:39 +0800 Subject: [PATCH 2/2] fix finding 4 --- zkevm-circuits/src/rlp_circuit_fsm.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zkevm-circuits/src/rlp_circuit_fsm.rs b/zkevm-circuits/src/rlp_circuit_fsm.rs index 3983902225..08358f994f 100644 --- a/zkevm-circuits/src/rlp_circuit_fsm.rs +++ b/zkevm-circuits/src/rlp_circuit_fsm.rs @@ -597,7 +597,7 @@ impl RlpCircuitConfig { meta.lookup_any("byte value check", |meta| { let cond = and::expr([ meta.query_fixed(q_enabled, Rotation::cur()), - is_padding_in_dt.expr(Rotation::cur())(meta), + not::expr(is_padding_in_dt.expr(Rotation::cur())(meta)), ]); vec![meta.query_advice(data_table.byte_value, Rotation::cur())]