aboutsummaryrefslogtreecommitdiffstats
path: root/src/federation
Commit message (Collapse)AuthorAgeFilesLines
* continuum-party: signing through an ssh-agentslopulus72 min.5-19/+250
| | | | | | | | | | | | | | A key held in hardware is never a file: only an ssh-agent signs with it. Given a public key as `--key` (a `.pub` file, `ssh-ed25519` or `ecdsa-sha2-nistp256`), the client asks the agent at `SSH_AUTH_SOCK` to sign what SSHSIG signs (a sign request with the key's blob, no flags) and writes the blob around the agent's signature as `ssh-keygen -Y sign` does. An ECDSA signature the agent gives with a high `s` is made low, the other of its two spellings, which the federation takes. What it makes is checked before it is used. A private key file signs as it did. A test starts `ssh-agent`, adds an ECDSA and an Ed25519 key to it and deletes their files, signs through it, and has both continuum and `ssh-keygen -Y verify` check each signature, one of an agent's high-S answers among them. Without OpenSSH it asks nothing.
* keys: a party's key may be ecdsa-sha2-nistp256, its signature low-S onlyslopulus72 min.4-33/+300
| | | | | | | | | | | | | | | | | | | | A party's keys may be held where no file has them, in a Secure Enclave or a phone, and those are ECDSA keys on NIST P-256. Everywhere a party's key counts (a version's keys, a key set, the key an event is signed with) such a key is taken beside an Ed25519 one, spelled as `ssh-keygen` writes it, without a comment: `ecdsa-sha2-nistp256`, a space, and the base64 of its SSH encoding, its point uncompressed and on the curve. Its signature is SSHSIG as an Ed25519 one is, hashed with `sha512`, its inner signature over SHA-256 as SSH signs with such a key. ECDSA signatures are malleable: of `s` and the curve's order less `s`, both check. So the federation takes one spelling alone: `s` low, at most half the order, `r` and `s` each SSH's shortest mpint, and the blob reading back to itself as an Ed25519 one does. What anyone makes of a party's signature is then none, as before. The vectors are a key `ssh-keygen -t ecdsa -b 256` made, a first version naming it, and a write and a key set `ssh-keygen -Y sign` signed with it, each taken; the signature's high-S twin, which checks as ECDSA, and its `r` spelled longer are none. Ed25519 keys and signatures are spelled and checked as they were.
* events: the store's summary names the node's party, and whether it votes for ittv5 hours1-0/+5
| | | | | | `GET /events` names the party the node is of (`party`, `--store-party`) and whether it votes for it by itself (`votesByItself`, `--store-vote-key`), and so casts a vote by hand (`POST /admin/events/vote`): what a page offering votes through the node asks.
* continuum-party: options from configuration files, as the node'stv5 hours1-44/+70
| | | | | | | | | `continuum-party` takes its options (`node`, `token`, `key`, `record`: `config::PARTY_OPTIONS`) on the command line and in configuration files of the node's format: `--config`, repeatable, arguments winning, `--unset`, includes and imports. The configuration's loader takes the options it reads as a table (`config::with_options`, `config::merged`, `file::load_with`), the node's or the client's, and a key naming none of them is an error in either; `node` and `token` are secrets, never logged.
* continuum-party proposals: where each proposal stands, and what it changestv5 hours2-0/+125
| | | | | | | | `continuum-party proposals` lists the proposals on the current version at the node, each with whether it passed or is dead and the parties voting `true` and `false`, as `GET /events/counts` names them, and what its version changes of the current one, read from an event proposing it, its signature checked: each field whose value differs, and of `keys` and `nodes` each party's (`client::changes`).
* events: counts names who voted what, and whether a proposal passed or is deadtv5 hours1-14/+71
| | | | | | | | `GET /events/counts` gives each proposal on the current version the parties voting `true` and `false` (`yes`, `no`), whether it passed and whether it is dead (`passed`, `dead`), as the node reads its votes (`State::tally`, which the fold judges by too), so that reading where a vote stands takes no fetch of every vote. A party's client still decides its votes by the votes it checks itself.
* continuum-party keys: a key set from authorized_keys lines, comments left outtv8 hours1-3/+11
| | | | | | The federation spells a key without a comment, so a key set holding a line's comment is none. `continuum-party keys` takes each key as an `authorized_keys` line, one argument each, and writes it as the federation spells it.
* client: a record begun from the store's root casts on its first versiontv8 hours2-9/+42
| | | | | | | | | | A record casts nothing on the version current when it began, as a `true` sent before may be held back somewhere. A federation's first version is current from its start, so a record begun at a node casts nothing on it, and with every party's begun so, no proposal on it can pass. `continuum-party init PARTY --root FILE` begins a record from the file the store's swarm starts from, for a party that never voted in it (`Record::before`): nothing was sent before it, and it casts on every version, the first too. A node voting by itself takes such a record as its `--store-vote-record`.
* held: the store's worker reads a document only while it is writabletv9 hours1-8/+8
| | | | | | | | | | | A rejoin makes the node's document writable again only as it ends, in the lock of the swap, once the node checked the epoch (`Holding::follows`) and follows it or gives it up. The store's worker reads nothing, and writes nothing, while the document isn't writable, checked in the lock it reads under. Whether a rejoin runs isn't enough: its state is taken up for its last checks, while the epoch's document is still the node's, and a store started from that document would keep the checkpoint it read there, and put again what it took into the document the node goes back to.
* held: nothing of a rejoin's document is read before the node follows ittv10 hours1-0/+6
| | | | | | | | | While a node rejoins, its document is that of the epoch it tries, which it follows only once it checks it (`Holding::follows`). The store's worker reads nothing of it, and writes nothing, while the node rejoins: else the store, starting there from the snapshot's checkpoint, would take one the node neither builds nor has pinned, and keep it should the node give up the rejoin.
* simtest: made-up epochs handed to a node holding a store (rows 15, 31)tv16 hours1-1/+1
| | | | | | | | | | d serves an epoch of the next generation it made up, of a lower ID than the others', its snapshot holding the root as the document stood before the checkpoint they moved to. A node joining with nothing that reaches only d takes it, the root being what its operator named, and reads only what it holds (15); one reaching only the others takes not their epoch, whose checkpoint it neither builds nor has pinned (15); the others try d's, find its root before their document's checkpoint, and stay on theirs (31).
* held: a checkpoint a node can't build, handed by peers, only pinned (row 22)tv16 hours1-1/+35
|
* simtest: the remake rows of a swarm holding a storetv16 hours1-1/+1
| | | | | | | | | | | | | Simulations of the store's attack rows on remakes (`docs/store.md`, Attacks): a snapshot other than its base's isn't followed (11); one coordinator's two decisions for an epoch, shown to different nodes, end on the lower epoch (13); a node away while the others switch rejoins and puts again what it wrote meanwhile (16); after a compaction whose snapshot holds a checkpoint, a node away all along follows only once its operator pins it (24); a compaction whose base comes before a checkpoint, switched after nodes moved to it, leaves them there, and a node starting with nothing reads the new document to it (28); a member deciding many compactions at once moves every node to the lowest epoch, losing no event (30).
* simtest: events written beyond a compaction's base go again (row 12)tv17 hours1-1/+1
| | | | | | A swarm holding a store compacts: events written beyond the base, on nodes that switch later, are put again in the new epoch, and every node holds every event, reads the same, and refused no change.
* remake: holding a store, a node follows an epoch only from a checkpoint it ↵tv17 hours1-0/+122
| | | | | | | | | | | | | builds A node of a swarm holding a store rejoining an epoch (`docs/store.md`, Remakes) follows it only where its snapshot has the swarm's policy and store, and holds the node's document's checkpoint, one it builds from that document, or one its operator pinned; with an empty document, the root of its store too (`Holding::follows`). A made-up epoch holding another, the root after the store moved on, say, would leave it holding events whose history nobody puts again: it stays on its own, as when a rejoin's check fails, and tries again later.
* remake: holding a store, a node puts again what the document it left holdstv17 hours1-36/+120
| | | | | | | | | | After a switch or a rejoin, a node of a swarm holding a store puts again what the document it left holds that a store starting at the new document's checkpoint takes, by its own refusals and drops, and the new one lacks (`docs/store.md`, Remakes, `Holding::left`): what it held beyond the base, and, where it moved to a later checkpoint since, what a store starting at the snapshot's takes to reach it. Its events aren't replayed into the new document, so none nobody takes go along.
* vectors: the snapshot after a checkpoint, as a run printed ittv17 hours1-1/+4
|
* vectors: a snapshot after a checkpointtv18 hours1-0/+75
| | | | | | | The snapshot of a compaction after the store moved to a checkpoint, built from a document every run builds alike: its change's hash and bytes, which a run of this code prints, as no script apart encodes Automerge. Left empty until a run prints them.
* remake: a holding swarm's snapshot holds the store read at its basetv18 hours1-0/+149
| | | | | | | | | | | A compaction's snapshot in a swarm holding a store holds the store as the node reads it from the document at the base, by its own refusals and its operator's drops (`docs/store.md`, Remakes): the checkpoint it reaches there, where it isn't the root, at `_continuum/checkpoint`; the root, the events that checkpoint keeps and those after it, each at its ID; and of the entries, the members'. What the checkpoint forgot, events nobody takes, and the entries of nodes that aren't members stay behind (`Holding::at_base`, `events::snapshot`, `Host::holding`).
* held: a store starts from the checkpoint its document holdstv18 hours1-19/+80
| | | | | | | | A remake's snapshot holds the store's checkpoint at `_continuum/checkpoint` where it isn't the root (`docs/store.md`, What the document holds), and none of what came before it. A node reading its store anew from such a document starts there, with what the checkpoint keeps; one pinning a checkpoint finds it there too, where it can't build it from the events.
* holding: a node writes its acks and the compactions it coordinatestv18 hours1-1/+1
| | | | | | | | | | | A change of a swarm holding a store may write its node's own protocol data a remake needs (`docs/store.md`, What a change writes): its acks, a remake's record and proposal, where there is none, of a compaction it coordinates, and, as the coordinator, its decision, or the record of the remake that made the epoch, carried into it whole; and the maps holding them, where there are none. An abort asked for by another than the coordinator stays closed, as does any other kind of remake. Rows 14 and 21 are judged here.
* federation: the test of a node voting above a checkpoint's heads holds for a ↵tv18 hours1-0/+2
| | | | | | | | | while With no time to hold an event for a while, lass's write, taken just before the proposal, counted as held for a while before it was proposed, and the node backed no heads leaving it out. The test's node now holds an event for an hour before it holds it for a while.
* federation: votes build on the events proposing what they vote ontv19 hours2-5/+82
| | | | | | | | | | A node voting by itself, and a party's client, signed a vote on the heads the node held: where those held what is beside a checkpoint's heads (a party's writes made while the swarm was parted, say), the vote wasn't above them, and a version event written on it was refused, so the checkpoint never moved, though it passed. Both now vote on the events proposing what they vote on, and a node proposes a checkpoint on the heads it names: so their votes are above those heads wherever the proposal is.
* federation: the changes founding a swarm, fixedtv20 hours1-29/+55
| | | | | | | | The changes founding the swarm of the vectors' first version's root, and those founding the fork whose root is the fork vector's, keeping tv's write, each by its hash and its bytes, as a run of this code printed them: Automerge encodes them, so no script apart computes them. Checked apart so far: each hash the SHA-256 of its change's chunk, each writer the first 16 bytes of its root's ID, the fork's second change built on its first.
* simtest: a fork whose root doesn't read as its heads do, found by who holds themtv21 hours1-3/+2
| | | | | | | | | `federation_attack_33`: beside the fork a node holding the history makes, one whose root leaves out tv's write, which counts at its heads. b, holding the history, builds the one and not the other (`fork::check`). Each fork's founder starts its swarm from its root and the events it keeps, and a node of lass joins each by its ID, taking it on its operator's word, and reads what the root keeps: tv's write in the one, carried by the changes founding its swarm, nothing in the other.
* federation: the changes founding a swarm printed, to be fixed as vectorstv21 hours1-0/+41
| | | | | | | An ignored test prints, each by its hash and its bytes, the changes founding the swarm of the vectors' first version's root, and those founding the fork whose root is the fork vector's, keeping tv's write: Automerge encodes them, so no script apart computes them, and they are fixed once printed by a run of this code.
* federation: a fork's root and its ID, fixedtv21 hours1-0/+21
| | | | | | A vector computed apart, as the others: the root of a fork of the vectors' first version at tv's write, keeping it, by the version after the first; its bytes, read back, and its ID.
* federation: a fork keeps what counts at its heads, and takes nothing of the ↵tv21 hours1-0/+62
| | | | | | | | | | other A property over generated federations, honest ones: a fork at the heads of a history's first half, by the version current there, numbered one past it and changing it. Its root keeps what counts at those heads, the values at places and the members, with its version current; it takes nothing else of the history; and the store it came from takes nothing built on the fork's root (`docs/federation-tests.md`, Properties, Forks).
* continuum-party: a federation's root, a fork's made through a node, and checkedtv21 hours1-6/+110
| | | | | | | | `root FILE`: the root of the federation whose first version the file holds, as the file its founders start its swarm from (`--store-root`). `fork FILE HEAD...`: the root of the fork at those heads by the version the file holds, with the events it keeps, as a node holding the federation builds it (`POST /admin/events/fork`). `check FILE`: what a node finds of the fork whose root the file holds (`POST /events/fork`).
* federation: a fork's root made, and checked by a node holding its historytv21 hours3-4/+210
| | | | | | | | | | `federation::fork`: a node holding a federation's history makes the root of a fork at heads it holds by a version, with the events the root keeps, as the file the fork's founders start its swarm from (`make`, `root_file`, which `--store-root` reads); and checks a fork's root it is given (`check`): whether it builds that root at its heads, byte for byte, what it holds that those heads lack, and, party by party, the keys the fork's version gives where they aren't those the party had there. The attack rows 35 and 36 have their tests.
* federation: a fork's store read from its document, with the events its root ↵tv21 hours1-1/+49
| | | | | | | | | keeps A node reads its store from a fork's root and the events the root keeps, which follow it in the document, once they are all there; until then it holds no store. Its store takes what builds on the fork's root, and nothing the store it came from took after the heads it forked at.
* document: the changes founding a fork's swarm, built from its root and what ↵tv21 hours2-12/+12
| | | | | | | | | | | it keeps A fork's root keeps events (`docs/store.md`, On Automerge): they follow its genesis change in changes of the same writer, built the same way, filled in the order of their IDs, events going into a change until their bytes there reach 1 MiB, the next event beginning the next change (`events::founding`). A swarm holding a store starts from all of them (`events::started`, given the events the root keeps; none for a federation's root).
* simtest: two checkpoints proposed at once, the one not backed dying by the naystv21 hours1-2/+2
| | | | | | | | `federation_attack_59`: a for tv and b for lass, apart, each propose a checkpoint once their stores took six events, and back it; c votes for makefu, following tv; each votes `false` on a checkpoint beside the one it backs (`--store-nay-beside`). a and b, together, vote `false` on each other's: the votes split. With c, tv's passes and every node moves there; lass's is dead by the nays of tv and makefu, which their records hold.
* federation: a rule voting `false` on a checkpoint proposed beside one a node ↵tv21 hours2-0/+150
| | | | | | | | | | backs `--store-nay-beside`, for a node voting by itself: where its party backs a proposal on the current version that can still pass, by its record or by what it votes now, it votes `false` on every other proposal there that only moves to a checkpoint and can still pass, once. So, of two checkpoints proposed at once, the one it doesn't back dies, and its backers are free (`docs/federation.md`, Votes a node casts by itself).
* federation: each attack table checked whole, its rows marked sim tootv21 hours3-94/+101
| | | | | | | | | One check of an attack table (`harness::every_row_has_its_test`), for the federation's and the store's: every row has its test among the sources of its kind, unit tests or the simulations (`simtest::holding`), but for the rows whose tests wait for later; a row marked `—` has none; no test names a row that isn't there, nor two tests one row. The rows waiting: forks, the remakes, flooding, what a node, a client or a tool does that isn't built yet, and a rule for two checkpoints proposed at once.
* federation: a node writes a version as soon as it holds it passedtv21 hours2-5/+119
| | | | | | | | | Once a proposal passed on the current version, as the node's store reads, the node writes it by a version event (`State::version_event`): on the `true` votes of the first parties by name that pass it, each party's of the lowest ID, so that nodes holding those votes write the same bytes, one event. It offers the event to its store first and puts it only where it is taken: of two passing at once, it writes the one it takes, and refuses the other as its own (`Holding::passed`, run by the store's worker).
* federation: the tests' harness builds a federation's roottv22 hours4-45/+26
| | | | | `Spec::root`: the root whose first version a spec spells out, built in one place for the tests of the attacks, of the store read from a document, and the properties.
* federation: a store read from its document holds what one given the events ↵tv22 hours1-28/+83
| | | | | | | | | | alone holds A property over generated federations, honest ones with checkpoints: their events are put into a document by two writers, in batches of a shuffled order, some by both at once, the writers merging now and then; a node reads its store from each writer's document as it grows, and once more after both merged. Each holds what a store given the events alone holds: its checkpoint, the events it took after it, and what it reads.
* store: a test per attack row marked unittv22 hours2-21/+253
| | | | | | | | | Each row of `docs/store.md`, Attacks, marked unit has its test, `store_attack_<row>`: where it is judged (`access::holding`, `access::token`), where the store held in memory meets it (`federation::store::memory`), and where a node reads its store from its document (`federation::held`). Tests that checked a row already take its name; a check reads the doc's rows and fails on a unit row without its test, but for rows 21 and 22, which the remakes bring.
* continuum-party: a vote through the node that votes for the partytv23 hours1-2/+31
| | | | | | | A party that has a node vote by itself votes by hand only through that node: `continuum-party vote PROPOSAL yes|no --through` asks the node to cast it (`POST /admin/events/vote`), by the record the node keeps, without a key or record of the client's own.
* node: votes it casts by itself, for its partytv23 hours1-6/+208
| | | | | | | | | | | | | | | | | | | | | | A node may vote and propose for its party by itself, by its operator's rules (`docs/federation.md`, Votes a node casts by itself; `federation::vote`): * `--store-vote-key`: the party's key it signs with, an OpenSSH private key file, one the party's version names, kept on the node; * `--store-vote-record`: its party's one record of its votes, which it votes by, written before each vote is sent, begun where there is none on the version current then; * `--store-follow`, `--store-follow-any`: the parties it follows, by default only on a version that only moves to a checkpoint; * `--store-propose-events`, `--store-propose-every`: when it proposes a checkpoint, once it holds so many events beyond its checkpoint, or so long after its store moved there; * `--store-held-for` (10 minutes): how long it holds an event before it holds it for a while, for the heads it proposes and the voters' rule. Its store keeps when, by the node's own clock, it took each event, and when it moved to its checkpoint. Whenever the worker reads the store, the node decides what to sign (`Holding::act`), records it, writes the record, offers it to its store, and puts it into the document (`held::write`). A vote by hand through the node, by the record and the voters' rule, is `Holding::vote_by_hand`.
* federation: what a node voting by itself decidestv23 hours2-0/+514
| | | | | | | | | | | | | | | | | | | | | | | | | A party may have one of its nodes vote and propose for it, by rules its operator sets (`docs/federation.md`, Votes a node casts by itself): `federation::vote::decide`, from the node's store, how long it held each event, and its party's record. * Following: `true` on a proposal on the current version where a party it follows voted `true`, `false` where one voted `false`; by default only on a version that only moves to a checkpoint, a `true` as a `false`. * Proposing a checkpoint: once so many events are held beyond its checkpoint, or so long after the store moved there, a version that only moves to a checkpoint at the heads of what it held for a while, at which the current version is current; only where nothing that can still pass is proposed on the current version, but a proposal it wouldn't back that nobody backs but its proposer. It backs what it proposes. It keeps to what a party's client keeps to (`Record::may_vote`), one `true` at a time; and by the voters' rule (`vote::backs_checkpoint`) backs a version naming a checkpoint only where it changes nothing of the current one but its number, what it changes and its checkpoint, and its heads leave out nothing it held for a while before it was proposed. A party that has a node vote by itself votes by hand only through that node, which keeps its one record: `vote::by_hand` decides such a vote by the record and, with a `true`, by the voters' rule.
* store: what heads leave outtv23 hours1-0/+41
| | | | | | | A voter backs a checkpoint only where everything it held for a while before it was proposed is among its heads, in their history, or above them (`docs/federation.md`, Checkpoints): `Store::left_out` names, of events a store took, those a checkpoint at given heads leaves out.
* docs: what of the federation is builttv23 hours1-3/+4
| | | | | | | The federation's design says what of it is built: the store in a swarm's document, members by the federation and the store at a node's API, as the store's design says; and a party's client, which signs its party's events, votes by its record, signs again what a move refused, and names a party that voted twice.
* continuum-party: a party's client of a federationtv23 hours2-0/+460
| | | | | | | | | | | | | | | | | | | | | | A second binary, behind the `federation` feature: a party's client, which signs its party's events with one of its keys (`--key`, an OpenSSH private key file), puts them through a node's API (`--node`, its user and password in the URL, or `--token`), and keeps its party's record (`--record`), by which it votes, written before a vote is sent (`federation::party`, run by `continuum::party`): * `init PARTY` begins a record of `PARTY` on the version current now; * `write PATH VALUE`, `keys KEY...`, `nodes NODE...` and `propose FILE` sign events on the node's heads, recorded, and put; * `vote PROPOSAL yes|no` votes on the proposal of that hash on the current version, by the record: with a `true`, the votes on its party's earlier proposal, from the node, checked, kept as the nays that freed it; * `again` signs again, of the latest event it signed at each place, its key set and its node list, what the node refuses as not above its checkpoint's heads, or as built on one it refuses; * `twice RECORD...` names, from the records of parties' clients, a party that voted twice. The feature brings reqwest along, the client's HTTP.
* federation: what a party's client decides bytv23 hours2-0/+639
| | | | | | | | | | | | | | | | | | | | A party's client signs its party's events with one of its keys, read from an OpenSSH private key file, unencrypted (`client::signing_key`), and keeps its party's record (`client::Record`): the votes it cast, each as signed, with the versions they are on; with each `true`, the votes that made its party's earlier proposal on that version dead, as signed; and the events it signed besides. The record begins on the version current then, and casts nothing on it; it is written whole or not at all. It votes by its record, never by what a node shows (`docs/federation.md`, Changing the policy): never `true` and `false` on one proposal, nor the same twice; a `true` only for a version changing the current one, and one at a time, its earlier `true` on a proposal the votes given make dead, each checked from itself and its version, which it keeps. It signs again, of the latest event it signed at each place, its key set and its node list, what a move refused (`Record::again`). And over the records parties' clients keep, it names a party that voted twice (`client::voted_twice`): its `true` and `false` on one proposal, or its `true` on two of one version, neither dead by all the votes. JSON is taken as the federation takes it (`client::json`).
* api: what counts names the proposals on the current version, and their votestv23 hours1-0/+49
| | | | | | | A party's client votes by the record it keeps, and keeps the votes that made its party's earlier proposal dead; it reads them from a node, and checks them itself, as each is signed. `GET /events/counts` names the proposals on the current version, by their hash, each with the events proposing it and the votes on it, by ID (`State::ballots`).
* federation: events made, as a party's client makes themtv23 hours2-48/+87
| | | | | | | What makes a signed event (`event::signed`) and what each does (`write`, `keys`, `nodes`, `proposal`, `vote`), and a version event (`event::version_event`), move from the tests' harness into `federation::event`, for a party's client to make them as the tests do: the harness makes its events through them.
* federation: events offered to a node's store, and its operator's dropstv23 hours2-2/+84
| | | | | | | | | | A node's store takes events from elsewhere than its document too: one put at its API is offered to it first (`Holding::offer`), to say what became of it. Its operator has it drop events it took after its checkpoint, with everything built on them (`Holding::drop_taken`), and takes them back (`Holding::allow`), the document's events then offered again (`docs/store.md`, A node's own). After each, what the node keeps of its own is written to its file where it changed, and the members are as the store reads now.
* topology: neighbours among the members of a node's own party, and of parties ↵tv24 hours1-0/+23
| | | | | | | | | | named A node of a swarm holding a store keeps some of its neighbours among the members of its own party and of the parties its operator names (`--store-neighbour-parties`), so that a party listing many nodes can't be all of them (`docs/store.md`, Members): its neighbours by the shared graph among those members alone, each as its entry names it, which every node of its party computes alike, with those among all members.