pub struct MerkleRoot<H: HashAxis, const LEAF_BYTES: usize = SHA256_BYTES>(/* private fields */);Expand description
Parametric Merkle-root commitment over any HashAxis impl
H with H::MAX_OUTPUT_BYTES = LEAF_BYTES.
LEAF_BYTES is the leaf width (and the root width — Merkle’s input
and output share the digest’s output size). The default,
MerkleRootCommitment, uses SHA-256 (32-byte leaves and root).
Per ADR-031 a standard-library commitment composes other
standard-library axes (HashAxis here); this is the
canonical-reference example of axis composition the wiki commits
to. Two MerkleRoot<H> instantiations with structurally-identical
H content-address identically per ADR-017.
Trait Implementations§
Source§impl<H: HashAxis, const LEAF_BYTES: usize> AxisExtension for MerkleRoot<H, LEAF_BYTES>
impl<H: HashAxis, const LEAF_BYTES: usize> AxisExtension for MerkleRoot<H, LEAF_BYTES>
Source§const AXIS_ADDRESS: &'static str = <MerkleRoot<H, LEAF_BYTES> as CommitmentAxis>::AXIS_ADDRESS
const AXIS_ADDRESS: &'static str = <MerkleRoot<H, LEAF_BYTES> as CommitmentAxis>::AXIS_ADDRESS
ADR-017 content address of this axis trait. The SDK macro
derives this from the trait name and method signatures.
Source§const MAX_OUTPUT_BYTES: usize = <MerkleRoot<H, LEAF_BYTES> as CommitmentAxis>::MAX_OUTPUT_BYTES
const MAX_OUTPUT_BYTES: usize = <MerkleRoot<H, LEAF_BYTES> as CommitmentAxis>::MAX_OUTPUT_BYTES
Maximum bytes any kernel of this axis returns.
Source§fn dispatch_kernel(
kernel_id: u32,
input: &[u8],
out: &mut [u8],
) -> Result<usize, ShapeViolation>
fn dispatch_kernel( kernel_id: u32, input: &[u8], out: &mut [u8], ) -> Result<usize, ShapeViolation>
Dispatch the kernel identified by
kernel_id against the
evaluated input bytes. The implementation copies the kernel’s
output into out and returns the written length. Read moreSource§impl<H: Clone + HashAxis, const LEAF_BYTES: usize> Clone for MerkleRoot<H, LEAF_BYTES>
impl<H: Clone + HashAxis, const LEAF_BYTES: usize> Clone for MerkleRoot<H, LEAF_BYTES>
Source§fn clone(&self) -> MerkleRoot<H, LEAF_BYTES>
fn clone(&self) -> MerkleRoot<H, LEAF_BYTES>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<H: HashAxis, const LEAF_BYTES: usize> CommitmentAxis for MerkleRoot<H, LEAF_BYTES>
impl<H: HashAxis, const LEAF_BYTES: usize> CommitmentAxis for MerkleRoot<H, LEAF_BYTES>
Source§impl<H: HashAxis, const LEAF_BYTES: usize> SubstrateTermBody for MerkleRoot<H, LEAF_BYTES>
impl<H: HashAxis, const LEAF_BYTES: usize> SubstrateTermBody for MerkleRoot<H, LEAF_BYTES>
Source§fn body_arena() -> &'static [Term]
fn body_arena() -> &'static [Term]
The Term arena the kernel decomposes to. Empty slice signals a
primitive-fast-path axis whose body the implementation may evaluate
through
dispatch_kernel directly per ADR-055’s optional fast-path.impl<H: Copy + HashAxis, const LEAF_BYTES: usize> Copy for MerkleRoot<H, LEAF_BYTES>
impl<H: HashAxis, const LEAF_BYTES: usize> Sealed for MerkleRoot<H, LEAF_BYTES>
Auto Trait Implementations§
impl<H, const LEAF_BYTES: usize> Freeze for MerkleRoot<H, LEAF_BYTES>
impl<H, const LEAF_BYTES: usize> RefUnwindSafe for MerkleRoot<H, LEAF_BYTES>where
H: RefUnwindSafe,
impl<H, const LEAF_BYTES: usize> Send for MerkleRoot<H, LEAF_BYTES>where
H: Send,
impl<H, const LEAF_BYTES: usize> Sync for MerkleRoot<H, LEAF_BYTES>where
H: Sync,
impl<H, const LEAF_BYTES: usize> Unpin for MerkleRoot<H, LEAF_BYTES>where
H: Unpin,
impl<H, const LEAF_BYTES: usize> UnsafeUnpin for MerkleRoot<H, LEAF_BYTES>
impl<H, const LEAF_BYTES: usize> UnwindSafe for MerkleRoot<H, LEAF_BYTES>where
H: 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
Mutably borrows from an owned value. Read more