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§
Sourcefn contains_proving_key(&self, function_name: &Identifier<N>) -> bool
fn contains_proving_key(&self, function_name: &Identifier<N>) -> bool
Returns true if the proving key for the given function name exists.
Sourcefn get_proving_key(
&self,
function_name: &Identifier<N>,
) -> Result<ProvingKey<N>>
fn get_proving_key( &self, function_name: &Identifier<N>, ) -> Result<ProvingKey<N>>
Returns the proving key for the given function name.
Sourcefn insert_proving_key(
&self,
function_name: &Identifier<N>,
proving_key: ProvingKey<N>,
) -> Result<()>
fn insert_proving_key( &self, function_name: &Identifier<N>, proving_key: ProvingKey<N>, ) -> Result<()>
Inserts the proving key for the given function name.
Sourcefn remove_proving_key(&self, function_name: &Identifier<N>)
fn remove_proving_key(&self, function_name: &Identifier<N>)
Removes the proving key for the given function name.
Sourcefn contains_verifying_key(&self, function_name: &Identifier<N>) -> bool
fn contains_verifying_key(&self, function_name: &Identifier<N>) -> bool
Returns true if the verifying key for the given function name exists.
Sourcefn get_verifying_key(
&self,
function_name: &Identifier<N>,
) -> Result<VerifyingKey<N>>
fn get_verifying_key( &self, function_name: &Identifier<N>, ) -> Result<VerifyingKey<N>>
Returns the verifying key for the given function name.
Sourcefn insert_verifying_key(
&self,
function_name: &Identifier<N>,
verifying_key: VerifyingKey<N>,
) -> Result<()>
fn insert_verifying_key( &self, function_name: &Identifier<N>, verifying_key: VerifyingKey<N>, ) -> Result<()>
Inserts the verifying key for the given function name.
Sourcefn remove_verifying_key(&self, function_name: &Identifier<N>)
fn remove_verifying_key(&self, function_name: &Identifier<N>)
Removes the verifying key for the given function name.
Sourcefn matches_value_type(
&self,
value: &Value<N>,
value_type: &ValueType<N>,
) -> Result<()>
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.
Sourcefn matches_register_type(
&self,
stack_value: &Value<N>,
register_type: &RegisterType<N>,
) -> Result<()>
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.
Sourcefn matches_external_record(
&self,
record: &Record<N, Plaintext<N>>,
locator: &Locator<N>,
) -> Result<()>
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.
Sourcefn matches_record(
&self,
record: &Record<N, Plaintext<N>>,
record_name: &Identifier<N>,
) -> Result<()>
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.
Sourcefn matches_plaintext(
&self,
plaintext: &Plaintext<N>,
plaintext_type: &PlaintextType<N>,
) -> Result<()>
fn matches_plaintext( &self, plaintext: &Plaintext<N>, plaintext_type: &PlaintextType<N>, ) -> Result<()>
Checks that the given plaintext matches the layout of the plaintext type.
Sourcefn matches_future(&self, future: &Future<N>, locator: &Locator<N>) -> Result<()>
fn matches_future(&self, future: &Future<N>, locator: &Locator<N>) -> Result<()>
Checks that the given future matches the layout of the future type.
Sourcefn program_id(&self) -> &ProgramID<N>
fn program_id(&self) -> &ProgramID<N>
Returns the program ID.
Sourcefn program_address(&self) -> &Address<N>
fn program_address(&self) -> &Address<N>
Returns the program address.
Sourcefn program_checksum(&self) -> &[U8<N>; 32]
fn program_checksum(&self) -> &[U8<N>; 32]
Returns the program checksum.
Sourcefn program_checksum_as_field(&self) -> Result<Field<N>>
fn program_checksum_as_field(&self) -> Result<Field<N>>
Returns the program checksum as a field element.
Sourcefn program_edition(&self) -> U16<N>
fn program_edition(&self) -> U16<N>
Returns the program edition.
Sourcefn program_owner(&self) -> &Option<Address<N>>
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.
Sourcefn set_program_owner(&mut self, program_owner: Option<Address<N>>)
fn set_program_owner(&mut self, program_owner: Option<Address<N>>)
Sets the program owner.
Sourcefn get_external_stack(&self, program_id: &ProgramID<N>) -> Result<Arc<Self>>
fn get_external_stack(&self, program_id: &ProgramID<N>) -> Result<Arc<Self>>
Returns the external stack for the given program ID.
Sourcefn get_function(&self, function_name: &Identifier<N>) -> Result<Function<N>>
fn get_function(&self, function_name: &Identifier<N>) -> Result<Function<N>>
Returns the function with the given function name.
Sourcefn get_function_ref(
&self,
function_name: &Identifier<N>,
) -> Result<&Function<N>>
fn get_function_ref( &self, function_name: &Identifier<N>, ) -> Result<&Function<N>>
Returns a reference to the function with the given function name.
Sourcefn get_number_of_calls(&self, function_name: &Identifier<N>) -> Result<usize>
fn get_number_of_calls(&self, function_name: &Identifier<N>) -> Result<usize>
Returns the expected number of calls for the given function name.
Sourcefn sample_value<R: Rng + CryptoRng>(
&self,
burner_address: &Address<N>,
value_type: &RegisterType<N>,
rng: &mut R,
) -> Result<Value<N>>
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.
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.