| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The policy was read in typed JSON, so that an Automerge text spelling
"signed" at its `values`, which no operation `rules::turns_strict` asks
of writes, turns no swarm strict. But that read every policy anew: a
setting that wasn't a string, or a text at `signatures`, made a policy
no node knows in swarms that aren't strict, which read it as before.
The policy is read in plain JSON again, as it was, and only its
strictness asks more (`policy::of`): it reads strict only where its
`values` is a string in typed JSON, an envelope read as its payload.
A policy that would read strict only through a text, at `values` or
holding the policy, is one no node knows. Every policy that doesn't read
strict reads as it did.
|
| |
|
|
|
|
|
|
| |
A strict `--bootstrap-policy` is refused with `--remake`, but whether
it was strict went by its JSON as given, where the node reads the
policy as written into the document: a strict policy given as an
envelope passed, and its genesis change was refused only once the node
had started. Both now read it as written (`policy::as_written`).
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A swarm turns strict only at its start or through a strict remake, and
a change writing a strict policy where the policy isn't strict is
refused, found by its operations: `"signed"` put at the policy's
`values`, or an envelope asking for it put at its place. But the policy
was read in plain JSON, where an Automerge text reads as a string, and
writing a text is no such operation: `{"$text": "signed"}` at `values`,
through the typed API, turned a swarm strict that nothing refused, with
a time before it nothing closes.
The policy is read in typed JSON now (`store::read_plain_as`): what
continuum writes there reads as it is, plain JSON or an envelope, and a
text, a counter or bytes as itself, tagged; a setting that isn't a
string makes a policy no node knows (`policy::read`), as a version it
doesn't know does. So no text turns a swarm strict, and the operations
`rules::turns_strict` asks of are the only ways to. A policy holding none of these reads
as before.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A strict policy written into a running swarm left a time before it:
changes written there, beside the turn, were refused by the nodes that
took the turn first and taken by the others where they came first (a
signed policy that isn't strict, among them, unseated the turn there);
and a remake whose base preceded the turn had every switching node
replay the turn as one of its own, each refusing the others'.
A change writing a strict policy where the policy at its history isn't
strict (`"signed"` at its `values`, or an envelope there asking for
signed values) is now refused, in every swarm. A swarm turns strict at
its start (`--bootstrap-policy`) or through a strict remake, each its
epoch's first change: no change of a strict epoch is from before its
policy, and the rule for the time before goes, with the walk that found
the changes that turned a swarm strict and what kept them
(`before_strict`, `turned_strict`, `Reads::strict_now`,
`Reads::turned_now`, `store::writers`, `store::made`,
`changes::in_history`). The strict swarm's simulation starts strict.
access.md says so, and that a strict swarm can't move to a policy its
nodes don't know by writing it.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
| |
`GET /auth/whoami` lists the user's capabilities (`caps`) and its token's `limit`, if
any, side by side; what the request may do is what both give, as endpoints decide it.
It says so now (`may`): the capabilities, or with a limit each capability met with each
of the limit's (`Capability::meet`): at the deeper of the two paths, a `*` of one
taking the other's key there, with the rights both name; nothing where the paths part,
no right is shared, or the path is protocol data one of them doesn't name.
|
| |
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
| |
Review 4, 1250's note: a key's comment was kept as given, unbounded but by the request
limit (2 MiB), in protocol data every node holds and the dashboard shows. It says whose
and where the key is: at most 256 bytes now (`sshsig::MAX_COMMENT`), a longer one
refused with the key.
|
| |
|
|
|
|
|
|
|
|
|
| |
Review 4, F12: `Screening::of` started screening over when the document was swapped (a
drop, a switch, a rejoin), the root pin alone carried on, so whether the document had
held a policy (`policed`, 1211) was forgotten there too, not only across a restart as
documented: after a drop with the policy removed meanwhile, late changes written under
it went in unjudged again.
It is carried on now, as the root pin is; what belongs to the old document (changes
waiting, refusals, drops held) still starts over. access.md says so.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Review 4, F11: only streams answered to a token ended with it (1273); one opened by
password (basic authentication) or a proxy's header went on after its user was
disabled or removed.
`streams_end` now wraps those too, by the user `basic_auth` leaves on the answer: such
a stream ends once the document no longer has its user, enabled
(`token::user_taken`, the part of a token's check about its user, which
`still_taken` uses too), looked at as the stream begins and as protocol data changes.
No expiry: a password has none.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Review 4, F7: `DELETE /auth/session` recorded the session as ended until the
`session_exp` of the token it came with. A token handed to another member's dashboard
has its `session_exp` cut to its own end (five minutes), and so has the session that
dashboard keeps with it: logging out there recorded an end minutes away, the next
remake's snapshot left it out, and the original browser's tokens of the same session,
refreshable for days, were taken again.
A token now keeps the login's end as it logged in (`Claims::login_exp`), which no
refresh changes, and an ended session is recorded until then (or the token's
`session_exp`, if later, as for a token from before the field).
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A token was checked when a request came, and a stream answered to it (the dashboard's
events, a subscription's links and messages, the store's streams) then went on for as
long as the client kept it open: past the token's expiry, past its user's tokens being
revoked, its user disabled or removed, its session ended.
Now a middleware inside `login::bearer` (`login::streams_end`) ends a streaming answer
(`text/event-stream`, `application/x-ndjson`) to a request with a token at the token's
deadline, its expiry, or as soon as the document no longer takes it
(`token::still_taken`, the checks `verify` makes of the document, now its own
function): looked at when a change touches protocol data (the root, a switch, among
it), and when a session ends on the node itself in a swarm without a registry
(`AppState::session_ended`). No polling: a timer for the expiry, and the changes as
they come. The client reconnects with the token it has then; a refreshed token is a
new one, so a stream lasts a token's lifetime at most (12 hours by default).
`futures` is a dependency of every build now (for `take_until`), not only of libp2p's
and Tor's.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A capability's path covered by prefix only, so what is the same at every key of a map
(each node's log filter, say, at `_continuum/local/<id>/log` from the next patch on)
took a capability per key. Now a `*` segment stands for any one key, as it already does
in signed paths and sealed places (`envelope`, `sealed`, which now share one `agree`):
* covering (`Capability::covers`): the pattern no longer than the path, and agreeing
with it segment by segment;
* listings (`reaches`): pattern and path agreeing on the segments both have, so every
key on the way shows, nothing past where the pattern differs;
* narrowing (`Capability::holds`, for a token's limit narrowed again and a refresh's):
at or below, a `*` only under a `*`: a limit naming one key never widens to all.
A `*` first is outside protocol data, so it never covers `_continuum`, as `[]` doesn't.
A key that is `*` itself can't be named alone. Every node judges changes by
capabilities, so all must read them alike: they run the same version.
|
| |
|
|
|
|
|
|
| |
A key's line was stored as the key alone (`ssh-ed25519 <base64>`), whatever comment it
came with, both from `PUT /auth/keys/<name>` and from `--bootstrap-keys`. Now its
comment is kept after it (`PublicKey::kept_line`), the spaces between its words made
one. The comment checks nothing: every use of a key parses the line, and the parse
reads the key alone.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The credentials dialog listed a user's keys whole, to add one or
remove one but the last, and any failure replaced the dialog with the
error, the form lost.
* A key is shown short: its type, the first and last four characters
of what tells it apart (an Ed25519 key's base64 after the part all of
them share), its comment; the whole line in its tooltip.
* A key can be edited, its name and its line: saved under the name, a
new name written first and the old one removed.
* A user with a password on this node (`--htpasswd`) may remove its
last key: it logs in by the password. GET /auth/keys says so
(`password`), and DELETE /auth/keys/{id} takes it then; the rules no
longer keep the last key on every node (no other node can tell who
has a password where; under a strict policy the signed entry keeps
one still).
* What fails says why beside where it was asked (the add form, the
edited row, the removed one), which stays as it was, to be set right
and tried again.
|
| |
|
|
|
|
|
| |
How many changes apply_bytes applied was read only by the handler of
SIGNATURES, which re-screened the changes waiting for them and
published those that went in. With SIGNATURES gone (1219), nothing
reads it: Outcome loses the field.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Review 3, R1: what a node received was vouched for only while its own
document's policy required signatures. A joiner's first sync, and
every node's message bringing `required`, went in by the rules alone:
a malicious first peer could plant changes under other members' actors
at their next seqs, their real ones then failing as duplicates for
good.
The signatures a message carries are always offered now, and the
screen always has them: a change waits for one where the policy at the
heads it is judged at requires it (rules::Reads::required, read once
per heads), whatever the receiving document holds. Changes written
under a policy not requiring signatures wait for none, as on every
other node; the check for forged changes runs always. Changes waiting
for a signature are judged again whenever signatures come.
The test of signatures required now takes the history into an empty
document; a new one takes changes written under a policy not requiring
them without any.
|
| |
|
|
|
|
|
|
| |
Each change taken but not yet applied got its own set of the heads it
is judged at, built in an ordered set and copied into a vector, and
kept so for those building on it. Most build on one change alone and
are judged at its heads: share them instead (reference counted), and
build a set only for a change with several dependencies.
|
| |
|
|
|
|
|
| |
Screening copied every change it took, and every one left waiting for
a signature, bytes and all, from the batch it had ordered and then
dropped. Move them out of the batch instead; only a refused change,
recorded with why, is still copied.
|
| |
|
|
|
|
|
| |
in_order is about a seventh of screening in the profile, most of it
hashing change hashes: each change went into and out of three maps,
and each dependency into two. Look each hash up once, in a map from
hash to place, and keep the rest by place in vectors.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
The profile of bench_screening puts screening at about 21% of the
samples, half of it Automerge applying the changes. Of the other half,
reading the policy for every change taken is the largest part (3.4%):
reaches_signed reads it, and what users sign, to tell whether the
change must go in before the next is judged.
Read them once, and again only after the document took the accepted
ones; a change to the policy or to what users sign is relevant, taken
at once. A change touching nothing reaches nothing.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
bench_screening showed screening growing quadratically: 1 000 changes
took 29 ms on top of applying them, 10 000 took 2.8 s, and 100 000
didn't finish in minutes. in_order placed changes in rounds, each
taking those, in hash order, whose dependencies were placed: a chain
received in one delta, its hashes in no order of their own, took about
as many rounds as changes, each over all of them.
It now counts, for each change, its dependencies among those received
not placed yet, and places the smallest hash of those with none left,
then those building on it as their counts reach zero (Kahn's
algorithm): n log n, and still the same order on every node, whatever
order the changes came in. One with a dependency neither in the
document nor among them, and what builds on it, still wait.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Review 2, N3: 1150 let any member write an abort decision once a remake
had expired a grace period ago, judged by the change's own time, the
writer's word. A member could race the coordinator's legitimate commit
with an abort dated as it liked; both taken, Automerge shows
one, and nodes that acted on the commit split from those that didn't.
The two writers of such aborts are operator requests whose endpoints
already need write on _continuum/remakes: aborting an expired remake
(DELETE /admin/remakes/{id}) and superseding one (POST
/admin/remakes?force=supersede). Both now commit as the user who asks
(the proposal and its vote with them, for a supersede), which the rules
take as one who may write the decision. The clause judging an abort by
its time goes, and with it the time the rules carried. An expired
remake is still aborted through any member, by an operator.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Review 2, N1: a strict manifest wasn't bound to its base. Any member
could propose an old, legitimately signed one again at the current
heads; nodes would verify it and vote, and every value at a signed
place changed or added since (a ban, a new user, a rotated key, a
changed userSigned or sealed declaration) would be deleted, nothing
after the base being left to replay.
The manifest now names the epoch and the heads it was made at, and a
node takes it (proposing or voting) only for a remake of that epoch
with exactly that base. GET /admin/strict-manifest makes it so;
continuum-signed strict proposes at those heads already.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Review 2, N12: a strict remake kept only the values at the signed
places its manifest names, and copied what holds them as it was. A
member that replaced _continuum/users by a scalar before the turn left
the strict epoch without a registry, where any member may do anything.
The holders of the registry, `_continuum/access` and the bans are now
made anew as maps, with only what the manifest keeps copied into them;
and a manifest keeping no user is refused (at proposal, vote and build
alike), as a strict swarm without one would trust every member.
|