v0.3.6-pre.005-fix.001

This commit is contained in:
2026-09-01 13:42:34 +02:00
parent 4fdeab4d67
commit ea5f756d17
9 changed files with 164 additions and 48 deletions

View File

@@ -1,5 +1,5 @@
// file: crates/ksp-job-backfill-lib/src/discovery.rs
// version: 1
// version: 2
/// Network-scoped identity of one discovered transaction candidate before canonical signature decoding.
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
@@ -262,7 +262,7 @@ where
std::option::Option::None => return std::result::Result::Err(discovery_invalid("scope.address")),
};
let mut before = match request.scope().kind() {
crate::BackfillScopeKind::BeforeAddress => request.scope().anchor().map(|value| value.as_str().to_owned()),
crate::BackfillScopeKind::BeforeAddress => request.scope().anchor().map(|value| return value.as_str().to_owned()),
crate::BackfillScopeKind::LatestAddress => std::option::Option::None,
crate::BackfillScopeKind::AfterAddress | crate::BackfillScopeKind::ExplicitSignatures => {
return std::result::Result::Err(discovery_invalid("scope.kind"));
@@ -434,8 +434,7 @@ fn discovery_invalid(field: &'static str) -> ksp_core_lib::Error {
}
fn discovery_stalled() -> ksp_core_lib::Error {
return ksp_core_lib::Error::new(crate::ERROR_CODE_BACKFILL_DISCOVERY_STALLED, "Backfill discovery cursor did not advance")
.with_context("field", "before");
return ksp_core_lib::Error::new(crate::ERROR_CODE_BACKFILL_DISCOVERY_STALLED, "Backfill discovery cursor did not advance").with_context("field", "before");
}
#[cfg(test)]

View File

@@ -51,10 +51,10 @@ pub use self::request::BackfillSignature;
pub use self::request::MAX_BACKFILL_CANDIDATES;
/// Maximum number of concurrent transaction hydrations admitted by one Backfill request.
pub use self::request::MAX_BACKFILL_HYDRATION_CONCURRENCY;
/// Maximum number of `getSignaturesForAddress` pages admitted by one address Backfill request.
pub use self::request::MAX_BACKFILL_PAGES;
/// Maximum page size admitted for one `getSignaturesForAddress` request.
pub use self::request::MAX_BACKFILL_PAGE_SIZE;
/// Maximum number of `getSignaturesForAddress` pages admitted by one address Backfill request.
pub use self::request::MAX_BACKFILL_PAGES;
/// Maximum Base58 text length possible for one canonical 64-byte Solana signature.
pub use self::request::MAX_BACKFILL_SIGNATURE_TEXT_BYTES;
/// Minimum Base58 text length possible for one canonical 64-byte Solana signature.

View File

@@ -43,16 +43,9 @@ fn pre_005_production_sources_keep_transport_and_store_in_their_owned_layers() {
include_str!("../src/request.rs"),
];
for source in sources {
for forbidden in [
"ksp_config_lib::",
"ksp_interface_lib::",
"ksp_store_api::",
"ksp_store_postgres_lib::",
"reqwest::",
"serde_json::",
"std::env",
"tonic::",
] {
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}");
}
}

View File

@@ -63,14 +63,13 @@ impl super::SignaturePageSource for FakeSource {
},
std::result::Result::Err(_) => {
return std::boxed::Box::pin(async {
return std::result::Result::Err(ksp_core_lib::Error::new(
crate::ERROR_CODE_BACKFILL_DISCOVERY_INVALID,
"test page queue lock poisoned",
));
return std::result::Result::Err(ksp_core_lib::Error::new(crate::ERROR_CODE_BACKFILL_DISCOVERY_INVALID, "test page queue lock poisoned"));
});
},
};
return std::boxed::Box::pin(async move { return std::result::Result::Ok(page); });
return std::boxed::Box::pin(async move {
return std::result::Result::Ok(page);
});
}
}
@@ -223,10 +222,7 @@ async fn pre_005_after_page_bound_is_partial_and_does_not_claim_anchor_completio
std::option::Option::Some(value) => value,
std::option::Option::None => return,
};
let source = FakeSource::new(std::vec![
std::vec![page_entry('7', 70), page_entry('6', 60)],
std::vec![page_entry('5', 50), page_entry('4', 40)],
]);
let source = FakeSource::new(std::vec![std::vec![page_entry('7', 70), page_entry('6', 60)], std::vec![page_entry('5', 50), page_entry('4', 40)],]);
let result = super::discover_with_source(&source, &request).await;
let discovery = match result {
std::result::Result::Ok(value) => value,

View File

@@ -127,18 +127,8 @@ fn pre_005_request_bounds_are_exact_and_explicit_context_is_rejected() {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => return,
};
let explicit_with_context = crate::BackfillRequest::new(
job_id,
network,
role,
crate::BackfillCommitment::Confirmed,
explicit_scope,
1,
1,
1,
1,
std::option::Option::Some(10),
);
let explicit_with_context =
crate::BackfillRequest::new(job_id, network, role, crate::BackfillCommitment::Confirmed, explicit_scope, 1, 1, 1, 1, std::option::Option::Some(10));
assert!(explicit_with_context.is_err());
return;
}