fix: dragonsmouth-from-slot '*' falls back to gRPC slot on empty blocks_metadata - #58
Open
gamandeepsingh wants to merge 1 commit into
Conversation
…ks_metadata resolve_initial_from_slot hard-errored when blocks_metadata had zero rows, contradicting the documented fallback behavior. Empty table now resolves to (None, FromSlotMode::LatestDb) so the initial subscribe request omits from_slot and gRPC starts from its own reported slot, the same outcome already used when a resolved slot turns out stale. Fixes solana-rpc#56
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
DRAGONSMOUTH_FROM_SLOT="*"hard-errors on a fresh deployment whereblocks_metadatahas zero rows:This contradicts the documented fallback in
crates/superbank/README.md:That fallback does work when a resolved slot turns out to be stale/
unavailable (superbank logs
slot not available; falling back to gRPC available slotand recovers). It just never gets a chance to run whenthe table is empty in the first place, since
resolve_initial_from_slot(
crates/superbank/src/ingest/grpc.rs) errors out before reachingthat path.
Fix
resolve_initial_from_slot'sFromSlotSpec::LatestDbbranch nowmatches on
fetch_latest_slot_from_blocks's result instead of using.ok_or_elseto hard-error onNone:Some(latest)— unchanged, resolves to that slot as before.None(empty table) — resolves to(None, FromSlotMode::LatestDb)instead of erroring. With no
from_slotset on the initial subscriberequest, gRPC starts the stream from its own current slot, which is
the same "gRPC-reported available slot" outcome the stale-slot case
already falls back to.
Updated
crates/superbank/README.mdto document the empty-table caseexplicitly.
Test plan
cargo fmt --all -- --checkcargo clippy -p superbank --all-targets --locked -- -D warningscargo test -p superbank --locked(56 passed)Fixes #56