Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit a4dd1f0

Browse files
committed
Update tests
1 parent 5f7ee6b commit a4dd1f0

1 file changed

Lines changed: 19 additions & 19 deletions

File tree

node/core/approval-voting/src/approval_checking.rs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -316,10 +316,9 @@ fn count_no_shows(
316316
let mut next_no_show = None;
317317
let no_shows = assignments
318318
.iter()
319-
.map(|(v_index, tick)| (
320-
v_index,
321-
tick.min(&block_tick).saturating_sub(clock_drift) + no_show_duration,
322-
))
319+
.map(|(v_index, tick)| {
320+
(v_index, tick.min(&block_tick).saturating_sub(clock_drift) + no_show_duration)
321+
})
323322
.filter(|&(v_index, no_show_at)| {
324323
let has_approved = if let Some(approved) = approvals.get(v_index.0 as usize) {
325324
*approved
@@ -594,7 +593,7 @@ mod tests {
594593

595594
#[test]
596595
fn tranches_to_approve_everyone_present() {
597-
let block_tick = 0;
596+
let block_tick = 20;
598597
let no_show_duration = 10;
599598
let needed_approvals = 4;
600599

@@ -829,7 +828,7 @@ mod tests {
829828
RequiredTranches::Exact {
830829
needed: 1,
831830
tolerated_missing: 0,
832-
next_no_show: Some(block_tick + no_show_duration + 1),
831+
next_no_show: Some(block_tick + no_show_duration),
833832
},
834833
);
835834

@@ -844,10 +843,11 @@ mod tests {
844843
no_show_duration,
845844
needed_approvals,
846845
),
847-
RequiredTranches::Exact {
848-
needed: 2,
849-
tolerated_missing: 1,
850-
next_no_show: Some(block_tick + 2 * no_show_duration + 2),
846+
RequiredTranches::Pending {
847+
considered: 2,
848+
next_no_show: None,
849+
maximum_broadcast: 3,
850+
clock_drift: block_tick,
851851
},
852852
);
853853

@@ -1079,7 +1079,7 @@ mod tests {
10791079
&test.assignments,
10801080
&approvals,
10811081
test.clock_drift,
1082-
0, // TODO: Ladi, add to tests.
1082+
20,
10831083
test.no_show_duration,
10841084
test.drifted_tick_now,
10851085
);
@@ -1108,8 +1108,8 @@ mod tests {
11081108
clock_drift: 10,
11091109
no_show_duration: 10,
11101110
drifted_tick_now: 20,
1111-
exp_no_shows: 0,
1112-
exp_next_no_show: Some(31),
1111+
exp_no_shows: 1,
1112+
exp_next_no_show: None,
11131113
})
11141114
}
11151115

@@ -1147,8 +1147,8 @@ mod tests {
11471147
clock_drift: 10,
11481148
no_show_duration: 10,
11491149
drifted_tick_now: 20,
1150-
exp_no_shows: 0,
1151-
exp_next_no_show: Some(31),
1150+
exp_no_shows: 2,
1151+
exp_next_no_show: None,
11521152
})
11531153
}
11541154

@@ -1160,8 +1160,8 @@ mod tests {
11601160
clock_drift: 10,
11611161
no_show_duration: 10,
11621162
drifted_tick_now: 20,
1163-
exp_no_shows: 0,
1164-
exp_next_no_show: Some(31),
1163+
exp_no_shows: 2,
1164+
exp_next_no_show: None,
11651165
})
11661166
}
11671167

@@ -1177,8 +1177,8 @@ mod tests {
11771177
clock_drift: 10,
11781178
no_show_duration: 10,
11791179
drifted_tick_now: 20,
1180-
exp_no_shows: 1,
1181-
exp_next_no_show: Some(31),
1180+
exp_no_shows: 2,
1181+
exp_next_no_show: None,
11821182
})
11831183
}
11841184

0 commit comments

Comments
 (0)