aboutsummaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* federation: votes build on the events proposing what they vote ontv21 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.
* simtest: show a store's refusals and ballots in a failed simulation's dumptv21 hours1-10/+66
| | | | | | For a node holding a store, the dump shows each event it refused and why, the proposals on the current version with the parties proposing them and their votes, whether each passes there, and the version events it took.
* sync: keep what a message asks for, and the heads answered from, sortedtv21 hours1-5/+13
| | | | | | | Automerge encodes the hashes of a sync message sorted, and asserts so: the hashes asked for that changes waiting in screening lack were added after those Automerge asks for, unsorted, and the heads a peer last said that we hold were taken as the peer's `have` as they came. Both are sorted now.
* sync: send a peer all it lacks past what still counts as senttv21 hours1-0/+92
| | | | | | | | | | | Messages taken as delivered and lost, more of them than still count as sent, leave a peer lacking changes we take it to have. Asking for the first of them, it got that one alone, and asked for the next once that arrived, a change per round trip; or, asking for our heads alone, the last of them again and again. When a peer needs a change in the history of the heads we share that no longer counts as sent, the session answers as if it had said it has nothing since the latest heads it said that we hold (`lost_beyond_sent`): everything since goes in one message.
* sync: ask for what changes waiting in screening lacktv21 hours3-1/+60
| | | | | | | | | | Screening keeps a change whose dependencies haven't come from Automerge, waiting, so Automerge never learns what it lacks: our next message asks for the peer's heads alone, and the peer, forgetting having sent those, sends them again, and what they build on only as far as it still counts it as sent. So the session asks for what changes waiting build on and the document lacks too (`Waiting::lacking`, `SyncSession::lacks`), as Automerge asks for what the changes it holds back lack.
* simtest: show what screening holds back in a failed simulation's dumptv21 hours2-1/+59
| | | | | | | | A failed simulation prints, for each node, the writer it writes as, the changes its screening keeps waiting (the latest few: whose writer and seq, how many of their dependencies it holds, whether a signature vouches for them) and the latest changes it refused, and, holding a store, the store's checkpoint, current version and what it took and refused.
* federation: the changes founding a swarm, fixedtv22 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: nodes started from a store's root synced before a test takes them aparttv22 hours1-1/+3
| | | | | | | The simulations of swarms holding a store start their nodes from the root and wait, besides each holding the store, until they synced: each took the others' handshakes and holds their entries. So a test taking nodes apart right after starts from nodes that know each other, as it means to.
* bootstrap: a node ready at once tries its seeds until they resolvetv22 hours1-2/+27
| | | | | | | | | A node starting from a document, or as a swarm's genesis node, is ready at once, and says HELLO to its seeds, members of its swarm that may be running. A seed that didn't resolve then (the node, or the seed, not reachable yet) was tried no more, and a node whose document names no member to reach, as one started from a store's root, stayed alone. Now such seeds are tried again in the background, backing off as a joining node does, until they resolve or the node stops.
* peer: a member's message before its handshake was taken asks for onetv22 hours2-6/+76
| | | | | | | | | | In a swarm holding a store, a node reads a peer's messages only by the party its handshake named. One whose handshake it hasn't taken (its reply lost, say) was cut off at its next message, as a non-member is, while the peer, which took ours, synced on, and neither said HELLO again. Now such a message goes unread, and the node says HELLO to the peer, as to any whose reply it waits for (`hello_again_now`): its reply names its party. What a peer refused as a non-member sends next is known to be a non-member's, its party kept, so that it asks for no HELLO. A simulation loses a's replies to b for a while.
* simtest: a fork whose root doesn't read as its heads do, found by who holds themtv23 hours2-4/+103
| | | | | | | | | `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 vectorstv23 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, fixedtv23 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 ↵tv23 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 checkedtv23 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`).
* api: a fork's root made, and what a node finds of onetv23 hours1-12/+78
| | | | | | | | | `POST /admin/events/fork`: the root of the fork at the heads named by the version given, as the node's store builds it, with the events it keeps, as the file the fork's founders start its swarm from (`--store-root`). `POST /events/fork`: what the node finds of the fork whose root the body holds: whether it builds that root at its heads, and why not; what it holds that those heads lack; and the parties whose keys the fork's version gives otherwise than they had there (`federation::fork`).
* federation: a fork's root made, and checked by a node holding its historytv23 hours4-18/+213
| | | | | | | | | | `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.
* node: `--store-root` holding a fork's root and the events it keepstv23 hours2-12/+57
| | | | | | | The file `--store-root` names holds the store's root on its first line, and, for a fork, the events the root keeps, each on a line of its own (JCS writes no line break). The node checks that the federation takes them as a store's root with what it keeps, and starts from the changes founding the swarm, built from them.
* federation: a fork's store read from its document, with the events its root ↵tv23 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.
* access: the changes founding a fork's swarm taken, unsigned, as built byte ↵tv23 hours3-6/+195
| | | | | | | | | | | for byte A change of a swarm holding a store naming no node is taken where it is one of those founding the swarm (`events::is_founding`): built from the root its document holds and the events the root keeps, those at its history and those it puts, by the fold (`access::holding`). A change of the genesis change's writer waits for no signature, as every node builds it and nobody signs it (`screen::built_by_every_node`); judged, it is refused unless it is one of them.
* document: the changes founding a fork's swarm, built from its root and what ↵tv23 hours7-26/+105
| | | | | | | | | | | 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 naystv23 hours2-3/+136
| | | | | | | | `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 ↵tv23 hours4-0/+163
| | | | | | | | | | 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 tootv23 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.
* simtest: a writer forked, its events reaching both sidestv23 hours1-0/+59
| | | | | | | `store_attack_10`: x1 and x2, tv's, start apart from one document under one writer, and each puts an event: changes of one writer at one number. Together, the documents part, each refusing the other's changes for good; the events reach every node, put again from the changes refused, and every node reads the same.
* simtest: a group naming many nodes is not every node's neighbourstv23 hours1-1/+51
| | | | | | | `store_attack_19`: makefu lists five nodes, tv two, and lass one, whose operator names tv's too (`--store-neighbour-parties`); each node keeps two neighbours by the graph among all members. a and b keep each other, and c one of them, whatever makefu's nodes are. The simulations' nodes started from the root may have their configuration adjusted.
* simtest: a proposal kept alive by its proposer alone holds back no checkpointtv23 hours1-1/+79
| | | | | | | | `federation_attack_67`: makefu proposes a version and backs it alone. a votes for tv by itself, proposing a checkpoint once its store took five events; b votes for lass, following tv; each with its party's record, begun before the federation. a proposes a checkpoint beside makefu's proposal, b backs it, a node writes it as it passed, and every node moves there.
* simtest: keys voting twice part honest nodes; their operators bring them backtv23 hours1-0/+110
| | | | | | | | `federation_attack_49`: tv backs a proposal of its own with lass, and one of lass's with makefu; b, apart, takes the other version than a and c. Together, they stay parted, each keeping the version it took. b's operator has it drop what it took and take the other side's (`Holding::drop_taken`, `allow`); or, where the versions named checkpoints, starts it again from the checkpoint the others moved to, pinned. No fork.
* simtest: a node away while the others moved to a checkpointtv23 hours1-0/+88
| | | | | | | | `store_attack_24`: c is away while a and b take a version passing on tv's and lass's votes that only moves to a checkpoint, move there, forget what came before, and take a write after it. Back, c builds the checkpoint from the document, which holds what came before, and reads what a and b read. What happens after a remake leaving it out comes with the remakes.
* simtest: different events to different peers, read alike once togethertv23 hours1-37/+205
| | | | | | | | | `federation_attack_28`: tv, lass and makefu, a node each, apart while each is given its own: two writes of tv's at one place, a write of lass's, and a proposal and the votes that pass it, each on another node. Apart, each reads its own; together, they read the same, the version that passed current, written by whichever node held it passed. The simulations of swarms holding a store share their federation, their nodes started from its root, and what they read of a node's store.
* federation: a node writes a version as soon as it holds it passedtv23 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).
* access: a generated change's closed path, picked by itselftv24 hours1-1/+2
| | | | | | Picked where the path goes, rustc 1.95 takes the pick's type from that place, a slice of strings, and refuses the paths offered: picked by itself, as `rng.pick(&KEYS)` is, it is one of the paths, which goes where a slice of strings does.
* access: what a generated change picks from, given its typetv24 hours1-7/+6
| | | | | | The closed paths a generated write picks one of are an array of their own, and the events a node put a slice: picked from an array written in place, a path's type is left to be inferred from where it goes, which some compilers don't.
* simtest: a swarm holding a store, its members and a node its party doesn't listtv24 hours2-0/+109
| | | | | | | tv lists a and b, which start from the store's root; lass lists c, which joins by the store's ID; d is of lass too, which doesn't list it. Events put on a and on c reach a, b and c, which read them; d, which no member syncs with, gets nothing. A simulated node started on a document expects its swarm, as `run` has it do.
* federation: the tests' harness builds a federation's roottv24 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.
* access: what a node of a swarm holding a store takes leaves its events soundtv24 hours1-0/+143
| | | | | | | | | Three nodes write at random: events at their IDs, larger than the fold allows or not, again, or at other keys; strings and maps under the events; deletions; their entries or others'; and what is closed. Each now and then catches up with a node that takes their changes as it receives them (`screen::apply_bytes`). What it takes leaves at every key under `_continuum/events` the bytes whose ID it is, the root's among them; its document saves and loads; and another node, given all it took, takes it all.
* federation: a store read from its document holds what one given the events ↵tv24 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 unittv24 hours5-46/+355
| | | | | | | | | 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 partytv25 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.
* api: a vote by hand, through the node that votes for its partytv25 hours1-22/+33
| | | | | | | | | | A party that has a node vote by itself votes by hand only through that node, which keeps its one record (`docs/federation.md`, Votes a node casts by itself): `POST /admin/events/vote`, `{"proposal": <hash>, "yes": <bool>}`, by the record and, with a `true`, by the voters' rule; signed with the party's key the node keeps, recorded, and put. Refused (`422`) where the record or the rule forbids it, or the node votes for no party. Putting an event through the API puts it into the document as the node's own votes are put (`held::write`).
* node: votes it casts by itself, for its partytv25 hours3-7/+380
| | | | | | | | | | | | | | | | | | | | | | 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 decidestv25 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 outtv25 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 builttv25 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 federationtv25 hours4-1/+475
| | | | | | | | | | | | | | | | | | | | | | 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 bytv25 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 the store refused, by kindtv25 hours1-2/+22
| | | | | | `GET /events/refused` says of each refusal its kind (`none`, `judged`, `builtOn`, with the event it builds on, or `notAbove`), apart from why: a party's client signs again what a move refused, which it tells so.
* api: what counts names the proposals on the current version, and their votestv25 hours2-1/+62
| | | | | | | 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 themtv25 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.
* continuum is a librarytv25 hours2-504/+510
| | | | | | | | Everything the node is moves from the binary into a library (`src/lib.rs`), so that other binaries can use it: a party's client of a federation next. The node's binary (`src/main.rs`) runs it (`continuum::run`), which wires things together as `main` did. The library's doc comments are prose, not examples to test (`doctest = false`); its tests are the library's, as `cargo quick` and `cargo sim` run them.