pub struct CheckpointRfc {
pub sequence: u64,
pub checkpoint_id: Uuid,
pub timestamp: u64,
pub content_hash: [u8; 32],
pub prev_hash: [u8; 32],
pub checkpoint_hash: [u8; 32],
pub vdf_proof: Option<VdfProofRfc>,
pub jitter_binding: Option<JitterBinding>,
pub chain_mac: Option<[u8; 32]>,
}Expand description
RFC-compliant checkpoint for CBOR wire format.
Separate from internal Checkpoint to allow different serialization
strategies (JSON for human-readable, CBOR for wire).
Fields§
§sequence: u64§checkpoint_id: Uuid§timestamp: u64§content_hash: [u8; 32]§prev_hash: [u8; 32]Zeros for the first checkpoint in a chain.
checkpoint_hash: [u8; 32]§vdf_proof: Option<VdfProofRfc>§jitter_binding: Option<JitterBinding>§chain_mac: Option<[u8; 32]>Implementations§
Source§impl CheckpointRfc
impl CheckpointRfc
Sourcepub fn new(
sequence: u64,
timestamp: u64,
content_hash: [u8; 32],
prev_hash: [u8; 32],
) -> Self
pub fn new( sequence: u64, timestamp: u64, content_hash: [u8; 32], prev_hash: [u8; 32], ) -> Self
Create a checkpoint with a new UUID and zeroed checkpoint hash.
Sourcepub fn with_vdf(self, proof: VdfProofRfc) -> Self
pub fn with_vdf(self, proof: VdfProofRfc) -> Self
Attach a VDF proof.
Sourcepub fn with_jitter(self, binding: JitterBinding) -> Self
pub fn with_jitter(self, binding: JitterBinding) -> Self
Attach a jitter binding.
Sourcepub fn with_chain_mac(self, mac: [u8; 32]) -> Self
pub fn with_chain_mac(self, mac: [u8; 32]) -> Self
Attach a PUF-bound chain MAC.
Sourcepub fn compute_hash(&mut self)
pub fn compute_hash(&mut self)
Compute and set checkpoint_hash over all fields except itself.
Trait Implementations§
Source§impl Clone for CheckpointRfc
impl Clone for CheckpointRfc
Source§fn clone(&self) -> CheckpointRfc
fn clone(&self) -> CheckpointRfc
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CheckpointRfc
impl Debug for CheckpointRfc
Source§impl<'de> Deserialize<'de> for CheckpointRfc
impl<'de> Deserialize<'de> for CheckpointRfc
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for CheckpointRfc
impl RefUnwindSafe for CheckpointRfc
impl Send for CheckpointRfc
impl Sync for CheckpointRfc
impl Unpin for CheckpointRfc
impl UnsafeUnpin for CheckpointRfc
impl UnwindSafe for CheckpointRfc
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more