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

EIP-7732 support (ePBS) #227

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 7 additions & 0 deletions clients/consensus/chainspec.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ type ChainSpec struct {
ElectraForkEpoch *uint64 `yaml:"ELECTRA_FORK_EPOCH"`
Eip7594ForkVersion phase0.Version `yaml:"EIP7594_FORK_VERSION" check-if-fork:"Eip7594ForkEpoch"`
Eip7594ForkEpoch *uint64 `yaml:"EIP7594_FORK_EPOCH"`
Eip7732ForkVersion phase0.Version `yaml:"EIP7732_FORK_VERSION" check-if-fork:"Eip7732ForkEpoch"`
Eip7732ForkEpoch *uint64 `yaml:"EIP7732_FORK_EPOCH"`
SecondsPerSlot time.Duration `yaml:"SECONDS_PER_SLOT"`
SlotsPerEpoch uint64 `yaml:"SLOTS_PER_EPOCH"`
EpochsPerHistoricalVector uint64 `yaml:"EPOCHS_PER_HISTORICAL_VECTOR"`
Expand Down Expand Up @@ -64,6 +66,11 @@ type ChainSpec struct {
DataColumnSidecarSubnetCount *uint64 `yaml:"DATA_COLUMN_SIDECAR_SUBNET_COUNT" check-if-fork:"Eip7594ForkEpoch"`
CustodyRequirement *uint64 `yaml:"CUSTODY_REQUIREMENT" check-if-fork:"Eip7594ForkEpoch"`

// EIP7732: ePBS
PtcSize uint64 `yaml:"PTC_SIZE" check-if-fork:"Eip7732ForkEpoch"`
MaxPayloadAttestations uint64 `yaml:"MAX_PAYLOAD_ATTESTATIONS" check-if-fork:"Eip7732ForkEpoch"`
DomainPtcAttester phase0.DomainType `yaml:"DOMAIN_PTC_ATTESTER" check-if-fork:"Eip7732ForkEpoch"`

// additional dora specific specs
WhiskForkEpoch *uint64
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,6 @@ require (
rsc.io/tmplfunc v0.0.3 // indirect
)

replace github.com/attestantio/go-eth2-client => github.com/attestantio/go-eth2-client v0.0.0-20250106164842-07b6ce39bb43
replace github.com/attestantio/go-eth2-client => github.com/pk910/go-eth2-client v0.0.0-20250127193505-8cfe1ff986fd

replace github.com/ethereum/go-ethereum => github.com/s1na/go-ethereum v0.0.0-20250103133732-7e1b0ba7e83f
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERo
github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU=
github.com/VictoriaMetrics/fastcache v1.12.2 h1:N0y9ASrJ0F6h0QaC3o6uJb3NIZ9VKLjCM7NQbSmF7WI=
github.com/VictoriaMetrics/fastcache v1.12.2/go.mod h1:AmC+Nzz1+3G2eCPapF6UcsnkThDcMsQicp4xDukwJYI=
github.com/attestantio/go-eth2-client v0.0.0-20250106164842-07b6ce39bb43 h1:QVr4VkeZGzR7Mxtg1PKZ6n97aQU4VfFbTVD5hZauNUM=
github.com/attestantio/go-eth2-client v0.0.0-20250106164842-07b6ce39bb43/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/bits-and-blooms/bitset v1.17.0 h1:1X2TS7aHz1ELcC0yU1y2stUs/0ig5oMU6STFZGrhvHI=
Expand Down Expand Up @@ -348,6 +346,8 @@ github.com/onsi/gomega v1.34.1 h1:EUMJIKUjM8sKjYbtxQI9A4z2o+rruxnzNvpknOXie6k=
github.com/onsi/gomega v1.34.1/go.mod h1:kU1QgUvBDLXBJq618Xvm2LUX6rSAfRaFRTcdOeDLwwY=
github.com/pk910/dynamic-ssz v0.0.5 h1:VP9heGYUwzlpyhk28P2nCAzhvGsePJOOOO5vQMDh2qQ=
github.com/pk910/dynamic-ssz v0.0.5/go.mod h1:b6CrLaB2X7pYA+OSEEbkgXDEcRnjLOZIxZTsMuO/Y9c=
github.com/pk910/go-eth2-client v0.0.0-20250127193505-8cfe1ff986fd h1:xty/DNk1Y9vwj2Enx/D/eFBoSL0zf4V6wkqCRHsmliY=
github.com/pk910/go-eth2-client v0.0.0-20250127193505-8cfe1ff986fd/go.mod h1:vy5jU/uDZ2+RcVzq5BfnG+bQ3/6uu9DGwCrGsPtjJ1A=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
Expand Down
8 changes: 8 additions & 0 deletions handlers/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,14 @@ func buildIndexPageData() (*models.IndexPageData, time.Duration) {
Active: uint64(currentEpoch) >= *specs.Eip7594ForkEpoch,
})
}
if specs.Eip7732ForkEpoch != nil && *specs.Eip7732ForkEpoch < uint64(18446744073709551615) {
pageData.NetworkForks = append(pageData.NetworkForks, &models.IndexPageDataForks{
Name: "eip7732",
Epoch: *specs.Eip7732ForkEpoch,
Version: specs.Eip7732ForkVersion[:],
Active: uint64(currentEpoch) >= *specs.Eip7732ForkEpoch,
})
}

