| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
| |
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".
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
| |
`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.
|
| |
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
| |
`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.
|
| |
|
|
|
|
|
|
|
|
|
| |
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`).
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
| |
Docs and comments outside future-work.md and review-rejections.md say what the code
does, and point nowhere else for what it doesn't: the architecture page's map, the
transports' forwarders, keys with `/`, a strict swarm's registry, trust.md's "Not yet"
(now saying what isn't protected, in a sentence), the topology bench, and the comments
of the change benchmarks, capabilities' grantor, tokens, dissemination, refusals and
topology.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Under a policy requiring signatures, a node takes a change only once a signature
vouches for it: one of the change itself, or of a later change of the same writer. A
writer is a node's run, each start, rejoin or drop making a fresh actor, so an epoch
gathers writers for as long as it lasts, and a transfer of its whole history (a joiner
pulling the document, a delta) must carry a signature for each of them, or the joiner
waits for the rest for good.
A message's signatures are now chosen by what it carries:
* changes, up to 256 signed among them: each one's signature;
* more (a whole document pulled): each writer's latest signed change among them, found
by the document's change metadata (`Signatures::for_changes`), vouching for the rest;
* a delta: each writer with changes in it (`get_changes_meta(from)`), its latest
verified signature (`for_delta`).
A message carries up to 65536 (6 MiB), and as many wait at the receiver for their
changes (a delta's come after it). So a transfer leaves writers unvouched only in an
epoch with more than 65536 runs writing since it began; a remake starts the count again.
Wire version 48.
|
| |
|
|
|
|
|
|
|
|
| |
Review 4, appendix: whether a write is signed because `_continuum/access/signed` lists
its path compared the listed paths by prefix (`signatures::related`), so a `*` there
was a literal key, while api.md says the list holds paths as capabilities name them,
which take `*` since 1259, and signed values already read the same list as patterns
(`envelope::reaches_signed`). A listed `metrics/*/alerts` signed nothing.
It compares by `access::agree` now: within or above the pattern, `*` for any one key.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Review 4, F5: a delta, and a message whose changes held more than 256 signatures (a
whole document pulled, of any real history), carried each actor's latest signature,
the 256 that became latest last. An actor is a node's run, so past 256 runs writing in
an epoch, some actors' changes arrived unvouched at the puller under a policy requiring
signatures, waited, and every resend carried the same 256: a joiner never finished.
A message now carries up to 4096 signatures (`MAX_PER_MESSAGE`, as many as wait for
their changes, `MAX_PENDING`: 384 KiB at most), all of its changes' up to there, each
actor's latest past it and for a delta, and a receiver takes as many (wire version
47). An epoch with more than 4096 runs writing would still leave some unvouched in
such a transfer, which the constant says; sending each actor of the transfer its own
latest would need the actors of a delta's changes, which only rebuilding their
metadata gives.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
and after a swap
Review 4, F2 (the honest case) and claim 2: a node signed at start its own changes at
the heads that nothing vouched for (1216), and after a swap only its current actor's
latest. An own change left unsigned can sit below the heads: a drop (`drop_taken`)
takes away a signed change and keeps an earlier unsigned one, and the node writes on
under a fresh actor, building on it; or a node's change is built on by another's
concurrently with the signed one the drop took. Nothing signed it again, and under a
policy requiring signatures every node pulling it (a joiner) waited for good, and for
everything built on it.
Now the latest change of each of the node's actors (`RemakeState::own_actors`, the
current one among them) that no signature vouches for is signed
(`Signatures::sign_own_actors`), at start and whenever the document is swapped (a drop,
a switch, a rejoin), the old `sign_own_heads` and `sign_own_latest` going. One
signature per actor vouches for all its changes before it. The case of a member whose
signed change the rules refuse, vouching once for its earlier ones, is
postponed (future-work.md, next).
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Logging out of the dashboard (`DELETE /auth/session`) only cleared the cookie: the
session's tokens stayed taken until they expired, by every node. Ending them took
`POST /auth/logout`, which ends all of a user's sessions.
Now `DELETE /auth/session` ends the session of the token it comes with (the cookie, or
a bearer token): where the swarm has a registry, it is recorded as
`_continuum/sessions/<user>/<session>` (`registry::session_path`), its value until when
the session would have lasted, and every node refuses the session's tokens once the
change reaches it (`token::Refused::Ended`): the page's own, its narrow tokens, and one
handed to another member's dashboard, all refreshed from it and keeping its ID. The
rules take the entry from the user itself or one who manages users, as a logout. A
remake's snapshot leaves out entries past that time, a user's map where none is left:
their tokens are expired anyway.
Without a registry the document can't record it: the node ending it refuses the
session's tokens itself (`AppState::ended_sessions`, until it restarts), others take
them until they expire, as a logout there is refused.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Setting a node's log filter took `write` on `_continuum`, all of the protocol data:
whoever could change one node's logging could change the swarm's members, remakes and
users too. Now what a node holds alone has paths of its own for capabilities, under
`_continuum/local/<node ID>/`: `log` (`/admin/log`), `config` (`/admin/config`) and
`debug` (`/debug`, always `write`), `read` to look and `write` to act
(`api::access::needed`, which takes the node's ID). So `_continuum/local/<node ID>` is
everything on one node, `_continuum/local/*/log` the log filter on every node, and
holders of `_continuum` keep it all.
Nothing is stored there: the store refuses writes under `_continuum/local`, and the
rules refuse a change touching it, as for epoch metadata. The quarantine stays with
`_continuum`: its entries are everyone's writes, which a node-local capability
mustn't show.
|
| |
|
|
|
|
| |
Since load_delta is for tests (1190), nothing else in changes.rs uses
anyhow's Context, and builds without tests warned of an unused import.
load_delta imports it itself.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A sync message carried the signatures its peer wasn't sent yet, by a
cursor per peer. Changes sent again, as after a message taken as
delivered and lost on the way, went without them: the peer was past
them. Under a policy requiring signatures they waited until the
writer's next signed change, or the next session.
A message now carries the signatures of the changes it carries
(Signatures::for_changes), whatever the peer was sent before: changes
sent again arrive vouched for as the first time. Past 256 (a message
carrying the batches of many writers), each writer's latest instead,
as a delta carries. The cursor goes, and with it resetting it after a
failed send or a new session.
|
| |
|
|
|
|
|
|
|
| |
delivered_messages_are_answered_with_changes_we_lack failed now and
then: after the answer, the node still lacked the peer's change.
Automerge's sync tells what each side has by a Bloom filter, whose
false positives take more rounds. The test now exchanges up to four
rounds more, each asking for what is still missing, until both are
level.
|
| |
|
|
|
|
|
|
|
|
|
| |
A sync message took the signatures its peer wasn't sent yet whenever it
had a body, an Automerge message saying only what we have included. A
signature belongs with the changes it vouches for: they go along the
trees, and a peer that got them elsewhere got the signatures with them.
Signatures now go in a message that carries changes (pushed, offered
as a delta, or in an Automerge message carrying some: SyncSession::
carrying), and in no other.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A node signed its changes no rule signs a while after them (--sign-every
1s): the change left at once, unsigned, and its signature followed on
its own a second later, to every neighbour, over every link. A few
writes made a cascade of SIGNATURES. Under a policy requiring
signatures it signed every change as it was made instead.
A node now signs its latest change, if no signature vouches for it, as
a sync message takes it (--sign-every sent, the default): the
signature leaves in the same message, and goes where the change goes.
One signature per message, however many changes it carries, each
vouching for those before it: a slow writer's every change is signed,
a fast writer's batches are, at no threshold to pick. A policy
requiring signatures signs what is sent too, even with `none`. `all`
still signs every change as it is made; changes to protocol data,
listed paths and ?signed=true writes are signed as they are made, as
before. The interval, and the task signing on it, go.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
A node commits a change, keeps it in its document file, and may stop
before any signature vouches for it. It starts again under a new
actor and only ever signed its current actor's latest change: the old
one stays unsigned for good. Peers pulling it then wait for a
signature under a policy requiring them, and so does everything the
node writes after, building on it. Signing every change at commit hid
this under such a policy; signing what is sent, next, won't.
At start, before anything leaves, a node signs each of its own
changes at the document's heads that no signature vouches for:
nothing it made since builds on them, so they are heads.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Review 3, R4: whether a batch was judged followed the receiving
document's policy now (and whether the batch writes one). After the
policy was removed, or replaced by a version the node doesn't know,
changes written under it and received late went in unjudged, while
nodes that had them earlier judged them; REFUSALS gave up likewise.
Screening now remembers that the document held a policy, known or not
(Screening::policed), and judges what it receives while it does, each
change by the policy at its dependencies; REFUSALS judges then too
(not under a policy the node doesn't know, as before). Not across a
restart, which access.md says.
|
| |
|
|
|
|
|
|
|
|
| |
With every message's signatures offered now (1205), Signatures::offer
runs for each, and it asked get_change_meta_by_hash whether the
document holds each signature's change, and each one waiting, up to
4096 of them: Automerge rebuilds the change's metadata from the
document's operations to answer. Ask changes::holds instead (1197),
there and in forks and kept_for; the metadata is still read where it
is used.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
With the policy's reads kept, judging a change still costs about one
read (some 3.5 µs), and so does judging without a policy: what is left
is At::new, which asks get_change_by_hash for each head. Automerge
builds the change again from the document's operations to answer, at
a cost growing with its history. Screening asks it again for every
candidate and every dependency, and sync for heads.
Ask by the missing dependencies instead (changes::holds), which look
the hash up: one the document holds is not among them. A change queued
in the document, waiting for its dependencies, isn't either; but then
some are missing, and only then is it asked the slow way. Every check
of whether a document holds a change goes through it.
|
| |
|
|
|
|
|
|
| |
The breakdown judges at the heads after 400 changes. Whether a read
at given heads costs more in a document with a long history decides
what a read the rules don't keep costs a node with a big document.
For the workloads of more than 10000 changes, break it down a second
time, judging the last 1000 at the heads after the rest.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
bench_screening shows judging at about 17 µs of a change's 25: some
two and a half reads at its heads (the policy, bans, its node's member
entry, whether there is a registry, the sealed declarations), each
costing as much as working out what the heads cover. Screening judges
most of a batch at the same heads, and those reads are the same for
every change judged there.
Keep them (rules::Reads), by node and by user where they depend on
one, while the heads stay the same; screening keeps one for a batch.
What the heads hold doesn't change as the document takes changes, so
nothing goes stale but by other heads. The benchmark breakdown shows
judging so and afresh.
|
| |
|
|
|
|
|
|
|
| |
bench_screening tells what screening costs in all, not where. Print,
per change judged, what decoding it, placing its operations
(inspect::Inspector) and judging it (rules::judge) cost; of judging,
what reading the policy costs, and one read for scale. Judged as
screening judges most changes: at the heads after the first ones,
whose maps flush the batch.
|
| |
|
|
|
|
|
|
|
|
| |
A write every node would refuse is rolled back by forking the document
at the heads before it, under the write lock, at a cost that grows with
the document's history. A user could ask for such writes in a loop.
Count each user's refused writes over the last minute. Past
--refused-writes-per-minute (default 10), its writes are answered 429
without being tried, until the oldest refusal leaves the minute.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Review 2, N7: a node screened received changes only while its own
document had a policy it enforces. A joiner's empty document has none,
so its first sync, as much history as the node it joins through chose,
was applied unjudged, and under signatures required unvouched; the same
for any node while the policy's own change arrived with later ones.
Sync messages, deltas and downloaded changes are now always screened,
each change judged by the policy at its dependencies (1135), so the
verdicts are the swarm's. While neither the document nor the changes
hold a policy (none touches a "policy" key: inspect::touch_key), only
an epoch's root is judged and nothing is placed: bench_screening, after
1188, measured placing everything at about as much again as applying
(564 ms + 543 ms for 100 000 changes), judging by the rules at about
five times (+2.5 s), which a document with a policy pays anyway.
access.md no longer lists the joiner's first sync, nor nodes agreeing
only as the policy reaches them (judged at the dependencies, they
agree), as left to do; changes::load_delta is for tests now.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Review 2, N9: the API checked a write's capability on the path asked
(servers/list/3/name), the rules on the list it is in (servers/list):
a user whose capability lay inside a list had every such write pass the
API and refused by the node's own judgement (403, after rolling the
document back).
inspect::placed places a write's path in the document by the rule the
inspector places operations by (Place::child: cut after the first list
or text on the way), and the store's writes check capabilities there.
One rule for both; a test checks placed against the paths the inspector
finds in the change such a write makes.
|