Merge all block unblinding code into a single unblinder struct#12232
Merged
terencechain merged 7 commits intoeip4844from Apr 5, 2023
Merged
Merge all block unblinding code into a single unblinder struct#12232terencechain merged 7 commits intoeip4844from
unblinder struct#12232terencechain merged 7 commits intoeip4844from
Conversation
456ff44 to
ceddae7
Compare
rkapka
commented
Apr 3, 2023
| if !u.b.IsBlinded() { | ||
| return u.b, nil | ||
| } | ||
| if u.b.Version() != u.version { |
Contributor
Author
There was a problem hiding this comment.
This should never happen when using newUnblinder because u.version is set from u.b.Version(), but it might happen when setting fields by hand. We could also remove the version field all together and always read the block's version.
Contributor
Author
|
Converted to draft because there is a failing test |
terencechain
reviewed
Apr 4, 2023
Collaborator
terencechain
left a comment
There was a problem hiding this comment.
Lgtm, a minor feedback on potentially removing separate version tracking
| ) | ||
|
|
||
| type unblinder struct { | ||
| version int |
Collaborator
There was a problem hiding this comment.
Why don't we just read block's version directly?
Comment on lines
+35
to
+37
| if !u.b.IsBlinded() || !u.builder.Configured() || u.version < version.Bellatrix { | ||
| return u.b, nil | ||
| } |
Collaborator
There was a problem hiding this comment.
I reckon if today we are stuck with the following
- block is blinded
- builder is not configured
The function should probably explicitly error out. It's better than broadcasting a blind block
terencechain
approved these changes
Apr 5, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
Other
What does this PR do? Why is it needed?
This PR creates a new
unblindertype responsible for (wait for it...) unblinding blocks. The main purpose of the type is to reduce code duplication and keep unblinding logic in one place. It can easily be extended for Deneb blocks.