Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
875fd03
add eip7732 containers & generate ssz code
pk910 Jan 27, 2025
563b55f
add eip7732 containers to versioned helper structs
pk910 Jan 27, 2025
fd8557b
some fixes
pk910 Jan 27, 2025
8cfe1ff
linter fixes
pk910 Jan 27, 2025
69ef9de
Merge branch 'master' into eip7732
pk910 Feb 4, 2025
43591af
add missing signedbeaconblock ssz handling
pk910 Feb 4, 2025
361ad93
update eip7732 containers, generate missing ssz code
pk910 Feb 5, 2025
0d04ee2
use `epbs` as block version for eip7732
pk910 Feb 5, 2025
f35b6f0
use correct ExecutionPayloadHeader for eip7732 containers
pk910 Feb 5, 2025
66eea50
Merge branch 'pk910/fix-attestation-annotations' into eip7732
pk910 Feb 5, 2025
72bb42c
add `ExecutionPayloadEvent`
pk910 Feb 5, 2025
1bf0201
add SignedExecutionPayloadEnvelope getter
pk910 Feb 5, 2025
2570116
Merge branch 'master' into eip7732
pk910 Feb 6, 2025
c7d9302
update block version to `eip7732`
pk910 Feb 6, 2025
3e9ff5f
fix ExecutionPayloadEvent field name
pk910 Feb 8, 2025
6103e2d
fix execution_payload endpoint url
pk910 Feb 8, 2025
4cc8d12
add `SignedExecutionPayloadEnvelope` getter to mock service
pk910 Feb 9, 2025
79247c3
fix linter
pk910 Feb 9, 2025
4136b2b
Merge branch 'master' into eip7732
pk910 May 22, 2025
f861f15
Merge branch 'master' into eip7732
pk910 Jul 15, 2025
8c135d9
Merge branch 'master' into eip7732
pk910 Jul 16, 2025
4382baf
add missing getters for eip7732
pk910 Jul 16, 2025
599a201
Merge branch 'fulu' into eip7732
pk910 Jul 23, 2025
72bcf1a
rename `eip7732` to `gloas`
pk910 Aug 25, 2025
378ca5a
update glaos spec to `v1.6.0-alpha.5`
pk910 Aug 25, 2025
bdafec0
rename `glaos` to `gloas`
pk910 Aug 25, 2025
96aa895
Merge remote-tracking branch 'upstream/fulu' into gloas
pk910 Aug 25, 2025
ba7ef0d
generate `BeaconState` ssz
pk910 Aug 25, 2025
f1d41f4
update gloas types
pk910 Sep 22, 2025
489df4c
add missing cloas code
pk910 Sep 25, 2025
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
22 changes: 22 additions & 0 deletions api/signedexecutionpayloadenvelopeopts.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright © 2025 Attestant Limited.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package api

// SignedExecutionPayloadEnvelopeOpts are the options for obtaining signed execution payload envelopes.
type SignedExecutionPayloadEnvelopeOpts struct {
Common CommonOpts

// Block is the ID of the block which the data is obtained.
Block string
}
104 changes: 104 additions & 0 deletions api/v1/executionpayloadevent.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
// Copyright © 2025 Attestant Limited.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package v1

import (
"encoding/hex"
"encoding/json"
"fmt"
"strconv"
"strings"

"github.com/attestantio/go-eth2-client/spec/phase0"
"github.com/pkg/errors"
)

// ExecutionPayloadEvent is the data for the execution payload event.
type ExecutionPayloadEvent struct {
BlockRoot phase0.Root
Slot phase0.Slot
ExecutionBlockHash phase0.Hash32
ExecutionOptimistic bool
}

// executionPayloadEventJSON is the spec representation of the struct.
type executionPayloadEventJSON struct {
BlockRoot string `json:"block_root"`
Slot string `json:"slot"`
ExecutionBlockHash string `json:"execution_block_hash"`
ExecutionOptimistic bool `json:"execution_optimistic"`
}

