pub struct DynamicRecord<A: Aleo> { /* private fields */ }Expand description
A dynamic record is a fixed-size representation of a record. Like static
Records, a dynamic record contains an owner, nonce, and a version.
However, instead of storing the full data, it only stores the Merkle root of
the data. This ensures that all dynamic records have a constant size,
regardless of the amount of data they contain.
Suppose we have the following record with two data entries:
record foo:
owner as address.private;
microcredits as u64.private;
memo as [u8; 32u32].public;The leaves of its Merkle tree are computed as follows:
L_0 := HashPSD8(ToField(name_0) || ToFields(entry_0))
L_1 := HashPSD8(ToField(name_1) || ToFields(entry_1))where name_i is the field encoding of the entry identifier (e.g. "microcredits" → Field),
and ToFields encodes the entry’s mode and plaintext variant.
The tree has depth RECORD_DATA_TREE_DEPTH = 5 and is constructed with
path hasher HashPSD2 and the padding scheme outlined in
snarkVM’s MerkleTree.
Implementations§
Source§impl<A: Aleo> DynamicRecord<A>
impl<A: Aleo> DynamicRecord<A>
Source§impl<A: Aleo> DynamicRecord<A>
impl<A: Aleo> DynamicRecord<A>
Sourcepub const fn data(&self) -> Option<&RecordData<A::Network>>
pub const fn data(&self) -> Option<&RecordData<A::Network>>
Returns the console record data.
Source§impl<A: Aleo> DynamicRecord<A>
impl<A: Aleo> DynamicRecord<A>
Sourcepub fn from_record(record: &Record<A, Plaintext<A>>) -> Result<Self>
pub fn from_record(record: &Record<A, Plaintext<A>>) -> Result<Self>
Creates a dynamic record from a static one.
Sourcepub fn merkleize_data(
data: &IndexMap<Identifier<A>, Entry<A, Plaintext<A>>>,
) -> Result<RecordDataTree<A>>
pub fn merkleize_data( data: &IndexMap<Identifier<A>, Entry<A, Plaintext<A>>>, ) -> Result<RecordDataTree<A>>
Serializes the given (ordered) entries to field elements, prepends an identifier tag
per entry, and computes the Merkle tree over the resulting leaves. More details on
the structure of the tree can be found in DynamicRecord.
Trait Implementations§
Source§impl<A: Clone + Aleo> Clone for DynamicRecord<A>
impl<A: Clone + Aleo> Clone for DynamicRecord<A>
Source§fn clone(&self) -> DynamicRecord<A>
fn clone(&self) -> DynamicRecord<A>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<A: Aleo> Eject for DynamicRecord<A>
impl<A: Aleo> Eject for DynamicRecord<A>
Source§fn eject_mode(&self) -> Mode
fn eject_mode(&self) -> Mode
Ejects the mode of the dynamic record.
Source§fn eject_value(&self) -> Self::Primitive
fn eject_value(&self) -> Self::Primitive
Ejects the dynamic record.
type Primitive = DynamicRecord<<A as Environment>::Network>
Source§fn eject(&self) -> (Mode, Self::Primitive)
fn eject(&self) -> (Mode, Self::Primitive)
Source§fn is_constant(&self) -> bool
fn is_constant(&self) -> bool
true if the circuit is a constant.Source§fn is_private(&self) -> bool
fn is_private(&self) -> bool
true if the circuit is a private.Source§impl<A: Aleo> Equal for DynamicRecord<A>
impl<A: Aleo> Equal for DynamicRecord<A>
Source§impl<A: Aleo> From<DynamicRecord<A>> for Value<A>
impl<A: Aleo> From<DynamicRecord<A>> for Value<A>
Source§fn from(dynamic_record: DynamicRecord<A>) -> Self
fn from(dynamic_record: DynamicRecord<A>) -> Self
Initializes the value from a dynamic record.
Source§impl<A: Aleo> Inject for DynamicRecord<A>
impl<A: Aleo> Inject for DynamicRecord<A>
Source§impl<A: Aleo> ToBits for DynamicRecord<A>
impl<A: Aleo> ToBits for DynamicRecord<A>
Source§fn write_bits_le(&self, vec: &mut Vec<Self::Boolean>)
fn write_bits_le(&self, vec: &mut Vec<Self::Boolean>)
Returns the circuit dynamic record as a list of little-endian bits.
Source§fn write_bits_be(&self, vec: &mut Vec<Self::Boolean>)
fn write_bits_be(&self, vec: &mut Vec<Self::Boolean>)
Returns the circuit dynamic record as a list of big-endian bits.
type Boolean = Boolean<A>
Source§fn to_bits_le(&self) -> Vec<Self::Boolean>
fn to_bits_le(&self) -> Vec<Self::Boolean>
Source§fn to_bits_be(&self) -> Vec<Self::Boolean>
fn to_bits_be(&self) -> Vec<Self::Boolean>
Auto Trait Implementations§
impl<A> !Freeze for DynamicRecord<A>
impl<A> !RefUnwindSafe for DynamicRecord<A>
impl<A> Send for DynamicRecord<A>
impl<A> !Sync for DynamicRecord<A>
impl<A> Unpin for DynamicRecord<A>where
<A as Environment>::BaseField: Unpin,
<<A as Environment>::Network as Environment>::Projective: Unpin,
<A as Environment>::ScalarField: Unpin,
<A as Environment>::Network: Unpin,
impl<A> UnsafeUnpin for DynamicRecord<A>
impl<A> UnwindSafe for DynamicRecord<A>where
<A as Environment>::BaseField: UnwindSafe + RefUnwindSafe,
<<A as Environment>::Network as Environment>::Projective: UnwindSafe,
<A as Environment>::ScalarField: UnwindSafe,
<A as Environment>::Network: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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