Skip to content

Conversation

james-prysm
Copy link
Contributor

@james-prysm james-prysm commented Aug 14, 2024

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

go.mod Outdated
// 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
Copy link
Contributor Author

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

@james-prysm james-prysm changed the title Builder electra Builder: Electra Sep 24, 2024
if !ok {
return nil, errors.New("builder returned non-electra bid")
}
for _, c := range kzgCommitments {
Copy link
Contributor Author

@james-prysm james-prysm Oct 17, 2024

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) {

return consensus_types.ErrNotSupported("SetExecutionRequests", b.version)
}
if req == nil {
return errors.New("nil execution request")
Copy link
Contributor Author

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?

Copy link
Contributor

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
Copy link
Contributor Author

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

_, 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) {
Copy link
Contributor Author

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?

Comment on lines 83 to 97
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()
Copy link
Collaborator

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 {
Copy link
Collaborator

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?

Copy link
Contributor Author

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)

}

// ExecHeaderResponseElectra is the header response for builder API /eth/v1/builder/header/{slot}/{parent_hash}/{pubkey}.
type ExecHeaderResponseElectra struct {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

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

if bb.ExecutionRequests == nil {
return nil, errors.New("execution requests is empty")
}
ExecutionRequests, err := bb.ExecutionRequests.ToProto()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is ExecutionRequests cap?

}

// MaxBlobsPerBlockByVersion returns the maximum number of blobs per block for the given fork version
func (b *BeaconChainConfig) MaxBlobsPerBlockByVersion(v int) int {
Copy link
Collaborator

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

return consensus_types.ErrNotSupported("SetExecutionRequests", b.version)
}
if req == nil {
return errors.New("nil execution request")
Copy link
Contributor

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.

@james-prysm james-prysm enabled auto-merge January 23, 2025 17:37
@james-prysm james-prysm added this pull request to the merge queue Jan 23, 2025
Merged via the queue into develop with commit 2c78e50 Jan 23, 2025
15 checks passed
@james-prysm james-prysm deleted the builder-electra branch January 23, 2025 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants