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

Fix dependent root retrival genesis case #14053

Merged
merged 2 commits into from
May 28, 2024

Conversation

terencechain
Copy link
Member

#14039 fixed several issues related to duty retrieval. One key fix was to avoid heavily mutating the state for retrieving the beacon state proposer. However, after merging the PR, we realized it broke long-running end-to-end tests for the beacon API.

helpers.go:242: time="2024-05-24 19:14:42" level=error msg="error getting validator duties" error="failed to get duties for next epoch `1`: failed to get attester duties for epoch `1`: HTTP request unsuccessful (500: Could not get dependent root: could not get block root: slot 0 out of bounds)" prefix=client

Currently, getting the dependent root does not work in the genesis case. A genesis state does not have any dependent root when requesting at slot 0, as demonstrated by these two test cases:

func Test_attestationDependentRoot(t *testing.T) {
	st, _ := util.DeterministicGenesisState(t, 1)
	_, err := attestationDependentRoot(st, 0)
	require.NoError(t, err)
}

func Test_proposalDependentRoot(t *testing.T) {
	st, _ := util.DeterministicGenesisState(t, 1)
	_, err := proposalDependentRoot(st, 0)
	require.NoError(t, err)
}

This PR fixes the issue by using the genesis root in the beacon database if the genesis epoch is specified in the request.

@terencechain terencechain added the Ready For Review A pull request ready for code review label May 28, 2024
@terencechain terencechain requested a review from a team as a code owner May 28, 2024 15:28
james-prysm
james-prysm previously approved these changes May 28, 2024
if requestedEpoch == 0 {
r, err := s.BeaconDB.GenesisBlockRoot(ctx)
if err != nil {
fmt.Println("Could not get genesis block root: ", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Left over from debugging?

@terencechain terencechain added this pull request to the merge queue May 28, 2024
Merged via the queue into develop with commit 43c7659 May 28, 2024
16 of 17 checks passed
@terencechain terencechain deleted the fix-dependent-root-retrival branch May 28, 2024 16:57
prestonvanloon pushed a commit that referenced this pull request May 31, 2024
* Fix dependent root retrival genesis case

* Remove print

(cherry picked from commit 43c7659)
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ready For Review A pull request ready for code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants