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
Unmarshal Block instead of State #5246
Conversation
@@ -308,20 +308,21 @@ func slotByBlockRoot(ctx context.Context, tx *bolt.Tx, blockRoot []byte) (uint64 | |||
return stateSummary.Slot, nil | |||
} | |||
|
|||
bkt := tx.Bucket(stateBucket) | |||
bkt := tx.Bucket(blocksBucket) |
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 actually started out by using block. But one very good feedback from @prestonvanloon: what if the block is missing then the node will never be able to delete the state
I know the state is slower, I think the compromise (later) is to add a root->slot
storage
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.
This is an issue during sync, unmarshalling a state just to delete it is quite inefficient. If a block is missing, then how would we save its resulting state ?
i could add a fallback to retrieve the state in the event the block is missing.
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.
This is just preparing for the worst case (ie, user saves the state then mistakenly deletes the block.. etc)
fallback sounds good
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.
ok done, added in a fallback
Codecov Report
@@ Coverage Diff @@
## master #5246 +/- ##
=========================================
Coverage ? 55.15%
=========================================
Files ? 267
Lines ? 21502
Branches ? 0
=========================================
Hits ? 11860
Misses ? 8032
Partials ? 1610 |
When deleting states a bottle neck came up where we were unmarshalling the whole state in order to just find out their slot. This unmarshals the block instead which is a much smaller object