Conversation
| return nil, errors.Wrap(err, "could not set execution") | ||
| } | ||
|
|
||
| payload, err := u.builder.SubmitBlindedBlock(ctx, sb) |
There was a problem hiding this comment.
Please don't forget to set SetBLSToExecutionChanges before SubmitBlindedBlock
Also, please add a unit test for this field
See #12263 for detail
# Conflicts: # beacon-chain/rpc/prysm/v1alpha1/validator/proposer_capella.go # beacon-chain/rpc/prysm/v1alpha1/validator/proposer_capella_test.go
| return nil, errors.Wrap(err, "could not set sync aggregate") | ||
| } | ||
| sb.SetSignature(sig[:]) | ||
| if err = sb.SetBLSToExecutionChanges(blsToExecChanges); err != nil && !errors.Is(err, consensusblocks.ErrUnsupportedGetter) { |
There was a problem hiding this comment.
Wouldn't the error be unsupported Setter here instead of Getter?
There was a problem hiding this comment.
This requires some more refactoring, but I can add it.
| StateRoot: make([]byte, fieldparams.RootLength), | ||
| ReceiptsRoot: make([]byte, fieldparams.RootLength), | ||
| LogsBloom: make([]byte, fieldparams.LogsBloomLength), | ||
| PrevRandao: make([]byte, fieldparams.RootLength), |
There was a problem hiding this comment.
presumably this omits BlockNumber, GasLimit, GasUsed, Timestamp because they are uint64s so they receive zero values, but we may want to always include all fields in functions like this as a matter of course to help verify completeness.
| BlockHash: make([]byte, fieldparams.RootLength), | ||
| Transactions: make([][]byte, 0), | ||
| Withdrawals: make([]*enginev1.Withdrawal, 0), | ||
| ExtraData: make([]byte, 0), |
There was a problem hiding this comment.
could we put these fields in the same order as the consensus types? That would make this code a little easier to compare to generated protobuf code.
There was a problem hiding this comment.
What do you mean exactly? In consensus types we have an ExecutionData interface and a type that wraps a proto object.
| return nil, errors.Wrap(err, "could not set execution") | ||
| } | ||
|
|
||
| payload, err := u.builder.SubmitBlindedBlock(ctx, sb) |
There was a problem hiding this comment.
It might be a good time to add a defensive check for SubmitBlindedBlock and do a version check on the response for the payload. right now the version isn't getting checked on the response and is not part of the executiondata interface which could result in a bad payload.
There was a problem hiding this comment.
payload is of type ExecutionData, which doesn't have a version. If we want to change this, it should be in a new PR.
There was a problem hiding this comment.
yeah we need a new PR for checking inside I'm not sure if ExecutionData needs it to get the version or not, but at least it should be checked inside
There was a problem hiding this comment.
my PR merged in with the check here
| if err != nil { | ||
| return nil, errors.Wrap(err, "could not create signed block") | ||
| } | ||
| wb.SetSlot(sb.Block().Slot()) |
There was a problem hiding this comment.
is there any pattern we can follow so we don't miss/forget doing these sets? also might be worth breaking into its own function to make this more readable.
There was a problem hiding this comment.
I guess the same comment applies to line 66and onwards.
do the settings in sb and wb need to be the same? maybe there can be a check on that too somehow?
There was a problem hiding this comment.
or better yet a utility function where wb/sb are passed so it's at least 1 spot ( not sure if it's completed replicated logic however.
There was a problem hiding this comment.
I extracted common code
| return nil, errors.New("builder not configured") | ||
| } | ||
|
|
||
| agg, err := u.b.Block().Body().SyncAggregate() |
There was a problem hiding this comment.
might need nil checks in case of panics
There was a problem hiding this comment.
this is already checked at the beginning of newUnblinder
|
Marking as blocked until we have the test builder ready. |
# Conflicts: # beacon-chain/blockchain/log.go # beacon-chain/core/blocks/payload.go # beacon-chain/rpc/eth/beacon/BUILD.bazel # beacon-chain/rpc/eth/beacon/blinded_blocks.go # beacon-chain/rpc/eth/beacon/blinded_blocks_test.go # beacon-chain/rpc/eth/beacon/blocks.go # beacon-chain/rpc/prysm/v1alpha1/validator/proposer_bellatrix.go # cmd/prysmctl/p2p/request_blocks.go # consensus-types/blocks/execution.go # consensus-types/blocks/execution_test.go # consensus-types/blocks/types.go
| return nil, err | ||
| } | ||
| return &unblinder{ | ||
| b: b, |
There was a problem hiding this comment.
should there be a nil check on builder here?
| if !u.b.IsBlinded() || u.b.Version() < version.Bellatrix { | ||
| return u.b, nil | ||
| } | ||
| if u.b.IsBlinded() && !u.builder.Configured() { |
There was a problem hiding this comment.
builder nil check could also be here I guess.
Dismissing my review. I haven't looked at it closely for approve but feel free to merge if others have
| return wb, nil | ||
| } | ||
|
|
||
| func copyBlockData(src interfaces.SignedBeaconBlock, dst interfaces.SignedBeaconBlock) error { |
There was a problem hiding this comment.
This might be the scariest function in all of this if we forget to add something/populate something.
| return errors.Wrap(err, "could not set sync aggregate") | ||
| } | ||
| dst.SetSignature(sig[:]) | ||
| if err = dst.SetBLSToExecutionChanges(blsToExecChanges); err != nil && !errors.Is(err, consensus_types.ErrUnsupportedField) { |
There was a problem hiding this comment.
worth adding capella fork marking here in comments?
| graffiti := src.Block().Body().Graffiti() | ||
| sig := src.Signature() | ||
| blsToExecChanges, err := src.Block().Body().BLSToExecutionChanges() | ||
| if err != nil && !errors.Is(err, consensus_types.ErrUnsupportedField) { |
There was a problem hiding this comment.
so copy Block will throw an error here if it's an old block that doesn't have this support?
What type of PR is this?
Other
What does this PR do? Why is it needed?
This PR creates a new unblinder type 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.
This was already merged to 4844 in #12232