Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
0d50423
Changes the buffer pool itself to provide data integrity at the page …
roberto-bayardo Dec 28, 2025
2c26be4
Rebase fixes
roberto-bayardo Jan 8, 2026
3e5f307
fix recovery test
roberto-bayardo Jan 8, 2026
3e0628c
fix fuzz tests and conformance tests
roberto-bayardo Jan 8, 2026
19e60fc
adjust one more recovery test
roberto-bayardo Jan 8, 2026
d0c6d53
fix last recovery test
roberto-bayardo Jan 8, 2026
413c42c
rustfmt
roberto-bayardo Jan 8, 2026
c0b6323
Remove obsolete conformance test
roberto-bayardo Jan 8, 2026
64991c1
improve read performance
roberto-bayardo Jan 8, 2026
2ddcaf0
review comments
roberto-bayardo Jan 8, 2026
e2f6f91
restore glob + checksummismatch error
roberto-bayardo Jan 8, 2026
585ef66
restore ChecksumMismatched error
roberto-bayardo Jan 8, 2026
b65943e
[runtime] Buffer Pool Nits (#2736)
patrick-ogrady Jan 8, 2026
a5fa889
use codec
patrick-ogrady Jan 8, 2026
11c9805
use checksum
patrick-ogrady Jan 8, 2026
6771aad
[storage] Cleanup Varint Reads (#2737)
patrick-ogrady Jan 8, 2026
37fe820
remove unnecessary function
patrick-ogrady Jan 8, 2026
11c3224
remove unnecessary comment
patrick-ogrady Jan 8, 2026
e22fb24
clamp during generation
patrick-ogrady Jan 8, 2026
2215a43
remove OS buffer references
patrick-ogrady Jan 8, 2026
05a1980
use CHECKSUM_SIZE
patrick-ogrady Jan 8, 2026
50a0d4c
make flush_internal detect when there's no new data
roberto-bayardo Jan 8, 2026
aab9987
explain why we expect
patrick-ogrady Jan 8, 2026
bfbe6ae
remove old record
patrick-ogrady Jan 8, 2026
b97a138
update changes
patrick-ogrady Jan 8, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 9 additions & 3 deletions consensus/fuzz/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,20 @@ use commonware_cryptography::{
};
use commonware_p2p::simulated::{Config as NetworkConfig, Link, Network};
use commonware_runtime::{buffer::PoolRef, deterministic, Clock, Metrics, Runner, Spawner};
use commonware_utils::{max_faults, NZUsize};
use commonware_utils::{max_faults, NZUsize, NZU16};
use futures::{channel::mpsc::Receiver, future::join_all, StreamExt};
use rand::{rngs::StdRng, RngCore, SeedableRng};
use std::{cell::RefCell, num::NonZeroUsize, panic, sync::Arc, time::Duration};
use std::{
cell::RefCell,
num::{NonZeroU16, NonZeroUsize},
panic,
sync::Arc,
time::Duration,
};

pub const EPOCH: u64 = 333;

const PAGE_SIZE: NonZeroUsize = NZUsize!(1024);
const PAGE_SIZE: NonZeroU16 = NZU16!(1024);
const PAGE_CACHE_SIZE: NonZeroUsize = NZUsize!(10);
const MIN_REQUIRED_CONTAINERS: u64 = 10;
const MAX_REQUIRED_CONTAINERS: u64 = 50;
Expand Down
6 changes: 3 additions & 3 deletions consensus/src/aggregation/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,19 +103,19 @@ mod tests {
deterministic::{self, Context},
Clock, Metrics, Quota, Runner, Spawner,
};
use commonware_utils::{test_rng, NZUsize, NonZeroDuration};
use commonware_utils::{test_rng, NZUsize, NonZeroDuration, NZU16};
use futures::{channel::oneshot, future::join_all};
use rand::{rngs::StdRng, Rng};
use std::{
collections::BTreeMap,
num::{NonZeroU32, NonZeroUsize},
num::{NonZeroU16, NonZeroU32, NonZeroUsize},
time::Duration,
};
use tracing::debug;

type Registrations<P> = BTreeMap<P, (Sender<P, deterministic::Context>, Receiver<P>)>;

const PAGE_SIZE: NonZeroUsize = NZUsize!(1024);
const PAGE_SIZE: NonZeroU16 = NZU16!(1024);
const PAGE_CACHE_SIZE: NonZeroUsize = NZUsize!(10);
const TEST_QUOTA: Quota = Quota::per_second(NonZeroU32::MAX);
const TEST_NAMESPACE: &[u8] = b"my testing namespace";
Expand Down
6 changes: 3 additions & 3 deletions consensus/src/marshal/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,15 @@ mod tests {
};
use commonware_runtime::{buffer::PoolRef, deterministic, Clock, Metrics, Quota, Runner};
use commonware_storage::archive::immutable;
use commonware_utils::{vec::NonEmptyVec, NZUsize, NZU64};
use commonware_utils::{vec::NonEmptyVec, NZUsize, NZU16, NZU64};
use futures::StreamExt;
use rand::{
seq::{IteratorRandom, SliceRandom},
Rng,
};
use std::{
collections::BTreeMap,
num::{NonZeroU32, NonZeroU64, NonZeroUsize},
num::{NonZeroU16, NonZeroU32, NonZeroU64, NonZeroUsize},
time::{Duration, Instant},
};
use tracing::info;
Expand All @@ -150,7 +150,7 @@ mod tests {
type S = bls12381_threshold::Scheme<K, V>;
type P = ConstantProvider<S, Epoch>;

const PAGE_SIZE: NonZeroUsize = NZUsize!(1024);
const PAGE_SIZE: NonZeroU16 = NZU16!(1024);
const PAGE_CACHE_SIZE: NonZeroUsize = NZUsize!(10);
const NAMESPACE: &[u8] = b"test";
const NUM_VALIDATORS: u32 = 4;
Expand Down
6 changes: 3 additions & 3 deletions consensus/src/ordered_broadcast/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,16 @@ mod tests {
deterministic::{self, Context},
Clock, Metrics, Quota, Runner, Spawner,
};
use commonware_utils::NZUsize;
use commonware_utils::{NZUsize, NZU16};
use futures::{channel::oneshot, future::join_all};
use std::{
collections::{BTreeMap, HashMap},
num::{NonZeroU32, NonZeroUsize},
num::{NonZeroU16, NonZeroU32, NonZeroUsize},
time::Duration,
};
use tracing::debug;

const PAGE_SIZE: NonZeroUsize = NZUsize!(1024);
const PAGE_SIZE: NonZeroU16 = NZU16!(1024);
const PAGE_CACHE_SIZE: NonZeroUsize = NZUsize!(10);
const TEST_QUOTA: Quota = Quota::per_second(NonZeroU32::MAX);
const TEST_NAMESPACE: &[u8] = b"ordered_broadcast_test";
Expand Down
6 changes: 3 additions & 3 deletions consensus/src/simplex/actors/voter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@ mod tests {
use commonware_macros::{select, test_traced};
use commonware_p2p::simulated::{Config as NConfig, Network};
use commonware_runtime::{deterministic, Clock, Metrics, Quota, Runner};
use commonware_utils::{quorum, NZUsize};
use commonware_utils::{quorum, NZUsize, NZU16};
use futures::{channel::mpsc, FutureExt, StreamExt};
use std::{
num::NonZeroU32,
num::{NonZeroU16, NonZeroU32},
sync::{Arc, Mutex},
time::Duration,
};

const PAGE_SIZE: NonZeroUsize = NZUsize!(1024);
const PAGE_SIZE: NonZeroU16 = NZU16!(1024);
const PAGE_CACHE_SIZE: NonZeroUsize = NZUsize!(10);
const TEST_QUOTA: Quota = Quota::per_second(NonZeroU32::MAX);

Expand Down
6 changes: 3 additions & 3 deletions consensus/src/simplex/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,20 +320,20 @@ mod tests {
use commonware_runtime::{
buffer::PoolRef, deterministic, Clock, Metrics, Quota, Runner, Spawner,
};
use commonware_utils::{max_faults, quorum, test_rng, NZUsize};
use commonware_utils::{max_faults, quorum, test_rng, NZUsize, NZU16};
use engine::Engine;
use futures::{future::join_all, StreamExt};
use rand::{rngs::StdRng, Rng as _};
use std::{
collections::{BTreeMap, HashMap},
num::{NonZeroU32, NonZeroUsize},
num::{NonZeroU16, NonZeroU32, NonZeroUsize},
sync::{Arc, Mutex},
time::Duration,
};
use tracing::{debug, info, warn};
use types::Activity;

const PAGE_SIZE: NonZeroUsize = NZUsize!(1024);
const PAGE_SIZE: NonZeroU16 = NZU16!(1024);
const PAGE_CACHE_SIZE: NonZeroUsize = NZUsize!(10);
const TEST_QUOTA: Quota = Quota::per_second(NonZeroU32::MAX);

Expand Down
4 changes: 2 additions & 2 deletions examples/bridge/src/bin/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use commonware_runtime::{
buffer::PoolRef, tokio, Metrics, Network, Quota, RayonPoolSpawner, Runner,
};
use commonware_stream::{dial, Config as StreamConfig};
use commonware_utils::{from_hex, ordered::Set, union, NZUsize, TryCollect, NZU32};
use commonware_utils::{from_hex, ordered::Set, union, NZUsize, TryCollect, NZU16, NZU32};
use std::{
net::{IpAddr, Ipv4Addr, SocketAddr},
str::FromStr,
Expand Down Expand Up @@ -264,7 +264,7 @@ fn main() {
activity_timeout: ViewDelta::new(10),
skip_timeout: ViewDelta::new(5),
fetch_concurrent: 32,
buffer_pool: PoolRef::new(NZUsize!(16_384), NZUsize!(10_000)),
buffer_pool: PoolRef::new(NZU16!(16_384), NZUsize!(10_000)),
},
);

Expand Down
4 changes: 2 additions & 2 deletions examples/log/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ use commonware_consensus::{
use commonware_cryptography::{ed25519, Sha256, Signer as _};
use commonware_p2p::{authenticated::discovery, Manager};
use commonware_runtime::{buffer::PoolRef, tokio, Metrics, Quota, Runner};
use commonware_utils::{ordered::Set, union, NZUsize, TryCollect, NZU32};
use commonware_utils::{ordered::Set, union, NZUsize, TryCollect, NZU16, NZU32};
use std::{
net::{IpAddr, Ipv4Addr, SocketAddr},
str::FromStr,
Expand Down Expand Up @@ -223,7 +223,7 @@ fn main() {
activity_timeout: ViewDelta::new(10),
skip_timeout: ViewDelta::new(5),
fetch_concurrent: 32,
buffer_pool: PoolRef::new(NZUsize!(16_384), NZUsize!(10_000)),
buffer_pool: PoolRef::new(NZU16!(16_384), NZUsize!(10_000)),
};
let engine = simplex::Engine::new(context.with_label("engine"), cfg);

Expand Down
6 changes: 3 additions & 3 deletions examples/reshare/src/dkg/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ use commonware_storage::journal::{
contiguous::variable::{Config as CVConfig, Journal as CVJournal},
segmented::variable::{Config as SVConfig, Journal as SVJournal},
};
use commonware_utils::{NZUsize, NZU64};
use commonware_utils::{NZUsize, NZU16, NZU64};
use futures::StreamExt;
use std::{
collections::BTreeMap,
num::{NonZeroU32, NonZeroUsize},
num::{NonZeroU16, NonZeroU32, NonZeroUsize},
};
use tracing::debug;

const PAGE_SIZE: NonZeroUsize = NZUsize!(1 << 12);
const PAGE_SIZE: NonZeroU16 = NZU16!(1 << 12);
const POOL_CAPACITY: NonZeroUsize = NZUsize!(1 << 20);
const WRITE_BUFFER: NonZeroUsize = NZUsize!(1 << 12);
const READ_BUFFER: NonZeroUsize = NZUsize!(1 << 20);
Expand Down
10 changes: 7 additions & 3 deletions examples/reshare/src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,14 @@ use commonware_runtime::{
buffer::PoolRef, spawn_cell, Clock, ContextCell, Handle, Metrics, Network, Spawner, Storage,
};
use commonware_storage::archive::immutable;
use commonware_utils::{ordered::Set, union, NZUsize, NZU32, NZU64};
use commonware_utils::{ordered::Set, union, NZUsize, NZU16, NZU32, NZU64};
use futures::{channel::mpsc, future::try_join_all};
use rand_core::CryptoRngCore;
use std::{marker::PhantomData, num::NonZero, time::Instant};
use std::{
marker::PhantomData,
num::{NonZero, NonZeroU16},
time::Instant,
};
use tracing::{error, info, warn};

const MAILBOX_SIZE: usize = 10;
Expand All @@ -45,7 +49,7 @@ const FREEZER_VALUE_TARGET_SIZE: u64 = 1024 * 1024 * 1024; // 1GB
const FREEZER_VALUE_COMPRESSION: Option<u8> = Some(3);
const REPLAY_BUFFER: NonZero<usize> = NZUsize!(8 * 1024 * 1024); // 8MB
const WRITE_BUFFER: NonZero<usize> = NZUsize!(1024 * 1024); // 1MB
const BUFFER_POOL_PAGE_SIZE: NonZero<usize> = NZUsize!(4_096); // 4KB
const BUFFER_POOL_PAGE_SIZE: NonZeroU16 = NZU16!(4_096); // 4KB
const BUFFER_POOL_CAPACITY: NonZero<usize> = NZUsize!(8_192); // 32MB
const MAX_REPAIR: NonZero<usize> = NZUsize!(50);

Expand Down
4 changes: 2 additions & 2 deletions examples/reshare/src/orchestrator/actor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use commonware_parallel::Strategy;
use commonware_runtime::{
buffer::PoolRef, spawn_cell, Clock, ContextCell, Handle, Metrics, Network, Spawner, Storage,
};
use commonware_utils::{vec::NonEmptyVec, NZUsize};
use commonware_utils::{vec::NonEmptyVec, NZUsize, NZU16};
use futures::{channel::mpsc, StreamExt};
use rand_core::CryptoRngCore;
use std::{collections::BTreeMap, marker::PhantomData, time::Duration};
Expand Down Expand Up @@ -105,7 +105,7 @@ where
config: Config<B, V, C, H, A, S, L, St>,
) -> (Self, Mailbox<V, C::PublicKey>) {
let (sender, mailbox) = mpsc::channel(config.mailbox_size);
let pool_ref = PoolRef::new(NZUsize!(16_384), NZUsize!(10_000));
let pool_ref = PoolRef::new(NZU16!(16_384), NZUsize!(10_000));

(
Self {
Expand Down
4 changes: 2 additions & 2 deletions examples/sync/src/databases/any.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use commonware_storage::{
operation::Committable,
},
};
use commonware_utils::{NZUsize, NZU64};
use commonware_utils::{NZUsize, NZU16, NZU64};
use std::{future::Future, num::NonZeroU64};
use tracing::error;

Expand All @@ -39,7 +39,7 @@ pub fn create_config() -> Config<Translator> {
log_write_buffer: NZUsize!(1024),
translator: Translator::default(),
thread_pool: None,
buffer_pool: buffer::PoolRef::new(NZUsize!(1024), NZUsize!(10)),
buffer_pool: buffer::PoolRef::new(NZU16!(1024), NZUsize!(10)),
}
}

Expand Down
4 changes: 2 additions & 2 deletions examples/sync/src/databases/immutable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use commonware_storage::{
Durable, Merkleized,
},
};
use commonware_utils::{NZUsize, NZU64};
use commonware_utils::{NZUsize, NZU16, NZU64};
use std::{future::Future, num::NonZeroU64};
use tracing::error;

Expand All @@ -36,7 +36,7 @@ pub fn create_config() -> Config<Translator, ()> {
log_write_buffer: NZUsize!(1024),
translator: commonware_storage::translator::EightCap,
thread_pool: None,
buffer_pool: commonware_runtime::buffer::PoolRef::new(NZUsize!(1024), NZUsize!(10)),
buffer_pool: commonware_runtime::buffer::PoolRef::new(NZU16!(1024), NZUsize!(10)),
}
}

Expand Down
1 change: 1 addition & 0 deletions runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ commonware-conformance = { workspace = true, optional = true }
commonware-macros.workspace = true
commonware-parallel = { workspace = true, features = ["std"] }
commonware-utils = { workspace = true, features = ["std"] }
crc32fast.workspace = true
futures.workspace = true
governor.workspace = true
io-uring = { workspace = true, optional = true }
Expand Down
4 changes: 4 additions & 0 deletions runtime/conformance.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
["commonware_runtime::storage::tests::conformance::CodecConformance<Header>"]
n_cases = 65536
hash = "541c356728d47b13f1d3ac800926ef3ae2396c82f5d4e043f5c7641c4c22b4b9"

["commonware_runtime::utils::buffer::pool::tests::conformance::CodecConformance<Checksum>"]
n_cases = 65536
hash = "2ca927141b521b7cccc541ec0df8614e418d317fc864ce11f428aefb330cf256"
6 changes: 6 additions & 0 deletions runtime/fuzz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,9 @@ name = "buffer"
path = "fuzz_targets/buffer.rs"
test = false
doc = false

[[bin]]
name = "blob_integrity"
path = "fuzz_targets/blob_integrity.rs"
test = false
doc = false
Loading
Loading