Liking cljdoc? Tell your friends :D

skuld.validator

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.

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.
raw docstring

-mainclj

(-main & [n-str alice-str bob-str])

chainclj


encode-kpclj

(encode-kp id)

new-identityclj

(new-identity)

A fresh identity in the shape the harness passes around.

A fresh identity in the shape the harness passes around.
raw docstring

runclj

(run n alice bob)

Replay n blocks and return this validator's digests.

Replay `n` blocks and return this validator's digests.
raw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close