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

Add HighestSlotStatesBelow DB getter #5213

Merged
merged 8 commits into from
Mar 26, 2020
Merged

Conversation

terencechain
Copy link
Member

This PR implements HighestSlotStatesBelow DB getter and tests.

Last piece of DB feature to be used by new state mgmt and gen service 🙌

@terencechain terencechain added the Ready For Review A pull request ready for code review label Mar 25, 2020
@terencechain terencechain self-assigned this Mar 25, 2020
@codecov
Copy link

codecov bot commented Mar 25, 2020

Codecov Report

❗ No coverage uploaded for pull request base (master@3792bf6). Click here to learn what that means.
The diff coverage is 67.34%.

@@            Coverage Diff            @@
##             master    #5213   +/-   ##
=========================================
  Coverage          ?   47.05%           
=========================================
  Files             ?      229           
  Lines             ?    18776           
  Branches          ?        0           
=========================================
  Hits              ?     8835           
  Misses            ?     8440           
  Partials          ?     1501

ctx, span := trace.StartSpan(ctx, "BeaconDB.statesAtSlotBitfieldIndex")
defer span.End()

highestSlot := index - 1
Copy link
Member

Choose a reason for hiding this comment

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

what if index is 0, this overflows

Copy link
Member Author

@terencechain terencechain Mar 26, 2020

Choose a reason for hiding this comment

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

addressed the line below :)

highestSlot = int(math.Max(0, float64(highestSlot)))

Copy link
Member

Choose a reason for hiding this comment

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

wouldn't

math.Max(0, float64(highestSlot))

return the larger number which will be MaxFloat64 ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Nice catch! It's now taking int instead of uint64, also verified via a test. Thank you :)

@prylabs-bulldozer prylabs-bulldozer bot merged commit 2df7679 into master Mar 26, 2020
@delete-merged-branch delete-merged-branch bot deleted the states-slots-saved-at branch March 26, 2020 15:37
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.

2 participants