Skip to main content

PublicCommitment

Struct PublicCommitment 

Source
pub struct PublicCommitment {
    pub chain: Chain,
    pub agent_id: Vec<u8>,
    pub escrow_id: u64,
    pub sender: Vec<u8>,
    pub recipient: Vec<u8>,
    pub asset_kind: AssetKind,
    pub asset_token: Vec<u8>,
    pub amount: BigNumber,
    pub condition: [u8; 32],
    pub outcome: ExecutionResult,
}
Expand description

The public commitment the guest writes to the receipt journal.

Fields§

§chain: Chain

Network the escrow settles on.

§agent_id: Vec<u8>

Raw bytes of the on-chain program id / contract address.

§escrow_id: u64

Unique on-chain identifier for this escrow instance.

§sender: Vec<u8>

Raw address bytes of the funding party.

§recipient: Vec<u8>

Raw address bytes of the recipient.

§asset_kind: AssetKind

Kind of asset under escrow.

§asset_token: Vec<u8>

Raw bytes of the token contract / mint (empty for the native coin).

§amount: BigNumber

Amount under escrow, in the smallest unit.

§condition: [u8; 32]

Witness-free commitment to the release condition (all-zero when none).

§outcome: ExecutionResult

Pass/fail outcome of executing the escrow.

Implementations§

Source§

impl PublicCommitment

Source

pub fn new(input: &ProofInput, outcome: ExecutionResult) -> Result<Self>

Builds the commitment from the guest input and the execution outcome.

§Errors

Returns CommitmentError if any participant or asset identity cannot be decoded into raw bytes.

Source

pub fn to_journal_bytes(&self) -> Result<Vec<u8>, CommitmentError>

Serializes the commitment into the journal byte layout.

§Errors

Returns CommitmentError::AmountTooLarge if the amount exceeds 256 bits, or CommitmentError::FieldTooLong if a length-prefixed field exceeds u16::MAX bytes.

Source

pub fn from_journal_bytes(bytes: &[u8]) -> Result<Self, CommitmentError>

Parses a commitment back from journal bytes.

§Errors

Returns CommitmentError if bytes is truncated, carries an unknown version, or contains an unrecognized enum tag.

Source

pub fn digest(&self) -> Result<[u8; 32], CommitmentError>

Returns sha256 of the journal bytes; the digest an on-chain verifier checks the receipt seal against.

§Errors

Propagates Self::to_journal_bytes errors.

Trait Implementations§

Source§

impl Clone for PublicCommitment

Source§

fn clone(&self) -> PublicCommitment

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 Debug for PublicCommitment

Source§

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

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

impl Eq for PublicCommitment

Source§

impl PartialEq for PublicCommitment

Source§

fn eq(&self, other: &PublicCommitment) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for PublicCommitment

Auto Trait Implementations§

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.