Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

precomputes Turbine trees speculatively before shreds arrive #5014

Merged
merged 3 commits into from
Mar 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion ledger/src/shred.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ pub struct ShredId(Slot, /*shred index:*/ u32, ShredType);

impl ShredId {
#[inline]
pub(crate) fn new(slot: Slot, index: u32, shred_type: ShredType) -> ShredId {
pub fn new(slot: Slot, index: u32, shred_type: ShredType) -> ShredId {
ShredId(slot, index, shred_type)
}

Expand All @@ -285,6 +285,16 @@ impl ShredId {
self.0
}

#[inline]
pub fn index(&self) -> u32 {
self.1
}

#[inline]
pub fn shred_type(&self) -> ShredType {
self.2
}

#[inline]
pub(crate) fn unpack(&self) -> (Slot, /*shred index:*/ u32, ShredType) {
(self.0, self.1, self.2)
Expand Down
5 changes: 3 additions & 2 deletions ledger/src/shred/wire.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,10 @@ pub(super) fn get_parent_offset(shred: &[u8]) -> Option<u16> {
Some(u16::from_le_bytes(bytes))
}

// Returns DataShredHeader.flags.
// Returns DataShredHeader.flags if the shred is data.
// Returns Error::InvalidShredType for coding shreds.
#[inline]
pub(crate) fn get_flags(shred: &[u8]) -> Result<ShredFlags, Error> {
pub fn get_flags(shred: &[u8]) -> Result<ShredFlags, Error> {
match get_shred_type(shred)? {
ShredType::Code => Err(Error::InvalidShredType),
ShredType::Data => {
Expand Down
Loading
Loading