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

Geyser: add starting entry to ReplicaEntryInfo(V2) #33963

Merged

Conversation

CriesofCarrots
Copy link
Contributor

Problem

In order to verify an Entry, geyser consumers currently have to walk all the previous entries in the block and sum the executed tx counts to figure out which transactions are included in the current entry. However, the node knows the transaction index an Entry starts with, so we can save geyser consumers quite a few operations by emitting this index too.

Summary of Changes

  • Add ReplicaEntryInfoV2, which includes starting_transaction_index
  • Populate the new field in replay stage
  • Cache the tx index in TpuEntryNotifier to populate in banking stage as well
  • Use new ReplicaEntryInfo variant in geyser

Copy link

codecov bot commented Nov 7, 2023

Codecov Report

Merging #33963 (cf3ad5a) into master (8c69a0e) will decrease coverage by 0.1%.
Report is 1 commits behind head on master.
The diff coverage is 0.0%.

@@            Coverage Diff            @@
##           master   #33963     +/-   ##
=========================================
- Coverage    81.9%    81.9%   -0.1%     
=========================================
  Files         811      811             
  Lines      219329   219344     +15     
=========================================
+ Hits       179696   179703      +7     
- Misses      39633    39641      +8     

Copy link
Contributor

@lijunwangs lijunwangs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I found our doc on geyser is quite outdated https://github.com/solana-labs/solana/blob/master/docs/src/developing/plugins/geyser-plugins.md. We need to update it with these new interfaces.

/// A wrapper to future-proof ReplicaEntryInfo handling. To make a change to the structure of
/// ReplicaEntryInfo, add an new enum variant wrapping a newer version, which will force plugin
/// implementations to handle the change.
#[repr(u32)]
pub enum ReplicaEntryInfoVersions<'a> {
V0_0_1(&'a ReplicaEntryInfo<'a>),
V0_0_2(&'a ReplicaEntryInfoV2<'a>),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does the upgrade path look like for this? People just pull in the new struct and we expect their plugins to handle the new fields?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The notifications themselves use the version enums. @lijunwangs , correct me if I'm wrong, but I think the intent is that people use sensible catch-all logic for the enums, so they can update to the new variant and fields at their leisure. Although thinking about it more carefully, I guess they can really only use that catch-all as an alert...

@CriesofCarrots CriesofCarrots merged commit 0e91e96 into solana-labs:master Nov 14, 2023
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants