Release solana-streamer 1.5.2

This commit is contained in:
0xfnzero
2026-05-26 21:23:27 +08:00
parent 8b967f58d6
commit 02c8a6d168
8 changed files with 245 additions and 87 deletions
+30 -2
View File
@@ -173,7 +173,10 @@ fn push_streamer_event_sdk_grpc_types(t: &EventType, out: &mut Vec<SdkGrpcEventT
use SdkGrpcEventType as Sdk;
match t {
St::BlockMeta => out.push(Sdk::BlockMeta),
St::PumpFunCreateToken => out.push(Sdk::PumpFunCreate),
St::PumpFunCreateToken => {
out.push(Sdk::PumpFunCreate);
out.push(Sdk::PumpFunCreateV2);
}
St::PumpFunCreateV2Token => out.push(Sdk::PumpFunCreateV2),
St::PumpFunBuy => {
out.push(Sdk::PumpFunBuy);
@@ -396,7 +399,8 @@ fn event_type_matches(filter_type: &EventType, event_type: &EventType) -> bool {
filter_type == event_type
|| matches!(
(filter_type, event_type),
(EventType::PumpFunBuy, EventType::PumpFunBuyExactSolIn)
(EventType::PumpFunCreateToken, EventType::PumpFunCreateV2Token)
| (EventType::PumpFunBuy, EventType::PumpFunBuyExactSolIn)
| (EventType::TokenAccount, EventType::TokenInfo)
| (EventType::RaydiumClmmSwap, EventType::RaydiumClmmSwapV2)
| (EventType::RaydiumClmmSwapV2, EventType::RaydiumClmmSwap)
@@ -531,6 +535,30 @@ mod tests {
assert!(!sdk_f.should_include(SdkGrpcEventType::PumpFunSell));
}
#[test]
fn pumpfun_create_filter_matches_create_v2_for_backward_compat() {
let f =
EventTypeFilter { include: vec![EventType::PumpFunCreateToken], ..Default::default() };
assert!(f.passes_event_type(&EventType::PumpFunCreateToken));
assert!(f.passes_event_type(&EventType::PumpFunCreateV2Token));
let sdk_f = build_sdk_parse_event_filter(Some(&f)).expect("mapped");
assert!(sdk_f.should_include(SdkGrpcEventType::PumpFunCreate));
assert!(sdk_f.should_include(SdkGrpcEventType::PumpFunCreateV2));
assert!(!sdk_f.should_include(SdkGrpcEventType::PumpFunBuy));
let f = EventTypeFilter {
include: vec![EventType::PumpFunCreateV2Token],
..Default::default()
};
assert!(!f.passes_event_type(&EventType::PumpFunCreateToken));
assert!(f.passes_event_type(&EventType::PumpFunCreateV2Token));
let sdk_f = build_sdk_parse_event_filter(Some(&f)).expect("mapped");
assert!(!sdk_f.should_include(SdkGrpcEventType::PumpFunCreate));
assert!(sdk_f.should_include(SdkGrpcEventType::PumpFunCreateV2));
}
#[test]
fn pumpfun_buy_filter_matches_exact_sol_in_for_backward_compat() {
let f = EventTypeFilter { include: vec![EventType::PumpFunBuy], ..Default::default() };
@@ -78,37 +78,19 @@ impl EventParser {
tx_index: Option<u64>,
callback: std::sync::Arc<dyn Fn(crate::streaming::event_parser::DexEvent) + Send + Sync>,
) -> anyhow::Result<()> {
let sdk_parse_filter =
crate::streaming::event_parser::common::filter::build_sdk_shred_parse_event_filter(
protocols,
event_type_filter,
);
let mut sdk_events = Vec::with_capacity(4);
sol_parser_sdk::shredstream::parse_transaction_dex_events_with_filter(
crate::streaming::common::parse_shred_transaction_events(
transaction,
signature,
slot.unwrap_or(0),
tx_index.unwrap_or(0),
tx_index,
recv_us,
sdk_parse_filter.as_ref(),
&mut sdk_events,
);
for sdk_event in sdk_events {
if let Some(mut event) = crate::streaming::parser_sdk_bridge::adapt_parser_event(
sdk_event,
None,
recv_us,
protocols,
event_type_filter,
) {
event.metadata_mut().handle_us =
crate::streaming::event_parser::common::high_performance_clock::elapsed_micros_since(
recv_us,
);
event = helpers::process_event(event, bot_wallet);
protocols,
event_type_filter,
bot_wallet,
|event| {
callback(event);
}
}
},
);
Ok(())
}
}