Skip to main content

KernelCheckpoint

Struct KernelCheckpoint 

Source
pub struct KernelCheckpoint { /* private fields */ }
Expand description

One logical checkpoint (§12.1).

Fields are private and every digest is computed by Self::assemble, so there is no constructor that takes a digest and “the host recomputed the hash and disagreed” is not a reachable state — the same discipline KernelRecord uses. Decoding goes through the same verification, which is why a tampered blob fails at the boundary rather than half-way through a restore.

Implementations§

Source§

impl KernelCheckpoint

Source

pub fn assemble(draft: CheckpointDraft) -> Result<Self, CheckpointError>

Build a checkpoint, computing all three digests and checking the tail covers (base_step_seq, through_step_seq] exactly.

Source

pub fn checkpoint_version(&self) -> u32

Source

pub fn abi_version(&self) -> u32

Source

pub fn operation_id(&self) -> &OperationId

Source

pub fn genesis_digest(&self) -> &Digest

Source

pub fn base_step_seq(&self) -> WireU64

Source

pub fn base_record_digest(&self) -> &Digest

Source

pub fn through_step_seq(&self) -> WireU64

Source

pub fn covered_transaction_head_digest(&self) -> &Digest

Source

pub fn logical_state(&self) -> &LogicalKernelState

Source

pub fn tail_inputs(&self) -> &[CanonicalInput]

Source

pub fn state_digest(&self) -> &Digest

Source

pub fn tail_digest(&self) -> &Digest

Source

pub fn checkpoint_digest(&self) -> &Digest

Source

pub fn checkpoint_bytes(&self) -> CanonicalBytes

Canonical bytes of the whole checkpoint — the blob a host persists.

Source

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

Decode a checkpoint from its stored bytes, verifying every digest and the tail coverage.

Source

pub fn boundary(&self) -> CheckpointBoundary

The prefix an ack of this checkpoint may reclaim (§12.3 rule 6).

Source

pub fn into_candidate(self) -> CheckpointCandidate

The §12.3 candidate this checkpoint hands the host.

Source

pub fn verify(&self) -> Result<(), CheckpointError>

Recompute every digest from the bytes this checkpoint carries and re-check its tail.

The first two lines of §12.2’s ladder. verify_belongs_to adds the operation/genesis half; the version halves are enforced by the decoder, which cannot produce a checkpoint whose checkpoint_version or abi_version this kernel does not read.

Source

pub fn verify_belongs_to( &self, operation_id: &OperationId, genesis_digest: &Digest, ) -> Result<(), CheckpointError>

Whether this checkpoint is this operation’s (§12.2 line 2).

Trait Implementations§

Source§

impl Clone for KernelCheckpoint

Source§

fn clone(&self) -> KernelCheckpoint

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 KernelCheckpoint

Source§

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

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

impl<'de> Deserialize<'de> for KernelCheckpoint

Source§

fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for KernelCheckpoint

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl Serialize for KernelCheckpoint

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for KernelCheckpoint

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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.