Skip to content
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

Draft
wants to merge 30 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
d0522ac
removing skip from test
james-prysm Aug 14, 2024
9269e0e
Merge branch 'develop' into electra-test-remove-skip
james-prysm Aug 14, 2024
1ed404c
builder wip
james-prysm Aug 14, 2024
592a45a
Merge branch 'develop' into builder-electra
james-prysm Aug 14, 2024
512e388
removing todo, it's probably ok
james-prysm Aug 14, 2024
bfae0ca
adding more TODOs
james-prysm Aug 14, 2024
d8b98d7
adding fromProtoElectra
james-prysm Aug 14, 2024
dbc55c9
using lightclient
james-prysm Aug 15, 2024
2521755
minor fixes
james-prysm Aug 15, 2024
9c8d26e
Merge branch 'develop' into builder-electra
james-prysm Sep 5, 2024
734ef94
Merge branch 'develop' into builder-electra
james-prysm Sep 16, 2024
066ce6a
Merge branch 'develop' into builder-electra
james-prysm Sep 24, 2024
67235fb
rolling back dependency changes
james-prysm Sep 24, 2024
6d580ec
go mod tidy
james-prysm Sep 24, 2024
c67df35
adding space back in
james-prysm Sep 24, 2024
6d1a9fa
Merge branch 'develop' into builder-electra
james-prysm Sep 25, 2024
d5f8e02
updating builder changes based on execution request changes
james-prysm Sep 26, 2024
2c907b2
Merge branch 'develop' into builder-electra
james-prysm Oct 15, 2024
289bb52
update ssz
james-prysm Oct 15, 2024
1c4be98
changelog
james-prysm Oct 15, 2024
45c1d0b
Merge branch 'develop' into builder-electra
james-prysm Oct 17, 2024
c1a93d8
updating based on execution request changes
james-prysm Oct 17, 2024
802a68b
fixing validation
james-prysm Oct 17, 2024
0aae98d
adding builder test for electra
james-prysm Oct 18, 2024
1adc957
Merge branch 'develop' into builder-electra
james-prysm Oct 18, 2024
759b819
gaz
james-prysm Oct 21, 2024
35e8541
attempting to fix test
james-prysm Oct 21, 2024
a5cea41
fixing ssz
james-prysm Oct 21, 2024
9cdb111
Merge branch 'develop' into builder-electra
james-prysm Oct 21, 2024
b409a59
Merge branch 'develop' into builder-electra
james-prysm Oct 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 87 additions & 0 deletions api/client/builder/bid.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,3 +290,90 @@ func (b signedBuilderBidDeneb) Version() int {
func (b signedBuilderBidDeneb) IsNil() bool {
return b.p == nil
}

type builderBidElectra struct {
p *ethpb.BuilderBidElectra
}

// WrappedBuilderBidElectra is a constructor which wraps a protobuf bid into an interface.
func WrappedBuilderBidElectra(p *ethpb.BuilderBidElectra) (Bid, error) {
w := builderBidElectra{p: p}
if w.IsNil() {
return nil, consensus_types.ErrNilObjectWrapped
}
return w, nil
}

// Version --
func (b builderBidElectra) Version() int {
return version.Electra
}

// Value --
func (b builderBidElectra) Value() primitives.Wei {
return primitives.LittleEndianBytesToWei(b.p.Value)
}

// Pubkey --
func (b builderBidElectra) Pubkey() []byte {
return b.p.Pubkey
}

// IsNil --
func (b builderBidElectra) IsNil() bool {
return b.p == nil
}

// HashTreeRoot --
func (b builderBidElectra) HashTreeRoot() ([32]byte, error) {
return b.p.HashTreeRoot()
}

// HashTreeRootWith --
func (b builderBidElectra) HashTreeRootWith(hh *ssz.Hasher) error {
return b.p.HashTreeRootWith(hh)
}

// Header --
func (b builderBidElectra) Header() (interfaces.ExecutionData, error) {
// We have to convert big endian to little endian because the value is coming from the execution layer.
return blocks.WrappedExecutionPayloadHeaderElectra(b.p.Header)
}

// BlobKzgCommitments --
func (b builderBidElectra) BlobKzgCommitments() ([][]byte, error) {
return b.p.BlobKzgCommitments, nil
}

type signedBuilderBidElectra struct {
p *ethpb.SignedBuilderBidElectra
}

// WrappedSignedBuilderBidElectra is a constructor which wraps a protobuf signed bit into an interface.
func WrappedSignedBuilderBidElectra(p *ethpb.SignedBuilderBidElectra) (SignedBid, error) {
w := signedBuilderBidElectra{p: p}
if w.IsNil() {
return nil, consensus_types.ErrNilObjectWrapped
}
return w, nil
}

// Message --
func (b signedBuilderBidElectra) Message() (Bid, error) {
return WrappedBuilderBidElectra(b.p.Message)
}

// Signature --
func (b signedBuilderBidElectra) Signature() []byte {
return b.p.Signature
}

// Version --
func (b signedBuilderBidElectra) Version() int {
return version.Electra
}

// IsNil --
func (b signedBuilderBidElectra) IsNil() bool {
return b.p == nil
}
10 changes: 10 additions & 0 deletions api/client/builder/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,16 @@ func (c *Client) GetHeader(ctx context.Context, slot primitives.Slot, parentHash
return nil, errors.Wrapf(err, "error unmarshaling the builder GetHeader response, using slot=%d, parentHash=%#x, pubkey=%#x", slot, parentHash, pubkey)
}
switch strings.ToLower(v.Version) {
case strings.ToLower(version.String(version.Electra)):
hr := &ExecHeaderResponseElectra{}
if err := json.Unmarshal(hb, hr); err != nil {
return nil, errors.Wrapf(err, "error unmarshaling the builder GetHeader response, using slot=%d, parentHash=%#x, pubkey=%#x", slot, parentHash, pubkey)
}
p, err := hr.ToProto()
if err != nil {
return nil, errors.Wrapf(err, "could not extract proto message from header")
}
return WrappedSignedBuilderBidElectra(p)
case strings.ToLower(version.String(version.Deneb)):
hr := &ExecHeaderResponseDeneb{}
if err := json.Unmarshal(hb, hr); err != nil {
Expand Down
Loading
Loading