Skip to content

Commit

Permalink
Support notifying bank created slot status in geyser
Browse files Browse the repository at this point in the history
  • Loading branch information
lijunwangs committed Oct 10, 2024
1 parent 2048633 commit c8d9016
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
16 changes: 13 additions & 3 deletions core/src/replay_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ use {
solana_rpc::{
optimistically_confirmed_bank_tracker::{BankNotification, BankNotificationSenderConfig},
rpc_subscriptions::RpcSubscriptions,
slot_status_notifier::{self, SlotStatusNotifier},
slot_status_notifier::SlotStatusNotifier,
},
solana_rpc_client_api::response::SlotUpdate,
solana_runtime::{
Expand Down Expand Up @@ -1126,6 +1126,7 @@ impl ReplayStage {
&poh_recorder,
&leader_schedule_cache,
&rpc_subscriptions,
&slot_status_notifier,
&mut progress,
&retransmit_slots_sender,
&mut skipped_slots_info,
Expand Down Expand Up @@ -2056,7 +2057,7 @@ impl ReplayStage {
poh_recorder: &Arc<RwLock<PohRecorder>>,
leader_schedule_cache: &Arc<LeaderScheduleCache>,
rpc_subscriptions: &Arc<RpcSubscriptions>,
slot_status_notifier: Option<SlotStatusNotifier>,
slot_status_notifier: &Option<SlotStatusNotifier>,
progress_map: &mut ProgressMap,
retransmit_slots_sender: &Sender<Slot>,
skipped_slots_info: &mut SkippedSlotsInfo,
Expand Down Expand Up @@ -4077,7 +4078,7 @@ impl ReplayStage {
slot_status_notifier
.read()
.unwrap()
.notify_bank_created(slot, parent);
.notify_created_bank(slot, parent.slot());
}
Bank::new_from_parent_with_options(parent, leader, slot, new_bank_options)
}
Expand Down Expand Up @@ -4425,6 +4426,7 @@ pub(crate) mod tests {
&bank_forks,
&leader_schedule_cache,
&rpc_subscriptions,
&None,
&mut progress,
&mut replay_timing,
);
Expand Down Expand Up @@ -4453,6 +4455,7 @@ pub(crate) mod tests {
&bank_forks,
&leader_schedule_cache,
&rpc_subscriptions,
&None,
&mut progress,
&mut replay_timing,
);
Expand Down Expand Up @@ -6322,6 +6325,7 @@ pub(crate) mod tests {
&bank_forks,
&leader_schedule_cache,
&rpc_subscriptions,
&None,
&mut progress,
&mut replay_timing,
);
Expand Down Expand Up @@ -6351,6 +6355,7 @@ pub(crate) mod tests {
&bank_forks,
&leader_schedule_cache,
&rpc_subscriptions,
&None,
&mut progress,
&mut replay_timing,
);
Expand Down Expand Up @@ -6381,6 +6386,7 @@ pub(crate) mod tests {
&bank_forks,
&leader_schedule_cache,
&rpc_subscriptions,
&None,
&mut progress,
&mut replay_timing,
);
Expand Down Expand Up @@ -6410,6 +6416,7 @@ pub(crate) mod tests {
&bank_forks,
&leader_schedule_cache,
&rpc_subscriptions,
&None,
&mut progress,
&mut replay_timing,
);
Expand Down Expand Up @@ -8344,6 +8351,7 @@ pub(crate) mod tests {
&poh_recorder,
&leader_schedule_cache,
&rpc_subscriptions,
&None,
&mut progress,
&retransmit_slots_sender,
&mut SkippedSlotsInfo::default(),
Expand Down Expand Up @@ -9012,6 +9020,7 @@ pub(crate) mod tests {
&poh_recorder,
&leader_schedule_cache,
&rpc_subscriptions,
&None,
&mut progress,
&retransmit_slots_sender,
&mut SkippedSlotsInfo::default(),
Expand All @@ -9038,6 +9047,7 @@ pub(crate) mod tests {
&poh_recorder,
&leader_schedule_cache,
&rpc_subscriptions,
&None,
&mut progress,
&retransmit_slots_sender,
&mut SkippedSlotsInfo::default(),
Expand Down
4 changes: 4 additions & 0 deletions geyser-plugin-interface/src/geyser_plugin_interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,9 @@ pub enum SlotStatus {

/// All shreds for the slot have been received.
Completed,

/// A new bank is created with the slot
CreatedBank,
}

impl SlotStatus {
Expand All @@ -335,6 +338,7 @@ impl SlotStatus {
SlotStatus::Rooted => "rooted",
SlotStatus::FirstShredReceived => "first_shread_received",
SlotStatus::Completed => "completed",
Self::CreatedBank => "created_bank",
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions geyser-plugin-manager/src/slot_status_notifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ impl SlotStatusNotifierInterface for SlotStatusNotifierImpl {
fn notify_completed(&self, slot: Slot) {
self.notify_slot_status(slot, None, SlotStatus::Completed);
}

fn notify_created_bank(&self, slot: Slot, parent: Slot) {
self.notify_slot_status(slot, Some(parent), SlotStatus::CreatedBank);
}
}

impl SlotStatusNotifierImpl {
Expand Down
2 changes: 1 addition & 1 deletion rpc/src/slot_status_notifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub trait SlotStatusNotifierInterface {
fn notify_completed(&self, slot: Slot);

/// Notified when the slot has bank created.
fn notify_bank_created(&self, slot: Slot, parent: Slot);
fn notify_created_bank(&self, slot: Slot, parent: Slot);
}

pub type SlotStatusNotifier = Arc<RwLock<dyn SlotStatusNotifierInterface + Sync + Send>>;

0 comments on commit c8d9016

Please sign in to comment.