Skip to content
This repository was archived by the owner on Jul 14, 2026. It is now read-only.

Commit 9209003

Browse files
committed
feat(geyser): add completed data set shred range to deshred txn
1 parent 29edcda commit 9209003

4 files changed

Lines changed: 59 additions & 26 deletions

File tree

core/src/completed_data_sets_service.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
//! [`CompletedDataSetsService`] is a hub, that runs different operations when a "completed data
2-
//! set", also known as a [`Vec<Entry>`], is received by the validator.
1+
//! [`CompletedDataSetsService`] is a hub that runs different operations when a completed data set
2+
//! is received by the validator.
3+
//!
4+
//! A completed data set is a contiguous range of data shreds whose combined payload deserializes
5+
//! to a single [`Vec<Entry>`].
36
//!
47
//! Currently, `WindowService` sends [`CompletedDataSetInfo`]s via a `completed_sets_receiver`
58
//! provided to the [`CompletedDataSetsService`].
@@ -148,6 +151,8 @@ impl CompletedDataSetsService {
148151
total_data_sets: &mut u64,
149152
lut_transactions: &mut u64| {
150153
let CompletedDataSetInfo { slot, indices } = completed_data_set_info;
154+
let completed_data_set_starting_shred_index = indices.start;
155+
let completed_data_set_ending_shred_index_exclusive = indices.end;
151156
match blockstore.get_entries_in_data_block(slot, indices, /*slot_meta:*/ None) {
152157
Ok(entries) => {
153158
*total_data_sets += 1;
@@ -177,6 +182,8 @@ impl CompletedDataSetsService {
177182
let mut notify_measure = Measure::start("notify_deshred");
178183
notifier.notify_deshred_transaction(
179184
slot,
185+
completed_data_set_starting_shred_index,
186+
completed_data_set_ending_shred_index_exclusive,
180187
signature,
181188
is_vote,
182189
tx,

geyser-plugin-interface/src/geyser_plugin_interface.rs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,10 +213,40 @@ pub struct ReplicaDeshredTransactionInfo<'a> {
213213
pub loaded_addresses: Option<&'a LoadedAddresses>,
214214
}
215215

216+
/// Extends ReplicaDeshredTransactionInfo with metadata about the completed data set that
217+
/// produced the transaction.
218+
///
219+
/// A completed data set is a contiguous range of data shreds whose combined payload deserializes
220+
/// to a single `Vec<Entry>`. Multiple transactions can share the same completed-data-set range,
221+
/// and completed data sets for the same slot may be observed out of order. These fields describe
222+
/// the data-set container; they are not a block-wide transaction index.
223+
#[derive(Clone, Debug)]
224+
#[repr(C)]
225+
pub struct ReplicaDeshredTransactionInfoV2<'a> {
226+
/// The transaction signature, used for identifying the transaction.
227+
pub signature: &'a Signature,
228+
229+
/// Indicates if the transaction is a simple vote transaction.
230+
pub is_vote: bool,
231+
232+
/// The versioned transaction.
233+
pub transaction: &'a VersionedTransaction,
234+
235+
/// Addresses loaded from address lookup tables for V0 transactions.
236+
pub loaded_addresses: Option<&'a LoadedAddresses>,
237+
238+
/// The inclusive starting shred index of the completed data set containing this transaction.
239+
pub completed_data_set_starting_shred_index: u32,
240+
241+
/// The exclusive ending shred index of the completed data set containing this transaction.
242+
pub completed_data_set_ending_shred_index_exclusive: u32,
243+
}
244+
216245
/// A wrapper to future-proof ReplicaDeshredTransactionInfo handling.
217246
#[repr(u32)]
218247
pub enum ReplicaDeshredTransactionInfoVersions<'a> {
219248
V0_0_1(&'a ReplicaDeshredTransactionInfo<'a>),
249+
V0_0_2(&'a ReplicaDeshredTransactionInfoV2<'a>),
220250
}
221251

222252
#[derive(Clone, Debug)]

geyser-plugin-manager/src/deshred_transaction_notifier.rs

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
use {
33
crate::geyser_plugin_manager::GeyserPluginManager,
44
agave_geyser_plugin_interface::geyser_plugin_interface::{
5-
ReplicaDeshredTransactionInfo, ReplicaDeshredTransactionInfoVersions,
5+
ReplicaDeshredTransactionInfoV2, ReplicaDeshredTransactionInfoVersions,
66
},
77
log::*,
88
solana_clock::Slot,
@@ -28,32 +28,36 @@ impl DeshredTransactionNotifier for DeshredTransactionNotifierImpl {
2828
fn notify_deshred_transaction(
2929
&self,
3030
slot: Slot,
31+
completed_data_set_starting_shred_index: u32,
32+
completed_data_set_ending_shred_index_exclusive: u32,
3133
signature: &Signature,
3234
is_vote: bool,
3335
transaction: &VersionedTransaction,
3436
loaded_addresses: Option<&LoadedAddresses>,
3537
) {
38+
let plugin_manager = self.plugin_manager.read().unwrap();
39+
40+
if plugin_manager.plugins.is_empty() {
41+
return;
42+
}
43+
3644
let mut measure =
3745
Measure::start("geyser-plugin-notify_plugins_of_deshred_transaction_info");
38-
let transaction_info = Self::build_replica_deshred_transaction_info(
46+
let transaction_info = ReplicaDeshredTransactionInfoV2 {
3947
signature,
4048
is_vote,
4149
transaction,
4250
loaded_addresses,
43-
);
44-
45-
let plugin_manager = self.plugin_manager.read().unwrap();
46-
47-
if plugin_manager.plugins.is_empty() {
48-
return;
49-
}
51+
completed_data_set_starting_shred_index,
52+
completed_data_set_ending_shred_index_exclusive,
53+
};
5054

5155
for plugin in plugin_manager.plugins.iter() {
5256
if !plugin.deshred_transaction_notifications_enabled() {
5357
continue;
5458
}
5559
match plugin.notify_deshred_transaction(
56-
ReplicaDeshredTransactionInfoVersions::V0_0_1(&transaction_info),
60+
ReplicaDeshredTransactionInfoVersions::V0_0_2(&transaction_info),
5761
slot,
5862
) {
5963
Err(err) => {
@@ -85,18 +89,4 @@ impl DeshredTransactionNotifierImpl {
8589
pub fn new(plugin_manager: Arc<RwLock<GeyserPluginManager>>) -> Self {
8690
Self { plugin_manager }
8791
}
88-
89-
fn build_replica_deshred_transaction_info<'a>(
90-
signature: &'a Signature,
91-
is_vote: bool,
92-
transaction: &'a VersionedTransaction,
93-
loaded_addresses: Option<&'a LoadedAddresses>,
94-
) -> ReplicaDeshredTransactionInfo<'a> {
95-
ReplicaDeshredTransactionInfo {
96-
signature,
97-
is_vote,
98-
transaction,
99-
loaded_addresses,
100-
}
101-
}
10292
}

ledger/src/deshred_transaction_notifier_interface.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,16 @@ use {
88

99
/// Trait for notifying about transactions when they are deshredded.
1010
/// This is called when entries are formed from shreds, before any execution occurs.
11+
///
12+
/// The completed-data-set shred range identifies the contiguous range of data shreds whose
13+
/// combined payload deserializes to a single `Vec<Entry>`. All transactions reconstructed from
14+
/// that same completed data set share the same shred-range metadata.
1115
pub trait DeshredTransactionNotifier {
1216
fn notify_deshred_transaction(
1317
&self,
1418
slot: Slot,
19+
completed_data_set_starting_shred_index: u32,
20+
completed_data_set_ending_shred_index_exclusive: u32,
1521
signature: &Signature,
1622
is_vote: bool,
1723
transaction: &VersionedTransaction,

0 commit comments

Comments
 (0)