aboutsummaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* rules: the changes that turned a swarm strict found once for its headstv2 days2-20/+58
| | | | | | | | | | | | Every change judged under a policy that isn't strict, in a strict document, walked back to the changes that turned it strict, each step reading every change the document holds. Only changes from the time before reach it in an honest swarm, but a member can send crafted ones at an old history, each costing every node a walk. The changes are now read once per walk (`store::made`), and what the walk finds is kept for the document's heads (`Reads::turned_now`), as whether its policy is strict is.
* rules: a strict swarm stays stricttv2 days1-1/+31
| | | | | | | | | | | | | | | | | A strict policy could be written over with one that isn't, or deleted, by a user who may manage the policy. While the swarm was relaxed so, nothing was asked of the time before it turned strict: a change written beside that turn was taken, and once the swarm turned strict again, built on, a node judging that change while strict from the first turn (one back from away, a joiner) refused it, and every node it told dropped it with the second turn and everything after. Under a strict policy, the policy is now written again only as strict: an envelope there whose value isn't a strict policy, a signed `null` among them, is refused. So a strict swarm has one change that turned it, and the time before it stays closed; to leave it, start a new swarm from its content. A swarm that isn't strict writes its policy as it did.
* rules: the document's own policy read once for its headstv2 days1-4/+19
| | | | | | | | | Every change judged under a policy that isn't strict, in every swarm, read the document's own policy to ask whether the time before a strict policy applies: in a swarm without a policy, where a change was judged for nearly nothing, a read of the policy for each. It is now read once for the document's heads and kept while the batch is judged at others (`Reads::strict_now`), read again once the document takes more.
* store: values ordered by seq as the policy a read shows saystv2 days2-25/+86
| | | | | | | | | | | | | | | Whether values are read by `seq` went by whether any value at the policy's place asks for signed values, not by what the policy reads as. Where the place holds two, they part: a signed policy that isn't strict read before a plain one that is, or two maps, the newer not strict. Such a swarm judged as not strict and read by `seq`. Now the policy's own place is read by `seq` where any value there asks for signed values, so an older policy put back beside a strict one can't undo it; every other place is read by `seq` only where the policy that read shows is strict (`policy::read`, which `policy::of` reads with). A swarm whose policy doesn't read as strict reads every place as Automerge has it.
* remakes: a signed place already held is kept like any write that losestv2 days1-1/+9
| | | | | | | Where the new epoch holds as high a `seq` at a signed place as the old one reads, the chain isn't replayed: it was counted as superseded and left out even with `--superseded-writes quarantine`, unlike every other write a newer one superseded. Now it goes to the quarantine then too.
* remakes: links replayed in the order their changes were madetv2 days1-31/+143
| | | | | | | | | | | | | | | | | Under a strict policy, the links of the chains to signed values were ordered across places by their changes' timestamps. How a link is judged in the new epoch depends on what was replayed before it: a key added to a user's entry, a capability granted. A write signed with a key added a moment before, through a node whose clock is behind, went first, was refused and quarantined, though every node had taken it. The changes replayed (`between`) now come each after those it builds on, clocks deciding only between changes neither of which saw the other, then the lower hash; the links follow that order, and an envelope takes its time from the first change that wrote it there. remakes.md says so, and what becomes of a place where a link is refused. Without a strict policy there are no links, and nothing changes.
* remakes: a chain replayed to what its part of the replay ends attv2 days1-4/+51
| | | | | | | | | | | | | A rejoin replays in two parts: what was written before it began, then what was written during it. A chain to a signed value was read to what the old document reads now, from the envelopes written within the part: a value written again during the rejoin made the first part's chain lead to an envelope that part doesn't hold, and the second part's start from one it doesn't either. Both were quarantined, and the new epoch kept the base's value. Each part's chain now leads to what the old document reads where that part ends.
* rules: the time before strict is the change that turned it, written again or nottv2 days3-37/+136
| | | | | | | | | | | | | | | | | | | | | | | | | | A change written under a policy that isn't strict was refused, in a strict document, unless it was in the history of the change that wrote the policy value the document read now. So the policy written again by a node that held a change from before, taken beside the strict policy, put that change in the new writer's history: that node kept it, every other node refused it, and the new policy with it, and the node was cut off. Now the reference is the change that turned the swarm strict: one that wrote a strict policy where the policy at its history wasn't, found by following back the writes of what the policy holds (`store::writers`). A change written under a policy that isn't strict is refused where such a change is beside it, neither in its history nor built on it. A policy written again, strict over strict, names the same change. One turning the swarm strict beside it is refused like any other. Of two at once neither is preferred: any rule choosing one, the lower hash say, would let a change made later to look as old take the place of the one every node took, and every node would drop it with all that was built on it. So two members turning a swarm strict at once split the nodes that took one from those that took the other; access.md says to turn it from one.
* store: a signed value chosen by seq is named sotv2 days1-5/+13
| | | | | | | | Where the policy asks for signed values, a place's value is chosen by `seq`, but conflict reports still called the choice `newestWins`, and the code and the architecture still said "newest" of what a read shows. A report names it `highestSeq`; the rest says "the one a read shows".
* rules: nothing added to the time before a swarm turned stricttv2 days2-0/+99
| | | | | | | | | | | | | | | | | | | A swarm turned strict by writing the policy into it kept the time before open: a change whose history lacks the policy's change is judged by the policy then, none or one that isn't strict, needs no signature there, and is taken whenever it comes, from any member. With values read by `seq`, an envelope planted at that time with the highest `seq` there is can never be followed: a ban, a user, a declaration, for good. Once a document's policy is strict, a change written under one that isn't is refused, received or held, unless it is in the history of the change that wrote the policy the document reads (`store::written_by`). A node that holds one beside that change, taken before it came, is told so by any peer that refused it (REFUSALS), judges it again, now refuses it too, and drops it with what builds on it, as for any change it took unjudged. A swarm strict from its genesis change has no such time; one whose policy isn't strict judges as before.
* swarm: a new swarm's policy recorded in its genesis changetv2 days7-1/+87
| | | | | | | | | | | | | | | | 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.
* remakes: values signed by their users replayed as chainstv2 days1-3/+399
| | | | | | | | | | | | | | | | | | | | | | | | | Under a strict policy, a replay wrote at each path the old document's merged view: at a place of a value its user signed, the last envelope alone, whose `prev` names one the new epoch doesn't hold if the value was written twice since the base. Every node refused it, it went to the quarantine, and the new epoch kept the base's value: a remake rolled back every signed value changed twice since its base, and a rejoining node lost its own the same way. And the replay found what changed by Automerge's diff, which says nothing of a value that changed beside Automerge's own choice: where a place held two values at the base, a write replacing the one read by `seq` wasn't replayed at all. Now, under a strict policy, the places of signed values are found from the changes' operations as well as from the diff, and each is replayed as the chain that leads to the envelope the old document reads: every envelope from the one the new document holds there, following `prev` through the changes since the base, each in a change of its own by its signer at the time it was made, judged as every node will judge it. A place is replayed only where the new document holds a lower `seq` there; where no chain leads from what it holds, it goes to the quarantine. A path above such places is split into its keys. Without a strict policy nothing changes.
* store: counters and the API's placement go by what a read showstv2 days2-6/+52
| | | | | | | | | | Where the policy asks for signed values, a place's value is chosen by `seq`, but two readers still took Automerge's own choice: an increment found the counter beside an envelope a read showed (answering the counter), and `inspect::placed`, which the API's checks go by, walked through whatever Automerge chose. Both now take the value a read shows (`store::shown`). A list's items keep Automerge's choice, as before: no signed value is one, and reading a list whole goes by it.
* store: values ordered by seq only where the policy asks for signed valuestv2 days1-13/+92
| | | | | | | | | | | | | | The order by `seq` sat in `store::candidates`, which every swarm reads through: in a swarm that isn't strict, a string shaped like an envelope, written at the same time as a plain value or a map, was read first. What a swarm without a strict policy reads must not change for signed values. The order now applies only where the policy asks for signed values (`"values": "signed"`), as any value at the policy's place says, read as written (`signs_values`), so the policy's own reading doesn't go round. Elsewhere `candidates` is newest first, as always. It is looked at only where a place holds several values and one is an envelope.
* api: a signed write after the last seq there is a conflict, not a panictv2 days1-1/+1
| | | | | | | `put_signed` added one to the `seq` of the envelope there unchecked: at `u64::MAX` it panicked where overflow is checked and wrapped where it isn't. It adds as `envelope::check` does, and nothing follows `u64::MAX`: `409`, as for any write not numbered after what is there.
* signed values: one reading of an envelope, everywheretv2 days8-139/+208
| | | | | | | | | | | | | | | | Three parts read an envelope three ways: the store's order took any string with the prefix whose meta held a `seq`, its reads any whose value decoded, the checks only one with four parts and a meta of exactly its fields. A string that the first two took and the checks refused was read first, read as the registry's or the policy's value, and treated as nothing by the check of the next write there. `document::signed` reads an envelope the one way: four parts, the value JSON, the meta exactly its six fields (one more, or one twice, and it isn't one), no newline in either, the signature decoding. The store's order, its plain reads, the checks, the API and the users API all go by it. What isn't one in every respect is a plain string, wherever it is read.
* signed values: value and meta apart, numbered; the highest seq is readtv2 days9-76/+321
| | | | | | | | | | | | | | | | | | | | | | | | | A member could put a user's older signed value back beside a newer one: a change made with dependencies from before both is judged where the place was empty, so the older envelope (`prev` empty) is taken; and of values written at once, the one read was the one with the highest operation, which whoever writes the change steers. A revoked capability, a lifted ban or an earlier policy came back that way, signed by whoever signed it then. An envelope is now `cv2.<value>.<meta>.<signature>`: the value as its user wrote it, and apart from it what continuum adds (swarm, path, user, at, seq, prev), the signature over the value's line and the meta's. `seq` is one more than that of the envelope it replaces, 0 where it replaces none; every node checks it with `prev`. Of the values a place holds, written at once, signed ones are read before any other, the highest `seq` first, of equal ones the lower digest (`store::candidates`): reads, snapshots and writes all go by it. An older envelope beside a newer one changes nothing. `application/continuum-signed` is the value's line, the meta's, then the signature; `scripts/continuum-signed` writes and checks it so. The wire version goes up: nodes must agree on what a place's value is.
* simtest: hyparview's views settle within a reaffirm roundtv4 days1-1/+11
| | | | | | | | `active_views_settle_and_heal` waited 60 s for the views to settle, on lossy links. A DISCONNECT lost leaves a link at one end until the next reaffirm round (`REAFFIRM_EVERY`, 60 s): the wait timed out with one member holding another that no longer held it. It waits twice that, as the heal after it does.
* relay: a STATUS's heads wait at least 50 ms before they are pulledtv4 days1-6/+10
| | | | | | | | | | | | | | A neighbour pulls heads a STATUS listed only if it still lacks them after a round trip to the sender, as they are usually on their way along a writer's tree. With no round trip known, or one measured long ago (busy pairs send no keepalives), it pulled at once; with a short one, a STATUS sent right after a change can overtake it by more than that round trip, delays varying per message. Either way the change came twice (`trees_hold_through_continuous_writes`: c pulled once while every write reached it along x's tree). The wait is the round trip, but 50 ms at least (and 1 s at most, as before).
* changes: type next to a mark within the texttv4 days1-1/+1
| | | | | `no_mark` typed at 0 to 4 into a text of three characters: splicing at 4 is past its end. It types at 0 to 3.
* changes: an insert may follow a mark the document holdstv4 days1-5/+35
| | | | | | | | | | | Screening asked of every operation naming an element that the element was inserted as a value or an object, inserting or not. In a document that took a mark before marks were refused, a transaction typing right after it inserts after the mark's begin or end, and was refused: every node refused the change of the node that typed, and all it wrote after. An element is written at only where a value or an object was put; an insert may follow any element of that list, as transactions insert.
* changes: a test that generates changes and asks what passes to stay soundtv4 days1-0/+234
| | | | | | | | | | | | | | Twice, crafting changes by hand missed some that pass screening's checks and break Automerge; a program generating them found three more kinds. This test does the same: on documents three honest writers wrote at once (maps, a list, a text, a counter), changes of one to four operations of every kind, at random places, naming as replaced nothing, what is there, or any operation. Each that passes the checks is applied, given back by its hash, saved and loaded, taken by a peer that lacks it, written after by an honest node, and saved and loaded again; nothing of that may fail or panic. The run is seeded, the seed named where it fails, and CHANGES_GENERATED sets how many documents (60 by default) for a longer run.
* changes: no marktv4 days1-230/+81
| | | | | | | | | | | | | Screening took marks in a text, checking that a mark's end comes at its begin or after it, by walking the elements each is inserted after back to the text's head: up to 22 s for one change of 9 KB. And it took a value put at a mark's begin or end, replacing it: sound until an honest node edits that text, then the node panics at its next sync or append, and its save doesn't load. Continuum's store writes no marks. A change with a mark's begin or end is now refused, and the walk is gone. An element written at is one a value or an object was inserted as.
* changes: no tabletv4 days1-2/+61
| | | | | | | | | | Screening took a table for a map. A table made is sound, but Automerge panics applying a change that puts a value into one, made by that change or a later one, and applying isn't caught where it panics. Transactions make a table and can't write into it; continuum's store makes none. A change making a table is refused, and so is one writing into a table the document holds.
* changes: what an operation replaces put a value or made an objecttv4 days1-3/+99
| | | | | | | | | | | | | | Screening took as replaced any operation made at that object and key without inserting: a deletion, an increment, a mark. A transaction names only what holds a value there: a counter incremented and put over names its put alone, a key put again after its deletion names nothing. Automerge takes a value put again naming its deletion, at a map's key or a list's element, and then gives back another change under its hash: a save that doesn't load, a sync that fails. A deletion naming a deletion panics as it is given back. An increment naming a deletion does the same as a put. What an operation names as replaced now put a value or made an object.
* libp2p tests log as RUST_LOG saystv4 days1-0/+10
| | | | | | | Nothing installs a subscriber in the transport's tests: RUST_LOG gave no output there, where a transient failure needs it. The first node a test run makes installs one, writing into the test's output, which is shown where a test fails.
* screen: take only the operations transactions writetv5 days1-85/+344
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Screening asked what an operation isn't: a deletion replacing nothing, a value put at a list's head without inserting, a mark ended but right after its begin. Others pass that Automerge's transactions never write, and Automerge takes them and breaks: an element written over naming as replaced the element inserted after it (an inserted element's key is the element it follows, its place is itself), an insert replacing something, a deletion or an increment inserted, an increment at a list's head, a mark ended ahead of its begin or at the head, a mark in a list. Giving such a change back panics or gives another change under its hash, and the save doesn't load. Each operation is now asked to be one transactions write (`document::changes::unwritten`): inserted, a value, an object or a mark's begin or end into a list or a text, replacing nothing; at a list's element, never its head, without inserting, replacing what is at that element; at a map's key, never inserted, a deletion or an increment replacing something; a mark's begin with its end as the next operation, both inserted. A value replaced at a list's element is the element itself or written at it, not an element inserted after it. Marks are only in a text, and a mark's end is at its begin or at an element after the begin's: their places follow from the elements each is inserted after, back to the text's head, as the change's history holds them. The document the tests write now has counters in a list and a map, an element written over, and marks over a span, the whole text, none of it, and across what was deleted and inserted since; and each case above is a test.
* changes: test what transactions never write against a document ready for ittv5 days1-8/+13
| | | | | | | | | `what_transactions_never_write_is_refused` checked changes built on the insert against a document without the deletion the insert builds on. Such a change isn't ready, and nothing is asked of it: the honest insert passed for that reason, and the two crafted from it weren't refused. Each is checked now against a document that holds what it builds on.
* screen: refuse what Automerge's transactions never writetv5 days1-1/+75
| | | | | | | | | | | Automerge 0.12.0 takes some changes that name nothing wrong, and then can't give them back: a deletion that replaces nothing, a value put at a list's head without being inserted, a mark ended where no mark began right before it. Giving the change back panics, the save doesn't load, and a sync to a peer that lacks it panics: one member stops every node it reaches. Those are refused with the other checks (`changes::Written`).
* screen: a change refused after its checks stands in for nothingtv5 days2-24/+84
| | | | | | | | | | | | | | | | Screening checks that a change is one Automerge writes (`changes::Written`) before it looks for forks and judges the rules, and the checks recorded what a change made as soon as it passed them. A fork of a change the document holds has its actor and counters: if it was checked first in a batch, and refused as forged after, its record stood in for that change's operations, outside the history of the next. An honest change writing into what the real one made was then refused, for good. Anyone could make such a fork, its hash ground to sort first. What a change made is recorded once screening takes it (`Written::taken`), and an operation named is looked for in the batch and in the document, whichever the change's history holds.
* screen: a twin of this node's actor switches it only signed with its keytv5 days2-19/+68
| | | | | | | | | | | | | A node switched to a fresh actor whenever a peer showed it a change of its own actor that it didn't hold, signed or not. So any peer made a node start a writer at will, by sending a copy of its last change with another value: and every writer costs every node memory in proportion to the document's history. Copies of a node's data directory hold its key, and sign their changes with it; a stranger can't. A twin switches the node only where a signature by the node's own key of it is kept or waiting. Unsigned, it is refused as forged as before, and nothing switches.
* screen: what is asked of a change, asked of its own historytv5 days2-56/+440
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A change is refused before Automerge sees it unless it is one Automerge writes (`document::changes::Written`). Three things about that, each of which let a crafted change through or parted nodes: * An operation a change names (the object written into, a list's element, an operation replaced) must be made in the change's own history, or before in the change itself, not anywhere in the document. Else a node that holds the operation takes the change and one that doesn't yet refuses it for good: nodes part by the order changes reach them. * And it must be what it is named as: an object of the kind written into, an element of that list, an operation at the place written. A change that replaces an operation elsewhere marks an unrelated value gone, and Automerge then gives back another change under its hash and saves a document that doesn't load; one that writes into an operation that made no object makes it panic. * A change that isn't its actor's first must have the one before it among its dependencies, as a transaction puts it there. A gap in an actor's numbers makes Automerge panic. What the document holds at the changes this one builds on is read there where it can be (a map's key, an object held by a map's key); else the operation's own change is decoded and the history walked back to it, no further than the operation's counter. So operations on a list's elements cost a walk each. Decoding a change can panic too (an operation naming an actor its change doesn't list): caught, and the change refused as one whose bytes aren't Automerge's.
* screen: refuse changes Automerge wouldn't have writtentv5 days3-1/+325
| | | | | | | | | | | | | | | | | | | | | Automerge 0.12.0 applies a change that lists an actor none of its operations names, or whose first operation is numbered below its dependencies' or near 2^32. It then gives back another change than the one it was given and saves a document that doesn't load, or panics at the next write. A member sending one stops the nodes that take it. Every change from elsewhere is looked at before Automerge sees it (`document::changes::Written`, from `access::screen::apply`, with or without a policy), and refused like one breaking a rule unless: * encoded again, it has the hash it came with; * its first operation is numbered one after the highest of its dependencies, 1 without any, as a transaction at the document's heads numbers it; * every operation it names (an object, a list's element, an operation replaced) is its own, or was made before it, in the document or by a change of the batch looked at before.
* state: quarantine a drop's own writes before the document is let gotv5 days1-5/+7
| | | | | | | | | | | A node dropping a change taken unjudged swapped in the document without it, released it, and only then quarantined its own writes that were dropped with it. In between, a reader found them gone and not quarantined: `simtest::policy::a_change_taken_unjudged` asserts right after seeing the change gone, and found the quarantine empty now and then. They are quarantined now under the document's lock, with the swap.
* hyparview: a member with k takes one a neighbour shorttv4 days3-10/+24
| | | | | | | | | | | | | | | A member one neighbour short asks once per `ONE_SHORT_EVERY` (300 s), and a member with `k` refused it. When a member most others had as a neighbour went away, three members ended up each with the other two as neighbours, one short each; each asked once, was refused by a full member, and waited five minutes. Changes pass only between neighbours: the three got none of what was written meanwhile (`active_views_settle_and_heal`, timed out waiting for the same heads). NEIGHBOUR says now whether its sender is one short, and a member with `k` takes such an ask as its `k + 1`th, the most it keeps; one with `k + 1` still refuses. Asks stay as rare as they were, and one is enough but where those asked have `k + 1`. Wire version 50.
* document file: format version 3tv6 days1-5/+15
| | | | | | | | | | The document file's first line names its format; each record's first byte its kind. A version that doesn't know a kind refuses the file, as it does a format it doesn't know. With the Closed and Opened records, the format is continuum-document/3, so a version knowing only 2 refuses a file it can't read by its first line. Files of 2 are read as of 3: the same records, Closed and Opened where a version knowing them wrote them.
* document file: say which versions read a file, and the Opened recordtv6 days1-4/+5
| | | | | | | | | | | The document file's format names itself in its first line (continuum-document/2) and each record's kind in its first byte. A record of a kind the reading version doesn't know makes the file unusable: the node doesn't start on it unless told to move it aside (--force badDocumentFile). lifecycle.md says so: a file one version wrote is read only by versions knowing every kind of record in it. The format's comment names the Opened record a node appends as it starts on the file, which undoes the clean stop's mark.
* login: a login given a lifetime of its own ends its session's record with ittv6 days2-5/+7
| | | | | | | | | | | | Ending a session records it in the document until the login's end (login_exp), so every token of the session, refreshed or handed over, is refused until none can live any longer. A login may ask a lifetime of its own (POST /auth/login with lifetime): its session ends with that token (session_exp), as a refresh never goes past it. Its login_exp is now that end too, so ending its session records it as long as one of its tokens can live, not for the node's whole session lifetime. A token refreshed with a lifetime (one handed to another member's dashboard) keeps the login's end.
* screen: refuse a change at a seq this node made under its own actortv6 days2-13/+27
| | | | | | | | | | | | | | | | | A node receiving a change of the actor it writes as, one it doesn't hold, writes on as a fresh actor (another node writes as it, from a copy of its files). Where the other node made it at a seq this node made a change at too, the change was taken to Automerge, which refuses the whole batch (duplicate seq): the message failed, and with it everything else it carried. Signatures::forks found it forged only where a signature verified a change of the actor at that seq, and this node signs its own latest change only as it sends it. forks now also finds a change forged where its actor is the one the document writes as and the document's latest change of it (get_last_local_change) is at its seq or later. apply_bytes switches to the fresh actor after judging the batch, not before, so the check still sees the actor; also where judging fails.
* sync: a delta's signatures as a blob of their owntv6 days4-18/+121
| | | | | | | | | | | | | | | | | | | | | | | | A sync message larger than the threshold for its peer (16 chunks, lower on a slow link or after a message to it failed whole) goes as a delta: the peer fetches its changes in chunks, from any node holding them. Its signatures, each writer's latest with changes in it, went in the envelope offering it: up to 65536 of them, 6 MiB, in one message, the size the delta exists to avoid. Nor did an Automerge message count its signatures (one per writer in a whole document pulled) towards the threshold. A delta's signatures are now a blob of their own: the offerer packs and keeps them (Blobs::keep, the latest 64), and the spec names them by BLAKE3 hash and size (DeltaSpec::signatures, None where no signature vouches for its changes). They are served as content (BlobId::Content), so their hash checks them. The receiver fetches them from the offerer alone, as another node holding the changes holds signatures of its own, before the changes, and offers them under the write lock just before judging the changes, so they wait for them as before. The envelope of a delta carries none. An Automerge message's signatures count towards its size: past the threshold, it goes as a delta. Wire version 49.
* signatures: keep a few different signatures of a change waiting for ittv6 days1-34/+101
| | | | | | | | | | | | | | | | | | | A received signature of a change the document doesn't hold yet waits for it (Pending), checked once the change comes. A delta's signatures come before its changes, so they wait for the whole download. Kept one per change, the last that came, a member could send a signature that doesn't verify for a change it knows is on its way and put the honest one aside: the writer then went unvouched for until its changes came again with their signatures. Pending now keeps up to three different signatures of a change (CANDIDATES): the first that came, and the latest others. Ed25519 signatures are deterministic, so every honest copy is the same bytes and counts once: one sent first stays, one sent after stays unless more others follow it. Once the change comes, offer and vouch_batch check them in turn, the first that came first, up to the first valid one, within the bound on invalid signatures (MAX_INVALID). MAX_PENDING counts signatures, not changes.
* signatures: look for arrived changes only where the document grewtv6 days1-9/+18
| | | | | | | | | | | Received signatures of changes the document doesn't hold yet wait for them, up to 65536 (MAX_PENDING). Each Signatures::offer, one per received sync message, looked up every waiting one's change to find those that came meanwhile. The pending signatures now remember the document's heads at the last look (Pending::scanned, Pending::arrived): while they stand, the document holds nothing more, as it only grows, and offer looks up none.
* login: wait for a session's end from before each checktv6 days1-2/+6
| | | | | | | | | | A stream opened with a token ends once refused_now refuses it. In a swarm without a registry, a session ended on this node is kept in memory (AppState::ended_sessions), and the streams waiting on session_ended are woken (notify_waiters). credentials_end now makes the Notified it waits on before each refused_now, the first one included, and not after: a session ended between a check and the wait is seen at once rather than at the next change to protocol data.
* signatures: check a bounded number of invalid received signaturestv6 days1-17/+90
| | | | | | | | | | | | | | | A sync message carries up to 65536 signatures (MAX_PER_MESSAGE), and the receiver checks, under the document's write lock, each one of a held change that would vouch for more of its actor's changes than the one before: about 30 µs each. A member sending that many signatures that don't verify cost the receiver about two seconds of writes per message. Signatures::offer and vouch_batch now stop checking after 64 found invalid (MAX_INVALID) and drop the rest unchecked, with a warning. A node forwards only signatures it verified, so an honest peer sends none. offer counts those a message brings apart from those that waited for their changes, which came from any peer. Signatures::vouch says which it found (Vouched): more vouched for, nothing more, or invalid.
* screen: write as a fresh actor when another node writes as this onetv6 days3-3/+85
| | | | | | | | | | | | | | | | | | | With --keep-actor, a node on a document file that ends with a clean stop writes on as the actor the file names. Two nodes started on copies of one file (a copied data directory, a restored disk image while the original runs) both do, and both make that actor's next change number: peers holding one refuse the other as forged, and everything built on it. screen::apply_bytes, the way every received change comes in, now looks for a change of the actor the node writes as that the node doesn't hold: only another node can have made it. The node then writes on as a fresh actor at once, logs a warning, and its callers add the actor to the node's own (RemakeState::add_own_actor), which the document file's header follows. The change is judged as any other. lifecycle.md says not to start a copy of a node's data directory with --keep-actor, and what the switch leaves: what both wrote before stays refused where the other's came first.
* document file: write as a fresh actor once the file is marked closedtv6 days1-2/+15
| | | | | | | | | | | | | | | | With --keep-actor, a node on a file whose last record is Closed writes on as the actor the header names, which takes the file holding every change of that actor. At a clean stop, the node's own workers go on writing until it exits: its alive stamp in the member list, votes, a coordinator's commit. One committed after Closed was appended, and sent by the still-running sync, would be a change of that actor the file lacks, and the next start would make another change with its number. swarm::document_file::close now takes the document's write lock, marks the file at the heads it sees there, and sets a fresh actor before letting go: what the node writes after is no change of the marked actor. A record the file worker appends after Closed (such a write, flushed) leaves the file unmarked, which starts a fresh actor next time.
* document file: undo the clean stop's mark before deciding the actortv6 days2-21/+31
| | | | | | | | | | | | | | At start, a node on a document file appends an Opened record before it writes anything, so that a Closed record before it no longer says the file holds every change of the actor it names. It does so now before deciding which actor to write as, and DocumentFile::open says whether it could: where the append fails (the disk full, permissions), the file still ends with Closed, and later appends likely fail too. A crash, or a clean stop whose last append failed (close then sees the file behind and writes no mark), would leave that Closed standing for a run the file never got. So with --keep-actor, the node writes on as the actor of before only where the file was marked as opened; else it writes as a fresh actor and warns.
* access: a limit that meets none of the user's capabilities gives nothing to ↵tv6 days2-2/+22
| | | | | | | | | | look with Looking at a node (its figures, peers, dashboard: Need::Observe) takes any capability, a token's limit applied. Caps::is_empty is now true where no capability of the user meets one of the limit's (Capability::meet), as well as where there are none: a token limited to the member list, for a user who may only read data/eu, may not look.
* access: a token with a limit changes no credentialstv6 days2-1/+28
| | | | | | | | | | | | | | | A token's limit narrows every endpoint but those under /auth, which any registered user may call. Among them, PUT and DELETE /auth/keys/{id} change the keys the user logs in with, and POST /auth/logout ends every token of the user. With the token a dashboard hands to another member's (the member list, read, five minutes), its holder could add a key of its own and log in by it as the user, with everything the user may do. These now take a password or a token without a limit (Need::Credentials, refused where Caps::limited). A narrowed token still refreshes within its limit, says who it is, lists the user's keys and ends its own session (DELETE /auth/session): a dashboard opened from another member's logs out with it.
* stats: the writers of the documenttv8 days4-3/+33
| | | | | | | | | | | How many writers (Automerge actors) the document's changes have matters: a writer is a node's run (each start, rejoin or drop makes one, a start keeping the one of before with `--keep-actor` after a clean stop), and every transfer of the whole history carries a signature for each. `/admin/stats` now says it (`document.writers`, and `document_writers` for Prometheus), counted from the changes' metadata alongside the saved size's measurement in the background (at least a minute apart), as that takes time proportional to the document too; an export, which measures the size alone, keeps the count of before. The dashboard's figures show it with the rest.