Struct simplicity::Amr
source · pub struct Amr(/* private fields */);Expand description
Annotated Merkle root
A Merkle root that commits to a node’s combinator, its source and target type, its witness data (if present), and recursively its children.
Uniquely identifies a program’s structure in terms of types at redemption time.
Implementations§
source§impl Amr
impl Amr
sourcepub fn update(self, left: Self, right: Self) -> Self
pub fn update(self, left: Self, right: Self) -> Self
Extend the given tagged hash by the given left and right hashes.
The hash self is taken as initial value,
left and right hash are combined to create a 512-bit block,
and the compression function is run once
sourcepub fn update_1(self, right: Self) -> Self
pub fn update_1(self, right: Self) -> Self
Extend the given tagged hash by 256 bits of zeroes and the right hash.
The hash self is taken as initial value,
256 bits of zeroes and right hash are combined to create a 512-bit block,
and the compression function is run once
sourcepub fn update_with_weight(self, left_weight: u64, right: Self) -> Self
pub fn update_with_weight(self, left_weight: u64, right: Self) -> Self
Updates the given tagged hash with given left cost and right hash.
The cost is serialized as the last 64 bits in the left block
pub fn update_fail_entropy(self, entropy: FailEntropy) -> Self
sourcepub fn from_byte_array(data: [u8; 32]) -> Self
pub fn from_byte_array(data: [u8; 32]) -> Self
Converts the given tagged hash into a byte array
sourcepub fn to_byte_array(self) -> [u8; 32]
pub fn to_byte_array(self) -> [u8; 32]
Converts the given tagged hash into a byte array
source§impl Amr
impl Amr
sourcepub fn iden(ty: &FinalArrow) -> Self
pub fn iden(ty: &FinalArrow) -> Self
Produce a CMR for an iden combinator
sourcepub fn unit(ty: &FinalArrow) -> Self
pub fn unit(ty: &FinalArrow) -> Self
Produce a CMR for a unit combinator
sourcepub fn injl(ty: &FinalArrow, child: Amr) -> Self
pub fn injl(ty: &FinalArrow, child: Amr) -> Self
Produce a CMR for an injl combinator
sourcepub fn injr(ty: &FinalArrow, child: Amr) -> Self
pub fn injr(ty: &FinalArrow, child: Amr) -> Self
Produce a CMR for an injr combinator
sourcepub fn take(ty: &FinalArrow, child: Amr) -> Self
pub fn take(ty: &FinalArrow, child: Amr) -> Self
Produce a CMR for a take combinator
sourcepub fn drop(ty: &FinalArrow, child: Amr) -> Self
pub fn drop(ty: &FinalArrow, child: Amr) -> Self
Produce a CMR for a drop combinator
sourcepub fn comp(
ty: &FinalArrow,
left_arrow: &FinalArrow,
left: Amr,
right: Amr
) -> Self
pub fn comp( ty: &FinalArrow, left_arrow: &FinalArrow, left: Amr, right: Amr ) -> Self
Produce a CMR for a comp combinator
sourcepub fn case(ty: &FinalArrow, left: Amr, right: Amr) -> Self
pub fn case(ty: &FinalArrow, left: Amr, right: Amr) -> Self
Produce a CMR for a case combinator
sourcepub fn assertl(ty: &FinalArrow, left: Amr, right: Amr) -> Self
pub fn assertl(ty: &FinalArrow, left: Amr, right: Amr) -> Self
Produce a CMR for an assertl combinator
sourcepub fn assertr(ty: &FinalArrow, left: Amr, right: Amr) -> Self
pub fn assertr(ty: &FinalArrow, left: Amr, right: Amr) -> Self
Produce a CMR for an assertr combinator
sourcepub fn pair(
ty: &FinalArrow,
left_arrow: &FinalArrow,
right_arrow: &FinalArrow,
left: Amr,
right: Amr
) -> Self
pub fn pair( ty: &FinalArrow, left_arrow: &FinalArrow, right_arrow: &FinalArrow, left: Amr, right: Amr ) -> Self
Produce a CMR for a pair combinator
sourcepub fn disconnect(
ty: &FinalArrow,
right_arrow: &FinalArrow,
left: Amr,
right: Amr
) -> Self
pub fn disconnect( ty: &FinalArrow, right_arrow: &FinalArrow, left: Amr, right: Amr ) -> Self
Produce a CMR for a disconnect combinator
sourcepub fn witness(ty: &FinalArrow, value: &Value) -> Self
pub fn witness(ty: &FinalArrow, value: &Value) -> Self
Produce a CMR for a witness combinator
sourcepub fn fail(entropy: FailEntropy) -> Self
pub fn fail(entropy: FailEntropy) -> Self
Produce an AMR for a fail combinator
sourcepub fn const_word(v: &Value) -> Self
pub fn const_word(v: &Value) -> Self
Compute the CMR of a constant word jet
This is equal to the IMR of the equivalent scribe, converted to a CMR in the usual way for jets.
Trait Implementations§
source§impl Ord for Amr
impl Ord for Amr
source§impl PartialOrd for Amr
impl PartialOrd for Amr
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read more