From 430303185a351a508c410cdfde13794cd0a88c99 Mon Sep 17 00:00:00 2001 From: avalonche Date: Sat, 3 Aug 2024 09:45:07 +1000 Subject: [PATCH] Update electra types for devnet-1 --- api/versionedsubmitblindedblockresponse.go | 8 +++---- go.mod | 6 ++--- go.sum | 6 +++++ http/unblindproposal.go | 1 - spec/versionedsubmitblockrequest.go | 28 ++++++++++++++++++---- 5 files changed, 37 insertions(+), 12 deletions(-) diff --git a/api/versionedsubmitblindedblockresponse.go b/api/versionedsubmitblindedblockresponse.go index 1cfc776..2e3ac03 100644 --- a/api/versionedsubmitblindedblockresponse.go +++ b/api/versionedsubmitblindedblockresponse.go @@ -219,8 +219,8 @@ func (v *VersionedSubmitBlindedBlockResponse) ExcessBlobGas() (uint64, error) { } } -// DepositReceipts returns the deposit receipts of the execution payload. -func (v *VersionedSubmitBlindedBlockResponse) DepositReceipts() ([]*consensuselectra.DepositReceipt, error) { +// DepositRequests returns the deposit receipts of the execution payload. +func (v *VersionedSubmitBlindedBlockResponse) DepositRequests() ([]*consensuselectra.DepositRequest, error) { if v == nil { return nil, errors.New("nil struct") } @@ -233,14 +233,14 @@ func (v *VersionedSubmitBlindedBlockResponse) DepositReceipts() ([]*consensusele return nil, errors.New("no data execution payload") } - return v.Electra.ExecutionPayload.DepositReceipts, nil + return v.Electra.ExecutionPayload.DepositRequests, nil default: return nil, errors.New("unsupported version") } } // WithdrawalRequests returns the execution layer withdrawal requests of the execution payload. -func (v *VersionedSubmitBlindedBlockResponse) WithdrawalRequests() ([]*consensuselectra.ExecutionLayerWithdrawalRequest, error) { +func (v *VersionedSubmitBlindedBlockResponse) WithdrawalRequests() ([]*consensuselectra.WithdrawalRequest, error) { if v == nil { return nil, errors.New("nil struct") } diff --git a/go.mod b/go.mod index 93f9ff7..3bcc6e1 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/attestantio/go-builder-client go 1.20 require ( - github.com/attestantio/go-eth2-client v0.21.4-0.20240508201227-6fd8b5ef4447 + github.com/attestantio/go-eth2-client v0.21.7-0.20240701211822-0a60485fce68 github.com/ferranbt/fastssz v0.1.3 // go-yaml after 1.9.2 has memory issues due to https://github.com/goccy/go-yaml/issues/325; avoid. github.com/goccy/go-yaml v1.9.2 @@ -39,8 +39,8 @@ require ( github.com/prometheus/procfs v0.10.1 // indirect github.com/prysmaticlabs/go-bitfield v0.0.0-20240328144219-a1caa50c3a1e // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect - golang.org/x/crypto v0.22.0 // indirect - golang.org/x/sys v0.19.0 // indirect + golang.org/x/crypto v0.23.0 // indirect + golang.org/x/sys v0.20.0 // indirect golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect google.golang.org/protobuf v1.30.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect diff --git a/go.sum b/go.sum index 0e9ffeb..7f999b4 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,7 @@ github.com/attestantio/go-eth2-client v0.21.4-0.20240508201227-6fd8b5ef4447 h1:k0SJ1kAoijCKsRLG+D8kzicwAwpkCWsa/9KRQS5EjFg= github.com/attestantio/go-eth2-client v0.21.4-0.20240508201227-6fd8b5ef4447/go.mod h1:yzMl6JKut8ngKCRyv+6H9j2nNjS/+SMm3N+duf8iix8= +github.com/attestantio/go-eth2-client v0.21.7-0.20240701211822-0a60485fce68 h1:+sc+OAeTcWjQ5BwK6aajh9xnu8KYtIJNVqwbWx+KvQ4= +github.com/attestantio/go-eth2-client v0.21.7-0.20240701211822-0a60485fce68/go.mod h1:vy5jU/uDZ2+RcVzq5BfnG+bQ3/6uu9DGwCrGsPtjJ1A= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= @@ -97,6 +99,8 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30= golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= +golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI= +golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -109,6 +113,8 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= +golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/http/unblindproposal.go b/http/unblindproposal.go index 961f282..6a33501 100644 --- a/http/unblindproposal.go +++ b/http/unblindproposal.go @@ -360,7 +360,6 @@ func (s *Service) unblindElectraProposal(ctx context.Context, SyncAggregate: proposal.Message.Body.SyncAggregate, BLSToExecutionChanges: proposal.Message.Body.BLSToExecutionChanges, BlobKZGCommitments: proposal.Message.Body.BlobKZGCommitments, - Consolidations: proposal.Message.Body.Consolidations, }, }, Signature: proposal.Signature, diff --git a/spec/versionedsubmitblockrequest.go b/spec/versionedsubmitblockrequest.go index 8a82b57..13cb0d0 100644 --- a/spec/versionedsubmitblockrequest.go +++ b/spec/versionedsubmitblockrequest.go @@ -969,8 +969,8 @@ func (v *VersionedSubmitBlockRequest) ExcessBlobGas() (uint64, error) { } } -// DepositReceipts returns the deposit receipts of the execution payload. -func (v *VersionedSubmitBlockRequest) DepositReceipts() ([]*consensuselectra.DepositReceipt, error) { +// DepositRequests returns the deposit receipts of the execution payload. +func (v *VersionedSubmitBlockRequest) DepositRequests() ([]*consensuselectra.DepositRequest, error) { if v == nil { return nil, errors.New("nil struct") } @@ -983,14 +983,14 @@ func (v *VersionedSubmitBlockRequest) DepositReceipts() ([]*consensuselectra.Dep return nil, errors.New("no data execution payload") } - return v.Electra.ExecutionPayload.DepositReceipts, nil + return v.Electra.ExecutionPayload.DepositRequests, nil default: return nil, errors.New("unsupported version") } } // WithdrawalRequests returns the execution layer withdrawal requests of the execution payload. -func (v *VersionedSubmitBlockRequest) WithdrawalRequests() ([]*consensuselectra.ExecutionLayerWithdrawalRequest, error) { +func (v *VersionedSubmitBlockRequest) WithdrawalRequests() ([]*consensuselectra.WithdrawalRequest, error) { if v == nil { return nil, errors.New("nil struct") } @@ -1009,6 +1009,26 @@ func (v *VersionedSubmitBlockRequest) WithdrawalRequests() ([]*consensuselectra. } } +// ConsolidationRequests returns the consolidation requests of the execution payload. +func (v *VersionedSubmitBlockRequest) ConsolidationRequests() ([]*consensuselectra.ConsolidationRequest, error) { + if v == nil { + return nil, errors.New("nil struct") + } + switch v.Version { + case consensusspec.DataVersionElectra: + if v.Electra == nil { + return nil, errors.New("no data") + } + if v.Electra.ExecutionPayload == nil { + return nil, errors.New("no data execution payload") + } + + return v.Electra.ExecutionPayload.ConsolidationRequests, nil + default: + return nil, errors.New("unsupported version") + } +} + // String returns a string version of the structure. func (v *VersionedSubmitBlockRequest) String() string { if v == nil {