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

Update electra types for devnet1 compatibility #147

Merged
merged 25 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
70f5e25
Update dependencies.
mcdee May 12, 2024
e02b07f
Updates for release.
mcdee May 12, 2024
84ddfd9
fix: passing of timeouts in `chunkedValidators`
moshe-blox May 29, 2024
23b592c
Merge pull request #142 from y0sher/fix-chunked-validators-timeout
mcdee Jun 3, 2024
000ee97
Ensure POST bodies are logged as JSON.
mcdee Jun 7, 2024
af90f05
Tidy up responses for POST requests.
mcdee Jun 7, 2024
b787d6b
Bump version.
mcdee Jun 10, 2024
770ba2b
Linting.
mcdee Jun 10, 2024
2d6d5b4
Support SSZ on a per-call basis.
mcdee Jun 11, 2024
ec55dc8
Merge pull request #145 from attestantio/per-call-ssz
mcdee Jun 11, 2024
da19cf1
Bump release.
mcdee Jun 11, 2024
291df33
update electra types for devnet 1 compatibility
pk910 Jul 1, 2024
deaa8fa
update `PayloadAttributesV4`
pk910 Jul 1, 2024
3e37d69
small fixes (regenerate ssz files)
pk910 Jul 1, 2024
6d554cc
removed `SignedConsolidation`
pk910 Jul 1, 2024
988e468
fix unused nolint:gocyclo
pk910 Jul 1, 2024
863d3f0
fix unrelated golangci-lint warnings
pk910 Jul 1, 2024
490a9b4
fix unrelated `golangci-lint` warning
pk910 Jul 1, 2024
6c6db7a
fix tests
pk910 Jul 1, 2024
8fe2dd5
Revert "fix unrelated golangci-lint warnings"
pk910 Jul 1, 2024
f7a78a9
Revert "fix unrelated `golangci-lint` warning"
pk910 Jul 1, 2024
c9dc332
Merge branch 'master' into pk910/electra-devnet1
pk910 Jul 1, 2024
7640d97
consitently rename `deposit_receipts` to `deposit_requests`
pk910 Jul 1, 2024
e9ac3a2
add missing unmarshal code for `consolidation_requests`
pk910 Jul 1, 2024
b956899
add `consolidation_requests_root` to `executionPayloadHeaderYAML`
pk910 Jul 1, 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
10 changes: 0 additions & 10 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,10 @@ linters:
# https://golangci-lint.run/usage/linters/#disabled-by-default
disable:
- cyclop
- deadcode
- depguard
- dupl
- execinquery
- exhaustive
- exhaustivestruct
- exhaustruct
- forcetypeassert
- funlen
Expand All @@ -172,21 +170,13 @@ linters:
- gocognit
- goconst
- err113
- golint
- gomnd
- ifshort
- interfacer
- ireturn
- lll
- maintidx
- maligned
- mnd
- musttag
- nosnakecase
- perfsprint
- scopelint
- structcheck
- varcheck
- varnamelen
- wrapcheck
- wsl
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
0.21.4:
- additional nil checks
- allow non-mainnet configurations

0.21.3:
- relax requirement for proposals to use the graffiti we request

Expand Down
1 change: 0 additions & 1 deletion api/v1/electra/blindedbeaconblockbody.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ type BlindedBeaconBlockBody struct {
ExecutionPayloadHeader *electra.ExecutionPayloadHeader
BLSToExecutionChanges []*capella.SignedBLSToExecutionChange `ssz-max:"16"`
BlobKZGCommitments []deneb.KZGCommitment `ssz-max:"4096" ssz-size:"?,48"`
Consolidations []*electra.SignedConsolidation `ssz-max:"1"`
}

// String returns a string version of the structure.
Expand Down
11 changes: 0 additions & 11 deletions api/v1/electra/blindedbeaconblockbody_json.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ type blindedBeaconBlockBodyJSON struct {
ExecutionPayloadHeader *electra.ExecutionPayloadHeader `json:"execution_payload_header"`
BLSToExecutionChanges []*capella.SignedBLSToExecutionChange `json:"bls_to_execution_changes"`
BlobKZGCommitments []string `json:"blob_kzg_commitments"`
Consolidations []*electra.SignedConsolidation `json:"consolidations"`
}

