v0.3.14-pre.002-fix.002
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
// file: crates/ksp-worker-raw-transaction-ingest-lib/src/continuity.rs
|
||||
// version: 2
|
||||
// version: 3
|
||||
|
||||
/// Maximum number of simultaneously retained non-repaired run-local gaps.
|
||||
pub(crate) const MAX_RAW_TRANSACTION_INGEST_OPEN_REPAIR_GAPS: usize = 64;
|
||||
const MAX_RAW_TRANSACTION_INGEST_OPEN_REPAIR_GAPS: usize = 64;
|
||||
/// Maximum number of run-local gaps that may actively repair at once.
|
||||
pub(crate) const MAX_RAW_TRANSACTION_INGEST_REPAIR_ACTIVE_GAPS: usize = 1;
|
||||
const MAX_RAW_TRANSACTION_INGEST_REPAIR_ACTIVE_GAPS: usize = 1;
|
||||
/// Maximum number of logical block fetches that a later repair scheduler may admit concurrently.
|
||||
pub(crate) const MAX_RAW_TRANSACTION_INGEST_REPAIR_BLOCK_FETCH_IN_FLIGHT: usize = 4;
|
||||
const MAX_RAW_TRANSACTION_INGEST_REPAIR_BLOCK_FETCH_IN_FLIGHT: usize = 4;
|
||||
/// Maximum number of slots admitted by one later HTTP repair discovery window.
|
||||
pub(crate) const MAX_RAW_TRANSACTION_INGEST_REPAIR_DISCOVERY_WINDOW_SLOTS: u64 = 512;
|
||||
const MAX_RAW_TRANSACTION_INGEST_REPAIR_DISCOVERY_WINDOW_SLOTS: u64 = 512;
|
||||
/// Maximum inclusive slot span admitted for one run-local repair gap.
|
||||
pub(crate) const MAX_RAW_TRANSACTION_INGEST_REPAIR_RANGE_SLOTS: u64 = 4_096;
|
||||
const MAX_RAW_TRANSACTION_INGEST_REPAIR_RANGE_SLOTS: u64 = 4_096;
|
||||
|
||||
/// Private source scope used to prove whether one configured live source can cover another run-local requirement.
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
@@ -107,7 +107,7 @@ impl RawTransactionIngestGapRange {
|
||||
std::option::Option::Some(value) => value,
|
||||
std::option::Option::None => return std::result::Result::Err(crate::runtime_error("continuity.gap_range_overflow")),
|
||||
};
|
||||
if slot_count > crate::MAX_RAW_TRANSACTION_INGEST_REPAIR_RANGE_SLOTS {
|
||||
if slot_count > MAX_RAW_TRANSACTION_INGEST_REPAIR_RANGE_SLOTS {
|
||||
return std::result::Result::Err(crate::runtime_error("continuity.gap_range_too_large"));
|
||||
}
|
||||
return std::result::Result::Ok(Self { end_slot, start_slot });
|
||||
@@ -143,7 +143,7 @@ impl RawTransactionIngestGapRange {
|
||||
std::option::Option::Some(value) => value,
|
||||
std::option::Option::None => return std::result::Result::Ok(std::option::Option::None),
|
||||
};
|
||||
if slot_count > crate::MAX_RAW_TRANSACTION_INGEST_REPAIR_RANGE_SLOTS {
|
||||
if slot_count > MAX_RAW_TRANSACTION_INGEST_REPAIR_RANGE_SLOTS {
|
||||
return std::result::Result::Ok(std::option::Option::None);
|
||||
}
|
||||
return std::result::Result::Ok(std::option::Option::Some(Self { end_slot, start_slot }));
|
||||
@@ -211,10 +211,10 @@ impl RawTransactionIngestGapLedger {
|
||||
return std::result::Result::Err(error);
|
||||
}
|
||||
}
|
||||
if open_gap_count > crate::MAX_RAW_TRANSACTION_INGEST_OPEN_REPAIR_GAPS {
|
||||
if open_gap_count > MAX_RAW_TRANSACTION_INGEST_OPEN_REPAIR_GAPS {
|
||||
return std::result::Result::Err(crate::runtime_error("continuity.open_gap_limit_exceeded"));
|
||||
}
|
||||
if active_gap_count > crate::MAX_RAW_TRANSACTION_INGEST_REPAIR_ACTIVE_GAPS {
|
||||
if active_gap_count > MAX_RAW_TRANSACTION_INGEST_REPAIR_ACTIVE_GAPS {
|
||||
return std::result::Result::Err(crate::runtime_error("continuity.active_gap_limit_exceeded"));
|
||||
}
|
||||
if !self.gaps.is_empty() && self.next_gap_id <= highest_gap_id {
|
||||
@@ -250,7 +250,7 @@ impl RawTransactionIngestGapLedger {
|
||||
}
|
||||
|
||||
/// Private source capability descriptor prepared without network I/O from already validated runtime resources.
|
||||
pub(crate) struct RawTransactionIngestRepairCapabilityDescriptor {
|
||||
pub(crate) struct RawTransactionIngestContinuityCapabilityDescriptor {
|
||||
block_material: bool,
|
||||
commitment: ksp_onchain_transport_lib::SolanaCommitment,
|
||||
http_block_scan: bool,
|
||||
@@ -263,7 +263,7 @@ pub(crate) struct RawTransactionIngestRepairCapabilityDescriptor {
|
||||
source_scope: crate::RawTransactionIngestCoverageScope,
|
||||
}
|
||||
|
||||
impl crate::RawTransactionIngestRepairCapabilityDescriptor {
|
||||
impl crate::RawTransactionIngestContinuityCapabilityDescriptor {
|
||||
/// Creates one private descriptor from source-local capabilities that were validated without issuing repair I/O.
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub(crate) fn new(
|
||||
@@ -324,7 +324,7 @@ struct RawTransactionIngestTargetCoverage {
|
||||
}
|
||||
|
||||
impl RawTransactionIngestTargetCoverage {
|
||||
fn from_capabilities(capabilities: &[crate::RawTransactionIngestRepairCapabilityDescriptor]) -> ksp_core_lib::Result<Self> {
|
||||
fn from_capabilities(capabilities: &[crate::RawTransactionIngestContinuityCapabilityDescriptor]) -> ksp_core_lib::Result<Self> {
|
||||
let mut value = Self { requirements: std::vec::Vec::new() };
|
||||
for capability in capabilities {
|
||||
if let std::result::Result::Err(error) = value.include(capability.commitment, capability.source_scope.clone()) {
|
||||
@@ -363,14 +363,14 @@ impl RawTransactionIngestTargetCoverage {
|
||||
|
||||
/// Run-local continuity contracts prepared from the exact caller-composed live-source aggregate before productive source execution.
|
||||
pub(crate) struct RawTransactionIngestContinuityContracts {
|
||||
capabilities: std::vec::Vec<crate::RawTransactionIngestRepairCapabilityDescriptor>,
|
||||
capabilities: std::vec::Vec<crate::RawTransactionIngestContinuityCapabilityDescriptor>,
|
||||
gap_ledger: RawTransactionIngestGapLedger,
|
||||
target_coverage: RawTransactionIngestTargetCoverage,
|
||||
}
|
||||
|
||||
impl crate::RawTransactionIngestContinuityContracts {
|
||||
/// Builds the private capability inventory, conservative `TargetCoverage` and empty run-local gap ledger without issuing network or Store I/O.
|
||||
pub(crate) fn new(capabilities: std::vec::Vec<crate::RawTransactionIngestRepairCapabilityDescriptor>) -> ksp_core_lib::Result<Self> {
|
||||
pub(crate) fn new(capabilities: std::vec::Vec<crate::RawTransactionIngestContinuityCapabilityDescriptor>) -> ksp_core_lib::Result<Self> {
|
||||
if capabilities.is_empty() || capabilities.len() > crate::MAX_RAW_TRANSACTION_INGEST_LIVE_SOURCES {
|
||||
return std::result::Result::Err(crate::runtime_error("continuity.capability_inventory_size_invalid"));
|
||||
}
|
||||
@@ -398,9 +398,9 @@ impl crate::RawTransactionIngestContinuityContracts {
|
||||
if !coverage_scope_catalog_is_complete() {
|
||||
return std::result::Result::Err(crate::runtime_error("continuity.coverage_scope_catalog_invalid"));
|
||||
}
|
||||
if crate::MAX_RAW_TRANSACTION_INGEST_REPAIR_BLOCK_FETCH_IN_FLIGHT == 0
|
||||
|| crate::MAX_RAW_TRANSACTION_INGEST_REPAIR_DISCOVERY_WINDOW_SLOTS == 0
|
||||
|| crate::MAX_RAW_TRANSACTION_INGEST_REPAIR_DISCOVERY_WINDOW_SLOTS > crate::MAX_RAW_TRANSACTION_INGEST_REPAIR_RANGE_SLOTS
|
||||
if MAX_RAW_TRANSACTION_INGEST_REPAIR_BLOCK_FETCH_IN_FLIGHT == 0
|
||||
|| MAX_RAW_TRANSACTION_INGEST_REPAIR_DISCOVERY_WINDOW_SLOTS == 0
|
||||
|| MAX_RAW_TRANSACTION_INGEST_REPAIR_DISCOVERY_WINDOW_SLOTS > MAX_RAW_TRANSACTION_INGEST_REPAIR_RANGE_SLOTS
|
||||
{
|
||||
return std::result::Result::Err(crate::runtime_error("continuity.repair_bounds_invalid"));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-worker-raw-transaction-ingest-lib/src/lib.rs
|
||||
// version: 27
|
||||
// version: 28
|
||||
|
||||
#![warn(missing_docs)]
|
||||
#![deny(unreachable_pub)]
|
||||
@@ -111,22 +111,12 @@ pub use self::snapshot::RawTransactionIngestSourceState;
|
||||
pub(crate) use self::admission::RawTransactionAdmission;
|
||||
/// Crate-private source-neutral ingress sent through the bounded central admission queue.
|
||||
pub(crate) use self::admission::RawTransactionIngress;
|
||||
/// Maximum number of simultaneously retained non-repaired run-local continuity gaps.
|
||||
pub(crate) use self::continuity::MAX_RAW_TRANSACTION_INGEST_OPEN_REPAIR_GAPS;
|
||||
/// Maximum number of run-local continuity gaps that may actively repair at once.
|
||||
pub(crate) use self::continuity::MAX_RAW_TRANSACTION_INGEST_REPAIR_ACTIVE_GAPS;
|
||||
/// Maximum number of logical block fetches reserved for the later bounded repair scheduler.
|
||||
pub(crate) use self::continuity::MAX_RAW_TRANSACTION_INGEST_REPAIR_BLOCK_FETCH_IN_FLIGHT;
|
||||
/// Maximum number of slots reserved for one later HTTP repair discovery window.
|
||||
pub(crate) use self::continuity::MAX_RAW_TRANSACTION_INGEST_REPAIR_DISCOVERY_WINDOW_SLOTS;
|
||||
/// Maximum inclusive slot span accepted by one run-local repair gap.
|
||||
pub(crate) use self::continuity::MAX_RAW_TRANSACTION_INGEST_REPAIR_RANGE_SLOTS;
|
||||
/// Private source continuity-capability descriptor prepared without network or Store I/O.
|
||||
pub(crate) use self::continuity::RawTransactionIngestContinuityCapabilityDescriptor;
|
||||
/// Private run-local continuity aggregate containing capabilities, TargetCoverage and the gap ledger.
|
||||
pub(crate) use self::continuity::RawTransactionIngestContinuityContracts;
|
||||
/// Private provider-neutral coverage scope used by run-local continuity proof contracts.
|
||||
pub(crate) use self::continuity::RawTransactionIngestCoverageScope;
|
||||
/// Private source capability descriptor prepared without repair I/O.
|
||||
pub(crate) use self::continuity::RawTransactionIngestRepairCapabilityDescriptor;
|
||||
/// Creates one terminal content-conflict error without copying conflicting material into diagnostics.
|
||||
pub(crate) use self::error::content_conflict_error;
|
||||
/// Creates one terminal counter-exhaustion error without exposing runtime material.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-worker-raw-transaction-ingest-lib/src/runtime_resources.rs
|
||||
// version: 28
|
||||
// version: 29
|
||||
|
||||
use sha2::Digest; // rust-rules: trait-import
|
||||
|
||||
@@ -76,7 +76,7 @@ impl RawTransactionIngestLiveSource {
|
||||
};
|
||||
}
|
||||
|
||||
fn repair_capability_descriptor(&self) -> ksp_core_lib::Result<crate::RawTransactionIngestRepairCapabilityDescriptor> {
|
||||
fn repair_capability_descriptor(&self) -> ksp_core_lib::Result<crate::RawTransactionIngestContinuityCapabilityDescriptor> {
|
||||
let commitment = match self {
|
||||
Self::HeliusTransaction(source) => source.commitment,
|
||||
Self::HttpBlockPolling(source) => source.commitment,
|
||||
@@ -142,7 +142,7 @@ impl RawTransactionIngestLiveSource {
|
||||
};
|
||||
let block_material = live_block_material || http_block_scan;
|
||||
let slot_enumerating = http_block_scan;
|
||||
return crate::RawTransactionIngestRepairCapabilityDescriptor::new(
|
||||
return crate::RawTransactionIngestContinuityCapabilityDescriptor::new(
|
||||
self.source_key(),
|
||||
self.network().clone(),
|
||||
commitment,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-worker-raw-transaction-ingest-lib/tests/hardening.rs
|
||||
// version: 25
|
||||
// version: 26
|
||||
|
||||
//! External public, security, redaction and release-boundary hardening canaries through `v0.3.14-pre.002`.
|
||||
|
||||
@@ -974,7 +974,7 @@ fn v0_3_14_pre_002_continuity_contracts_are_private_bounded_and_io_free() {
|
||||
"KnownReferences",
|
||||
"RawTransactionIngestGapLedger",
|
||||
"RawTransactionIngestTargetCoverage",
|
||||
"RawTransactionIngestRepairCapabilityDescriptor",
|
||||
"RawTransactionIngestContinuityCapabilityDescriptor",
|
||||
"RawTransactionIngestContinuityContracts",
|
||||
"continuity.known_references_not_target_scope",
|
||||
"continuity.coalescible_gap_ranges",
|
||||
@@ -1008,6 +1008,7 @@ fn v0_3_14_pre_002_continuity_contracts_are_private_bounded_and_io_free() {
|
||||
assert!(!continuity.contains(forbidden), "pre.002 continuity contract performed or imported forbidden I/O/boundary: {forbidden}");
|
||||
}
|
||||
assert!(!root.contains("pub use self::continuity::"));
|
||||
assert!(!root.contains("repair"), "pre.002 private continuity wiring leaked repair responsibility through crate root");
|
||||
assert!(root.contains("pub(crate) use self::continuity::RawTransactionIngestContinuityContracts;"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-worker-raw-transaction-ingest-lib/unit_tests/continuity.rs
|
||||
// version: 1
|
||||
// version: 2
|
||||
|
||||
fn network() -> std::option::Option<ksp_store_lib::RawNetworkId> {
|
||||
return match ksp_store_lib::RawNetworkId::new("mainnet") {
|
||||
@@ -16,12 +16,12 @@ fn capability(
|
||||
source_key_byte: u8,
|
||||
commitment: ksp_onchain_transport_lib::SolanaCommitment,
|
||||
scope: crate::RawTransactionIngestCoverageScope,
|
||||
) -> std::option::Option<crate::RawTransactionIngestRepairCapabilityDescriptor> {
|
||||
) -> std::option::Option<crate::RawTransactionIngestContinuityCapabilityDescriptor> {
|
||||
let network = match network() {
|
||||
std::option::Option::Some(value) => value,
|
||||
std::option::Option::None => return std::option::Option::None,
|
||||
};
|
||||
return match crate::RawTransactionIngestRepairCapabilityDescriptor::new(
|
||||
return match crate::RawTransactionIngestContinuityCapabilityDescriptor::new(
|
||||
[source_key_byte; 32],
|
||||
network,
|
||||
commitment,
|
||||
@@ -67,19 +67,19 @@ fn gap(
|
||||
|
||||
#[test]
|
||||
fn pre_002_repair_bounds_are_exact_and_run_local() {
|
||||
assert_eq!(crate::MAX_RAW_TRANSACTION_INGEST_OPEN_REPAIR_GAPS, 64);
|
||||
assert_eq!(crate::MAX_RAW_TRANSACTION_INGEST_REPAIR_ACTIVE_GAPS, 1);
|
||||
assert_eq!(crate::MAX_RAW_TRANSACTION_INGEST_REPAIR_BLOCK_FETCH_IN_FLIGHT, 4);
|
||||
assert_eq!(crate::MAX_RAW_TRANSACTION_INGEST_REPAIR_DISCOVERY_WINDOW_SLOTS, 512);
|
||||
assert_eq!(crate::MAX_RAW_TRANSACTION_INGEST_REPAIR_RANGE_SLOTS, 4_096);
|
||||
assert_eq!(super::MAX_RAW_TRANSACTION_INGEST_OPEN_REPAIR_GAPS, 64);
|
||||
assert_eq!(super::MAX_RAW_TRANSACTION_INGEST_REPAIR_ACTIVE_GAPS, 1);
|
||||
assert_eq!(super::MAX_RAW_TRANSACTION_INGEST_REPAIR_BLOCK_FETCH_IN_FLIGHT, 4);
|
||||
assert_eq!(super::MAX_RAW_TRANSACTION_INGEST_REPAIR_DISCOVERY_WINDOW_SLOTS, 512);
|
||||
assert_eq!(super::MAX_RAW_TRANSACTION_INGEST_REPAIR_RANGE_SLOTS, 4_096);
|
||||
return;
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pre_002_gap_range_is_inclusive_bounded_and_overflow_safe() {
|
||||
assert!(super::RawTransactionIngestGapRange::new(10, 9).is_err());
|
||||
assert!(super::RawTransactionIngestGapRange::new(10, 10 + crate::MAX_RAW_TRANSACTION_INGEST_REPAIR_RANGE_SLOTS - 1).is_ok());
|
||||
assert!(super::RawTransactionIngestGapRange::new(10, 10 + crate::MAX_RAW_TRANSACTION_INGEST_REPAIR_RANGE_SLOTS).is_err());
|
||||
assert!(super::RawTransactionIngestGapRange::new(10, 10 + super::MAX_RAW_TRANSACTION_INGEST_REPAIR_RANGE_SLOTS - 1).is_ok());
|
||||
assert!(super::RawTransactionIngestGapRange::new(10, 10 + super::MAX_RAW_TRANSACTION_INGEST_REPAIR_RANGE_SLOTS).is_err());
|
||||
assert!(super::RawTransactionIngestGapRange::new(u64::MAX, u64::MAX).is_ok());
|
||||
return;
|
||||
}
|
||||
@@ -168,7 +168,7 @@ fn pre_002_known_references_can_never_be_configured_target_coverage() {
|
||||
std::option::Option::Some(value) => value,
|
||||
std::option::Option::None => panic!("network fixture unavailable"),
|
||||
};
|
||||
let result = crate::RawTransactionIngestRepairCapabilityDescriptor::new(
|
||||
let result = crate::RawTransactionIngestContinuityCapabilityDescriptor::new(
|
||||
[1_u8; 32],
|
||||
network,
|
||||
ksp_onchain_transport_lib::SolanaCommitment::Confirmed,
|
||||
@@ -220,7 +220,7 @@ fn pre_002_gap_ledger_enforces_open_gap_bound_and_next_id_monotonicity() {
|
||||
std::option::Option::None => panic!("network fixture unavailable"),
|
||||
};
|
||||
let mut gaps = std::vec::Vec::new();
|
||||
for index in 0..=crate::MAX_RAW_TRANSACTION_INGEST_OPEN_REPAIR_GAPS {
|
||||
for index in 0..=super::MAX_RAW_TRANSACTION_INGEST_OPEN_REPAIR_GAPS {
|
||||
let gap_id = (index as u64) + 1;
|
||||
let slot = (index as u64) * 2;
|
||||
let gap = match gap(gap_id, 1, slot, slot, super::RawTransactionIngestGapState::Pending) {
|
||||
|
||||
Reference in New Issue
Block a user