Skip to content

Commit

Permalink
Merge pull request #63 from ethpandaops/electra-support
Browse files Browse the repository at this point in the history
Electra support
  • Loading branch information
pk910 authored Aug 16, 2024
2 parents 300fd9a + efb5e97 commit ec7cf06
Show file tree
Hide file tree
Showing 159 changed files with 13,492 additions and 8,060 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/_shared-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
- name: Set up go
uses: actions/setup-go@v4
with:
go-version: 1.21.x
go-version: 1.22.x

# setup project dependencies
- name: Get dependencies
Expand Down Expand Up @@ -87,7 +87,7 @@ jobs:
- name: Set up go
uses: actions/setup-go@v4
with:
go-version: 1.21.x
go-version: 1.22.x

# setup cross build libs
- name: Get cross build dependencies
Expand Down Expand Up @@ -126,7 +126,7 @@ jobs:
- name: Set up go
uses: actions/setup-go@v4
with:
go-version: 1.21.x
go-version: 1.22.x

# setup project dependencies
- name: Get dependencies
Expand Down Expand Up @@ -159,7 +159,7 @@ jobs:
- name: Set up go
uses: actions/setup-go@v4
with:
go-version: 1.21.x
go-version: 1.22.x

# setup project dependencies
- name: Get dependencies
Expand Down Expand Up @@ -192,7 +192,7 @@ jobs:
- name: Set up go
uses: actions/setup-go@v4
with:
go-version: 1.21.x
go-version: 1.22.x

# setup project dependencies
- name: Get dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/_shared-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Set up go
uses: actions/setup-go@v4
with:
go-version: 1.21.x
go-version: 1.22.x

- name: Verify dependencies
run: go mod verify
Expand Down
28 changes: 19 additions & 9 deletions .hack/devnet/kurtosis.devnet.config.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
participants:
- el_type: geth
el_image: ethereum/client-go:stable
cl_type: lighthouse
cl_image: sigp/lighthouse:latest
count: 4
participants_matrix:
el:
- el_type: geth
el_image: ethpandaops/geth:lightclient-prague-devnet-1-37c4b03
cl:
- cl_type: lighthouse
cl_image: ethpandaops/lighthouse:electra-devnet-1-ba28217
- cl_type: teku
cl_image: ethpandaops/teku:master-2d2d17b
- cl_type: nimbus
cl_image: ethpandaops/nimbus-eth2:unstable-minimal-c0fc0f4
- cl_type: grandine
cl_image: ethpandaops/grandine:electra-minimal-b7bae2c
network_params:
seconds_per_slot: 12
additional_services: []
snooper_enabled: false
electra_fork_epoch: 5
min_validator_withdrawability_delay: 1
shard_committee_period: 1
preset: minimal
additional_services:
- dora
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# build env
FROM golang:1.21 AS build-env
FROM golang:1.22 AS build-env
COPY go.mod go.sum /src/
WORKDIR /src
RUN go mod download
Expand Down
70 changes: 0 additions & 70 deletions aws/s3store.go

This file was deleted.

110 changes: 110 additions & 0 deletions clients/consensus/chainspec.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
package consensus

