Skip to content
Open
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
8 changes: 5 additions & 3 deletions crates/core/providers-solana/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,11 @@ impl BlockStreamer for Client {
// Auto mode: skip archive for recent slots, use it for historical data
match self.main_rpc_client.get_slot(self.metrics.clone()).await {
Ok(current_slot) => {
let threshold = current_slot.saturating_sub(10_000);
let skip_archive = start > threshold;
// The CAR archive is usually 1-2 epochs behind the latest block,
// so a threshold of 3 epochs should be safe.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe you want a configuration here in case you need to experiment with it at run time?

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 idea with UseArchive::Auto is to only initiate the OF1 archive use when we're fairly certain that we are going to get some data from it. My goal with this change is just to align the threshold more closely with that idea (if the archive is 1-2 epochs behind the chain tip, the third most recent epoch will likely be available).

let skip_archive = current_slot
.checked_sub(3 * solana_clock::DEFAULT_SLOTS_PER_EPOCH)
.is_some_and(|threshold| start > threshold);

if skip_archive {
tracing::info!(
Expand All @@ -261,7 +264,6 @@ impl BlockStreamer for Client {
tracing::info!(
start_slot = start,
current_slot = current_slot,
threshold,
"Using archive mode (historical slots, use_archive = auto)"
);
}
Expand Down
Loading