Skip to main content

MerkleRoot

Struct MerkleRoot 

Source
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>

Source§

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

Maximum bytes any kernel of this axis returns.
Source§

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 more
Source§

impl<H: Clone + HashAxis, const LEAF_BYTES: usize> Clone for MerkleRoot<H, LEAF_BYTES>

Source§

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)

Performs copy-assignment from source. Read more
Source§

impl<H: HashAxis, const LEAF_BYTES: usize> CommitmentAxis for MerkleRoot<H, LEAF_BYTES>

Source§

const AXIS_ADDRESS: &'static str = "https://uor.foundation/axis/CommitmentAxis/MerkleRootParametric"

Source§

const MAX_OUTPUT_BYTES: usize = LEAF_BYTES

Source§

fn commit(input: &[u8], out: &mut [u8]) -> Result<usize, ShapeViolation>

Commit to input — emits the commitment bytes into out. Read more
Source§

impl<H: Debug + HashAxis, const LEAF_BYTES: usize> Debug for MerkleRoot<H, LEAF_BYTES>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<H: HashAxis, const LEAF_BYTES: usize> Default for MerkleRoot<H, LEAF_BYTES>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<H: HashAxis, const LEAF_BYTES: usize> SubstrateTermBody for MerkleRoot<H, LEAF_BYTES>

Source§

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.
Source§

impl<H: Copy + HashAxis, const LEAF_BYTES: usize> Copy for MerkleRoot<H, LEAF_BYTES>

Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.