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

Clean Up Block Retrieval Methods #7593

Merged
merged 13 commits into from Oct 23, 2020
Merged

Clean Up Block Retrieval Methods #7593

merged 13 commits into from Oct 23, 2020

Conversation

nisdas
Copy link
Member

@nisdas nisdas commented Oct 21, 2020

What type of PR is this?

Code Quality

What does this PR do? Why is it needed?

  • Cleans up block retrieval methods.
  • Add in a few additional test cases for block retrieval.

Which issues(s) does this PR fix?

Fixes #

Other notes for review

@nisdas nisdas requested a review from a team as a code owner October 21, 2020 14:03
@nisdas nisdas added the Ready For Review A pull request ready for code review label Oct 21, 2020
}
// Return nothing with an end slot of 0.
if endSlot == 0 {
return [][]byte{}, nil
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 return the genesis block?

Copy link
Contributor

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

Copy link
Contributor

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

rauljordan
rauljordan previously approved these changes Oct 21, 2020
rauljordan
rauljordan previously approved these changes Oct 22, 2020
@rauljordan
Copy link
Contributor

@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
Copy link
Member

Choose a reason for hiding this comment

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

Return error?

Copy link
Member

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.

@prylabs-bulldozer prylabs-bulldozer bot merged commit 6eb022f into master Oct 23, 2020
@delete-merged-branch delete-merged-branch bot deleted the cleanUPDB branch October 23, 2020 04:23
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.

None yet

4 participants