aboutsummaryrefslogtreecommitdiffstats
path: root/src/simtest
diff options
context:
space:
mode:
Diffstat (limited to 'src/simtest')
-rw-r--r--src/simtest/holding.rs22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/simtest/holding.rs b/src/simtest/holding.rs
index 743e354..a7fc116 100644
--- a/src/simtest/holding.rs
+++ b/src/simtest/holding.rs
@@ -1407,12 +1407,13 @@ async fn store_attack_30() {
}
/// A swarm on the epoch of a compaction whose snapshot holds a checkpoint, and d, of
-/// makefu, serving an epoch of that generation it made up, of a lower ID, whose snapshot
-/// holds the root and tv's write alone, as the document stood before the checkpoint:
-/// the simulation, its nodes (a, b, c, d), the federation's first version and ID, tv's
-/// write, and the two epochs.
+/// makefu, serving an epoch of that generation it made up, of a `lower` ID or a higher,
+/// whose snapshot holds the root and tv's write alone, as the document stood before the
+/// checkpoint: the simulation, its nodes (a, b, c, d), the federation's first version
+/// and ID, tv's write, and the two epochs.
async fn made_up_epoch(
seed: u64,
+ lower: bool,
) -> (
Sim,
Vec<AppState>,
@@ -1496,8 +1497,8 @@ async fn made_up_epoch(
)
.expect("a snapshot")
})
- .find(|snapshot| snapshot.epoch.id < honest.id)
- .expect("a lower epoch");
+ .find(|snapshot| (snapshot.epoch.id < honest.id) == lower)
+ .expect("an epoch");
let lower = made_up.epoch;
assert!(events::checkpoint(&made_up.doc).is_none());
crate::remake::testing::serve(&nodes[3], lower, made_up.doc).await;
@@ -1519,7 +1520,8 @@ fn not_followed(node: &AppState) -> bool {
/// epoch, whose checkpoint it neither builds nor has pinned.
#[tokio::test(flavor = "multi_thread", worker_threads = 4)]
async fn store_attack_15() {
- let (sim, nodes, _, id, head, _, lower) = made_up_epoch(97).await;
+ // Of a higher ID than the others', which so leave it alone.
+ let (sim, nodes, _, id, head, _, made_up) = made_up_epoch(97, false).await;
let away: [(&str, &[&str]); 2] = [("e", &["a", "b", "c", "f"]), ("f", &["d", "e"])];
for (joiner, others) in away {
for other in others {
@@ -1535,7 +1537,9 @@ async fn store_attack_15() {
sim.wait_until(
"e takes the made-up epoch, with tv's write",
Duration::from_secs(60),
- move || async move { e.local_epoch() == lower && e.is_ready().await && holds(e, &[head]) },
+ move || async move {
+ e.local_epoch() == made_up && e.is_ready().await && holds(e, &[head])
+ },
)
.await;
let d = &nodes[3];
@@ -1559,7 +1563,7 @@ async fn store_attack_15() {
/// pinned, and stays where it is, taking what is written on.
#[tokio::test(flavor = "multi_thread", worker_threads = 4)]
async fn store_attack_31() {
- let (sim, nodes, _, _, head, honest, _) = made_up_epoch(98).await;
+ let (sim, nodes, _, _, head, honest, _) = made_up_epoch(98, true).await;
let all = &nodes;
sim.wait_until(
"a, b and c don't follow d's epoch",