diff --git a/primitives/src/circuit/rescue/mod.rs b/primitives/src/circuit/rescue/mod.rs index 58e29007a..29b21f169 100644 --- a/primitives/src/circuit/rescue/mod.rs +++ b/primitives/src/circuit/rescue/mod.rs @@ -18,9 +18,8 @@ pub use non_native::RescueNonNativeStateVar; use crate::rescue::{RescueMatrix, RescueVector, PRP}; -/// Generic ResuceStateVar. Both RescueStateVar and RescueNonNativeStateVar -/// should implement it. -pub trait RescueStateVarGen { +/// Variable to represent the state of the sponge. +pub trait SpongeStateVar { /// The native field. type Native; /// Non-native field. @@ -32,7 +31,7 @@ pub trait RescueStateVarGen { /// Trait for rescue circuit over native field. pub trait RescueGadget where - R: RescueStateVarGen, + R: SpongeStateVar, { /// Given an input state st_0 and an output state st_1, ensure that st_1 = /// rescue_permutation(st_0) where rescue_permutation is the instance @@ -115,7 +114,7 @@ where pub(crate) trait PermutationGadget: Circuit where - R: RescueStateVarGen, + R: SpongeStateVar, F: PrimeField, { fn check_var_bound_rescue_state(&self, rescue_state: &R) -> Result<(), CircuitError>; diff --git a/primitives/src/circuit/rescue/native.rs b/primitives/src/circuit/rescue/native.rs index dc3fd6d90..d731c3ff8 100644 --- a/primitives/src/circuit/rescue/native.rs +++ b/primitives/src/circuit/rescue/native.rs @@ -18,14 +18,14 @@ use jf_relation::{ }; use jf_utils::compute_len_to_next_multiple; -use super::{PermutationGadget, RescueGadget, RescueStateVarGen}; +use super::{PermutationGadget, RescueGadget, SpongeStateVar}; #[derive(Clone, Debug)] /// Array of variables representing a Rescue state (4 field elements). pub struct RescueStateVar(pub(crate) [Variable; STATE_SIZE]); /// For the native field, there is only really one field `F`. -impl RescueStateVarGen for RescueStateVar { +impl SpongeStateVar for RescueStateVar { type Native = F; type NonNative = F; type Var = Variable; diff --git a/primitives/src/circuit/rescue/non_native.rs b/primitives/src/circuit/rescue/non_native.rs index 8015bdd05..dfa5bb4f7 100644 --- a/primitives/src/circuit/rescue/non_native.rs +++ b/primitives/src/circuit/rescue/non_native.rs @@ -22,7 +22,7 @@ use jf_relation::{ }; use jf_utils::{compute_len_to_next_multiple, field_switching}; -use super::{PermutationGadget, RescueGadget, RescueStateVarGen}; +use super::{PermutationGadget, RescueGadget, SpongeStateVar}; /// Array of variables representing a Rescue state (4 field elements), and also /// the modulus of the non-native evaluating field. @@ -32,7 +32,7 @@ pub struct RescueNonNativeStateVar { pub(crate) modulus: FpElem, } -impl RescueStateVarGen for RescueNonNativeStateVar { +impl SpongeStateVar for RescueNonNativeStateVar { type Native = T; type NonNative = F; type Var = FpElemVar;