diff options
Diffstat (limited to 'src/simtest')
| -rw-r--r-- | src/simtest/holding.rs | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/src/simtest/holding.rs b/src/simtest/holding.rs index 12dac23..16158b1 100644 --- a/src/simtest/holding.rs +++ b/src/simtest/holding.rs @@ -774,10 +774,9 @@ async fn store_attack_10() { /// Two checkpoints proposed at once, by nodes voting by themselves: a for tv and b for /// lass, apart, each propose one once their stores took six events, and back it; c votes -/// for makefu, following tv; each votes `false` on a checkpoint beside the one it backs. -/// a and b, together, vote `false` on each other's: the votes split. With c, tv's passes -/// and every node moves there; lass's is dead by the nays of tv and makefu, which their -/// records hold. +/// for makefu, following tv. a and b, together, hold both, each party's `true` on its own: +/// the votes split, and no node votes `false` by a rule. With c, tv's passes by two +/// thirds and every node moves there; lass's lapses with the move. #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn federation_attack_59() { let sim = Sim::with_identity(89); @@ -786,12 +785,10 @@ async fn federation_attack_59() { let dir = crate::files::scratch_dir("sim-attack-59"); let proposing = Rules { propose_events: Some(6), - nay_beside: true, ..Rules::default() }; let following = Rules { follow: vec!["tv".to_owned()], - nay_beside: true, held_for: Duration::from_secs(3600), ..Rules::default() }; @@ -831,20 +828,18 @@ async fn federation_attack_59() { sim.net.bring_up("a"); sim.net.bring_up("b"); sim.wait_until( - "a and b vote `false` on each other's", + "a and b hold both, each party's `true` on its own", LONG, move || async move { all[..2].iter().all(|node| { - ballot(node, "tv") - .is_some_and(|(_, yes, no)| yes == set(&["tv"]) && no == set(&["lass"])) + ballot(node, "tv").is_some_and(|(_, yes, no)| yes == set(&["tv"]) && no.is_empty()) && ballot(node, "lass") - .is_some_and(|(_, yes, no)| yes == set(&["lass"]) && no == set(&["tv"])) + .is_some_and(|(_, yes, no)| yes == set(&["lass"]) && no.is_empty()) }) }, ) .await; let (passing, _, _) = ballot(&nodes[0], "tv").expect("tv's"); - let (other, _, _) = ballot(&nodes[0], "lass").expect("lass's"); sim.net.bring_up("c"); sim.wait_until( "every node moves to tv's checkpoint", @@ -852,18 +847,18 @@ async fn federation_attack_59() { move || async move { all.iter().all(|node| current(node) == Some(passing)) }, ) .await; - for party in ["tv", "makefu"] { + for party in ["tv", "lass", "makefu"] { let record = Record::load(&dir.join(format!("{party}.json"))).expect("its record"); let nay = record.votes.iter().any(|vote| { matches!( Event::read_taken(vote.as_bytes()), Some(Event::Signed(Signed { - does: Does::Vote { proposal, yes: false, .. }, + does: Does::Vote { yes: false, .. }, .. - })) if proposal == other + })) ) }); - assert!(nay, "{party} voted no `false` on lass's checkpoint"); + assert!(!nay, "{party}'s node voted `false`, by no rule of its"); } } |
