aboutsummaryrefslogtreecommitdiffstats
path: root/src/simtest
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-08 09:50:01 +0000
committertv <tv@krebsco.de>2026-11-08 14:29:51 +0100
commitd015ec9500fbb6b0e54977e1c5ea616483e06d68 (patch)
treec0386d5876d5f45c411a2994050eaea9c90d61fd /src/simtest
parent800ef4faf27abebbce8a553763d6e60662fde997 (diff)
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.
Diffstat (limited to 'src/simtest')
-rw-r--r--src/simtest/policy.rs28
1 files changed, 18 insertions, 10 deletions
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);
}