fix: use SLOT_DURATION_MS instead of deprecated SECONDS_PER_SLOT#148
Open
barnabasbusa wants to merge 1 commit intomasterfrom
Open
fix: use SLOT_DURATION_MS instead of deprecated SECONDS_PER_SLOT#148barnabasbusa wants to merge 1 commit intomasterfrom
barnabasbusa wants to merge 1 commit intomasterfrom
Conversation
SECONDS_PER_SLOT has been deprecated and removed from the consensus spec config (ethereum/consensus-specs#4926) in favor of SLOT_DURATION_MS. When CL nodes stop returning SECONDS_PER_SLOT, the ChainSpec field stays at zero, causing a divide-by-zero panic in ethwallclock when computing the current slot. Replace SecondsPerSlot (time.Duration) with SlotDurationMs (uint64) in ChainSpec to match the new spec field directly. Fall back to SECONDS_PER_SLOT for backwards compatibility with older genesis configs. Add a guard in InitWallclock to prevent the panic if neither value is available. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Fix:
Summary
SecondsPerSlot(time.Duration,yaml:"SECONDS_PER_SLOT") withSlotDurationMs(uint64,yaml:"SLOT_DURATION_MS") inChainSpecto match the new consensus spec fieldSECONDS_PER_SLOTfor backwards compatibility with older genesis configs that haven't migrated yetInitWallclockto prevent divide-by-zero panic if neither value is availableContext
SECONDS_PER_SLOThas been deprecated and removed from the consensus spec config (ethereum/consensus-specs#4926) in favor ofSLOT_DURATION_MS. The ethereum-genesis-generator is removing it in ethpandaops/ethereum-genesis-generator#268. When CL nodes stop returningSECONDS_PER_SLOT, theChainSpecfield stays at zero, causing a divide-by-zero panic inethwallclockwhen computing the current slot.Similar change was made in dora: ethpandaops/dora#612
Test plan
SLOT_DURATION_MSbut notSECONDS_PER_SLOTSECONDS_PER_SLOT🤖 Generated with Claude Code