Skip to content

Introduce compute_shuffling_lookahead_start_slot helper - #5602

Merged
jtraglia merged 2 commits into
ethereum:masterfrom
jihoonsong:shuffling-decision-slot
Sep 4, 2026
Merged

Introduce compute_shuffling_lookahead_start_slot helper#5602
jtraglia merged 2 commits into
ethereum:masterfrom
jihoonsong:shuffling-decision-slot

Conversation

@jihoonsong

@jihoonsong jihoonsong commented Sep 4, 2026

Copy link
Copy Markdown
Member

shuffling_decision_slot is the next slot to dependent_slot, except for the first two epochs. For GENESIS_EPOCH and GENESIS_EPOCH + MIN_SEED_LOOKAHEAD, it's equal to dependent_slot, which is GENESIS_SLOT. I've found this useful for advancing dependent state just as necessary as to advance proposer lookahead.

As for the concern of advancing state, my interpretation of this chunk of code is to fetch and use cached proposer lookahead. That said, I'm open to a better expression than what we have.

I stole the name from is_previous_slot_payload_decision. Other names that I considered are:

  • compute_shuffling_processed_slot
  • compute_shuffling_known_slot
  • compute_shuffling_available_slot
  • compute_shuffling_determined_slot

IMO, known and available are ambiguous because it can be any slot in current and past epochs. It should mean the first slot of the previous epoch.

Another way is introducing compute_shuffling_lookahead_epoch and doing compute_start_slot_at_epoch(compute_shuffling_lookahead_epoch(epoch)). But I think adding a helper returning the start slot of lookahead epoch brings us slightly more value.

@github-actions github-actions Bot added testing CI, actions, tests, testing infra gloas heze labels Sep 4, 2026
@jihoonsong jihoonsong changed the title Introduce compute_shuffling_decision_slot helper Introduce compute_shuffling_decision_slot helper Sep 4, 2026
Comment thread specs/gloas/fork-choice.md Outdated
Comment on lines +723 to +727
def compute_shuffling_decision_slot(epoch: Epoch) -> Slot:
if epoch <= MIN_SEED_LOOKAHEAD:
return GENESIS_SLOT
return compute_start_slot_at_epoch(epoch - MIN_SEED_LOOKAHEAD)
```

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Naming things is tough. I'm thinking we should do:

  • compute_lookahead_start_slot (preferred)
  • compute_shuffling_lookahead_start_slot

I've looked through the usages below & I believe this to be fine. I do not believe it is necessary to mention "shuffling" here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'd go with compute_shuffling_lookahead_start_slot. I believe it should mention shuffling; otherwise, it's ambiguous which lookahead is being referred to. For instance, the lookahead for proposer has changed post-Fulu. See #5374 for more context.

@jihoonsong
jihoonsong force-pushed the shuffling-decision-slot branch from e9dbb6b to 6d8cd21 Compare September 4, 2026 16:19
@jihoonsong jihoonsong changed the title Introduce compute_shuffling_decision_slot helper Introduce compute_shuffling_lookahead_start_slot helper Sep 4, 2026
@jtraglia
jtraglia merged commit 46a14d6 into ethereum:master Sep 4, 2026
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gloas heze testing CI, actions, tests, testing infra

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants