Skip to content

fix: use SECONDS_PER_SLOT when deriving slots from time#133

Merged
tcoratger merged 1 commit intoleanEthereum:mainfrom
unnawut:fix-seconds-intervals
Nov 6, 2025
Merged

fix: use SECONDS_PER_SLOT when deriving slots from time#133
tcoratger merged 1 commit intoleanEthereum:mainfrom
unnawut:fix-seconds-intervals

Conversation

@unnawut
Copy link
Copy Markdown
Collaborator

@unnawut unnawut commented Nov 6, 2025

🗒️ Description

Most slot calculation were using INTERVALS_PER_SLOT to derive slot number from time. This is only a coincidence that it's correct because both SECONDS_PER_SLOT = 4 and INTERVALS_PER_SLOT = 4.

A quick mental check on this is imagine we have more sub-slots cutoffs but slot time is still the same at 4 seconds, so INTERVALS_PER_SLOT = 6 but SECONDS_PER_SLOT = 4.

Then current_slot = Slot(self.time // INTERVALS_PER_SLOT) becomes current_slot = Slot(self.time // 6) which gives the wrong slot number at 4 seconds per slot. It should be current_slot = Slot(self.time // SECONDS_PER_SLOT)

🔗 Related Issues or PRs

✅ Checklist

  • Ran tox checks to avoid unnecessary CI fails:
    uvx tox
  • Considered adding appropriate tests for the changes.
  • Considered updating the online docs in the ./docs/ directory.

@unnawut unnawut added bug Category: bug fix specs Scope: Changes to the specifications labels Nov 6, 2025
Copy link
Copy Markdown
Collaborator

@tcoratger tcoratger left a comment

Choose a reason for hiding this comment

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

Thanks, I thought we had eliminated the bugs with this fix #75 (comment) but apparently there were still some left, I hope it's okay now.

@tcoratger tcoratger merged commit 299902a into leanEthereum:main Nov 6, 2025
10 checks passed
@unnawut unnawut deleted the fix-seconds-intervals branch November 6, 2025 08:49
@unnawut unnawut added this to the pq-devnet-1 milestone Nov 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Category: bug fix specs Scope: Changes to the specifications

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants