v0.3.12-pre.007-fix.001
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-worker-raw-transaction-ingest-lib/unit_tests/runtime_resources.rs
|
||||
// version: 7
|
||||
// version: 8
|
||||
|
||||
fn grpc_endpoint(cluster: &str) -> std::option::Option<ksp_onchain_transport_lib::YellowstoneGrpcEndpointSettings> {
|
||||
return grpc_endpoint_with_identity(cluster, "yellowstone-fixture", "fixture-provider");
|
||||
@@ -62,7 +62,9 @@ fn http_pool(cluster: &str, role_name: &str, request_kind: &str) -> std::option:
|
||||
};
|
||||
}
|
||||
|
||||
fn transaction_request(commitment: std::option::Option<ksp_onchain_transport_lib::SolanaCommitment>) -> std::option::Option<ksp_onchain_transport_lib::YellowstoneSubscribeRequest> {
|
||||
fn transaction_request(
|
||||
commitment: std::option::Option<ksp_onchain_transport_lib::SolanaCommitment>,
|
||||
) -> std::option::Option<ksp_onchain_transport_lib::YellowstoneSubscribeRequest> {
|
||||
let name = match ksp_onchain_transport_lib::YellowstoneSubscribeFilterName::new("tx-fixture") {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(_) => return std::option::Option::None,
|
||||
@@ -134,10 +136,7 @@ impl super::RawTransactionIngestYellowstoneBlockView for BlockViewFixture {
|
||||
return self.transactions.len();
|
||||
}
|
||||
|
||||
fn transaction_identity(
|
||||
&self,
|
||||
position: usize,
|
||||
) -> ksp_core_lib::Result<(ksp_onchain_transport_lib::YellowstoneTransactionSignature, u64)> {
|
||||
fn transaction_identity(&self, position: usize) -> ksp_core_lib::Result<(ksp_onchain_transport_lib::YellowstoneTransactionSignature, u64)> {
|
||||
return match self.transactions.get(position) {
|
||||
std::option::Option::Some(value) => std::result::Result::Ok(*value),
|
||||
std::option::Option::None => std::result::Result::Err(crate::runtime_error("fixture.block_transaction_missing")),
|
||||
@@ -219,12 +218,7 @@ const PRE_004_OTHER_TRANSACTION_BASE64: &str = "AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEB
|
||||
const PRE_004_ZERO_SIGNATURE_TEXT: &str = "1111111111111111111111111111111111111111111111111111111111111111";
|
||||
const PRE_004_ZERO_TRANSACTION_BASE64: &str = "AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
|
||||
|
||||
fn http_pool_for_url(
|
||||
url: &str,
|
||||
cluster: &str,
|
||||
endpoint_name: &str,
|
||||
provider: &str,
|
||||
) -> std::option::Option<ksp_onchain_transport_lib::HttpTransportPool> {
|
||||
fn http_pool_for_url(url: &str, cluster: &str, endpoint_name: &str, provider: &str) -> std::option::Option<ksp_onchain_transport_lib::HttpTransportPool> {
|
||||
let url = match ksp_onchain_transport_lib::HttpEndpointUrl::parse(url) {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(_) => return std::option::Option::None,
|
||||
@@ -349,11 +343,8 @@ fn serve_http_once(body: std::string::String) -> std::io::Result<(std::string::S
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
let response = std::format!(
|
||||
"HTTP/1.1 200 OK\r\nContent-Type: application/json\r\nContent-Length: {}\r\nConnection: close\r\n\r\n{}",
|
||||
body.len(),
|
||||
body,
|
||||
);
|
||||
let response =
|
||||
std::format!("HTTP/1.1 200 OK\r\nContent-Type: application/json\r\nContent-Length: {}\r\nConnection: close\r\n\r\n{}", body.len(), body,);
|
||||
if let std::result::Result::Err(error) = std::io::Write::write_all(&mut stream, response.as_bytes()) {
|
||||
return std::result::Result::Err(error);
|
||||
}
|
||||
@@ -441,10 +432,7 @@ async fn pre_002_source_accepts_matching_confirmed_transaction_and_get_transacti
|
||||
|
||||
#[tokio::test(flavor = "current_thread")]
|
||||
async fn pre_002_source_rejects_processed_and_implicit_commitment() {
|
||||
for commitment in [
|
||||
std::option::Option::Some(ksp_onchain_transport_lib::SolanaCommitment::Processed),
|
||||
std::option::Option::None,
|
||||
] {
|
||||
for commitment in [std::option::Option::Some(ksp_onchain_transport_lib::SolanaCommitment::Processed), std::option::Option::None] {
|
||||
let endpoint = match grpc_endpoint("devnet") {
|
||||
std::option::Option::Some(value) => value,
|
||||
std::option::Option::None => return,
|
||||
@@ -637,8 +625,8 @@ async fn pre_003_transaction_signal_fixture_preserves_exact_source_neutral_ident
|
||||
assert_eq!(
|
||||
signal.matched_filter_fingerprint,
|
||||
[
|
||||
0x20, 0x83, 0x1d, 0xc8, 0x37, 0x8b, 0x60, 0x70, 0xf9, 0x1d, 0x9d, 0xe6, 0xd3, 0xa1, 0xd2, 0xb3, 0xd7, 0x72, 0x98,
|
||||
0xe3, 0xad, 0xa7, 0x6c, 0x01, 0xfa, 0xa3, 0x08, 0x26, 0xff, 0xab, 0xcd, 0x84,
|
||||
0x20, 0x83, 0x1d, 0xc8, 0x37, 0x8b, 0x60, 0x70, 0xf9, 0x1d, 0x9d, 0xe6, 0xd3, 0xa1, 0xd2, 0xb3, 0xd7, 0x72, 0x98, 0xe3, 0xad, 0xa7, 0x6c, 0x01,
|
||||
0xfa, 0xa3, 0x08, 0x26, 0xff, 0xab, 0xcd, 0x84,
|
||||
]
|
||||
);
|
||||
assert_eq!(signal.created_at, std::option::Option::Some(super::RawTransactionIngestSourceTimestamp { nanos: 456_000_000, seconds: 1_760_000_123 }));
|
||||
@@ -883,10 +871,7 @@ fn pre_005_slot_status_projection_is_exact_and_source_neutral() {
|
||||
(ksp_onchain_transport_lib::YellowstoneSlotStatus::Processed, super::RawTransactionIngestContinuityStatus::Processed),
|
||||
(ksp_onchain_transport_lib::YellowstoneSlotStatus::Confirmed, super::RawTransactionIngestContinuityStatus::Confirmed),
|
||||
(ksp_onchain_transport_lib::YellowstoneSlotStatus::Finalized, super::RawTransactionIngestContinuityStatus::Finalized),
|
||||
(
|
||||
ksp_onchain_transport_lib::YellowstoneSlotStatus::FirstShredReceived,
|
||||
super::RawTransactionIngestContinuityStatus::FirstShredReceived,
|
||||
),
|
||||
(ksp_onchain_transport_lib::YellowstoneSlotStatus::FirstShredReceived, super::RawTransactionIngestContinuityStatus::FirstShredReceived),
|
||||
(ksp_onchain_transport_lib::YellowstoneSlotStatus::Completed, super::RawTransactionIngestContinuityStatus::Completed),
|
||||
(ksp_onchain_transport_lib::YellowstoneSlotStatus::CreatedBank, super::RawTransactionIngestContinuityStatus::CreatedBank),
|
||||
(ksp_onchain_transport_lib::YellowstoneSlotStatus::Dead, super::RawTransactionIngestContinuityStatus::Dead),
|
||||
@@ -988,10 +973,7 @@ async fn pre_004_observed_get_transaction_closes_signal_to_common_raw_ingress_wi
|
||||
assert_eq!(acquisition.transaction().reference().network().as_str(), "devnet");
|
||||
assert_eq!(acquisition.transaction().reference().signature().as_bytes(), &[0_u8; 64]);
|
||||
assert_eq!(acquisition.transaction().slot(), 42);
|
||||
assert_eq!(
|
||||
acquisition.transaction().block_time().map(|value| return value.unix_millis()),
|
||||
std::option::Option::Some(1_760_000_120_000),
|
||||
);
|
||||
assert_eq!(acquisition.transaction().block_time().map(|value| return value.unix_millis()), std::option::Option::Some(1_760_000_120_000),);
|
||||
assert_eq!(acquisition.observation().provenance().provider().as_str(), "ys.fixture-provider:http.fixture-http-provider");
|
||||
return;
|
||||
}
|
||||
@@ -1229,14 +1211,8 @@ async fn pre_004_status_provenance_and_future_source_timestamp_are_bounded_and_r
|
||||
std::option::Option::Some(value) => value,
|
||||
std::option::Option::None => return,
|
||||
};
|
||||
let mut signal = match pre_004_signal(
|
||||
&source,
|
||||
super::RawTransactionIngestSourceFamily::TransactionStatus,
|
||||
42,
|
||||
7,
|
||||
&["filter-b", "filter-a", "filter-a"],
|
||||
0,
|
||||
) {
|
||||
let mut signal = match pre_004_signal(&source, super::RawTransactionIngestSourceFamily::TransactionStatus, 42, 7, &["filter-b", "filter-a", "filter-a"], 0)
|
||||
{
|
||||
std::option::Option::Some(value) => value,
|
||||
std::option::Option::None => return,
|
||||
};
|
||||
@@ -1302,10 +1278,12 @@ async fn pre_006_coalescence_key_merges_transaction_and_status_before_http_fanou
|
||||
std::result::Result::Err(_) => return,
|
||||
};
|
||||
let mut coordinator = super::RawTransactionIngestHydrationCoordinator::new(&settings);
|
||||
if coordinator.queue_signal(&source, transaction, received_at).is_err() {
|
||||
let (frontier_sender, _frontier_receiver) = tokio::sync::watch::channel(crate::RawTransactionIngestProcessingFrontierProjection::empty());
|
||||
let mut processing_frontier = super::RawTransactionIngestProcessingFrontierReporter::new(frontier_sender);
|
||||
if coordinator.queue_signal(&source, transaction, received_at, &mut processing_frontier).is_err() {
|
||||
return;
|
||||
}
|
||||
if coordinator.queue_signal(&source, status, received_at).is_err() {
|
||||
if coordinator.queue_signal(&source, status, received_at, &mut processing_frontier).is_err() {
|
||||
return;
|
||||
}
|
||||
assert_eq!(coordinator.pending.len(), 1);
|
||||
|
||||
Reference in New Issue
Block a user