-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Changes from all commits
6b8bf55
cb64f08
6adb578
e5932c7
6b2674a
6491e14
68b3ffe
d44254a
22f1dfb
1f64730
45c7942
c87064d
5c1355e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,6 +53,11 @@ 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. | ||
// TODO(#7620): Return error for invalid range. | ||
if endSlot < startSlot { | ||
return nil, nil | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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. |
||
} | ||
filter := filters.NewFilter().SetStartSlot(startSlot).SetEndSlot(endSlot) | ||
blocks, blockRoots, err := s.beaconDB.Blocks(ctx, filter) | ||
if err != 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