| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A node of a swarm holding a store holds the store, read from its document
(`docs/store.md`, What the store takes from the document): `federation::held`. Whenever
the document changes, a worker reads the events it holds that the store wasn't offered
from it, under the document's lock, and offers them to the store without it, each taken
as from anywhere: once its dependencies are held, judged at its history. Another
document (a drop, a rejoin) is read as it comes, the store going on.
The node reads its store anew from its document whenever it starts, from the root, by
what is its own of it: the events it refused by what it took before, and those its
operator had it drop, which it keeps in a file (`--store-file`), written whenever that
changes, so that a store read anew in another order refuses what it refused before. A
file that doesn't read stops the node from starting; without one, a restart may take
what it refused.
|
| |
|
|
|
|
|
|
|
|
|
| |
Vectors (`docs/federation-tests.md`, Fixed bytes) for a write and its signature and ID,
the first version of two parties and its hash, the root it makes and its ID, a version
event, an event whose value holds names that UTF-16 units sort otherwise than bytes, and
events at federation 1's sizes and just past them: 256 KiB, 32 segments of 255 bytes,
64 nodes, integers to 2⁵³. Each value was computed apart from this code, by a script of
its own: JCS by hand, Ed25519 by another library, and the signature's blob as OpenSSH's
`PROTOCOL.sshsig` describes it, as `ssh-keygen -Y sign` makes it. Checking one against
`ssh-keygen` itself is left to whoever has it at hand.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Three to five parties write in their namespaces, change their key sets and node lists,
propose versions and checkpoints on what they last caught up with, vote, and write the
versions that pass; honest ones back one proposal on a version, an adversary votes as it
likes and signs as another party with its own key, or where it may not write. Over such
histories:
* the store judges every event, and reads, as the model does, offered the same events in
the same order, with an adversary and without;
* what builds on a refused event is refused;
* honest parties read the same whatever order the events come in, checkpoints and all;
* after a checkpoint, what the store took the model takes, reading the whole history but
for what the store refused as not above it, and the two read the same; the version
naming the checkpoint is taken;
* every version a store takes was backed by two thirds of the parties of the version it
changes, in its history;
* without a party voting twice, no two versions change one.
A failing history is cut down and printed.
|
| |
|
|
|
|
|
|
|
|
|
| |
The model (`docs/federation-tests.md`, The harness) reads the federation as
`docs/federation.md` says, as plainly as it can: every event judged at its history read
anew from the root, the version current there the highest-numbered written one, keys,
key sets, node lists, votes, passing and dead, version events and the heads a version
may name each worked out from that history alone; a node's own, the first of two
versions changing one; and what counts read from everything taken. It keeps nothing but
which events it took, and makes no checkpoint: slow and short, it is what the fold is
checked against. A test takes it through a version passing, offered last event first.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Each row of `docs/federation.md`'s attacks marked unit that the fold and the store in
memory answer has its test, named by its row (`federation_attack_12`), with events made
for it by the harness: keys that aren't their party's, bytes that are none, events of
another federation or a fork, writes where a party held or holds no place, key sets
and keys stolen or dropped, votes cast twice, at once, split, or at a history from
before, versions that are none or written again late, two versions changing one in
every order, forks and roots, checkpoints, events not above their heads, and heads a
version may not name.
`every_row_marked_unit_has_its_test` reads the table and this file, and checks that
every row marked unit has its test, or waits for a later stage (what a node, a party's
client or a tool does, and what a node tells of a fork), and that no test names a row
that isn't there.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`Federation` is the store's fold for `docs/federation.md`. The state judging reads is
the state of an event's history, which the store builds from the checkpoint and that
history alone; so the version current there is the state's, the highest-numbered one
written, and a history holding two versions of one number is refused.
* A signed event's party is a party of the version current at its history. A write is
signed by a key among its party's (those of its key set that counts, else those its
version names) where a rule gives its party the place; a key set, node list,
proposal or vote by a key its version names.
* A vote is on the version current at its history, for a proposal proposed on it; a
`true` only where every other proposal its party backs on that version is dead.
Passing and dead go by the parties voting each way, a party with both counting for
both.
* A version event writes a proposal on the version current at its history, passed
there, which is a version changing that one; one naming a checkpoint names heads
after the current checkpoint at which it is current too, none in another's history,
the version event above them. A node keeps a version event only where it changes the
version it reads, or writes one it took.
* What counts is read by the current version: of each party's writes at a place it may
write, signed by a key among its party's, and of its key sets and node lists written
under a version at least their `since`, the latest, then the lowest ID. A checkpoint
keeps what counts at its heads and the proposals and votes on the version current
there; a fork's root what counts at its heads by its version; the members are the
nodes each party's node list names.
Tests take a federation through writes, a key set, a proposal passing, one yes at a
time, two versions changing one, a checkpoint and a node starting from it, and a fork.
Events are read with their signature checked once, where they are judged.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
`Event::read` reads an event and says what makes one none (`docs/federation.md`,
Events): bytes that aren't the JCS of the JSON they read as, larger than 256 KiB, with
no dependency or more than 64, not ascending, or a field missing or more; and of a
signed event, a party that is no party's name, a key or signature that doesn't read back
to itself or doesn't hold, a path, key set, node list or vote spelled otherwise. A
proposal is taken whatever it holds, named by its hash; a version event names a hash.
`Checkpoint` reads and writes `{"at", "keeps", "version"}`, a root among them, which is
no event.
The tests' harness (`docs/federation-tests.md`, The harness) makes parties with keys
from seeds, signs each kind of event as the design says, and spells versions out.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`Version::read` reads a version by itself, and says what makes one none
(`docs/federation.md`, The policy): a field missing or more but for `checkpoint`,
another federation, a number and `changes` that don't go together, keys and node lists
not of the same parties, a party's name, its keys (one to 16, spelled as keys, none twice
in the version) and its node list (up to 64 node IDs, none twice), checkpoint heads, and
rules (a literal first segment and not `_continuum`, `{party}` once at most, `**` last
only, a writer that is a party of it, `"{party}"` where the path holds `{party}`, or
`false`; a path as a write's may be). `changes_validly` asks whether it changes another:
one past its number, its hash, and each `since` its own number or the other's with the
same keys, or node list. `writer` gives who writes at a path, by the first rule that
matches; `only_moves_on` whether it changes nothing but its number, what it changes and
its checkpoint.
|
| |
|
|
|
|
|
|
|
|
|
| |
A key is `ssh-ed25519`, one space, and its base64, padded and canonical, with no
comment, its 32 bytes an Ed25519 public key; a node ID is spelled as continuum spells
it, its key one too; and a signature is the SSHSIG blob of version 1 for the namespace
`continuum-federation`, hashed with `sha512`, its reserved field empty, its key the
event's, in base64, padded and canonical, unarmored, checked by continuum's strict
check (`access::sshsig::verify_blob`) and read back to what `ssh-keygen` writes around
it. `keys::sign` makes one, for clients and tests. Tests show each spelled otherwise
taken for none.
|
| |
|
|
|
|
|
|
|
|
| |
An event is the JCS encoding (RFC 8785) of a JSON object, within the limits federation 1
sets (`docs/federation.md`, Events). `jcs::read` gives the JSON bytes are only where
they are what JCS writes of it: names sorted by their UTF-16 units and none twice, no
whitespace, strings escaped as ECMAScript escapes them; and, beyond JCS, numbers only
integers from −2⁵³ to 2⁵³, strings only whole Unicode characters, and objects and
arrays nested up to 32 deep. Tests show what reads back and what is none, the order of
names by UTF-16 units that byte order gets wrong, and the depth.
|
|
|
`federation`, a feature of its own, builds what `docs/federation.md` and
`docs/store.md` design, stage by stage; without it continuum builds and behaves as it
does. The aliases build with it, and `docs/development.md` says so.
Its first part is the store's: an event's ID, the SHA-256 of its bytes written as 64
lower-case hex digits and read back only so, and the `Fold` trait as `docs/store.md`
gives it. The trait reads a checkpoint's parts too, the heads it was built at and the
events it keeps, which a node taking a pinned checkpoint needs; the design names it.
Nothing uses either yet, but a test.
|