perf: Major event processing system refactor for improved performance

This commit is contained in:
ysq
2025-08-28 14:49:56 +08:00
parent 9ea4dab4df
commit 218abd3aa4
19 changed files with 292 additions and 574 deletions
@@ -1,15 +1,15 @@
use std::collections::HashMap;
use solana_sdk::pubkey::Pubkey;
use prost_types::Timestamp;
use solana_sdk::{instruction::CompiledInstruction, pubkey::Pubkey, signature::Signature};
use crate::streaming::event_parser::{
common::{EventMetadata, EventType, ProtocolType},
core::traits::{EventParser, GenericEventParseConfig, GenericEventParser, UnifiedEvent},
protocols::pumpfun::{
discriminators, pumpfun_create_token_event_log_decode, pumpfun_migrate_event_log_decode,
pumpfun_trade_event_log_decode, PumpFunCreateTokenEvent, PumpFunMigrateEvent,
PumpFunTradeEvent,
use crate::{
impl_event_parser_delegate,
streaming::event_parser::{
common::{EventMetadata, EventType, ProtocolType},
core::traits::{GenericEventParseConfig, GenericEventParser, UnifiedEvent},
protocols::pumpfun::{
discriminators, pumpfun_create_token_event_log_decode,
pumpfun_migrate_event_log_decode, pumpfun_trade_event_log_decode,
PumpFunCreateTokenEvent, PumpFunMigrateEvent, PumpFunTradeEvent,
},
},
};
@@ -284,63 +284,4 @@ impl PumpFunEventParser {
}
}
#[async_trait::async_trait]
impl EventParser for PumpFunEventParser {
fn inner_instruction_configs(&self) -> HashMap<&'static str, Vec<GenericEventParseConfig>> {
self.inner.inner_instruction_configs()
}
fn instruction_configs(&self) -> HashMap<Vec<u8>, Vec<GenericEventParseConfig>> {
self.inner.instruction_configs()
}
fn parse_events_from_inner_instruction(
&self,
inner_instruction: &CompiledInstruction,
signature: Signature,
slot: u64,
block_time: Option<Timestamp>,
program_received_time_us: i64,
outer_index: i64,
inner_index: Option<i64>,
) -> Vec<Box<dyn UnifiedEvent>> {
self.inner.parse_events_from_inner_instruction(
inner_instruction,
signature,
slot,
block_time,
program_received_time_us,
outer_index,
inner_index,
)
}
fn parse_events_from_instruction(
&self,
instruction: &CompiledInstruction,
accounts: &[Pubkey],
signature: Signature,
slot: u64,
block_time: Option<Timestamp>,
program_received_time_us: i64,
outer_index: i64,
inner_index: Option<i64>,
) -> Vec<Box<dyn UnifiedEvent>> {
self.inner.parse_events_from_instruction(
instruction,
accounts,
signature,
slot,
block_time,
program_received_time_us,
outer_index,
inner_index,
)
}
fn should_handle(&self, program_id: &Pubkey) -> bool {
self.inner.should_handle(program_id)
}
fn supported_program_ids(&self) -> Vec<Pubkey> {
self.inner.supported_program_ids()
}
}
impl_event_parser_delegate!(PumpFunEventParser);