pub struct ChainEvent {
pub sequence: u64,
pub chain_id: u32,
pub timestamp: DateTime<Utc>,
pub prev_hash: [u8; 32],
pub hash: [u8; 32],
pub payload_hash: [u8; 32],
pub source: String,
pub kind: String,
pub payload: Option<Value>,
pub idempotency_key: Option<[u8; 32]>,
pub rule_hash: Option<[u8; 32]>,
}Expand description
A chain event – one entry in the append-only log.
Fields§
§sequence: u64Sequence number (0 = genesis).
chain_id: u32Chain ID (0 = local).
timestamp: DateTime<Utc>Event timestamp.
prev_hash: [u8; 32]SHAKE-256 hash of the previous event (zeroed for genesis).
hash: [u8; 32]SHAKE-256 hash of this event (covers all fields incl. payload).
payload_hash: [u8; 32]SHAKE-256 hash of the canonical payload bytes (zeroed when
payload is None). Enables independent content verification.
source: StringEvent source (e.g. “kernel”, “service.cron”, “cluster”).
kind: StringEvent kind (e.g. “boot”, “service.start”, “peer.join”).
payload: Option<Value>Optional payload (JSON).
idempotency_key: Option<[u8; 32]>Optional idempotency key for replay protection (WEFT-103).
When provided to ChainManager::append_idempotent, the chain
rejects (returns the prior event without appending a duplicate)
any new event whose key matches an entry within the last
IDEMPOTENCY_LOOKBACK events. This shields the append path
from replayed writes at retry boundaries (mesh peers, HTTP
reties, sync-sweep loops).
Not covered by the event hash. Idempotency keys are an out-of-band deduplication hint, not part of the immutable chain commitment. This keeps existing chains hash-stable as the field rolls out and allows different writers to retry the same logical operation without invalidating the ledger.
rule_hash: Option<[u8; 32]>Hash of the kind-registry rules in force when this event was
appended (ADR-103 A7). None for every pre-P2 event.
Covered by the event hash only when Some, so events
without it hash byte-identically to before the field existed.
A binary that predates the field ignores it on read, recomputes
a different hash and fails integrity verification loudly.
Trait Implementations§
Source§impl Clone for ChainEvent
impl Clone for ChainEvent
Source§impl Debug for ChainEvent
impl Debug for ChainEvent
Source§impl<'de> Deserialize<'de> for ChainEvent
impl<'de> Deserialize<'de> for ChainEvent
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>,
Auto Trait Implementations§
impl Freeze for ChainEvent
impl RefUnwindSafe for ChainEvent
impl Send for ChainEvent
impl Sync for ChainEvent
impl Unpin for ChainEvent
impl UnsafeUnpin for ChainEvent
impl UnwindSafe for ChainEvent
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<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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