-
Notifications
You must be signed in to change notification settings - Fork 1.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
Builder: Electra #14344
Builder: Electra #14344
Conversation
go.mod
Outdated
@@ -284,3 +284,5 @@ replace github.com/json-iterator/go => github.com/prestonvanloon/go v1.1.7-0.201 | |||
|
|||
// See https://github.com/prysmaticlabs/grpc-gateway/issues/2 | |||
replace github.com/grpc-ecosystem/grpc-gateway/v2 => github.com/prysmaticlabs/grpc-gateway/v2 v2.3.1-0.20230315201114-09284ba20446 | |||
|
|||
replace github.com/ethereum/go-ethereum => github.com/lightclient/go-ethereum v1.10.10-0.20240726203109-4a0622f95d30 |
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.
temp uses lightclient's fork to use the updated libraries in e2e
} | ||
for _, c := range kzgCommitments { |
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.
removing this validation as we already validate when we convert the bid from json to proto in func (bb *BuilderBidElectra) ToProto() (*eth.BuilderBidElectra, error) {
consensus-types/blocks/setters.go
Outdated
@@ -179,6 +180,9 @@ func (b *SignedBeaconBlock) SetExecutionRequests(req *enginev1.ExecutionRequests | |||
if b.version < version.Electra { | |||
return consensus_types.ErrNotSupported("SetExecutionRequests", b.version) | |||
} | |||
if req == nil { | |||
return errors.New("nil execution request") |
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.
should I throw an error or just set it to an empty request object?
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.
In my opinion it's bad practice to have different ways of handling the same thing within one package. We don't check this in other setters, so we should just skip it here too.
http.Error(w, err.Error(), http.StatusInternalServerError) | ||
return | ||
} | ||
p.currVersion = version.Electra |
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.
i'm not sure if this is the best way to do it, it's because the payload is still deneb so I can't do it by payload version
@@ -292,6 +292,50 @@ func TestClient_GetHeader(t *testing.T) { | |||
_, err := c.GetHeader(ctx, slot, bytesutil.ToBytes32(parentHash), bytesutil.ToBytes48(pubkey)) | |||
require.ErrorContains(t, "could not extract proto message from header: too many blob commitments: 7", err) | |||
}) | |||
t.Run("electra", func(t *testing.T) { |
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.
should i add any more kinds of tests?
bidDeneb, ok := bid.(builder.BidDeneb) | ||
if !ok { | ||
log.Warnf("bid type %T does not implement builder.BidDeneb ", bid) | ||
} else { | ||
builderKzgCommitments = bidDeneb.BlobKzgCommitments() | ||
} | ||
} | ||
|
||
var executionRequests *enginev1.ExecutionRequests | ||
if bid.Version() >= version.Electra { | ||
bidElectra, ok := bid.(builder.BidElectra) | ||
if !ok { | ||
log.Warnf("bid type %T does not implement builder.BidElectra ", bid) | ||
} else { | ||
executionRequests = bidElectra.ExecutionRequests() |
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 dont need to do this until after: higherValueBuilder && withdrawalsMatched
for the default bellatrix case, we can just set them as nil: setBuilderExecution(blk, builderPayload, nil, nil)
if isBlinded { | ||
requestsErr = "failed to set builder execution requests" | ||
} | ||
if err := blk.SetExecutionRequests(requests); err != nil { |
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.
If a builder returns us an invalid execution requests, shouldn't we default to local block?
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.
isn't that what we do? it returns an error and then it falls back to
if err := setBuilderExecution(blk, builderPayload, builderKzgCommitments, executionRequests); err != nil {
log.WithError(err).Warn("Proposer: failed to set builder payload")
return local.Bid, local.BlobsBundle, setLocalExecution(blk, local)
@@ -1307,6 +1275,208 @@ func (p *ExecutionPayloadDeneb) ToProto() (*v1.ExecutionPayloadDeneb, error) { | |||
}, nil | |||
} | |||
|
|||
// ExecHeaderResponseElectra is the header response for builder API /eth/v1/builder/header/{slot}/{parent_hash}/{pubkey}. | |||
type ExecHeaderResponseElectra struct { |
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.
Why cant the testing middleware uses this struct here?
prysm/testing/middleware/builder/builder.go
Line 109 in 5bbbad6
type ExecHeaderResponseElectra struct { |
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.
good question i'm not sure i should fix the old ones too
api/client/builder/types.go
Outdated
if bb.ExecutionRequests == nil { | ||
return nil, errors.New("execution requests is empty") | ||
} | ||
ExecutionRequests, err := bb.ExecutionRequests.ToProto() |
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.
Why is ExecutionRequests
cap?
@@ -395,6 +395,14 @@ func (b *BeaconChainConfig) MaxBlobsPerBlock(slot primitives.Slot) int { | |||
return b.DeprecatedMaxBlobsPerBlock | |||
} | |||
|
|||
// MaxBlobsPerBlockByVersion returns the maximum number of blobs per block for the given fork version | |||
func (b *BeaconChainConfig) MaxBlobsPerBlockByVersion(v int) int { |
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.
Please add a test for this helper function
beacon-chain/rpc/prysm/v1alpha1/validator/proposer_bellatrix.go
Outdated
Show resolved
Hide resolved
beacon-chain/rpc/prysm/v1alpha1/validator/proposer_bellatrix.go
Outdated
Show resolved
Hide resolved
beacon-chain/rpc/prysm/v1alpha1/validator/proposer_bellatrix.go
Outdated
Show resolved
Hide resolved
beacon-chain/rpc/prysm/v1alpha1/validator/proposer_bellatrix.go
Outdated
Show resolved
Hide resolved
consensus-types/blocks/setters.go
Outdated
@@ -179,6 +180,9 @@ func (b *SignedBeaconBlock) SetExecutionRequests(req *enginev1.ExecutionRequests | |||
if b.version < version.Electra { | |||
return consensus_types.ErrNotSupported("SetExecutionRequests", b.version) | |||
} | |||
if req == nil { | |||
return errors.New("nil execution request") |
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.
In my opinion it's bad practice to have different ways of handling the same thing within one package. We don't check this in other setters, so we should just skip it here too.
Co-authored-by: Radosław Kapka <[email protected]>
Co-authored-by: Radosław Kapka <[email protected]>
Co-authored-by: Radosław Kapka <[email protected]>
Co-authored-by: Radosław Kapka <[email protected]>
Co-authored-by: Radosław Kapka <[email protected]>
Co-authored-by: Radosław Kapka <[email protected]>
What type of PR is this?
Feature
What does this PR do? Why is it needed?
implements ethereum/builder-specs#101
does not include
Which issues(s) does this PR fix?
Fixes #
Other notes for review