aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/federation.md2
-rw-r--r--docs/store.md15
-rw-r--r--src/federation/store/memory.rs9
3 files changed, 17 insertions, 9 deletions
diff --git a/docs/federation.md b/docs/federation.md
index cc26951..63c4ccd 100644
--- a/docs/federation.md
+++ b/docs/federation.md
@@ -657,7 +657,7 @@ crafted events. *Sim*: a simulation. *Bench*: measured, not judged.
| 51 | A node whose operator had it drop a version is sent it again, written anew by another node, or holds the votes that passed it | It refuses any event writing that version and writes it no more, until its operator says otherwise | unit |
| 52 | A party taken out and let in again | The list it wrote before counts no more: its list's `since` is the version that let it in | unit |
| 53 | A version naming checkpoint heads its proposal isn't above, or a vote on it, or a version event writing it, that isn't | No version, or refused: moving to a checkpoint refuses nothing that decided it | unit |
-| 54 | An event not above a checkpoint's heads (written beside them, or built on one that was), after nodes moved to it | Refused; its party signs it again | unit |
+| 54 | An event not above a checkpoint's heads (written beside them, built on one that was, or naming one before them), after nodes moved to it | Refused; its party signs it again | unit |
| 55 | A checkpoint a node can't build, handed to it by peers, or a fork's root it can't check | Taken only where its operator pinned it, or named the fork | unit |
| 56 | Two versions changing one, naming different checkpoints | As 12: each node keeps the one it took, and moves to its checkpoint | unit |
| 57 | A key added back, or a place given back, after a checkpoint | Brings back nothing signed before the checkpoint that counted no more there | unit |
diff --git a/docs/store.md b/docs/store.md
index b766d41..81f508f 100644
--- a/docs/store.md
+++ b/docs/store.md
@@ -22,9 +22,9 @@ lower-case hex digits. In its bytes it names the events it builds on, its
**dependencies**, by their IDs; how it names them is its fold's. An event's **history**
is everything it builds on: its dependencies, theirs, and so on, which its ID fixes. The
**heads** of a set of events are the events nothing in it builds on. An event is
-**above** some heads where it has them all in its history, and every event of its
-history that isn't one of them, nor in their history, has them all in its own: it builds
-on them, and on nothing written beside them. None of the heads is above them.
+**above** some heads where it has them all in its history, and each of its dependencies
+is one of them or above them: it builds on them, names nothing before them, and builds on
+nothing written beside them. None of the heads is above them.
## Checkpoints
@@ -35,11 +35,10 @@ by the hash of its encoding, which its fold gives, and built byte for byte from
heads, so every node holding the history up to them builds the same one.
A store holds a checkpoint, the events it keeps, byte for byte, and the events after it:
-each above the checkpoint's heads, its dependencies among those heads and the events
-after them. The heads are held by their IDs, whether the checkpoint keeps them or not,
-and a head brought again is taken as held; a root is its own checkpoint's one head
-(below). A store takes an event only once it holds its dependencies, so it holds every
-event's history back to its checkpoint.
+each above the checkpoint's heads. The heads are held by their IDs, whether the
+checkpoint keeps them or not, and a head brought again is taken as held; a root is its
+own checkpoint's one head (below). A store takes an event only once it holds its
+dependencies, so it holds every event's history back to its checkpoint.
A store's first checkpoint is its **root**, taken without judging, whose ID is the
store's: its bytes are a checkpoint's, which no fold reads as an event, so the store
diff --git a/src/federation/store/memory.rs b/src/federation/store/memory.rs
index 33e895d..6a67bfa 100644
--- a/src/federation/store/memory.rs
+++ b/src/federation/store/memory.rs
@@ -751,6 +751,12 @@ mod tests {
store.offer(testfold::put(&[first], "c", "1")),
Offered::Refused(Refusal::NotAbove)
);
+ // On its heads, but naming what came before them too: not above them.
+ let second = Id::of(&testfold::put(&[first], "a", "2"));
+ assert_eq!(
+ store.offer(testfold::put(&[lock, second], "c", "1")),
+ Offered::Refused(Refusal::NotAbove)
+ );
let root = store.id();
assert_eq!(
store.offer(testfold::put(&[root], "c", "1")),
@@ -774,10 +780,13 @@ mod tests {
let here = taken(store.offer(testfold::put(&[root], "a", "1")));
let beside = taken(store.offer(testfold::put(&[root], "b", "1")));
let on_beside = taken(store.offer(testfold::put(&[beside], "c", "1")));
+ // Built on the heads, but naming the root as well.
+ let naming = taken(store.offer(testfold::put(&[here, root], "d", "1")));
let cut = taken(store.offer(testfold::cut(&[here], 1, &[here])));
assert_eq!(store.taken(), &[cut]);
assert_eq!(store.refusal(&beside), Some(&Refusal::NotAbove));
assert_eq!(store.refusal(&on_beside), Some(&Refusal::NotAbove));
+ assert_eq!(store.refusal(&naming), Some(&Refusal::NotAbove));
assert!(!store.state().counts().contains_key("b"));
}