// MarshalJSON implements json.Marshaler.
func (e *ExecutionPayloadEvent) MarshalJSON() ([]byte, error) {
return json.Marshal(&executionPayloadEventJSON{
BlockRoot: fmt.Sprintf("%#x", e.BlockRoot),
Slot: fmt.Sprintf("%d", e.Slot),
ExecutionBlockHash: fmt.Sprintf("%#x", e.ExecutionBlockHash),
ExecutionOptimistic: e.ExecutionOptimistic,
})
}

// UnmarshalJSON implements json.Unmarshaler.
func (e *ExecutionPayloadEvent) UnmarshalJSON(input []byte) error {
var err error

var executionPayloadEventJSON executionPayloadEventJSON
if err = json.Unmarshal(input, &executionPayloadEventJSON); err != nil {
return errors.Wrap(err, "invalid JSON")
}
if executionPayloadEventJSON.BlockRoot == "" {
return errors.New("block root missing")
}
block, err := hex.DecodeString(strings.TrimPrefix(executionPayloadEventJSON.BlockRoot, "0x"))
if err != nil {
return errors.Wrap(err, "invalid value for block root")
}
if len(block) != rootLength {
return fmt.Errorf("incorrect length %d for block root", len(block))
}
copy(e.BlockRoot[:], block)
if executionPayloadEventJSON.Slot == "" {
return errors.New("slot missing")
}
slot, err := strconv.ParseUint(executionPayloadEventJSON.Slot, 10, 64)
if err != nil {
return errors.Wrap(err, "invalid value for slot")
}
e.Slot = phase0.Slot(slot)
if executionPayloadEventJSON.ExecutionBlockHash == "" {
return errors.New("payload hash missing")
}
payloadHash, err := hex.DecodeString(strings.TrimPrefix(executionPayloadEventJSON.ExecutionBlockHash, "0x"))
if err != nil {
return errors.Wrap(err, "invalid value for payload hash")
}
if len(payloadHash) != rootLength {
return fmt.Errorf("incorrect length %d for payload hash", len(payloadHash))
}
copy(e.ExecutionBlockHash[:], payloadHash)
e.ExecutionOptimistic = executionPayloadEventJSON.ExecutionOptimistic

return nil
}

// String returns a string version of the structure.
func (e *ExecutionPayloadEvent) String() string {
data, err := json.Marshal(e)
if err != nil {
return fmt.Sprintf("ERR: %v", err)
}

return string(data)
}
4 changes: 2 additions & 2 deletions api/v1/payloadattributesevent.go
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ func (e *PayloadAttributesEvent) MarshalJSON() ([]byte, error) {
if err != nil {
return nil, errors.Wrap(err, "failed to marshal payload attributes v3")
}
case spec.DataVersionElectra, spec.DataVersionFulu:
case spec.DataVersionElectra, spec.DataVersionFulu, spec.DataVersionGloas:
if e.Data.V4 == nil {
return nil, errors.New("no payload attributes v4 data")
}
Expand Down Expand Up @@ -619,7 +619,7 @@ func (e *PayloadAttributesEvent) unpack(data *payloadAttributesEventJSON) error
return err
}
e.Data.V3 = &payloadAttributes
case spec.DataVersionElectra, spec.DataVersionFulu:
case spec.DataVersionElectra, spec.DataVersionFulu, spec.DataVersionGloas:
var payloadAttributes PayloadAttributesV4
err = json.Unmarshal(data.Data.PayloadAttributes, &payloadAttributes)
if err != nil {
Expand Down
113 changes: 113 additions & 0 deletions api/versionedsignedblindedbeaconblock.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ type VersionedSignedBlindedBeaconBlock struct {
Deneb *apiv1deneb.SignedBlindedBeaconBlock
Electra *apiv1electra.SignedBlindedBeaconBlock
Fulu *apiv1electra.SignedBlindedBeaconBlock
Gloas *apiv1electra.SignedBlindedBeaconBlock
}

// Slot returns the slot of the signed beacon block.
Expand Down Expand Up @@ -71,6 +72,13 @@ func (v *VersionedSignedBlindedBeaconBlock) Slot() (phase0.Slot, error) {
}

return v.Fulu.Message.Slot, nil
case spec.DataVersionGloas:
if v.Gloas == nil ||
v.Gloas.Message == nil {
return 0, ErrDataMissing
}

return v.Gloas.Message.Slot, nil
default:
return 0, ErrUnsupportedVersion
}
Expand Down Expand Up @@ -158,6 +166,22 @@ func (v *VersionedSignedBlindedBeaconBlock) Attestations() ([]spec.VersionedAtte
}
}

