Skip to content

Comments

Add helper functions for slot time deadlines#4589

Merged
jtraglia merged 8 commits intoethereum:masterfrom
0xYYY:slot-time-deadline-util-func
Sep 17, 2025
Merged

Add helper functions for slot time deadlines#4589
jtraglia merged 8 commits intoethereum:masterfrom
0xYYY:slot-time-deadline-util-func

Conversation

@0xYYY
Copy link
Contributor

@0xYYY 0xYYY commented Sep 15, 2025

This PR adds some helper functions to phase0 for getting deadlines of various slot components.

Related PR: #4542

Fixes #4586

@0xYYY 0xYYY marked this pull request as draft September 15, 2025 14:37
@0xYYY
Copy link
Contributor Author

0xYYY commented Sep 15, 2025

TODO (create the following helper functions and update spec/tests to use these instead of get_slot_component_duration_ms):

  • get_proposer_reorg_cutoff_ms
  • get_attestation_due_ms
  • get_aggregate_due_ms
  • get_sync_message_due_ms
  • get_contribution_due_ms
  • get_payload_attestation_due_ms
  • get_view_freeze_cutoff_ms
  • get_inclusion_list_submission_due_ms
  • get_proposer_inclusion_list_cutoff_ms

hi @jtraglia, creating this initial draft with one of the functions
would like to get some feedback, and if all is good, will proceed to implement changes for rest of the functions

@0xYYY 0xYYY force-pushed the slot-time-deadline-util-func branch from 5b2ebc6 to a7f141f Compare September 15, 2025 14:42
@jtraglia
Copy link
Member

@0xYYY Yes, this look good. Please continue!

@0xYYY 0xYYY marked this pull request as ready for review September 16, 2025 14:24
@0xYYY
Copy link
Contributor Author

0xYYY commented Sep 16, 2025

hi @jtraglia, thanks for the comments
i have also made the changes for other functions, and the PR is ready to be reviewed now

Copy link
Member

@jtraglia jtraglia left a comment

Choose a reason for hiding this comment

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

Really great work @0xYYY, thank you!

I would like for @dankrad & @rolfyone to review this too.

Copy link
Contributor

@rolfyone rolfyone left a comment

Choose a reason for hiding this comment

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

LGTM

@dankrad
Copy link
Contributor

dankrad commented Sep 17, 2025

Looks great :)

@jtraglia jtraglia merged commit 6cb5b4d into ethereum:master Sep 17, 2025
15 checks passed
@dankrad dankrad mentioned this pull request Sep 22, 2025
11 tasks
#### `get_attestation_due_ms`

```python
def get_attestation_due_ms(epoch: Epoch) -> uint64:
Copy link
Member

Choose a reason for hiding this comment

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

this returns 3999 for the attestation deadline

>>> 3333 * 12000 // 10000
3999

wondering if we rather wanna round to closest integer to have cleaner values

Copy link
Member

Choose a reason for hiding this comment

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

This came up in the original PR too. We could do something like this if devs want it.

Copy link
Member

Choose a reason for hiding this comment

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

Ah I missed that comment, I guess there isn't a need to adapt it on the spec, can just change the rounding in our code eg. can just use Math.round instead of Math.floor, the difference is negligible so it shouldn't matter either way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Define functions for slot time deadlines

5 participants