Skip to main content

StackTrait

Trait StackTrait 

Source
pub trait StackTrait<N: Network> {
Show 34 methods // Required methods fn contains_proving_key( &self, function_or_record_name: &Identifier<N>, ) -> bool; fn get_proving_key( &self, function_or_record_name: &Identifier<N>, ) -> Result<ProvingKey<N>>; fn insert_proving_key( &self, function_or_record_name: &Identifier<N>, proving_key: ProvingKey<N>, ) -> Result<()>; fn remove_proving_key(&self, function_or_record_name: &Identifier<N>); fn contains_verifying_key( &self, function_or_record_name: &Identifier<N>, ) -> bool; fn get_verifying_key( &self, function_or_record_name: &Identifier<N>, ) -> Result<VerifyingKey<N>>; fn insert_verifying_key( &self, function_or_record_name: &Identifier<N>, verifying_key: VerifyingKey<N>, ) -> Result<()>; fn remove_verifying_key(&self, function_or_record_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_amendment_count(&self) -> u64; fn set_program_amendment_count(&mut self, program_amendment_count: u64); 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_stack_global(&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_minimum_number_of_calls( &self, function_name: &Identifier<N>, ) -> Result<usize>; fn contains_dynamic_call( &self, function_name: &Identifier<N>, ) -> Result<bool>; 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>>>; fn evaluate_view( &self, state: FinalizeGlobalState, store: &dyn FinalizeStoreTrait<N>, view_name: &Identifier<N>, inputs: Vec<Value<N>>, ) -> Result<Vec<Value<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_or_record_name: &Identifier<N>) -> bool

Returns true if the proving key for the given name exists. The name can be a function name or a record name (for translation keys).

Source

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

Returns the proving key for the given name. The name can be a function name or a record name (for translation keys).

Source

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

Inserts the proving key for the given name. The name can be a function name or a record name (for translation keys).

Source

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

Removes the proving key for the given name. The name can be a function name or a record name (for translation keys).

Source

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

Returns true if the verifying key for the given name exists. The name can be a function name or a record name (for translation keys).

Source

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

Returns the verifying key for the given name. The name can be a function name or a record name (for translation keys).

Source

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

Inserts the verifying key for the given name. The name can be a function name or a record name (for translation keys).

Source

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

Removes the verifying key for the given name. The name can be a function name or a record name (for translation keys).

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_amendment_count(&self) -> u64

Returns the number of amendments for the current program edition.

Source

fn set_program_amendment_count(&mut self, program_amendment_count: u64)

Sets the number of amendments for the current 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_stack_global(&self, program_id: &ProgramID<N>) -> Result<Arc<Self>>

Returns the external stack for the given program ID, without checking that:

  • The program ID is different from the current program ID.
  • The program ID is imported by the current program.

This function is only to be used for resolution during dynamic dispatch.

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_minimum_number_of_calls( &self, function_name: &Identifier<N>, ) -> Result<usize>

Returns the minimum number of calls for the given function name. Note: In a static call graph (no dynamic dispatch), the minimum is the actual count.

Source

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

Returns whether or not a function has a dynamic call in its execution.

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.

Source

fn evaluate_view( &self, state: FinalizeGlobalState, store: &dyn FinalizeStoreTrait<N>, view_name: &Identifier<N>, inputs: Vec<Value<N>>, ) -> Result<Vec<Value<N>>>

Evaluates a view function on this stack against the given finalize-store state.

The caller (Call::finalize) loads operand values from the caller’s registers and passes them as inputs; this method runs the view body and returns its outputs. It is the cross-crate hook that lets Call::finalize (in snarkvm-synthesizer-program) dispatch view-call evaluation into snarkvm-synthesizer-process without depending on concrete Stack / FinalizeRegisters types.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§