aboutsummaryrefslogtreecommitdiffstats
path: root/src/swarm/bootstrap.rs
Commit message (Collapse)AuthorAgeFilesLines
* A node of both kinds, for a swarm to move to sets by (--store-both)tv16 hours1-10/+25
| | | | | | | | | | | | | | | | | | | With store-document, store-both has the node hold its store in the Automerge document too, and sync with nodes of either kind: * it says to each peer the kind that peer holds, and passes its set on to those that hold sets (swarm::set::holds_a_set), the Automerge document to the others; * what its set takes of the document goes on to the peers on sets (Holding::unpassed), and what its set takes of them is put into the document, as events it lacks are (Holding::lacking); * its entry in the document is put as its entry in the set (swarm::set::mirror_entry), and it reads the members of both; * without the set's file yet, its set is made of the store as it reads it of its document, with what store-file kept of its own. A simulation: two nodes on the Automerge document, one on a set, one of both between them; an event put on either side reaches all four.
* swarm: a seed whose HELLO failed is said HELLO again soon, a few timestv18 hours1-5/+19
| | | | | | | | What a node speaks is mostly known a moment after it proved where it is, and its HELLO goes as it proves: one in the oldest version, which can't say a kind other than Automerge's, didn't go. Such a seed is tried again after a quarter of a second, four times, before the wait that grows; it was five seconds each time a node on a set started.
* A node joins a swarm of sets with nothing but the store's IDtv18 hours1-26/+55
| | | | | | | | | | | | | Given store-id and store-document, no file yet and no root, or a checkpoint pinned (store-checkpoint), a node starts with nothing of its store (held::Begun::Start, passing::Start): it asks the members whose handshake it took for the checkpoint named by the store's ID, its root, or by the pin, then for the events that one keeps, each taken only as what its name says; begins its set from them; and is ready, catching up as any node behind. A set gives the checkpoint its store holds by its name (passing::Unit::Checkpoint). A simulation: a node given the ID alone joins two that hold a write.
* A node of a swarm holding a store, on a set of events (--store-document)tv19 hours1-0/+91
| | | | | | | | | | | | | | | | | With store-root or store-id, store-document names the file of the store's own document, a set of events: the node holds its store there and nothing in the Automerge document, syncs with nodes holding a set and no others, and goes on from the file when started again. Without a file yet it begins from the root (StoreStart::set); joining by the ID alone needs a file. What a checkpoint forgot is kept for store-keeps-forgotten (30 days). The file stands for store-file, and no checkpoint is pinned. The set is written to its file where it changed, every five seconds with the store's worker and as the node stops (Holding::save), what a checkpoint forgot longer ago let go of first. Simulations: a node behind catches up; a node goes on from its file.
* swarm: a node whose store a set of events carriestv19 hours1-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | Such a node (Holding::carrying) holds an Automerge document with nothing in it, which nothing passes on, and its set is its document: * swarm::set passes the set on. Where it stands goes in the node's STATUSes as another kind's stamp, and a peer's is given to the set; what the set says besides goes as a SYNC's body; what the set took, of a peer or of the node itself, goes on to the node's other neighbours. What compares stamps for an Automerge document's sake is handed the node's own, and finds nothing to do; the Automerge sync isn't begun. * The node writes its own entry (AppState::mutate_set): what writes protocol data through a view writes to the members' entries as a tree, and what the node's own reads as after is put as its next entry, signed and passed on. Anything else is refused, and so is a write to an Automerge document as such. * An event the node writes (held::write) is offered to the set and passed on; a set lacks nothing of its store to put again. * The node's swarm is its store's, said at its start. A simulation: three such nodes of two parties register, and each holds the others' entries; events put on two of them reach all three, and they come to stand alike, the documents they hold beside empty.
* swarm: a seed whose first HELLO failed is said HELLO againtv19 hours1-0/+12
| | | | | | Its failing was logged as retried, and nothing retried it: a node that is no neighbour yet gets no HELLO again from the peer worker. The seed now stays with those still to reach, tried again as they are.
* swarm: the member registry is read of any view, not of an Automerge documenttv2 days1-1/+1
|
* document: values read and written through a view any kind of document givestv2 days1-8/+8
| | | | | | | | | | | | | document::view: Read (the value at a path, plain, typed, a map's keys) and Write (a value written, one deleted), which Automerge's documents, writes in progress and documents as they were all are. The member registry, the users, access control's reads and rules, the topology, forgetting and bootstrap read and write through them, and name neither Automerge's ReadDoc and Transactable nor document::store, which is what an Automerge document can do beyond. How a swarm holding a store judges what a change writes is handed to the rules (rules::judge_seen), being its kind of document's to say.
* roots: a seed joining itself names the root once it has ittv9 days1-0/+11
| | | | | | | | | | | | A joiner takes no root before each of its seeds named one, and a seed names its root only in a handshake. A seed that shook hands while joining itself named none, and never again: its joiner waited for ever. scripts/wire-check hit that (b joining a, c through b, d through c): b's reply to c came 2 ms before b had its document. Now a node notes the peers its handshakes named no root to, and once ready, shakes hands with them again, naming it. Older joiners take it too: it's a handshake as before.
* bootstrap: a node ready at once tries its seeds until they resolvetv2026-11-171-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.
* federation: a fork's root made, and checked by a node holding its historytv2026-11-171-14/+3
| | | | | | | | | | `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 keepstv2026-11-171-11/+56
| | | | | | | 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.
* document: the changes founding a fork's swarm, built from its root and what ↵tv2026-11-171-1/+1
| | | | | | | | | | | 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).
* node: a swarm holding a store, started from its root or joined by its IDtv2026-11-161-0/+124
| | | | | | | | | | | | | | | | | | | | Behind the `federation` feature, two options: * `--store-root PATH` starts a swarm holding a store, or goes on with one, from the store's root, as bytes in the file, which the federation must take as a root. With no document to start on, the node builds the genesis change from it, as every node given the root does, and is ready at once; a document to start on must be of the root's swarm. * `--store-id ID` joins one through seeds by its ID, the root's SHA-256 in hex. An empty document of the first epoch takes as its root only that store's genesis change, built again from the root it holds (`document::events::is_genesis`), whatever peers name: the root pin doesn't wait for seeds, nor is disputed. Either names the swarm the node joins, which a state file must remember too, and can't be combined with the other, nor with what makes a new swarm's first change (`--genesis`, `--bootstrap-users`, `--bootstrap-keys`, `--bootstrap-policy`, `--remake`, `--genesis-root`). The root is read as a file of its own kind (`store`), counted among the node's files.
* swarm: a new swarm's policy recorded in its genesis changetv2026-11-151-1/+6
| | | | | | | | | | | | | | | | A swarm strict from its start had its policy written by its first user in a later change. A change is judged by the policy at its history, so any member could always add a change whose history is from before the policy: judged by none, needing no signature, taken whenever it comes. Since signed values are read by `seq`, an envelope planted there with the highest `seq` there is can never be followed: a ban, a user, a declaration, for good. `--bootstrap-policy JSON`, with `--genesis`, records the policy in the genesis change, with the first users: then no change of the swarm is from before it. It must be a policy this node knows, and a strict one needs `--bootstrap-keys`, or nobody could sign what decides who may do what.
* document file: a clean stop marked, and `--keep-actor` writes on as the same ↵tv2026-11-091-2/+8
| | | | | | | | | | | | | | | | | | | | | | actor A node writes as a fresh Automerge actor at each start, so no change number of an actor comes twice: one sent before a crash but not yet appended to the document file would otherwise be made again, differently. An epoch thus gathers a writer per start, and every transfer of its history carries a signature per writer. The document file now says when it holds everything the node wrote: * at a clean stop, after the last append, an empty `Closed` record, only where the file is up to the document's heads (ready, not rejoining); * as a node starts on the file, before anything is written, an empty `Opened` record, so a crash from then on leaves a file without the mark; * the header names the actor the node writes with (`current`). With `--keep-actor` (off by default; needs `--document-file`), a node starting on a file that ends with `Closed` writes on as that actor. A crash, a drop, a switch or a rejoin still starts a fresh one, so an epoch's writers come to one per node plus one per such event. lifecycle.md says so.
* roots: only the seeds' roots end the wait for themtv2026-11-091-0/+1
| | | | | | | | | | | | | | Review 4, R2 partly (F8): a joining node waited for "each of its seeds" to name the swarm's root as a count, of every admitted peer that named one. Node identities are self-made and admission is the swarm key: a member answering a joiner under as many identities as it has seeds, naming its own root within the wait, made the joiner pin it before the real seeds answered, and refuse them after as another history. Now the seeds are the nodes proven at the seeds' addresses (`roots::seed_found`, as `bootstrap::resolve_seeds` finds them), and only their roots count toward the wait and start its clock. Another peer naming a root still disputes it (no root while they differ), so such a member can keep a joiner from joining, as any member can, but not hand it another root. access.md says so.
* roots: a joiner takes a root once its seeds named ittv2026-11-081-1/+19
| | | | | | | | | | | | | | | | Review 3, R2: the root pin was set by the first HELLO_REPLY, and the first sync, a round trip later, took that root; a peer naming another afterwards was refused as another history. So the seed that answered first decided, not "none while they disagree", and a malicious seed makes itself fastest. A node joining with an empty document of the first epoch now takes no root (RootPin::Awaiting, roots left for later) until each of its seeds named one, or ROOT_WAIT (10 s) passed since the first did; then the one they name, none while they differ, as before. With --genesis-root it takes that one alone, at once. access.md, the option's help and example.toml say so; switching roots later, while the joiner holds nothing of its own, is postponed.
* roots: an epoch's root pinned, and named in every handshaketv2026-11-081-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Review 2, N7, the care it raised: a joining node's empty document took as the first epoch's root whatever dependency-less change came first, from whichever peer it joined through; the first epoch's ID is all zeros, so nothing pinned it. A remake's epoch has its ID, the snapshot change's hash, which the rules hold its root to. * Every node names its epoch's root in HELLO and HELLO_REPLY (the epoch's ID for a remake's, its genesis change for the first; wire version 45). A node whose document starts from another root of the same epoch refuses the handshake, logging it: another history under the swarm's ID, a forged root or a genesis started again. * A joining node with an empty document takes as its root only the one it was given (--genesis-root, new), else the one its peers name, and none while they name different ones (access::screen::RootPin, kept in Screening across documents): one peer hands it another root only if it is all the joiner hears, or never, with --genesis-root. A root refused is listed with the refused, what builds on it with it. * The genesis node logs the root (`The swarm's root`); GET /admin/epochs shows it (`root`). A genesis started again under a remembered swarm ID used to merge with the nodes of it still running; they now refuse it (another root), and the docs say to join them with seeds instead. The epoch's identity stays as it is (generation 0 all zeros): records and epoch metadata name it so, and every comparison of epochs with them.
* access: --bootstrap-keystv2026-11-071-5/+6
| | | | | | | The first users' SSH keys, recorded at genesis with their entries, so a swarm can be strict from its start. Auth plan M7.
* signatures: kept in the document filetv2026-11-071-4/+13
| | | | | | | A node's signatures are saved with its document (--document-file) and loaded with it. Auth plan M5.
* access: the users endpointstv2026-11-071-3/+3
| | | | | | | | /admin/users: list, add (one or several), remove, disable, grant and revoke capabilities; each one change, refused if it would lock its writer out. Capabilities as the store's paths name them. Auth plan M1.
* access: first users at genesistv2026-11-071-1/+23
| | | | | | | | --bootstrap-users gives a new swarm a registry from its first change, each first user with everything; other users may do nothing until added. Without it the swarm has no registry and works as before. Auth plan M1.
* HyParView (slim)tv2026-11-061-1/+10
|
* swarm neighbourstv2026-11-061-2/+10
|
* bootstrap: replace pull by progress notifytv2026-11-011-2/+14
|
* use Automerge as Document instead of AutoCommittv2026-10-311-3/+2
| | | | This allows a lot of operations to drop mut.
* move all automerge references to documenttv2026-10-311-4/+2
|
* rename AutoMerge to Documenttv2026-10-311-6/+6
|
* move keepalive and firewall to pathstv2026-10-281-0/+1
|
* use libp2p mDNStv2026-10-271-0/+11
|
* move protocol paths to dedicated moduletv2026-10-261-2/+3
|
* add simulation testtv2026-10-251-1/+4
|
* allow to persist documenttv2026-10-251-22/+145
|
* add files module to consistently track statstv2026-10-251-6/+6
|
* warn about unresolvable seeds once; log successtv2026-10-251-7/+22
|
* add disk I/O statstv2026-10-251-4/+18
|
* add possibility to start with a documenttv2026-10-251-4/+61
| | | | The --recover-from option allows a node start with a given document.
* add state filetv2026-10-251-2/+18
| | | | | This allows storing the swarm ID and additionally discovered seeds, which prevents a formerly genesis node to start a new document.
* put swarm ID into the documenttv2026-10-251-3/+19
|
* add genesis flag and never give uptv2026-10-251-65/+87
| | | | | | | | | The --genesis flag has been introduced to start with a new document. This prevents restarts to accidentally start with a new document and accept reads/writes, causing a second swarm to appear. Additionally, bootstrapping doesn't timeout anymore as that's of no use for nobody.
* drop pre-membership sync messagestv2026-10-231-4/+2
| | | | | The handshake resets the session anyway, and the sender's reply timeout resends what still matters.
* merge membership and authenticate into standingtv2026-10-231-5/+2
|
* consistently use the words node, peer, and seedtv2026-10-231-3/+3
|
* rename cluster to swarm everywhere!tv2026-10-211-14/+14
|
* rename compaction to remaketv2026-10-211-1/+1
|
* reorganize all the modulestv2026-10-211-0/+104