return versionedAttestations, nil
case spec.DataVersionGloas:
if v.Gloas == nil ||
v.Gloas.Message == nil ||
v.Gloas.Message.Body == nil {
return nil, ErrDataMissing
}

versionedAttestations := make([]spec.VersionedAttestation, len(v.Gloas.Message.Body.Attestations))
for i, attestation := range v.Gloas.Message.Body.Attestations {
versionedAttestations[i] = spec.VersionedAttestation{
Version: spec.DataVersionGloas,
Gloas: attestation,
}
}

return versionedAttestations, nil
default:
return nil, ErrUnsupportedVersion
Expand Down Expand Up @@ -200,6 +224,12 @@ func (v *VersionedSignedBlindedBeaconBlock) Root() (phase0.Root, error) {
}

return v.Fulu.Message.HashTreeRoot()
case spec.DataVersionGloas:
if v.Gloas == nil {
return phase0.Root{}, ErrDataMissing
}

return v.Gloas.Message.HashTreeRoot()
default:
return phase0.Root{}, ErrUnsupportedVersion
}
Expand Down Expand Up @@ -244,6 +274,12 @@ func (v *VersionedSignedBlindedBeaconBlock) BodyRoot() (phase0.Root, error) {
}

return v.Fulu.Message.Body.HashTreeRoot()
case spec.DataVersionGloas:
if v.Gloas == nil {
return phase0.Root{}, ErrDataMissing
}

return v.Gloas.Message.Body.HashTreeRoot()
default:
return phase0.Root{}, ErrUnsupportedVersion
}
Expand Down Expand Up @@ -285,6 +321,12 @@ func (v *VersionedSignedBlindedBeaconBlock) ParentRoot() (phase0.Root, error) {
}

return v.Fulu.Message.ParentRoot, nil
case spec.DataVersionGloas:
if v.Gloas == nil {
return phase0.Root{}, ErrDataMissing
}

return v.Gloas.Message.ParentRoot, nil
default:
return phase0.Root{}, ErrUnsupportedVersion
}
Expand Down Expand Up @@ -326,6 +368,12 @@ func (v *VersionedSignedBlindedBeaconBlock) StateRoot() (phase0.Root, error) {
}

return v.Fulu.Message.StateRoot, nil
case spec.DataVersionGloas:
if v.Gloas == nil {
return phase0.Root{}, ErrDataMissing
}

return v.Gloas.Message.StateRoot, nil
default:
return phase0.Root{}, ErrUnsupportedVersion
}
Expand Down Expand Up @@ -409,6 +457,20 @@ func (v *VersionedSignedBlindedBeaconBlock) AttesterSlashings() ([]spec.Versione
}
}

return versionedAttesterSlashings, nil
case spec.DataVersionGloas:
if v.Gloas == nil {
return nil, ErrDataMissing
}

versionedAttesterSlashings := make([]spec.VersionedAttesterSlashing, len(v.Gloas.Message.Body.AttesterSlashings))
for i, attesterSlashing := range v.Gloas.Message.Body.AttesterSlashings {
versionedAttesterSlashings[i] = spec.VersionedAttesterSlashing{
Version: spec.DataVersionGloas,
Gloas: attesterSlashing,
}
}

return versionedAttesterSlashings, nil
default:
return nil, ErrUnsupportedVersion
Expand Down Expand Up @@ -454,6 +516,12 @@ func (v *VersionedSignedBlindedBeaconBlock) ProposerSlashings() ([]*phase0.Propo
}