// load recent epochs
buildIndexPageRecentEpochsData(pageData, currentEpoch, finalizedEpoch, justifiedEpoch, recentEpochCount)
Expand Down
33 changes: 33 additions & 0 deletions indexer/beacon/block_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/attestantio/go-eth2-client/spec/bellatrix"
"github.com/attestantio/go-eth2-client/spec/capella"
"github.com/attestantio/go-eth2-client/spec/deneb"
"github.com/attestantio/go-eth2-client/spec/eip7732"
"github.com/attestantio/go-eth2-client/spec/electra"
"github.com/attestantio/go-eth2-client/spec/phase0"
"github.com/ethpandaops/dora/utils"
Expand Down Expand Up @@ -44,6 +45,9 @@ func marshalVersionedSignedBeaconBlockSSZ(dynSsz *dynssz.DynSsz, block *spec.Ver
case spec.DataVersionElectra:
version = uint64(block.Version)
ssz, err = dynSsz.MarshalSSZ(block.Electra)
case spec.DataVersionEIP7732:
version = uint64(block.Version)
ssz, err = dynSsz.MarshalSSZ(block.EIP7732)
default:
err = fmt.Errorf("unknown block version")
}
Expand Down Expand Up @@ -110,6 +114,11 @@ func unmarshalVersionedSignedBeaconBlockSSZ(dynSsz *dynssz.DynSsz, version uint6
if err := dynSsz.UnmarshalSSZ(block.Electra, ssz); err != nil {
return nil, fmt.Errorf("failed to decode electra signed beacon block: %v", err)
}
case spec.DataVersionEIP7732:
block.EIP7732 = &eip7732.SignedBeaconBlock{}
if err := dynSsz.UnmarshalSSZ(block.EIP7732, ssz); err != nil {
return nil, fmt.Errorf("failed to decode eip7732 signed beacon block: %v", err)
}
default:
return nil, fmt.Errorf("unknown block version")
}
Expand Down Expand Up @@ -137,6 +146,9 @@ func marshalVersionedSignedBeaconBlockJson(block *spec.VersionedSignedBeaconBloc
case spec.DataVersionElectra:
version = uint64(block.Version)
jsonRes, err = block.Electra.MarshalJSON()
case spec.DataVersionEIP7732:
version = uint64(block.Version)
jsonRes, err = block.EIP7732.MarshalJSON()
default:
err = fmt.Errorf("unknown block version")
}
Expand Down Expand Up @@ -185,6 +197,11 @@ func unmarshalVersionedSignedBeaconBlockJson(version uint64, ssz []byte) (*spec.
if err := block.Electra.UnmarshalJSON(ssz); err != nil {
return nil, fmt.Errorf("failed to decode electra signed beacon block: %v", err)
}
case spec.DataVersionEIP7732:
block.EIP7732 = &eip7732.SignedBeaconBlock{}
if err := block.EIP7732.UnmarshalJSON(ssz); err != nil {
return nil, fmt.Errorf("failed to decode eip7732 signed beacon block: %v", err)
}
default:
return nil, fmt.Errorf("unknown block version")
}
Expand Down Expand Up @@ -218,6 +235,8 @@ func getBlockExecutionExtraData(v *spec.VersionedSignedBeaconBlock) ([]byte, err
}

return v.Electra.Message.Body.ExecutionPayload.ExtraData, nil
case spec.DataVersionEIP7732:
return nil, nil
default:
return nil, errors.New("unknown version")
}
Expand Down Expand Up @@ -262,6 +281,12 @@ func getStateRandaoMixes(v *spec.VersionedBeaconState) ([]phase0.Root, error) {
}

return v.Electra.RANDAOMixes, nil
case spec.DataVersionEIP7732:
if v.EIP7732 == nil || v.EIP7732.RANDAOMixes == nil {
return nil, errors.New("no eip7732 block")
}

return v.EIP7732.RANDAOMixes, nil
default:
return nil, errors.New("unknown version")
}
Expand All @@ -282,6 +307,8 @@ func getStateDepositIndex(state *spec.VersionedBeaconState) uint64 {
return state.Deneb.ETH1DepositIndex
case spec.DataVersionElectra:
return state.Electra.ETH1DepositIndex
case spec.DataVersionEIP7732:
return state.EIP7732.ETH1DepositIndex
}
return 0
}
Expand Down Expand Up @@ -321,6 +348,12 @@ func getStateCurrentSyncCommittee(v *spec.VersionedBeaconState) ([]phase0.BLSPub
}

return v.Electra.CurrentSyncCommittee.Pubkeys, nil
case spec.DataVersionEIP7732:
if v.EIP7732 == nil || v.EIP7732.CurrentSyncCommittee == nil {
return nil, errors.New("no eip7732 block")
}

return v.EIP7732.CurrentSyncCommittee.Pubkeys, nil
default:
return nil, errors.New("unknown version")
}
Expand Down
Loading