pub struct Consignment {
pub version: u8,
pub genesis: Genesis,
pub transitions: Vec<Transition>,
pub seal_assignments: Vec<SealAssignment>,
pub anchors: Vec<Anchor>,
pub schema_id: Hash,
}Expand description
Complete contract consignment
This is the wire format for transferring CSV contract state between peers. A valid consignment contains a complete, verifiable chain from genesis to the current state.
Fields§
§version: u8Consignment version
genesis: GenesisContract genesis
transitions: Vec<Transition>State transitions in topological order
seal_assignments: Vec<SealAssignment>Seal assignments (indexed by transition output)
anchors: Vec<Anchor>Anchor proofs (on-chain commitment locations)
schema_id: HashSchema ID (for validation against contract rules)
Implementations§
Source§impl Consignment
impl Consignment
Sourcepub fn new(
genesis: Genesis,
transitions: Vec<Transition>,
seal_assignments: Vec<SealAssignment>,
anchors: Vec<Anchor>,
schema_id: Hash,
) -> Self
pub fn new( genesis: Genesis, transitions: Vec<Transition>, seal_assignments: Vec<SealAssignment>, anchors: Vec<Anchor>, schema_id: Hash, ) -> Self
Create a new consignment
Sourcepub fn state_root(&self) -> Hash
pub fn state_root(&self) -> Hash
Compute the consignment state root hash
This hash represents the current state of the contract after all transitions have been applied.
Sourcepub fn contract_id(&self) -> Hash
pub fn contract_id(&self) -> Hash
Get the contract ID (from genesis)
Sourcepub fn transition_count(&self) -> usize
pub fn transition_count(&self) -> usize
Get the number of transitions
Sourcepub fn assignment_count(&self) -> usize
pub fn assignment_count(&self) -> usize
Get the number of seal assignments
Sourcepub fn anchor_count(&self) -> usize
pub fn anchor_count(&self) -> usize
Get the number of anchors
Sourcepub fn latest_state_for_seal(&self, seal: &SealRef) -> Option<&StateAssignment>
pub fn latest_state_for_seal(&self, seal: &SealRef) -> Option<&StateAssignment>
Get the latest state for a given seal
Walks transitions in order to find the most recent assignment to the given seal.
Sourcepub fn current_seals(&self) -> BTreeSet<Vec<u8>>
pub fn current_seals(&self) -> BTreeSet<Vec<u8>>
Get all current seal owners
Returns the set of seals that have received state but haven’t been consumed by any transition.
Sourcepub fn validate_structure(&self) -> Result<(), ConsignmentError>
pub fn validate_structure(&self) -> Result<(), ConsignmentError>
Validate basic consignment structure
Sourcepub fn from_bytes(bytes: &[u8]) -> Result<Self, Error>
pub fn from_bytes(bytes: &[u8]) -> Result<Self, Error>
Deserialize consignment from bytes with size limit (50MB max)
Sourcepub fn from_genesis(genesis: Genesis) -> Self
pub fn from_genesis(genesis: Genesis) -> Self
Create a consignment with only genesis (no transitions yet)
Trait Implementations§
Source§impl Clone for Consignment
impl Clone for Consignment
Source§fn clone(&self) -> Consignment
fn clone(&self) -> Consignment
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more