v0.3.13-pre.004

This commit is contained in:
2026-09-10 14:25:30 +02:00
parent 31c0a83e51
commit 28e4da3879
13 changed files with 1303 additions and 33 deletions

View File

@@ -1,5 +1,5 @@
// file: crates/ksp-worker-raw-transaction-ingest-lib/tests/dependency_boundary.rs
// version: 19
// version: 20
//! Dependency firewall canaries for the RAW transaction ingest Worker foundation.
@@ -255,6 +255,51 @@ fn v0_3_13_pre_003_standard_logs_source_reuses_transport_facades_and_common_hydr
return;
}
#[test]
fn v0_3_13_pre_004_standard_block_source_is_direct_raw_and_transport_facade_only() {
let root = include_str!("../src/lib.rs");
let resources = include_str!("../src/runtime_resources.rs");
for required in [
"RawTransactionIngestStandardBlockSource",
"SolanaStandardWsSession::connect",
".block_subscribe(",
"SolanaBlockSubscribeConfig::new",
"SolanaTransactionEncoding::Base64",
"SolanaTransactionDetails::Full",
"std::option::Option::Some(1)",
"std::option::Option::Some(false)",
"build_standard_block_material",
"RawTransactionMaterial::binary_base64_with_embedded_signature",
"RawTransactionVersion::Number(1)",
"block_subscribe",
"source.standard_block_missing",
"source.standard_block_remote_error",
] {
assert!(resources.contains(required), "required pre.004 standard block contract missing: {required}");
}
for forbidden in [
"get_block_observed",
"ksp_config_lib::",
"ksp_job_backfill_lib::",
"ksp_store_postgres_lib::",
"reqwest::",
"tokio_tungstenite::",
"tonic::",
"yellowstone_grpc_proto::",
"unbounded_channel",
] {
assert!(
!runtime_contains(forbidden) && !resources.contains(forbidden) && !root.contains(forbidden),
"pre.004 crossed a forbidden standard-block boundary: {forbidden}",
);
}
return;
}
fn runtime_contains(value: &str) -> bool {
return include_str!("../src/runtime.rs").contains(value);
}
#[test]
fn v0_3_12_pre_006_source_surface_hardens_shutdown_and_faults_without_backend_edges() {
let root = include_str!("../src/lib.rs");

View File

@@ -1,5 +1,5 @@
// file: crates/ksp-worker-raw-transaction-ingest-lib/tests/hardening.rs
// version: 12
// version: 13
//! External public, security, redaction and release-boundary hardening canaries for `pre.010`.
@@ -161,7 +161,12 @@ fn pre_010_source_visibility_contract_uses_crate_root_for_shared_items() {
(include_str!("../src/persistence.rs"), &["RawTransactionIngestPersistenceOutcome", "RawTransactionIngestPersistencePort"]),
(
include_str!("../src/runtime_resources.rs"),
&["RawTransactionIngestStandardLogsSource", "RawTransactionIngestYellowstoneSource", "RawTransactionIngestRuntimeResources"],
&[
"RawTransactionIngestStandardBlockSource",
"RawTransactionIngestStandardLogsSource",
"RawTransactionIngestYellowstoneSource",
"RawTransactionIngestRuntimeResources",
],
),
];
for (source, symbols) in source_contracts {
@@ -566,6 +571,47 @@ fn v0_3_13_pre_003_standard_logs_redaction_and_reference_only_contract_are_expli
return;
}
#[test]
fn v0_3_13_pre_004_standard_block_redaction_version_and_null_guards_are_explicit() {
let resources = include_str!("../src/runtime_resources.rs");
for required in [
"RawTransactionIngestStandardBlockSource",
".field(\"filter_kind\"",
".field(\"filter_fingerprint_bytes\"",
".field(\"source_key_bytes\"",
"source.standard_block_context_slot_mismatch",
"source.standard_block_remote_error",
"source.standard_block_missing",
"source.standard_block_transactions_missing",
"source.standard_block_transaction_version_unsupported",
"source.standard_block_transaction_version_unqualified",
"SolanaTransactionVersion::Number(0)",
"SolanaTransactionVersion::Number(1)",
] {
assert!(resources.contains(required), "required pre.004 standard block hardening guard missing: {required}");
}
let source_struct = match resources.split_once("pub struct RawTransactionIngestStandardBlockSource {") {
std::option::Option::Some((_, tail)) => match tail.split_once("impl crate::RawTransactionIngestStandardBlockSource") {
std::option::Option::Some((value, _)) => value,
std::option::Option::None => "",
},
std::option::Option::None => "",
};
for forbidden in ["err:", "block:", "transaction_data:", "url:"] {
assert!(!source_struct.contains(forbidden), "remote/raw material stored in standard block source: {forbidden}");
}
let source_impl = match resources.split_once("impl crate::RawTransactionIngestStandardBlockSource {") {
std::option::Option::Some((_, tail)) => match tail.split_once("impl std::fmt::Debug for crate::RawTransactionIngestStandardBlockSource") {
std::option::Option::Some((value, _)) => value,
std::option::Option::None => "",
},
std::option::Option::None => "",
};
assert!(!source_impl.contains("observe_pending("), "direct Standard Block source must not inflate hydration_pending");
assert!(source_impl.contains("processing_frontier.observe_settled(slot)"));
return;
}
#[test]
fn v0_3_12_pre_009_hydration_retry_ownership_and_no_orphan_cleanup_are_explicit() {
let resources = include_str!("../src/runtime_resources.rs");

View File

@@ -1,5 +1,5 @@
// file: crates/ksp-worker-raw-transaction-ingest-lib/tests/public_api.rs
// version: 13
// version: 14
//! External public-surface proofs for the RAW transaction ingest Worker foundation.
@@ -224,6 +224,31 @@ fn v0_3_13_pre_003_standard_logs_runtime_resource_surface_is_typed_and_transport
return;
}
#[test]
fn v0_3_13_pre_004_standard_block_runtime_resource_surface_is_typed_and_transport_owned() {
let _source_new: fn(
ksp_onchain_transport_lib::WsEndpointSettings,
ksp_onchain_transport_lib::SolanaBlockSubscribeFilter,
ksp_onchain_transport_lib::SolanaCommitment,
) -> ksp_core_lib::Result<ksp_worker_raw_transaction_ingest_lib::RawTransactionIngestStandardBlockSource> =
ksp_worker_raw_transaction_ingest_lib::RawTransactionIngestStandardBlockSource::new;
let _resources_from_block: fn(
ksp_worker_raw_transaction_ingest_lib::RawTransactionIngestStandardBlockSource,
) -> ksp_worker_raw_transaction_ingest_lib::RawTransactionIngestRuntimeResources =
ksp_worker_raw_transaction_ingest_lib::RawTransactionIngestRuntimeResources::from_standard_block_source;
let _push_block: fn(
&mut ksp_worker_raw_transaction_ingest_lib::RawTransactionIngestRuntimeResources,
ksp_worker_raw_transaction_ingest_lib::RawTransactionIngestStandardBlockSource,
) -> ksp_core_lib::Result<()> = ksp_worker_raw_transaction_ingest_lib::RawTransactionIngestRuntimeResources::try_push_standard_block_source;
let root = include_str!("../src/lib.rs");
let resources = include_str!("../src/runtime_resources.rs");
assert!(root.contains("RawTransactionIngestStandardBlockSource"));
for forbidden in ["pub fn ws_endpoint(", "pub fn filter(", "pub fn source_key("] {
assert!(!resources.contains(forbidden), "standard block source implementation escape hatch present: {forbidden}");
}
return;
}
#[test]
fn v0_3_12_pre_007_processing_frontier_snapshot_getters_are_public_and_processing_only() {
let _hydration_pending: fn(&ksp_worker_raw_transaction_ingest_lib::RawTransactionIngestSnapshot) -> usize =

View File

@@ -1,5 +1,5 @@
// file: crates/ksp-worker-raw-transaction-ingest-lib/tests/release_completeness.rs
// version: 11
// version: 12
//! Release-completeness canaries through the `pre.010` public/release/security hardening tranche.
@@ -84,6 +84,7 @@ fn pre_010_public_root_export_inventory_is_exact() {
"RawTransactionIngestSnapshotFuture",
"RawTransactionIngestSnapshotSource",
"RawTransactionIngestSourceState",
"RawTransactionIngestStandardBlockSource",
"RawTransactionIngestStandardLogsSource",
"RawTransactionIngestTerminalFuture",
"RawTransactionIngestWorker",
@@ -115,6 +116,7 @@ fn pre_010_external_hardening_suite_is_present_and_scoped() {
"pre_010_lower_layers_have_no_dependency_return_to_concrete_worker",
"v0_3_12_pre_002_public_root_exposes_contract_types_without_transport_implementation_paths",
"v0_3_13_pre_003_standard_logs_redaction_and_reference_only_contract_are_explicit",
"v0_3_13_pre_004_standard_block_redaction_version_and_null_guards_are_explicit",
] {
assert!(hardening.contains(required), "required pre.010 hardening canary missing: {required}");
}
@@ -129,6 +131,7 @@ fn pre_010_external_hardening_suite_is_present_and_scoped() {
assert!(dependency_boundary.contains("v0_3_12_pre_007_processing_frontier_remains_run_local_and_backend_neutral_after_continuity_extension"));
assert!(dependency_boundary.contains("v0_3_12_pre_008_worker_observes_transport_reconnect_replay_and_faults_only_on_proven_retention_gap"));
assert!(dependency_boundary.contains("v0_3_13_pre_003_standard_logs_source_reuses_transport_facades_and_common_hydration_only"));
assert!(dependency_boundary.contains("v0_3_13_pre_004_standard_block_source_is_direct_raw_and_transport_facade_only"));
let public_api = include_str!("public_api.rs");
assert!(public_api.contains("pre_003_kind_code_and_settings_are_consumable_from_crate_root"));
assert!(public_api.contains("pre_004_start_handle_and_terminal_future_are_consumable_without_public_join_handle"));
@@ -137,6 +140,7 @@ fn pre_010_external_hardening_suite_is_present_and_scoped() {
assert!(public_api.contains("v0_3_12_pre_002_runtime_resource_types_are_consumable_without_client_escape_hatch"));
assert!(public_api.contains("v0_3_13_pre_002_multi_source_runtime_resource_surface_is_bounded_and_source_neutral"));
assert!(public_api.contains("v0_3_13_pre_003_standard_logs_runtime_resource_surface_is_typed_and_transport_owned"));
assert!(public_api.contains("v0_3_13_pre_004_standard_block_runtime_resource_surface_is_typed_and_transport_owned"));
assert!(public_api.contains("v0_3_12_pre_007_processing_frontier_snapshot_getters_are_public_and_processing_only"));
assert!(public_api.contains("pre_008_snapshot_surface_and_common_projection_are_public_and_stable"));
return;