builder: deneb and handling blobs#12477
Conversation
f42b326 to
0c7f3cc
Compare
7a66220 to
c3925b7
Compare
beacon-chain/builder/service.go
Outdated
| return nil, ErrNoBuilder | ||
| return nil, nil, ErrNoBuilder | ||
| } | ||
| if blobs != nil && uint64(len(blobs)) > fieldparams.MaxBlobsPerBlock { |
There was a problem hiding this comment.
Do i need this check here?
There was a problem hiding this comment.
I dont think you need blobs != nil here
| return nil, nil, errors.Wrapf(err, "could not get protobuf block") | ||
| } | ||
|
|
||
| b := ðpb.SignedBlindedBeaconBlockAndBlobsDeneb{Block: psb, Blobs: blobs} |
There was a problem hiding this comment.
any additional checks needed for blobs here?
There was a problem hiding this comment.
I think we are good here
153380c to
4216dd8
Compare
| // Signature -- | ||
| func (b signedBuilderBidDeneb) Signature() []byte { | ||
| return b.p.Signature | ||
| } | ||
|
|
||
| // Version -- | ||
| func (b signedBuilderBidDeneb) Version() int { | ||
| return version.Deneb | ||
| } | ||
|
|
||
| // IsNil -- | ||
| func (b signedBuilderBidDeneb) IsNil() bool { | ||
| return b.p == nil | ||
| } |
There was a problem hiding this comment.
let's move these before or after builderBidDeneb methods
| return nil, nil, errors.Wrapf(err, "could not get protobuf block") | ||
| } | ||
|
|
||
| b := ðpb.SignedBlindedBeaconBlockAndBlobsDeneb{Block: psb, Blobs: blobs} |
There was a problem hiding this comment.
I think we are good here
| blobs := make([][]byte, len(b.Blobs)) | ||
| for i := range b.Blobs { | ||
| blobs[i] = b.Blobs[i] | ||
| } |
There was a problem hiding this comment.
I'd probably check the length here similar to the above fieldparams.BlobLength
api/client/builder/types.go
Outdated
| func (b BlobsBundle) ToProto() (*v1.BlobsBundle, error) { | ||
| commitments := make([][]byte, len(b.Commitments)) | ||
| for i := range b.Commitments { | ||
| if len(b.Commitments[i]) != 48 { |
There was a problem hiding this comment.
Replace 48 with fieldparams.BLSPubkeyLength
api/client/builder/types_test.go
Outdated
| name: "ExecPayloadResponse.ExecutionPayload.BlockHash", | ||
| }, | ||
| { | ||
| expected: "1", |
There was a problem hiding this comment.
DataGasUsed and ExcessDataGas should be using different values to avoid mix up
api/client/builder/types_test.go
Outdated
| DataGasUsed: 1, | ||
| ExcessDataGas: 1, |
There was a problem hiding this comment.
Let's use different values here
| DataGasUsed: 1, | ||
| ExcessDataGas: 1, |
There was a problem hiding this comment.
Let's use different values here
beacon-chain/builder/service.go
Outdated
| return nil, ErrNoBuilder | ||
| return nil, nil, ErrNoBuilder | ||
| } | ||
| if blobs != nil && uint64(len(blobs)) > fieldparams.MaxBlobsPerBlock { |
There was a problem hiding this comment.
I dont think you need blobs != nil here
25b25cc to
ae02dcd
Compare
ccf3258 to
ab9623e
Compare
4fd3bef to
bd554c4
Compare
rkapka
left a comment
There was a problem hiding this comment.
We should make safe copies when converting to proto objects
api/client/builder/bid.go
Outdated
|
|
||
| // Header -- | ||
| func (b builderBidDeneb) Header() (interfaces.ExecutionData, error) { | ||
| if b.p == nil { |
There was a problem hiding this comment.
You should either verify b.p in all getters or skip it everywhere. Since we error out in the constructor when wrapping a nil object, I would just remove it.
api/client/builder/bid.go
Outdated
| return nil, errors.New("builder bid is nil") | ||
| } | ||
| // We have to convert big endian to little endian because the value is coming from the execution layer. | ||
| v := big.NewInt(0).SetBytes(bytesutil.ReverseByteOrder(b.p.Value)) |
There was a problem hiding this comment.
I would extract math.WeiToGwei(big.NewInt(0).SetBytes(bytesutil.ReverseByteOrder(b.p.Value))) to a function and reuse it for Capella/Deneb/etc.
| return payload, bundle, nil | ||
| } | ||
|
|
||
| func (p *ExecutionPayloadDeneb) ToProto() (*v1.ExecutionPayloadDeneb, error) { |
There was a problem hiding this comment.
We make unsafe copies everywhere
| return HydrateSignedBlindedBeaconBlockDeneb(ðpb.SignedBlindedBeaconBlockDeneb{}) | ||
| } | ||
|
|
||
| func NewBlindedBlobSidecar() *ethpb.SignedBlindedBlobSidecar { |
69b60fc to
ceb1ad3
Compare
7b92a6c to
fbaafd9
Compare
| return | ||
| } | ||
| v := big.NewInt(0).SetBytes(bytesutil.ReverseByteOrder(b.Value)) | ||
| // used for testing bid values |
There was a problem hiding this comment.
This comment doesn't really explain what's special about multiplying by 2. I think adding Nishant's explanation will be better:
we set the payload value as twice its actual one so that it always chooses builder payloads vs local payloads
math/math_helper.go
Outdated
| // Wei is the smallest unit of Ether, and sent in the payload value of the execution engine API call. | ||
| // represented as a pointer to a bigInt. |
There was a problem hiding this comment.
| // Wei is the smallest unit of Ether, and sent in the payload value of the execution engine API call. | |
| // represented as a pointer to a bigInt. | |
| // Wei is the smallest unit of Ether, represented as a pointer to a bigInt. |
I don't think a type definition should specify a particular use case, although it's a nitpick really.
f67e3bb to
6b0a45f
Compare
What type of PR is this?
Feature
What does this PR do? Why is it needed?
Introduces deneb block and blobs to builder
implements changes from
ethereum/builder-specs#80
ethereum/builder-specs#79
ethereum/builder-specs#61
ethereum/consensus-specs#3391
ethereum/consensus-specs#3392
part of #12248