Skip to content

Commit 90387dc

Browse files
keyless/immutable test generalization
1 parent 59d96a8 commit 90387dc

11 files changed

Lines changed: 2365 additions & 2066 deletions

File tree

storage/src/qmdb/current/db.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -274,10 +274,6 @@ where
274274
/// the receiver's grafted-pin derivation requires chunk-aligned, absorbed state at the start
275275
/// of the range, and locations above this boundary place that derivation in the
276276
/// delayed-merge-unstable region (relevant for MMB).
277-
///
278-
/// For families without delayed merges this is the inactivity floor rounded down to the
279-
/// nearest chunk boundary. For families with delayed merges (MMB) it is held back further,
280-
/// until the youngest pruned chunk-pair's height-`gh+1` parent has been born in the ops tree.
281277
pub fn sync_boundary(&self) -> Result<Location<F>, Error<F>> {
282278
self.settled_bitmap_prune_loc()
283279
}
@@ -397,14 +393,15 @@ where
397393
/// Prunes historical operations prior to `prune_loc`. This does not affect the db's root or
398394
/// snapshot.
399395
///
400-
/// Pruning is clipped to the settled bitmap boundary (see [`Db::sync_boundary`]): the ops
401-
/// log's lower bound is never advanced past where the grafting overlay has been pruned. The
402-
/// bitmap and grafted tree advance to that same settled boundary regardless of `prune_loc`.
396+
/// Pruning is clipped to the settled bitmap boundary (see [`Db::sync_boundary`]): the ops log's
397+
/// lower bound is never advanced past where the grafting overlay has been pruned. The bitmap
398+
/// and grafted tree advance to that same settled boundary regardless of `prune_loc`.
403399
///
404400
/// # Errors
405401
///
406402
/// - Returns [Error::PruneBeyondMinRequired] if `prune_loc` > inactivity floor.
407-
/// - Returns [`crate::merkle::Error::LocationOverflow`] if `prune_loc` > [crate::merkle::Family::MAX_LEAVES].
403+
/// - Returns [`crate::merkle::Error::LocationOverflow`] if `prune_loc` >
404+
/// [crate::merkle::Family::MAX_LEAVES].
408405
pub async fn prune(&mut self, prune_loc: Location<F>) -> Result<(), Error<F>> {
409406
let inactivity_floor = self.inactivity_floor_loc();
410407
if prune_loc > inactivity_floor {

storage/src/qmdb/current/mod.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1820,10 +1820,10 @@ pub mod tests {
18201820
});
18211821
}
18221822

1823-
/// Verify that on a non-delayed-merge (MMR) family `pruning_boundary()` lags the
1824-
/// inactivity floor only by chunk alignment (less than one chunk) — never by a
1825-
/// delayed-merge absorption window. Guards against an accidental regression that
1826-
/// would introduce a larger lag on families that don't need it.
1823+
/// Verify that on a non-delayed-merge (MMR) family `pruning_boundary()` lags the inactivity
1824+
/// floor only by chunk alignment (less than one chunk) — never by a delayed-merge absorption
1825+
/// window. Guards against an accidental regression that would introduce a larger lag on
1826+
/// families that don't need it.
18271827
#[test_traced]
18281828
fn test_current_mmr_prune_boundary_lag_is_only_chunk_alignment() {
18291829
let executor = deterministic::Runner::default();
@@ -1867,9 +1867,8 @@ pub mod tests {
18671867
});
18681868
}
18691869

1870-
/// Verify that `prune(loc)` with `loc < pruning_boundary()` prunes the ops journal only
1871-
/// as far as the caller requested. The clip must pick the smaller of the two — it must
1872-
/// not over-prune when the caller asked for less than the settled boundary.
1870+
/// Verify that `prune(loc)` with `loc < pruning_boundary()` prunes the ops journal only as far
1871+
/// as the caller requested.
18731872
#[test_traced]
18741873
fn test_current_prune_below_settled_boundary_is_honored() {
18751874
let executor = deterministic::Runner::default();

storage/src/qmdb/current/sync/tests.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
//! Tests for [crate::qmdb::current] state sync.
22
//!
3-
//! This module reuses the shared sync test functions from [crate::qmdb::any::sync::tests]
4-
//! by implementing [SyncTestHarness] for current database types. The key difference from
5-
//! `any` harnesses is that `sync_target_root` returns the **ops root** (via
3+
//! This module reuses the shared sync test functions from [crate::qmdb::any::sync::tests] by
4+
//! implementing [SyncTestHarness] for current database types. The key difference from `any`
5+
//! harnesses is that `sync_target_root` returns the **ops root** (via
66
//! [qmdb::sync::Database::root](crate::qmdb::sync::Database::root)), not the canonical root
77
//! returned by `Db::root()`.
88
//!
99
//! Harnesses are instantiated for **both** MMR and MMB merkle families across each (ordered,
10-
//! unordered) x (fixed, variable) database variant, so the shared suite runs twice per
11-
//! variant.
10+
//! unordered) x (fixed, variable) database variant, so the shared suite runs twice per variant.
1211
//!
1312
//! In addition to the shared harness-based suite, this module contains focused tests for
14-
//! `current`-specific sync behavior: overlay-state authentication (canonical-root check),
15-
//! pruned MMB round-trip, and target-update regression coverage.
13+
//! `current`-specific sync behavior: overlay-state authentication (canonical-root check), pruned
14+
//! MMB round-trip, and target-update regression coverage.
1615
1716
use crate::qmdb::{
1817
any::sync::tests::{ConfigOf, SyncTestHarness},

0 commit comments

Comments
 (0)