fix(gloas): prevent uint64 underflow in ListFinalizedSlots on short-lived chains#242
Open
barnabasbusa wants to merge 1 commit intorelease/gloasfrom
Open
fix(gloas): prevent uint64 underflow in ListFinalizedSlots on short-lived chains#242barnabasbusa wants to merge 1 commit intorelease/gloasfrom
barnabasbusa wants to merge 1 commit intorelease/gloasfrom
Conversation
…ains When the finalized epoch is smaller than historical_epoch_count (e.g. on a freshly started devnet or kurtosis enclave), the previous expression `latestSlot - SlotsPerEpoch*HistoricalEpochCount` underflows uint64 and produces a value near 2^64, so the loop never executes and the /checkpointz/v1/beacon/slots endpoint returns an empty list — leaving the UI's historical checkpoints table blank until the chain has produced HistoricalEpochCount epochs. Clamp the lower bound at 0 so we return every available finalized epoch-boundary slot, regardless of chain age. Same fix as #241 but targeted at release/gloas so gloas devnets can pick it up without waiting for a master merge.
3 tasks
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.
Summary
release/gloasso gloas devnets / kurtosis enclaves can pick it up immediately without waiting for a master merge.ListFinalizedSlots(backingGET /checkpointz/v1/beacon/slots) computed its lower-bound slot aslatestSlot - SlotsPerEpoch * HistoricalEpochCountinuint64. When the finalized epoch is smaller thanhistorical_epoch_count— typical for the first ~2 minutes of a kurtosis gloas enclave withSLOTS_PER_EPOCH=8and the defaulthistorical_epoch_count=20— the subtraction underflows to ~2^64, so thei > valloop condition is immediately false and the endpoint returns an empty slice. UI "historical finalized epoch boundaries" table then stays blank.finalizedEpoch >= HistoricalEpochCount.Repro (on release/gloas before this patch)
After: the list returns whatever's available (1 entry after the first finalized epoch, 2 after the second, …).
Test plan
go build ./...go vet ./...golangci-lint run --new-from-rev=origin/release/gloas ./pkg/beacon/...→ 0 issues