From 4115e8317ee3ecf0c04b33dd4a45466534e0877d Mon Sep 17 00:00:00 2001 From: Brechtpd Date: Wed, 20 Sep 2023 19:14:10 +0200 Subject: [PATCH] Feedback --- zkevm-circuits/src/circuit_tools/memory.rs | 14 +++----------- zkevm-circuits/src/mpt_circuit.rs | 10 +++++----- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/zkevm-circuits/src/circuit_tools/memory.rs b/zkevm-circuits/src/circuit_tools/memory.rs index d53cc8d3a1..7f1fb3cb2c 100644 --- a/zkevm-circuits/src/circuit_tools/memory.rs +++ b/zkevm-circuits/src/circuit_tools/memory.rs @@ -29,21 +29,13 @@ impl> Index for Memory type Output = MB; fn index(&self, tag: C) -> &Self::Output { - if let Some(bank) = self.banks.get(&tag) { - bank - } else { - unreachable!() - } + self.banks.get(&tag).expect("bank exists") } } impl> IndexMut for Memory { fn index_mut(&mut self, tag: C) -> &mut Self::Output { - if let Some(bank) = self.banks.get_mut(&tag) { - bank - } else { - unreachable!() - } + self.banks.get_mut(&tag).expect("bank exists") } } @@ -56,7 +48,7 @@ impl> Memory { } } - pub(crate) fn add_rw( + pub(crate) fn add_memory_bank( &mut self, meta: &mut ConstraintSystem, cb: &mut ConstraintBuilder, diff --git a/zkevm-circuits/src/mpt_circuit.rs b/zkevm-circuits/src/mpt_circuit.rs index f3685c747f..8913c10d7c 100644 --- a/zkevm-circuits/src/mpt_circuit.rs +++ b/zkevm-circuits/src/mpt_circuit.rs @@ -258,23 +258,23 @@ impl MPTConfig { state_cm.add_columns(meta, &mut cb.base, lu(MptTableType::Mult), 2, false, 2); let mut memory = Memory::new(); - memory.add_rw(meta, &mut cb.base, &mut state_cm, MptCellType::MemKeyC, 2); - memory.add_rw(meta, &mut cb.base, &mut state_cm, MptCellType::MemKeyS, 2); - memory.add_rw( + memory.add_memory_bank(meta, &mut cb.base, &mut state_cm, MptCellType::MemKeyC, 2); + memory.add_memory_bank(meta, &mut cb.base, &mut state_cm, MptCellType::MemKeyS, 2); + memory.add_memory_bank( meta, &mut cb.base, &mut state_cm, MptCellType::MemParentC, 2, ); - memory.add_rw( + memory.add_memory_bank( meta, &mut cb.base, &mut state_cm, MptCellType::MemParentS, 2, ); - memory.add_rw(meta, &mut cb.base, &mut state_cm, MptCellType::MemMain, 2); + memory.add_memory_bank(meta, &mut cb.base, &mut state_cm, MptCellType::MemMain, 2); let mut ctx = MPTContext { mpt_table,