From 1b1459d0303eeb9efbf6a9f6b1bd42d8eaae60ea Mon Sep 17 00:00:00 2001 From: Danny Willems Date: Tue, 8 Oct 2024 17:51:22 +0200 Subject: [PATCH] Arrabiata: remove "permutation" gadget --- arrabiata/src/columns.rs | 4 ---- arrabiata/src/interpreter.rs | 10 ---------- arrabiata/src/witness.rs | 16 ---------------- 3 files changed, 30 deletions(-) diff --git a/arrabiata/src/columns.rs b/arrabiata/src/columns.rs index 3402b55d76..3d986818f8 100644 --- a/arrabiata/src/columns.rs +++ b/arrabiata/src/columns.rs @@ -15,8 +15,6 @@ use strum_macros::{EnumCount as EnumCountMacro, EnumIter}; #[derive(Debug, Clone, Copy, PartialEq, EnumCountMacro, EnumIter)] pub enum Gadget { App, - // Permutation argument - PermutationArgument, // Two old gadgets /// Decompose a 255 bits scalar into 16 chunks of 16 bits. SixteenBitsDecomposition, @@ -57,7 +55,6 @@ impl FormattedOutput for Column { match self { Column::Selector(sel) => match sel { Gadget::App => "q_app".to_string(), - Gadget::PermutationArgument => "q_perm".to_string(), Gadget::SixteenBitsDecomposition => "q_16bits".to_string(), Gadget::BitDecompositionFrom16Bits => "q_bit_from_16bits".to_string(), Gadget::BitDecomposition => "q_bits".to_string(), @@ -75,7 +72,6 @@ impl FormattedOutput for Column { match self { Column::Selector(sel) => match sel { Gadget::App => "q_app".to_string(), - Gadget::PermutationArgument => "q_perm".to_string(), Gadget::SixteenBitsDecomposition => "q_16bits".to_string(), Gadget::BitDecompositionFrom16Bits => "q_bit_from_16bits".to_string(), Gadget::BitDecomposition => "q_bits".to_string(), diff --git a/arrabiata/src/interpreter.rs b/arrabiata/src/interpreter.rs index b0a3040e03..05424964b4 100644 --- a/arrabiata/src/interpreter.rs +++ b/arrabiata/src/interpreter.rs @@ -841,9 +841,6 @@ pub fn run_ivc(env: &mut E, instr: Instruction) { env.activate_gadget(Gadget::EllipticCurveScaling); // When processing the first bit, we must load the scalar, and it // comes from previous computation. - if processing_bit == 0 { - env.activate_gadget(Gadget::PermutationArgument); - } // The two first columns are supposed to be used for the output. // It will be used to write the result of the scalar multiplication // in the next row. @@ -985,7 +982,6 @@ pub fn run_ivc(env: &mut E, instr: Instruction) { }; } Instruction::EllipticCurveAddition(i_comm) => { - env.activate_gadget(Gadget::PermutationArgument); env.activate_gadget(Gadget::EllipticCurveAddition); assert!(i_comm < NUMBER_OF_COLUMNS, "Invalid index. We do only support the addition of the commitments to the columns, for now. We must additionally support the scaling of cross-terms and error terms"); let (x1, y1) = { @@ -1029,7 +1025,6 @@ pub fn run_ivc(env: &mut E, instr: Instruction) { }; } Instruction::Poseidon(curr_round) => { - env.activate_gadget(Gadget::PermutationArgument); env.activate_gadget(Gadget::Poseidon); debug!("Executing instruction Poseidon({curr_round})"); if curr_round < POSEIDON_ROUNDS_FULL { @@ -1111,7 +1106,6 @@ pub fn run_ivc(env: &mut E, instr: Instruction) { // calls, like when we need to hash the public inputs, and the // state might be from a previous place in the execution trace. let state: Vec = if curr_round == 0 { - env.activate_gadget(Gadget::PermutationArgument); round_input_positions .iter() .enumerate() @@ -1171,16 +1165,12 @@ pub fn run_ivc(env: &mut E, instr: Instruction) { .collect(); // If we are at the last round, we save the state in the // environment. - // It does require the permutation argument to be activated. - // FIXME: activating the permutation argument has no effect - // for now. // FIXME/IMPROVEME: we might want to execute more Poseidon // full hash in sequentially, and then save one row. For // now, we will save the state at the end of the last round // and reload it at the beginning of the next Poseidon full // hash. if round == POSEIDON_ROUNDS_FULL - 1 { - env.activate_gadget(Gadget::PermutationArgument); state.iter().enumerate().for_each(|(i, x)| { unsafe { env.save_poseidon_state(x.clone(), i) }; }); diff --git a/arrabiata/src/witness.rs b/arrabiata/src/witness.rs index a97c438cb6..8c6dfb223f 100644 --- a/arrabiata/src/witness.rs +++ b/arrabiata/src/witness.rs @@ -428,10 +428,6 @@ where } fn load_poseidon_state(&mut self, pos: Self::Position, i: usize) -> Self::Variable { - assert!( - self.selectors[Gadget::PermutationArgument as usize][self.current_row], - "The permutation argument should be activated" - ); let state = if self.current_iteration % 2 == 0 { self.sponge_e1[i].clone() } else { @@ -471,10 +467,6 @@ where } unsafe fn save_poseidon_state(&mut self, x: Self::Variable, i: usize) { - assert!( - self.selectors[Gadget::PermutationArgument as usize][self.current_row], - "The permutation argument should be activated" - ); if self.current_iteration % 2 == 0 { let modulus: BigInt = Fp::modulus_biguint().into(); self.sponge_e1[i] = x.mod_floor(&modulus) @@ -549,10 +541,6 @@ where pos_y: Self::Position, side: Side, ) -> (Self::Variable, Self::Variable) { - assert!( - self.selectors[Gadget::PermutationArgument as usize][self.current_row], - "The permutation argument should be activated" - ); match self.current_instruction { Instruction::EllipticCurveScaling(i_comm, bit) => { // If we're processing the leftmost bit (i.e. bit == 0), we must load @@ -657,10 +645,6 @@ where y: Self::Variable, side: Side, ) { - assert!( - self.selectors[Gadget::PermutationArgument as usize][self.current_row], - "The permutation argument should be activated" - ); match side { Side::Left => { self.temporary_accumulators.0 = (x, y);