return v.Fulu.Message.Body.ProposerSlashings, nil
case spec.DataVersionGloas:
if v.Gloas == nil {
return nil, ErrDataMissing
}

return v.Gloas.Message.Body.ProposerSlashings, nil
default:
return nil, ErrUnsupportedVersion
}
Expand Down Expand Up @@ -496,6 +564,12 @@ func (v *VersionedSignedBlindedBeaconBlock) ProposerIndex() (phase0.ValidatorInd
}

return v.Fulu.Message.ProposerIndex, nil
case spec.DataVersionGloas:
if v.Gloas == nil {
return 0, ErrDataMissing
}

return v.Gloas.Message.ProposerIndex, nil
default:
return 0, ErrUnsupportedVersion
}
Expand Down Expand Up @@ -549,6 +623,15 @@ func (v *VersionedSignedBlindedBeaconBlock) ExecutionParentHash() (phase0.Hash32
}

return v.Fulu.Message.Body.ExecutionPayloadHeader.ParentHash, nil
case spec.DataVersionGloas:
if v.Gloas == nil ||
v.Gloas.Message == nil ||
v.Gloas.Message.Body == nil ||
v.Gloas.Message.Body.ExecutionPayloadHeader == nil {
return phase0.Hash32{}, ErrDataMissing
}

return v.Gloas.Message.Body.ExecutionPayloadHeader.ParentHash, nil
default:
return phase0.Hash32{}, ErrUnsupportedVersion
}
Expand Down Expand Up @@ -602,6 +685,15 @@ func (v *VersionedSignedBlindedBeaconBlock) ExecutionBlockHash() (phase0.Hash32,
}

return v.Fulu.Message.Body.ExecutionPayloadHeader.BlockHash, nil
case spec.DataVersionGloas:
if v.Gloas == nil ||
v.Gloas.Message == nil ||
v.Gloas.Message.Body == nil ||
v.Gloas.Message.Body.ExecutionPayloadHeader == nil {
return phase0.Hash32{}, ErrDataMissing
}

return v.Gloas.Message.Body.ExecutionPayloadHeader.BlockHash, nil
default:
return phase0.Hash32{}, ErrUnsupportedVersion
}
Expand Down Expand Up @@ -655,6 +747,15 @@ func (v *VersionedSignedBlindedBeaconBlock) ExecutionBlockNumber() (uint64, erro
}

return v.Fulu.Message.Body.ExecutionPayloadHeader.BlockNumber, nil
case spec.DataVersionGloas:
if v.Gloas == nil ||
v.Gloas.Message == nil ||
v.Gloas.Message.Body == nil ||
v.Gloas.Message.Body.ExecutionPayloadHeader == nil {
return 0, ErrDataMissing
}

return v.Gloas.Message.Body.ExecutionPayloadHeader.BlockNumber, nil
default:
return 0, ErrUnsupportedVersion
}
Expand Down Expand Up @@ -689,6 +790,12 @@ func (v *VersionedSignedBlindedBeaconBlock) BlobKZGCommitments() ([]deneb.KZGCom
}

return v.Fulu.Message.Body.BlobKZGCommitments, nil
case spec.DataVersionGloas:
if v.Gloas == nil || v.Gloas.Message == nil || v.Gloas.Message.Body == nil {
return nil, ErrDataMissing
}

return v.Gloas.Message.Body.BlobKZGCommitments, nil
default:
return nil, ErrUnsupportedVersion
}
Expand Down Expand Up @@ -727,6 +834,12 @@ func (v *VersionedSignedBlindedBeaconBlock) Signature() (phase0.BLSSignature, er
}

return v.Fulu.Signature, nil
case spec.DataVersionGloas:
if v.Gloas == nil || v.Gloas.Message == nil || v.Gloas.Message.Body == nil {
return phase0.BLSSignature{}, ErrDataMissing
}

return v.Gloas.Signature, nil
default:
return phase0.BLSSignature{}, ErrUnsupportedVersion
}
Expand Down
Loading
Loading