import (
"bytes"
"reflect"
"time"

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

type ForkVersion struct {
Epoch uint64
CurrentVersion []byte
PreviousVersion []byte
}

// https://github.com/ethereum/consensus-specs/blob/dev/configs/mainnet.yaml
type ChainSpec struct {
PresetBase string `yaml:"PRESET_BASE"`
ConfigName string `yaml:"CONFIG_NAME"`
MinGenesisTime time.Time `yaml:"MIN_GENESIS_TIME"`
GenesisForkVersion phase0.Version `yaml:"GENESIS_FORK_VERSION"`
AltairForkVersion phase0.Version `yaml:"ALTAIR_FORK_VERSION"`
AltairForkEpoch *uint64 `yaml:"ALTAIR_FORK_EPOCH"`
BellatrixForkVersion phase0.Version `yaml:"BELLATRIX_FORK_VERSION"`
BellatrixForkEpoch *uint64 `yaml:"BELLATRIX_FORK_EPOCH"`
CappellaForkVersion phase0.Version `yaml:"CAPELLA_FORK_VERSION"`
CappellaForkEpoch *uint64 `yaml:"CAPELLA_FORK_EPOCH"`
DenebForkVersion phase0.Version `yaml:"DENEB_FORK_VERSION"`
DenebForkEpoch *uint64 `yaml:"DENEB_FORK_EPOCH"`
ElectraForkVersion phase0.Version `yaml:"ELECTRA_FORK_VERSION"`
ElectraForkEpoch *uint64 `yaml:"ELECTRA_FORK_EPOCH"`
Eip7594ForkVersion phase0.Version `yaml:"EIP7594_FORK_VERSION"`
Eip7594ForkEpoch *uint64 `yaml:"EIP7594_FORK_EPOCH"`
SecondsPerSlot time.Duration `yaml:"SECONDS_PER_SLOT"`
SlotsPerEpoch uint64 `yaml:"SLOTS_PER_EPOCH"`
EpochsPerHistoricalVector uint64 `yaml:"EPOCHS_PER_HISTORICAL_VECTOR"`
EpochsPerSlashingVector uint64 `yaml:"EPOCHS_PER_SLASHINGS_VECTOR"`
EpochsPerSyncCommitteePeriod uint64 `yaml:"EPOCHS_PER_SYNC_COMMITTEE_PERIOD"`
MinSeedLookahead uint64 `yaml:"MIN_SEED_LOOKAHEAD"`
ShuffleRoundCount uint64 `yaml:"SHUFFLE_ROUND_COUNT"`
MaxEffectiveBalance uint64 `yaml:"MAX_EFFECTIVE_BALANCE"`
MaxEffectiveBalanceElectra uint64 `yaml:"MAX_EFFECTIVE_BALANCE_ELECTRA"`
TargetCommitteeSize uint64 `yaml:"TARGET_COMMITTEE_SIZE"`
MaxCommitteesPerSlot uint64 `yaml:"MAX_COMMITTEES_PER_SLOT"`
MinPerEpochChurnLimit uint64 `yaml:"MIN_PER_EPOCH_CHURN_LIMIT"`
ChurnLimitQuotient uint64 `yaml:"CHURN_LIMIT_QUOTIENT"`
DomainBeaconProposer phase0.DomainType `yaml:"DOMAIN_BEACON_PROPOSER"`
DomainBeaconAttester phase0.DomainType `yaml:"DOMAIN_BEACON_ATTESTER"`
DomainSyncCommittee phase0.DomainType `yaml:"DOMAIN_SYNC_COMMITTEE"`
SyncCommitteeSize uint64 `yaml:"SYNC_COMMITTEE_SIZE"`
DepositContractAddress []byte `yaml:"DEPOSIT_CONTRACT_ADDRESS"`

// additional dora specific specs
WhiskForkEpoch *uint64
}

var byteType = reflect.TypeOf(byte(0))

func (chain *ChainSpec) CheckMismatch(chain2 *ChainSpec) []string {
mismatches := []string{}

chainT := reflect.ValueOf(chain).Elem()
chain2T := reflect.ValueOf(chain2).Elem()

for i := 0; i < chainT.NumField(); i++ {
fieldV := chainT.Field(i)
field2V := chain2T.Field(i)

if fieldV.Type().Kind() == reflect.Ptr {
if !fieldV.IsNil() {
fieldV = fieldV.Elem()
}
if !field2V.IsNil() {
field2V = field2V.Elem()
}
}

if fieldV.Type().Kind() == reflect.Slice && fieldV.Type().Elem() == byteType {
// compare byte slices
bytesA := fieldV.Interface().([]byte)
bytesB := field2V.Interface().([]byte)

if !bytes.Equal(bytesA, bytesB) {
mismatches = append(mismatches, chainT.Type().Field(i).Name)
}
} else if fieldV.Interface() != field2V.Interface() {
if chainT.Field(i).Interface() == reflect.Zero(chainT.Field(i).Type()).Interface() {
// 0 value on chain side are allowed
continue
}
mismatches = append(mismatches, chainT.Type().Field(i).Name)
}
}

return mismatches
}

func (chain *ChainSpec) Clone() *ChainSpec {
res := &ChainSpec{}
chainT := reflect.ValueOf(chain).Elem()
chain2T := reflect.ValueOf(res).Elem()

for i := 0; i < chainT.NumField(); i++ {
value := chainT.Field(i)
chain2T.Field(i).Set(value)
}

return res
}
Loading

0 comments on commit ec7cf06

Please sign in to comment.