pub struct ChainState {
pub subject_cid512: String,
pub epoch: u64,
pub record_digest: [u8; 64],
pub next_key_commitments: Vec<[u8; 64]>,
}Expand description
A validated point in an identity’s key-rotation chain: either the genesis
capsule (ChainState::genesis) or a successfully validated update-record
(the return value of validate_successor).
It is simultaneously (a) the predecessor input to the next successor-check
and (b) the persistent duplicity watermark the B2 layer (#886) stores:
the (epoch, record_digest) pair plus the commitments needed to admit the
next link.
Fields§
§subject_cid512: StringThe genesis cid512 that names this identity. Constant across the whole
chain; every update-record must carry the same subject_cid512.
epoch: u64Epoch of this state. Genesis is epoch 0 by construction; the first update-record must therefore carry epoch >= 1.
record_digest: [u8; 64]H512 over the canonical bytes of the record this state represents — the
value the next update-record must echo in prev_record_digest, and the
digest half of the B2 watermark.
next_key_commitments: Vec<[u8; 64]>The keys this state pre-commits to for the next rotation. Empty means a declared-immutable identity (§7.1) — no update-record is ever a valid successor.
Implementations§
Source§impl ChainState
impl ChainState
Sourcepub fn genesis(capsule: &Capsule) -> Result<Self>
pub fn genesis(capsule: &Capsule) -> Result<Self>
Build the predecessor state for a genesis capsule.
The caller is responsible for having verified the capsule’s own
self-signature and its H512(bytes) == cid512 gate first
(verify_capsule, GATE 1/2); this only projects the fields the
successor-check needs. The genesis record digest is H512 of the
capsule’s canonical bytes — the same digest embedded in its cid512 — so
the first update-record’s prev_record_digest chains to it directly.
Sourcepub fn from_validated_update(record: &UpdateRecord) -> Self
pub fn from_validated_update(record: &UpdateRecord) -> Self
Project the predecessor state of an already-validated update-record —
e.g. reconstructing the watermark from a persisted record on startup.
For validating a fresh candidate, prefer validate_successor, which
returns this state only after all gates pass.
Trait Implementations§
Source§impl Clone for ChainState
impl Clone for ChainState
Source§fn clone(&self) -> ChainState
fn clone(&self) -> ChainState
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 ChainState
impl Debug for ChainState
Source§impl PartialEq for ChainState
impl PartialEq for ChainState
Source§fn eq(&self, other: &ChainState) -> bool
fn eq(&self, other: &ChainState) -> bool
self and other values to be equal, and is used by ==.impl Eq for ChainState
impl StructuralPartialEq for ChainState
Auto Trait Implementations§
impl Freeze for ChainState
impl RefUnwindSafe for ChainState
impl Send for ChainState
impl Sync for ChainState
impl Unpin for ChainState
impl UnsafeUnpin for ChainState
impl UnwindSafe for ChainState
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more