pub fn verify_chain(events: &[&Event]) -> Result<(), HashError>Expand description
Verify the Merkle-DAG integrity of a collection of events.
This function performs two checks for each event in the collection:
-
Hash integrity: the event’s stored
event_hashmatches the BLAKE3 hash computed from its fields. If any ancestor was modified, its hash will no longer match, causing this check to fail. -
Parent resolution: every parent hash referenced by an event must appear as another event’s
event_hashin the provided collection.
Together, these checks enforce the Merkle property: modifying any event
invalidates the hashes of all its descendants (because a descendant’s hash
covers its parents field, which encodes ancestor hashes).
Events may be provided in any order; all hashes are collected into a lookup table before validation begins.
§Errors
Returns the first HashError encountered. The order in which events
are checked is not guaranteed.