From d015ec9500fbb6b0e54977e1c5ea616483e06d68 Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 8 Nov 2026 09:50:01 +0000 Subject: simtest: refused by whichever node judges first In a_strict_swarm and sealed_values, c's forged writes were waited for to be refused by a and by b. Whichever judges them first tells c, which drops them before the other may have judged them (it waits for their signature, or never gets them): wait for a refusal on either, then for c to drop them. --- src/simtest/policy.rs | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'src/simtest/policy.rs') diff --git a/src/simtest/policy.rs b/src/simtest/policy.rs index 8057660..0453c54 100644 --- a/src/simtest/policy.rs +++ b/src/simtest/policy.rs @@ -337,11 +337,16 @@ async fn a_strict_swarm() { let mallory = crate::access::registry::entry("alice", 1, &crate::access::registry::all_caps()); forge(&c, "alice", "_continuum/users/mallory", mallory).await; forge(&c, "alice", "config", json!({"mode": "forged"})).await; + // By whichever node judges them first: c, told, drops them before the other may. + sim.wait_until("the plain writes are refused", SOON, || async { + refused(&a).await + refused(&b).await > 0 + }) + .await; + sim.wait_until("c drops them", SOON, || async { + plain(&c, "_continuum/users/mallory").await.is_none() + }) + .await; for node in [&a, &b] { - sim.wait_until("the plain writes are refused", SOON, move || async move { - refused(node).await > 0 - }) - .await; assert!(plain(node, "_continuum/users/mallory").await.is_none()); assert_eq!(plain(node, "config").await, Some(json!({"mode": "slow"}))); } @@ -414,13 +419,16 @@ async fn sealed_values() { let stray = sealed_for(&[alice_key, PublicKey([22; 32])]); forge(&c, "alice", "secrets/web", json!(stray)).await; forge(&c, "alice", "secrets/api", json!("hunter2")).await; + // By whichever node judges them first: c, told, drops them before the other may. + sim.wait_until("the badly sealed writes are refused", SOON, || async { + refused(&a).await + refused(&b).await > 0 + }) + .await; + sim.wait_until("c drops them", SOON, || async { + !holds(&c, "secrets/web").await + }) + .await; for node in [&a, &b] { - sim.wait_until( - "the badly sealed writes are refused", - SOON, - move || async move { refused(node).await > 0 }, - ) - .await; assert!(!holds(node, "secrets/web").await); assert!(!holds(node, "secrets/api").await); } -- cgit v1.3.1