Skip to content

dizzy.engine.dagstore.events

dizzy.engine.dagstore.events

The event envelope and its content hash.

An event's stream id is SHA-256 over the canonical JSON of {"v": 1, "type": ..., "parents": [...sorted...], "payload": ...}. The v field versions the hash format itself; parents are sorted so sibling order can't mint two ids for the same event. The id is therefore self-verifying: anyone holding the event can recompute it.

TamperedEvent

Bases: ValueError

An event's id does not match its content.

Source code in dizzy/src/dizzy/engine/dagstore/events.py
23
24
class TamperedEvent(ValueError):
    """An event's id does not match its content."""

verify(event)

True iff the event's id matches its content.

Source code in dizzy/src/dizzy/engine/dagstore/events.py
50
51
52
def verify(event: Event) -> bool:
    """True iff the event's id matches its content."""
    return event.id == compute_id(event.type, event.parents, event.payload)