Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use slot to determine fork version #14653

Merged
merged 24 commits into from
Nov 26, 2024
Merged

Use slot to determine fork version #14653

merged 24 commits into from
Nov 26, 2024

Conversation

saolyn
Copy link
Contributor

@saolyn saolyn commented Nov 21, 2024

What type of PR is this?

Other

What does this PR do? Why is it needed?

This PR updates the logic to use the slot instead of the head state version to determine the fork version.

This approach reduces the risk of errors in cases where the block for the first slot of a new fork is delayed or not proposed, which could result in the head state still reflecting the previous fork.

Which issues(s) does this PR fix?
N/A

Other notes for review

Acknowledgements

  • I have read CONTRIBUTING.md.
  • I have made an appropriate entry to CHANGELOG.md.
  • I have added a description to this PR with sufficient context for reviewers to understand this PR.

@saolyn saolyn added the API Api related tasks label Nov 21, 2024
@saolyn saolyn requested review from rkapka and james-prysm November 21, 2024 00:16
@saolyn saolyn requested a review from a team as a code owner November 21, 2024 00:16
@saolyn saolyn requested a review from dB2510 November 21, 2024 00:16
james-prysm
james-prysm previously approved these changes Nov 21, 2024
@james-prysm james-prysm dismissed their stale review November 21, 2024 14:04

radek's comment

Copy link
Member

@prestonvanloon prestonvanloon left a comment

Choose a reason for hiding this comment

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

Looks like a big improvement to avoid reading from the state. I am a bit concerned that there are no unit tests added or changed. Could you add some tests for this logic change?

httputil.HandleError(w, "Could not get head state: "+err.Error(), http.StatusInternalServerError)
return
v := slots.ToForkVersion(primitives.Slot(slot))
if slot == 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't this be based on rawSlot instead of slot?

@rkapka rkapka force-pushed the version-current-epoch branch from 030b97b to bd59ada Compare November 26, 2024 18:20
Copy link
Contributor

@rkapka rkapka left a comment

Choose a reason for hiding this comment

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

LGTM

@saolyn saolyn added this pull request to the merge queue Nov 26, 2024
Merged via the queue into develop with commit 74bb082 Nov 26, 2024
17 of 18 checks passed
@saolyn saolyn deleted the version-current-epoch branch November 26, 2024 23:20
rkapka added a commit that referenced this pull request Nov 29, 2024
* Use slot to determine version

* gaz

* solve cyclic dependency

* Radek' review

* unit test

* gaz

* use require instead of assert

* fix test

* fix test

* fix TestGetAggregateAttestation

* fix ListAttestations test

* James' review

* Radek' review

* add extra checks to GetAttesterSlashingsV2

* fix matchingAtts

* improve tests + fix

* fix

* stop appending all non electra atts

* more tests

* changelog

* revert TestProduceSyncCommitteeContribution changes

---------

Co-authored-by: Radosław Kapka <[email protected]>
Co-authored-by: rkapka <[email protected]>
@kasey kasey added the changelog/changed Changelog Section: Changed label Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Api related tasks changelog/changed Changelog Section: Changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants