StackTrait

Trait StackTrait 

Source
pub trait StackTrait<N: Network> {
Show 29 methods // Required methods fn contains_proving_key(&self, function_name: &Identifier<N>) -> bool; fn get_proving_key( &self, function_name: &Identifier<N>, ) -> Result<ProvingKey<N>>; fn insert_proving_key( &self, function_name: &Identifier<N>, proving_key: ProvingKey<N>, ) -> Result<()>; fn remove_proving_key(&self, function_name: &Identifier<N>); fn contains_verifying_key(&self, function_name: &Identifier<N>) -> bool; fn get_verifying_key( &self, function_name: &Identifier<N>, ) -> Result<VerifyingKey<N>>; fn insert_verifying_key( &self, function_name: &Identifier<N>, verifying_key: VerifyingKey<N>, ) -> Result<()>; fn remove_verifying_key(&self, function_name: &Identifier<N>); fn matches_value_type( &self, value: &Value<N>, value_type: &ValueType<N>, ) -> Result<()>; fn matches_register_type( &self, stack_value: &Value<N>, register_type: &RegisterType<N>, ) -> Result<()>; fn matches_external_record( &self, record: &Record<N, Plaintext<N>>, locator: &Locator<N>, ) -> Result<()>; fn matches_record( &self, record: &Record<N, Plaintext<N>>, record_name: &Identifier<N>, ) -> Result<()>; fn matches_plaintext( &self, plaintext: &Plaintext<N>, plaintext_type: &PlaintextType<N>, ) -> Result<()>; fn matches_future( &self, future: &Future<N>, locator: &Locator<N>, ) -> Result<()>; fn program(&self) -> &Program<N>; fn program_id(&self) -> &ProgramID<N>; fn program_address(&self) -> &Address<N>; fn program_checksum(&self) -> &[U8<N>; 32]; fn program_checksum_as_field(&self) -> Result<Field<N>>; fn program_edition(&self) -> U16<N>; fn program_owner(&self) -> &Option<Address<N>>; fn set_program_owner(&mut self, program_owner: Option<Address<N>>); fn get_external_stack(&self, program_id: &ProgramID<N>) -> Result<Arc<Self>>; fn get_function(&self, function_name: &Identifier<N>) -> Result<Function<N>>; fn get_function_ref( &self, function_name: &Identifier<N>, ) -> Result<&Function<N>>; fn get_number_of_calls( &self, function_name: &Identifier<N>, ) -> Result<usize>; fn sample_value<R: Rng + CryptoRng>( &self, burner_address: &Address<N>, value_type: &RegisterType<N>, rng: &mut R, ) -> Result<Value<N>>; fn sample_record<R: Rng + CryptoRng>( &self, burner_address: &Address<N>, record_name: &Identifier<N>, record_nonce: Group<N>, rng: &mut R, ) -> Result<Record<N, Plaintext<N>>>; fn sample_record_using_tvk<R: Rng + CryptoRng>( &self, burner_address: &Address<N>, record_name: &Identifier<N>, tvk: Field<N>, index: Field<N>, rng: &mut R, ) -> Result<Record<N, Plaintext<N>>>;
}
Expand description

This trait is intended to be implemented only by snarkvm_synthesizer_process::Stack.

We make it a trait only to avoid circular dependencies.

Required Methods§

Source

fn contains_proving_key(&self, function_name: &Identifier<N>) -> bool

Returns true if the proving key for the given function name exists.

Source

fn get_proving_key( &self, function_name: &Identifier<N>, ) -> Result<ProvingKey<N>>

Returns the proving key for the given function name.

Source

fn insert_proving_key( &self, function_name: &Identifier<N>, proving_key: ProvingKey<N>, ) -> Result<()>

Inserts the proving key for the given function name.

Source

fn remove_proving_key(&self, function_name: &Identifier<N>)

Removes the proving key for the given function name.

Source

fn contains_verifying_key(&self, function_name: &Identifier<N>) -> bool

Returns true if the verifying key for the given function name exists.

Source

fn get_verifying_key( &self, function_name: &Identifier<N>, ) -> Result<VerifyingKey<N>>

Returns the verifying key for the given function name.

Source

fn insert_verifying_key( &self, function_name: &Identifier<N>, verifying_key: VerifyingKey<N>, ) -> Result<()>

Inserts the verifying key for the given function name.

Source

fn remove_verifying_key(&self, function_name: &Identifier<N>)

Removes the verifying key for the given function name.

Source

fn matches_value_type( &self, value: &Value<N>, value_type: &ValueType<N>, ) -> Result<()>

Checks that the given value matches the layout of the value type.

Source

fn matches_register_type( &self, stack_value: &Value<N>, register_type: &RegisterType<N>, ) -> Result<()>

Checks that the given stack value matches the layout of the register type.

Source

fn matches_external_record( &self, record: &Record<N, Plaintext<N>>, locator: &Locator<N>, ) -> Result<()>

Checks that the given record matches the layout of the external record type.

Source

fn matches_record( &self, record: &Record<N, Plaintext<N>>, record_name: &Identifier<N>, ) -> Result<()>

Checks that the given record matches the layout of the record type.

Source

fn matches_plaintext( &self, plaintext: &Plaintext<N>, plaintext_type: &PlaintextType<N>, ) -> Result<()>

Checks that the given plaintext matches the layout of the plaintext type.

Source

fn matches_future(&self, future: &Future<N>, locator: &Locator<N>) -> Result<()>

Checks that the given future matches the layout of the future type.

Source

fn program(&self) -> &Program<N>

Returns the program.

Source

fn program_id(&self) -> &ProgramID<N>

Returns the program ID.

Source

fn program_address(&self) -> &Address<N>

Returns the program address.

Source

fn program_checksum(&self) -> &[U8<N>; 32]

Returns the program checksum.

Source

fn program_checksum_as_field(&self) -> Result<Field<N>>

Returns the program checksum as a field element.

Source

fn program_edition(&self) -> U16<N>

Returns the program edition.

Source

fn program_owner(&self) -> &Option<Address<N>>

Returns the program owner. The program owner should only be set for programs that are deployed after ConsensusVersion::V9 is active.

Source

fn set_program_owner(&mut self, program_owner: Option<Address<N>>)

Sets the program owner.

Source

fn get_external_stack(&self, program_id: &ProgramID<N>) -> Result<Arc<Self>>

Returns the external stack for the given program ID.

Source

fn get_function(&self, function_name: &Identifier<N>) -> Result<Function<N>>

Returns the function with the given function name.

Source

fn get_function_ref( &self, function_name: &Identifier<N>, ) -> Result<&Function<N>>

Returns a reference to the function with the given function name.

Source

fn get_number_of_calls(&self, function_name: &Identifier<N>) -> Result<usize>

Returns the expected number of calls for the given function name.

Source

fn sample_value<R: Rng + CryptoRng>( &self, burner_address: &Address<N>, value_type: &RegisterType<N>, rng: &mut R, ) -> Result<Value<N>>

Samples a value for the given value_type.

Source

fn sample_record<R: Rng + CryptoRng>( &self, burner_address: &Address<N>, record_name: &Identifier<N>, record_nonce: Group<N>, rng: &mut R, ) -> Result<Record<N, Plaintext<N>>>

Returns a record for the given record name, with the given burner address and nonce.

Source

fn sample_record_using_tvk<R: Rng + CryptoRng>( &self, burner_address: &Address<N>, record_name: &Identifier<N>, tvk: Field<N>, index: Field<N>, rng: &mut R, ) -> Result<Record<N, Plaintext<N>>>

Returns a record for the given record name, deriving the nonce from tvk and index.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§