// MarshalJSON implements json.Marshaler.
Expand Down Expand Up @@ -188,16 +187,6 @@ func (b *BlindedBeaconBlockBody) unpack(data *blindedBeaconBlockBodyJSON) error
}
copy(b.BlobKZGCommitments[i][:], data)
}
if data.Consolidations == nil {
b.Consolidations = make([]*electra.SignedConsolidation, 0)
} else {
for i := range data.Consolidations {
if data.Consolidations[i] == nil {
return fmt.Errorf("consolidations entry %d missing", i)
}
}
b.Consolidations = data.Consolidations
}

return nil
}
69 changes: 6 additions & 63 deletions api/v1/electra/blindedbeaconblockbody_ssz.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions api/v1/electra/blindedbeaconblockbody_yaml.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ type blindedBeaconBlockBodyYAML struct {
ExecutionPayloadHeader *electra.ExecutionPayloadHeader `yaml:"execution_payload_header"`
BLSToExecutionChanges []*capella.SignedBLSToExecutionChange `yaml:"bls_to_execution_changes"`
BlobKZGCommitments []string `yaml:"blob_kzg_commitments"`
Consolidations []*electra.SignedConsolidation `json:"consolidations"`
}

// MarshalYAML implements yaml.Marshaler.
Expand All @@ -62,7 +61,6 @@ func (b *BlindedBeaconBlockBody) MarshalYAML() ([]byte, error) {
ExecutionPayloadHeader: b.ExecutionPayloadHeader,
BLSToExecutionChanges: b.BLSToExecutionChanges,
BlobKZGCommitments: blobKZGCommitments,
Consolidations: b.Consolidations,
}, yaml.Flow(true))
if err != nil {
return nil, err
Expand Down
50 changes: 32 additions & 18 deletions api/v1/payloadattributesevent.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,12 @@ type PayloadAttributesV4 struct {
Withdrawals []*capella.Withdrawal
// ParentBeaconBlockRoot is the parent beacon block root.
ParentBeaconBlockRoot phase0.Root
// DepositReceipts is the list of deposit receipts.
DepositReceipts []*electra.DepositReceipt
// WithdrawalRequests is the list of execution layer withdrawal requests.
WithdrawalRequests []*electra.ExecutionLayerWithdrawalRequest
// DepositRequests is the list of deposit receipts.
DepositRequests []*electra.DepositRequest
// WithdrawalRequests is the list of withdrawal requests.
WithdrawalRequests []*electra.WithdrawalRequest
// ConsolidationRequests is the list of consolidation requests.
ConsolidationRequests []*electra.ConsolidationRequest
}

// payloadAttributesEventJSON is the spec representation of the event.
Expand Down Expand Up @@ -142,13 +144,14 @@ type payloadAttributesV3JSON struct {

// payloadAttributesV4JSON is the spec representation of the payload attributes v4.
type payloadAttributesV4JSON struct {
Timestamp string `json:"timestamp"`
PrevRandao string `json:"prev_randao"`
SuggestedFeeRecipient string `json:"suggested_fee_recipient"`
Withdrawals []*capella.Withdrawal `json:"withdrawals"`
ParentBeaconBlockRoot string `json:"parent_beacon_block_root"`
DepositReceipts []*electra.DepositReceipt `json:"deposit_receipts"`
WithdrawalRequests []*electra.ExecutionLayerWithdrawalRequest `json:"withdrawal_requests"`
Timestamp string `json:"timestamp"`
PrevRandao string `json:"prev_randao"`
SuggestedFeeRecipient string `json:"suggested_fee_recipient"`
Withdrawals []*capella.Withdrawal `json:"withdrawals"`
ParentBeaconBlockRoot string `json:"parent_beacon_block_root"`
DepositRequests []*electra.DepositRequest `json:"deposit_requests"`
WithdrawalRequests []*electra.WithdrawalRequest `json:"withdrawal_requests"`
ConsolidationRequests []*electra.ConsolidationRequest `json:"consolidation_requests"`
}

// UnmarshalJSON implements json.Unmarshaler.
Expand Down Expand Up @@ -394,15 +397,15 @@ func (p *PayloadAttributesV4) unpack(data *payloadAttributesV4JSON) error {
}
copy(p.ParentBeaconBlockRoot[:], parentBeaconBlockRoot)

if data.DepositReceipts == nil {
return errors.New("payload attributes deposit receipts missing")
if data.DepositRequests == nil {
return errors.New("payload attributes deposit requests missing")
}
for i := range data.DepositReceipts {
if data.DepositReceipts[i] == nil {
return fmt.Errorf("deposit receipts entry %d missing", i)
for i := range data.DepositRequests {
if data.DepositRequests[i] == nil {
return fmt.Errorf("deposit requests entry %d missing", i)
}
}
p.DepositReceipts = data.DepositReceipts
p.DepositRequests = data.DepositRequests

if data.WithdrawalRequests == nil {
return errors.New("payload attributes withdraw requests missing")
Expand All @@ -414,6 +417,16 @@ func (p *PayloadAttributesV4) unpack(data *payloadAttributesV4JSON) error {
}
p.WithdrawalRequests = data.WithdrawalRequests

if data.ConsolidationRequests == nil {
return errors.New("payload attributes consolidation requests missing")
}
for i := range data.ConsolidationRequests {
if data.ConsolidationRequests[i] == nil {
return fmt.Errorf("consolidation requests entry %d missing", i)
}
}
p.ConsolidationRequests = data.ConsolidationRequests

return nil
}

Expand Down Expand Up @@ -472,8 +485,9 @@ func (e *PayloadAttributesEvent) MarshalJSON() ([]byte, error) {
SuggestedFeeRecipient: e.Data.V4.SuggestedFeeRecipient.String(),
Withdrawals: e.Data.V4.Withdrawals,
ParentBeaconBlockRoot: fmt.Sprintf("%#x", e.Data.V4.ParentBeaconBlockRoot),
DepositReceipts: e.Data.V4.DepositReceipts,
DepositRequests: e.Data.V4.DepositRequests,
WithdrawalRequests: e.Data.V4.WithdrawalRequests,
ConsolidationRequests: e.Data.V4.ConsolidationRequests,
})
if err != nil {
return nil, errors.Wrap(err, "failed to marshal payload attributes v4")
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ require (
github.com/stretchr/testify v1.8.4
go.opentelemetry.io/otel v1.16.0
go.opentelemetry.io/otel/trace v1.16.0
golang.org/x/crypto v0.22.0
golang.org/x/crypto v0.23.0
golang.org/x/sync v0.2.0
)

Expand All @@ -44,7 +44,7 @@ require (
github.com/rogpeppe/go-internal v1.11.0 // indirect
go.opentelemetry.io/otel/metric v1.16.0 // indirect
golang.org/x/net v0.21.0 // indirect
golang.org/x/sys v0.19.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/Knetic/govaluate.v3 v3.0.0 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ go.opentelemetry.io/otel/trace v1.16.0 h1:8JRpaObFoW0pxuVPapkgH8UhHQj+bJW8jJsCZE
go.opentelemetry.io/otel/trace v1.16.0/go.mod h1:Yt9vYq1SdNz3xdjZZK7wcXv1qv2pwLkqr2QVwea0ef0=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
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/net v0.0.0-20191116160921-f9c825593386/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4=
Expand All @@ -119,8 +119,8 @@ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
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=
Expand Down
2 changes: 1 addition & 1 deletion http/aggregateattestation.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func (s *Service) AggregateAttestation(ctx context.Context,

endpoint := "/eth/v1/validator/aggregate_attestation"
query := fmt.Sprintf("slot=%d&attestation_data_root=%#x", opts.Slot, opts.AttestationDataRoot)
httpResponse, err := s.get(ctx, endpoint, query, &opts.Common)
httpResponse, err := s.get(ctx, endpoint, query, &opts.Common, false)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion http/attestationdata.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (s *Service) AttestationData(ctx context.Context,

endpoint := "/eth/v1/validator/attestation_data"
query := fmt.Sprintf("slot=%d&committee_index=%d", opts.Slot, opts.CommitteeIndex)
httpResponse, err := s.get(ctx, endpoint, query, &opts.Common)
httpResponse, err := s.get(ctx, endpoint, query, &opts.Common, false)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion http/attestationpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (s *Service) AttestationPool(ctx context.Context,

endpoint := "/eth/v1/beacon/pool/attestations"
query := fmt.Sprintf("slot=%d", opts.Slot)
httpResponse, err := s.get(ctx, endpoint, query, &opts.Common)
httpResponse, err := s.get(ctx, endpoint, query, &opts.Common, false)
if err != nil {
return nil, err
}
Expand Down
Loading
Loading