v0.3.6-pre.006
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
// file: crates/ksp-job-backfill-lib/tests/dependency_boundary.rs
|
||||
// version: 1
|
||||
// version: 2
|
||||
|
||||
//! Dependency firewall canaries for the concrete Backfill foundation.
|
||||
//! Dependency firewall canaries for Backfill discovery and RAW v1 conversion.
|
||||
|
||||
#[test]
|
||||
fn pre_005_manifest_uses_only_planned_ksp_edges_and_backend_neutral_store() {
|
||||
fn pre_006_manifest_uses_only_planned_ksp_edges_and_backend_neutral_store() {
|
||||
let manifest = include_str!("../Cargo.toml");
|
||||
for required in [
|
||||
"ksp-core-lib = { path = \"../ksp-core-lib\" }",
|
||||
@@ -12,6 +12,7 @@ fn pre_005_manifest_uses_only_planned_ksp_edges_and_backend_neutral_store() {
|
||||
"ksp-logging-lib = { path = \"../ksp-logging-lib\" }",
|
||||
"ksp-onchain-transport-lib = { path = \"../ksp-onchain-transport-lib\" }",
|
||||
"ksp-store-lib = { path = \"../ksp-store-lib\", default-features = false }",
|
||||
"serde_json.workspace = true",
|
||||
"sha2.workspace = true",
|
||||
] {
|
||||
assert!(manifest.contains(required), "required Backfill dependency missing: {required}");
|
||||
@@ -25,7 +26,8 @@ fn pre_005_manifest_uses_only_planned_ksp_edges_and_backend_neutral_store() {
|
||||
"ksp-wallet-lib",
|
||||
"solana-",
|
||||
"reqwest",
|
||||
"serde",
|
||||
"serde.workspace = true",
|
||||
"serde = {",
|
||||
"tonic",
|
||||
] {
|
||||
assert!(!manifest.contains(forbidden), "forbidden Backfill dependency present: {forbidden}");
|
||||
@@ -34,21 +36,32 @@ fn pre_005_manifest_uses_only_planned_ksp_edges_and_backend_neutral_store() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pre_005_production_sources_keep_transport_and_store_in_their_owned_layers() {
|
||||
let sources = [
|
||||
fn pre_006_production_sources_keep_transport_and_store_in_their_owned_layers() {
|
||||
let non_conversion_sources = [
|
||||
include_str!("../src/constants.rs"),
|
||||
include_str!("../src/discovery.rs"),
|
||||
include_str!("../src/error.rs"),
|
||||
include_str!("../src/lib.rs"),
|
||||
include_str!("../src/request.rs"),
|
||||
];
|
||||
for source in sources {
|
||||
for source in non_conversion_sources {
|
||||
for forbidden in
|
||||
["ksp_config_lib::", "ksp_interface_lib::", "ksp_store_api::", "ksp_store_postgres_lib::", "reqwest::", "serde_json::", "std::env", "tonic::"]
|
||||
{
|
||||
assert!(!source.contains(forbidden), "forbidden concrete Backfill path detected: {forbidden}");
|
||||
}
|
||||
}
|
||||
let conversion = include_str!("../src/conversion.rs");
|
||||
assert!(conversion.contains("serde_json::"));
|
||||
assert!(conversion.contains("get_transaction_observed"));
|
||||
assert!(conversion.contains("SolanaTransactionEncoding::Base64"));
|
||||
assert!(conversion.contains("std::option::Option::Some(0)"));
|
||||
assert!(conversion.contains("BackfillHydrationOutcome::Missing(reference)"));
|
||||
assert!(!conversion.contains("execute_standard_rpc"));
|
||||
assert!(!conversion.contains("persist_raw_transaction_acquisition"));
|
||||
for forbidden in ["ksp_config_lib::", "ksp_interface_lib::", "ksp_store_api::", "ksp_store_postgres_lib::", "reqwest::", "std::env", "tonic::"] {
|
||||
assert!(!conversion.contains(forbidden), "forbidden RAW conversion path detected: {forbidden}");
|
||||
}
|
||||
let discovery = include_str!("../src/discovery.rs");
|
||||
assert!(discovery.contains("get_signatures_for_address"));
|
||||
assert!(!discovery.contains("execute_standard_rpc"));
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// file: crates/ksp-job-backfill-lib/tests/public_api.rs
|
||||
// version: 1
|
||||
// version: 2
|
||||
|
||||
//! Public API canaries for the bounded Backfill foundation.
|
||||
//! Public API canaries for bounded Backfill discovery and RAW v1 conversion.
|
||||
|
||||
#[test]
|
||||
fn pre_005_request_scope_and_discovery_contracts_are_available_from_crate_root() {
|
||||
@@ -64,3 +64,25 @@ fn pre_005_candidate_identity_is_network_plus_signature_not_transport_source() {
|
||||
assert_ne!(mainnet_identity, devnet_identity);
|
||||
return;
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pre_006_raw_conversion_contract_is_available_from_crate_root() {
|
||||
assert_eq!(ksp_job_backfill_lib::RAW_TRANSACTION_FORMAT_ID, "ksp.solana.raw_transaction");
|
||||
assert_eq!(ksp_job_backfill_lib::RAW_TRANSACTION_FORMAT_VERSION, 1);
|
||||
let signature = ksp_job_backfill_lib::BackfillSignature::new("1".repeat(64));
|
||||
assert!(signature.is_ok());
|
||||
let signature = match signature {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(_) => return,
|
||||
};
|
||||
let decoded = signature.to_raw_transaction_signature();
|
||||
assert!(decoded.is_ok());
|
||||
if let std::result::Result::Ok(decoded) = decoded {
|
||||
assert_eq!(decoded.as_bytes(), &[0_u8; 64]);
|
||||
}
|
||||
let _hydrate = ksp_job_backfill_lib::hydrate_backfill_candidate;
|
||||
let _outcome: std::option::Option<ksp_job_backfill_lib::BackfillHydrationOutcome> = std::option::Option::None;
|
||||
let _acquisition: std::option::Option<ksp_job_backfill_lib::BackfillRawAcquisition> = std::option::Option::None;
|
||||
assert_eq!(ksp_job_backfill_lib::ERROR_CODE_BACKFILL_RAW_CONVERSION_INVALID, ksp_core_lib::ErrorCode::new("job_backfill", "raw_conversion_invalid"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
// file: crates/ksp-job-backfill-lib/tests/release_completeness.rs
|
||||
// version: 1
|
||||
// version: 2
|
||||
|
||||
//! Completeness canaries for the `pre.005` Backfill foundation.
|
||||
//! Completeness canaries for the `pre.006` Backfill RAW conversion tranche.
|
||||
|
||||
#[test]
|
||||
fn pre_005_production_module_inventory_is_exact() -> std::io::Result<()> {
|
||||
fn pre_006_production_module_inventory_is_exact() -> std::io::Result<()> {
|
||||
let source_root = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("src");
|
||||
let entries = match std::fs::read_dir(source_root) {
|
||||
std::result::Result::Ok(value) => value,
|
||||
@@ -32,12 +32,12 @@ fn pre_005_production_module_inventory_is_exact() -> std::io::Result<()> {
|
||||
}
|
||||
}
|
||||
names.sort_unstable();
|
||||
assert_eq!(names, std::vec!["constants.rs", "discovery.rs", "error.rs", "lib.rs", "request.rs"]);
|
||||
assert_eq!(names, std::vec!["constants.rs", "conversion.rs", "discovery.rs", "error.rs", "lib.rs", "request.rs"]);
|
||||
return std::result::Result::Ok(());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pre_005_surface_is_discovery_only_without_raw_persistence_or_checkpoint_runtime() {
|
||||
fn pre_006_surface_adds_raw_conversion_without_persistence_or_checkpoint_runtime() {
|
||||
let root = include_str!("../src/lib.rs");
|
||||
for required in [
|
||||
"BackfillCandidate",
|
||||
@@ -50,11 +50,17 @@ fn pre_005_surface_is_discovery_only_without_raw_persistence_or_checkpoint_runti
|
||||
"BackfillScopeFingerprint",
|
||||
"BackfillSignature",
|
||||
"discover_backfill_candidates",
|
||||
"BackfillRawAcquisition",
|
||||
"BackfillHydrationOutcome",
|
||||
"hydrate_backfill_candidate",
|
||||
"RAW_TRANSACTION_FORMAT_ID",
|
||||
"RAW_TRANSACTION_FORMAT_VERSION",
|
||||
"ERROR_CODE_BACKFILL_RAW_CONVERSION_INVALID",
|
||||
] {
|
||||
assert!(root.contains(required), "required pre.005 public contract missing: {required}");
|
||||
assert!(root.contains(required), "required pre.006 public contract missing: {required}");
|
||||
}
|
||||
for forbidden in ["RawTransactionObservation", "persist_raw_transaction_acquisition", "BackfillCheckpoint", "BackfillJobHandle", "JobSnapshotSource"] {
|
||||
assert!(!root.contains(forbidden), "later Backfill tranche leaked into pre.005: {forbidden}");
|
||||
for forbidden in ["persist_raw_transaction_acquisition", "BackfillCheckpoint", "BackfillJobHandle", "JobSnapshotSource"] {
|
||||
assert!(!root.contains(forbidden), "later Backfill tranche leaked into pre.006: {forbidden}");
|
||||
}
|
||||
assert!(!root.contains("pub mod "));
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user