pub enum Input<N>where
N: Network,{
Constant(Field<N>, Option<Plaintext<N>>),
Public(Field<N>, Option<Plaintext<N>>),
Private(Field<N>, Option<Ciphertext<N>>),
Record(Field<N>, Field<N>),
ExternalRecord(Field<N>),
DynamicRecord(Field<N>),
RecordWithDynamicID(Field<N>, Field<N>, Field<N>),
ExternalRecordWithDynamicID(Field<N>, Field<N>),
}Expand description
The transition input.
Variants§
Constant(Field<N>, Option<Plaintext<N>>)
The plaintext hash and (optional) plaintext.
Public(Field<N>, Option<Plaintext<N>>)
The plaintext hash and (optional) plaintext.
Private(Field<N>, Option<Ciphertext<N>>)
The ciphertext hash and (optional) ciphertext.
Record(Field<N>, Field<N>)
The serial number and tag of the record.
ExternalRecord(Field<N>)
The hash of the external record’s (function_id, record, tvk, input index).
DynamicRecord(Field<N>)
The hash of the dynamic record’s (function_id, record, tvk, input index).
RecordWithDynamicID(Field<N>, Field<N>, Field<N>)
The serial number, tag, and dynamic ID of a record input in a dynamic call transition.
The dynamic_id is computed from hash(function_id, record, tvk, index).
From the caller’s perspective, this appears as DynamicRecord(dynamic_id).
ExternalRecordWithDynamicID(Field<N>, Field<N>)
The external record hash and dynamic ID of an external record input in a dynamic call transition.
The dynamic_id is computed from hash(function_id, record, tvk, index).
From the caller’s perspective, this appears as DynamicRecord(dynamic_id).
Implementations§
Source§impl<N> Input<N>where
N: Network,
impl<N> Input<N>where
N: Network,
Sourcepub fn to_transition_leaf(&self, index: u8) -> TransitionLeaf<N>
pub fn to_transition_leaf(&self, index: u8) -> TransitionLeaf<N>
Returns the input as a transition leaf. Note: RecordWithDynamicID uses leaf variant 3 (same as Record) with version 2. Note: ExternalRecordWithDynamicID uses leaf variant 4 (same as ExternalRecord) with version 2.
Sourcepub fn into_tag(self) -> Option<Field<N>>
pub fn into_tag(self) -> Option<Field<N>>
Returns the tag, if the input is a record, and consumes self.
Sourcepub const fn serial_number(&self) -> Option<&Field<N>>
pub const fn serial_number(&self) -> Option<&Field<N>>
Returns the serial number, if the input is a record.
Sourcepub fn into_serial_number(self) -> Option<Field<N>>
pub fn into_serial_number(self) -> Option<Field<N>>
Returns the serial number, if the input is a record, and consumes self.
Sourcepub fn verifier_inputs(&self) -> impl Iterator<Item = <N as Environment>::Field>
pub fn verifier_inputs(&self) -> impl Iterator<Item = <N as Environment>::Field>
Returns the public verifier inputs for the proof.
Sourcepub const fn dynamic_id(&self) -> Option<&Field<N>>
pub const fn dynamic_id(&self) -> Option<&Field<N>>
Returns the dynamic ID, if the input carries one.
Sourcepub fn to_caller_input(&self) -> Input<N>
pub fn to_caller_input(&self) -> Input<N>
Returns the input from the caller’s perspective. This converts internal variants (like RecordWithDynamicID) to what the caller would see (like DynamicRecord).
Sourcepub fn verify(
&self,
function_id: Field<N>,
tcm: &Field<N>,
index: usize,
) -> bool
pub fn verify( &self, function_id: Field<N>, tcm: &Field<N>, index: usize, ) -> bool
Returns true if the input is well-formed.
If the optional value exists, this method checks that it hashes to the input ID.
Sourcepub fn is_type(&self, expected_value_type: &ValueType<N>) -> bool
pub fn is_type(&self, expected_value_type: &ValueType<N>) -> bool
Returns true if the input matches the expected value type.
Sourcepub fn valid_as_argument(
&self,
callee_value_type: &ValueType<N>,
is_dynamic: Option<bool>,
) -> bool
pub fn valid_as_argument( &self, callee_value_type: &ValueType<N>, is_dynamic: Option<bool>, ) -> bool
Returns true if the input matches the given value type as seen by the callee. Record,
ExternalRecord, DynamicRecord, RecordWithDynamicID and ExternalRecordWithDynamicID
inputs are handled according to the value of is_dynamic:
Some(true)enforces type correspondence assuming the inputs refer to a dynamic call.Some(false)enforces it assuming a static call.Noneis flexible and makes no assumption about the type of call: both dynamic-call and static-call matching patterns returntrue.
For inputs of an invalid type according to is_dynamic, this function returns false
regardless of the value type.
Trait Implementations§
Source§impl<'de, N> Deserialize<'de> for Input<N>where
N: Network,
impl<'de, N> Deserialize<'de> for Input<N>where
N: Network,
Source§fn deserialize<D>(
deserializer: D,
) -> Result<Input<N>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<Input<N>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserializes the transition input from a string or bytes.
impl<N> Eq for Input<N>
Source§impl<N> FromBytes for Input<N>where
N: Network,
impl<N> FromBytes for Input<N>where
N: Network,
Source§fn read_le<R>(reader: R) -> Result<Input<N>, Error>where
R: Read,
fn read_le<R>(reader: R) -> Result<Input<N>, Error>where
R: Read,
Reads the input from a buffer.
Source§fn from_bytes_le(bytes: &[u8]) -> Result<Self, Error>where
Self: Sized,
fn from_bytes_le(bytes: &[u8]) -> Result<Self, Error>where
Self: Sized,
Self from a byte array in little-endian order.Source§fn from_bytes_le_unchecked(bytes: &[u8]) -> Result<Self, Error>where
Self: Sized,
fn from_bytes_le_unchecked(bytes: &[u8]) -> Result<Self, Error>where
Self: Sized,
Self::from_bytes_le but avoids costly checks.
This shall only be called when deserializing from a trusted source, such as local storage. Read moreSource§fn read_le_unchecked<R>(reader: R) -> Result<Self, Error>
fn read_le_unchecked<R>(reader: R) -> Result<Self, Error>
Self::read_le but avoids costly checks.
This shall only be called when deserializing from a trusted source, such as local storage. Read moreSource§impl<N> Serialize for Input<N>where
N: Network,
impl<N> Serialize for Input<N>where
N: Network,
Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serializes the transition input into string or bytes.
impl<N> StructuralPartialEq for Input<N>
Auto Trait Implementations§
impl<N> !Freeze for Input<N>
impl<N> RefUnwindSafe for Input<N>where
Field<N>: RefUnwindSafe,
Option<Plaintext<N>>: RefUnwindSafe,
Option<Ciphertext<N>>: RefUnwindSafe,
impl<N> Send for Input<N>
impl<N> Sync for Input<N>
impl<N> Unpin for Input<N>
impl<N> UnsafeUnpin for Input<N>
impl<N> UnwindSafe for Input<N>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<'de, T> DeserializeExt<'de> for Twhere
T: DeserializeOwned,
impl<'de, T> DeserializeExt<'de> for Twhere
T: DeserializeOwned,
fn take_from_value<D>(
value: &mut Value,
field: &str,
) -> Result<T, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more