Skip to content

Commit 276b8c7

Browse files
nits
1 parent faf5c6e commit 276b8c7

1 file changed

Lines changed: 9 additions & 17 deletions

File tree

consensus/src/marshal/mocks/harness.rs

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -994,12 +994,11 @@ pub fn certify_at_later_view_survives_earlier_view_pruning<H: TestHarness>() {
994994
);
995995
let orphan_digest = H::digest(&orphan);
996996

997-
// Verify `repeated` at V=1, then certify at V=100 (reproposal-style gap).
998-
// Chain views below are disjoint from V=1 and V=100 so the verified cache
999-
// at those views is not overwritten by chain proposals (verified_blocks
1000-
// drops subsequent writes at an existing view index).
997+
// Verify `repeated` at V=1, then certify at V=25 (reproposal-style gap).
998+
// The chain below starts at V=2 to avoid overwriting V=1 in the
999+
// verified archive (which drops subsequent writes at an existing view).
10011000
let v_early = Round::new(Epoch::zero(), View::new(1));
1002-
let v_late = Round::new(Epoch::zero(), View::new(100));
1001+
let v_late = Round::new(Epoch::zero(), View::new(25));
10031002
let mut peers: [ValidatorHandle<H>; 0] = [];
10041003
H::verify(&mut handle, v_early, &repeated, &mut peers).await;
10051004
assert!(
@@ -1011,12 +1010,11 @@ pub fn certify_at_later_view_survives_earlier_view_pruning<H: TestHarness>() {
10111010
H::verify(&mut handle, v_early, &orphan, &mut peers).await;
10121011

10131012
// Drive the finalized chain forward to advance `last_processed_round`
1014-
// past V=1's retention boundary but not past V=100's. With
1013+
// past V=1's retention boundary but not past V=25's. With
10151014
// view_retention_timeout=10 and prunable_items_per_section=10,
1016-
// processing views 50..=70 leaves `oldest_allowed=60` in both prunable
1017-
// archives. V=1 is dropped, V=100 is retained.
1015+
// processing views 2..=22 leaves `oldest_allowed=12` in both prunable
1016+
// archives. V=1 is dropped, V=25 is retained.
10181017
const CHAIN_LEN: u64 = 21;
1019-
const CHAIN_START_VIEW: u64 = 50;
10201018
let mut parent = Sha256::hash(b"");
10211019
let mut parent_commitment = H::genesis_parent_commitment(NUM_VALIDATORS as u16);
10221020
for i in 1..=CHAIN_LEN {
@@ -1029,17 +1027,11 @@ pub fn certify_at_later_view_survives_earlier_view_pruning<H: TestHarness>() {
10291027
);
10301028
let digest = H::digest(&block);
10311029
let commitment = H::commitment(&block);
1032-
let view = View::new(CHAIN_START_VIEW + i - 1);
1033-
let round = Round::new(Epoch::zero(), view);
1030+
let round = Round::new(Epoch::zero(), View::new(i + 1));
10341031
H::propose(&mut handle, round, &block).await;
1035-
let parent_view = if i == 1 {
1036-
View::zero()
1037-
} else {
1038-
View::new(CHAIN_START_VIEW + i - 2)
1039-
};
10401032
let proposal = Proposal {
10411033
round,
1042-
parent: parent_view,
1034+
parent: View::new(i),
10431035
payload: commitment,
10441036
};
10451037
let finalization = H::make_finalization(proposal, &schemes, QUORUM);

0 commit comments

Comments
 (0)