pub struct KeccakEnv<F> {
    pub constraints_env: ConstraintsEnv<F>,
    pub witness_env: WitnessEnv<F>,
    pub step: Option<Steps>,
    /* private fields */
}
Expand description

This struct contains all that needs to be kept track of during the execution of the Keccak step interpreter

Fields§

§constraints_env: ConstraintsEnv<F>

Environment for the constraints (includes lookups). The step of the hash that is being executed can be None if just ended

§witness_env: WitnessEnv<F>

Environment for the witness (includes multiplicities)

§step: Option<Steps>

Current step

Implementations§

source§

impl<F: Field> KeccakEnv<F>

source

pub fn new(hash_idx: u64, preimage: &[u8]) -> Self

Starts a new Keccak environment for a given hash index and bytestring of preimage data

source

pub fn write_column(&mut self, column: KeccakColumn, value: u64)

Writes an integer value to a column of the Keccak witness

source

pub fn write_column_field(&mut self, column: KeccakColumn, value: F)

Writes a field value to a column of the Keccak witness

source

pub fn null_state(&mut self)

Nullifies the Witness and Constraint environments by resetting it to default values (except for table-related) This way, each row only adds the constraints of that step (do not nullify the step)

source

pub fn selector(&self) -> Steps

Returns the selector of the current step in standardized form

source

pub fn step(&mut self)

Entrypoint for the interpreter. It executes one step of the Keccak circuit (one row), and updates the environment accordingly (including the witness and inter-step lookups). When it finishes, it updates the value of the current step, so that the next call to the step() function executes the next step.

source

pub fn update_step(&mut self)

This function updates the next step of the environment depending on the current step

Trait Implementations§

source§

impl<F: Clone> Clone for KeccakEnv<F>

source§

fn clone(&self) -> KeccakEnv<F>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<F: Debug> Debug for KeccakEnv<F>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl DecomposableTracer<KeccakEnv<<<KeccakConfig as FoldingConfig>::Curve as AffineRepr>::ScalarField>> for DecomposedKeccakTrace

source§

fn new( domain_size: usize, env: &mut KeccakEnv<<<KeccakConfig as FoldingConfig>::Curve as AffineRepr>::ScalarField> ) -> Self

Create a new decomposable trace with the given domain size, and environment.
source§

fn pad_witnesses(&mut self)

Pads the rows of the witnesses until reaching the domain size using the first row repeatedly. It does not add selector columns.
source§

impl<F: Field> Default for KeccakEnv<F>

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl Tracer<N_ZKVM_KECCAK_REL_COLS, KeccakConfig, KeccakEnv<<<KeccakConfig as FoldingConfig>::Curve as AffineRepr>::ScalarField>> for KeccakTrace

§

type Selector = ()

source§

fn init( domain_size: usize, selector: Steps, _env: &mut KeccakEnv<<<KeccakConfig as FoldingConfig>::Curve as AffineRepr>::ScalarField> ) -> Self

Initialize a new trace with the given domain size, selector, and environment.
source§

fn push_row( &mut self, _selector: Self::Selector, row: &[<<KeccakConfig as FoldingConfig>::Curve as AffineRepr>::ScalarField; 2073] )

Add a witness row to the circuit (only for relation columns)
source§

fn pad_with_row( &mut self, _selector: Self::Selector, row: &[<<KeccakConfig as FoldingConfig>::Curve as AffineRepr>::ScalarField; 2073] ) -> usize

Pad the rows of one opcode with the given row until reaching the domain size if needed. Returns the number of rows that were added. It does not add selector columns.
source§

fn pad_with_zeros(&mut self, _selector: Self::Selector) -> usize

Pads the rows of one opcode with zero rows until reaching the domain size if needed. Returns the number of rows that were added. It does not add selector columns.
source§

fn pad_dummy(&mut self, _selector: Self::Selector) -> usize

Pad the rows of one opcode with the first row until reaching the domain size if needed. It only tries to pad witnesses which are non empty. Returns the number of rows that were added. It does not add selector columns. Read more

Auto Trait Implementations§

§

impl<F> RefUnwindSafe for KeccakEnv<F>where F: RefUnwindSafe,

§

impl<F> Send for KeccakEnv<F>where F: Send,

§

impl<F> Sync for KeccakEnv<F>where F: Sync,

§

impl<F> Unpin for KeccakEnv<F>where F: Unpin,

§

impl<F> UnwindSafe for KeccakEnv<F>where F: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V