-
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
Add electra DB #13975
Add electra DB #13975
Conversation
a5711b4
to
87a64f9
Compare
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.
LGTM
@@ -51,3 +51,17 @@ func hasDenebBlindKey(enc []byte) bool { | |||
} | |||
return bytes.Equal(enc[:len(denebBlindKey)], denebBlindKey) | |||
} | |||
|
|||
func hasElectraKey(enc []byte) bool { | |||
if len(electraKey) >= len(enc) { |
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 don't really need to do this, it would be fine to just call bytes.Equal.
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.
@kasey it is required or a runtime error for slice bounds out of range
will happen when len(enc)
is less than len(electraKey)
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.
You are thinking of bytes.Prefix, i think. It would be safe to call bytes.HasPrefix without this check
https://pkg.go.dev/bytes?utm_source=godoc#HasPrefix
func hasElectraKey(enc []byte) bool {
return bytes.hasPrefix(enc, electraKey)
}
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.
You're right, this is basically replicating bytes.HasPrefix
.
* Add electra DB * Fix typo * Revert deep ssz change --------- Co-authored-by: james-prysm <90280386+james-prysm@users.noreply.github.com>
* Add electra DB * Fix typo * Revert deep ssz change --------- Co-authored-by: james-prysm <90280386+james-prysm@users.noreply.github.com>
This PR adds electra changes to db. Mainly two things and a note
1.) Add electra block support
2.) Add electra state support
3.) Refactor
saveStatesEfficientInternal
into multiple helpers. The functionality remains the same. It needs to be done to reduce cognitive complexity or CI will be red