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: ChainNetwork the escrow settles on.
agent_id: Vec<u8>Raw bytes of the on-chain program id / contract address.
escrow_id: u64Unique 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: AssetKindKind of asset under escrow.
asset_token: Vec<u8>Raw bytes of the token contract / mint (empty for the native coin).
amount: BigNumberAmount under escrow, in the smallest unit.
condition: [u8; 32]Witness-free commitment to the release condition (all-zero when none).
outcome: ExecutionResultPass/fail outcome of executing the escrow.
Implementations§
Source§impl PublicCommitment
impl PublicCommitment
Sourcepub fn new(input: &ProofInput, outcome: ExecutionResult) -> Result<Self>
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.
Sourcepub fn to_journal_bytes(&self) -> Result<Vec<u8>, CommitmentError>
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.
Sourcepub fn from_journal_bytes(bytes: &[u8]) -> Result<Self, CommitmentError>
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.
Sourcepub fn digest(&self) -> Result<[u8; 32], CommitmentError>
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
impl Clone for PublicCommitment
Source§fn clone(&self) -> PublicCommitment
fn clone(&self) -> PublicCommitment
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PublicCommitment
impl Debug for PublicCommitment
impl Eq for PublicCommitment
Source§impl PartialEq for PublicCommitment
impl PartialEq for PublicCommitment
Source§fn eq(&self, other: &PublicCommitment) -> bool
fn eq(&self, other: &PublicCommitment) -> bool
self and other values to be equal, and is used by ==.