tasm_lib::traits::mem_preserver

Trait MemPreserver

Source
pub trait MemPreserver: BasicSnippet {
    // Required methods
    fn rust_shadow(
        &self,
        stack: &mut Vec<BFieldElement>,
        memory: &HashMap<BFieldElement, BFieldElement>,
        nd_tokens: VecDeque<BFieldElement>,
        nd_digests: VecDeque<Digest>,
        stdin: VecDeque<BFieldElement>,
        sponge: &mut Option<Tip5>,
    ) -> Vec<BFieldElement>;
    fn pseudorandom_initial_state(
        &self,
        seed: [u8; 32],
        bench_case: Option<BenchmarkCase>,
    ) -> MemPreserverInitialState;

    // Provided method
    fn corner_case_initial_states(&self) -> Vec<MemPreserverInitialState> { ... }
}
Expand description

A MemPreserver cannot modify memory

An MemPreserver is a piece of tasm code that can do pretty much everything except modify memory, including static memory. It can read from any input and write to standard out. It can also modify the sponge state. See also: closure, function, procedure, algorithm, read_only_algorithm, accessor

Required Methods§

Source

fn rust_shadow( &self, stack: &mut Vec<BFieldElement>, memory: &HashMap<BFieldElement, BFieldElement>, nd_tokens: VecDeque<BFieldElement>, nd_digests: VecDeque<Digest>, stdin: VecDeque<BFieldElement>, sponge: &mut Option<Tip5>, ) -> Vec<BFieldElement>

Source

fn pseudorandom_initial_state( &self, seed: [u8; 32], bench_case: Option<BenchmarkCase>, ) -> MemPreserverInitialState

Provided Methods§

Implementors§