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
Clean Up Block Retrieval Methods #7593
Conversation
} | ||
// Return nothing with an end slot of 0. | ||
if endSlot == 0 { | ||
return [][]byte{}, nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this return the genesis block?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We always retrieve the genesis block by its root and not by slots to overcome the limitations of zero values in Go throughout the codebase
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps worth adding as a comment @nisdas
@nisdas looks like some DB tests fail |
@@ -53,6 +53,10 @@ func (s *State) ReplayBlocks(ctx context.Context, state *stateTrie.BeaconState, | |||
// LoadBlocks loads the blocks between start slot and end slot by recursively fetching from end block root. | |||
// The Blocks are returned in slot-descending order. | |||
func (s *State) LoadBlocks(ctx context.Context, startSlot, endSlot uint64, endBlockRoot [32]byte) ([]*ethpb.SignedBeaconBlock, error) { | |||
// Nothing to load for invalid range. | |||
if endSlot < startSlot { | |||
return nil, nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Return error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed offline that this breaks many tests. We'll revisit at a later time. @nisdas suggested filing an issue and TODO for this, to fix the test input data.
What type of PR is this?
Code Quality
What does this PR do? Why is it needed?
Which issues(s) does this PR fix?
Fixes #
Other notes for review