One validator, in its own JVM, replaying a block sequence and printing its final digest.
The property under test is that two validators handed the same blocks reach
the same state. Running both in one JVM cannot establish that, and this
repository has already been bitten twice by exactly that mistake: datahike's
plan cache and query-result cache are namespace-level, so two histories in
one process contaminate each other and agree for the wrong reason
(urd.gas.replica documents the two false negatives).
The same hazard is broader here. Anything a validator holds outside the
database -- a memoised value, a defonce, an interned keyword's hash seed,
iteration order over a mutable structure -- is shared between two in-process
replicas and cannot cause them to differ. A second JVM is the only
arrangement where a divergence has room to appear.
hasch/edn-hash over the stake state and over every datom in the database.
Not the EDN string: a printed map is order-dependent in ways the value is
not, so comparing strings would report a divergence that does not exist and
hide one that does.
Prints one line prefixed VALIDATOR so the parent can find it among
datahike's logging.
One validator, in its own JVM, replaying a block sequence and printing its final digest. ## Why a separate process rather than a loop The property under test is that two validators handed the same blocks reach the same state. Running both in one JVM cannot establish that, and this repository has already been bitten twice by exactly that mistake: datahike's plan cache and query-result cache are namespace-level, so two histories in one process contaminate each other and agree for the wrong reason (`urd.gas.replica` documents the two false negatives). The same hazard is broader here. Anything a validator holds outside the database -- a memoised value, a `defonce`, an interned keyword's hash seed, iteration order over a mutable structure -- is shared between two in-process replicas and cannot cause them to differ. A second JVM is the only arrangement where a divergence has room to appear. ## What is compared `hasch/edn-hash` over the stake state and over every datom in the database. Not the EDN string: a printed map is order-dependent in ways the value is not, so comparing strings would report a divergence that does not exist and hide one that does. Prints one line prefixed `VALIDATOR ` so the parent can find it among datahike's logging.
(run n alice bob)Replay n blocks and return this validator's digests.
Replay `n` blocks and return this validator's digests.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |