aboutsummaryrefslogtreecommitdiffstats
path: root/src/federation
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-17 04:55:54 +0000
committertv <tv@krebsco.de>2026-11-17 05:58:31 +0100
commite4b709e823f70ee74574cb49367e7bee780d8584 (patch)
tree217339ca7836e3d2a3e37f86e0fe146a2ae03827 /src/federation
parentd55f7c258eb76a4169014dd5ae7ed3465305002b (diff)
held: a checkpoint a node can't build, handed by peers, only pinned (row 22)
Diffstat (limited to 'src/federation')
-rw-r--r--src/federation/held.rs36
1 files changed, 35 insertions, 1 deletions
diff --git a/src/federation/held.rs b/src/federation/held.rs
index 744e959..4b28235 100644
--- a/src/federation/held.rs
+++ b/src/federation/held.rs
@@ -1232,6 +1232,40 @@ mod tests {
);
}
+ /// A checkpoint a node can't build, handed to it by peers, in a snapshot: taken only
+ /// where its operator pinned it.
+ #[test]
+ fn store_attack_22() {
+ let (tv, lass) = (Party::new("tv", 1), Party::new("lass", 2));
+ let first = Spec::first(&[&tv, &lass], &[]);
+ let root = first.root();
+ let on = first.hash();
+ let head = tv.write(&[Id::of(&root)], "home/tv/a", harness::str("1"));
+ let mut next = first.after(on);
+ next.checkpoint = Some(vec![Id::of(&head)]);
+ let proposal = tv.propose(&[Id::of(&head)], &next.json());
+ let votes = [
+ tv.vote(&[Id::of(&proposal)], on, next.hash(), true),
+ lass.vote(&[Id::of(&proposal)], on, next.hash(), true),
+ ];
+ let written = harness::version_event(&[Id::of(&votes[0]), Id::of(&votes[1])], next.hash());
+ let lacking = events::started(Federation::NAME, &root, &[]).unwrap();
+ let mut moved = lacking.fork();
+ for event in [&head, &proposal, &votes[0], &votes[1], &written] {
+ put(&mut moved, event);
+ }
+ let handed = snapshot(&moved, &Holding::default());
+ let pin = Id::of(&events::checkpoint(&handed).unwrap());
+ let store = Some(Id::of(&root));
+ assert!(
+ Holding::default()
+ .follows(&handed, &lacking, store)
+ .is_err()
+ );
+ let pinned = Holding::open(None, Arc::new(Files::default()), Some(pin), None).unwrap();
+ assert!(pinned.follows(&handed, &lacking, store).is_ok());
+ }
+
/// After a switch, what the document left holds beyond the base that a store starting
/// at the new document's checkpoint takes goes again; what nobody takes doesn't.
#[test]
@@ -1788,7 +1822,7 @@ mod tests {
}
/// Rows whose tests wait: remakes (stage 5), and flooding.
- const LATER: &[u32] = &[15, 22, 29, 31];
+ const LATER: &[u32] = &[15, 29, 31];
#[test]
fn every_row_has_its_test() {