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

simulators/eth2/dencun: Dencun Interop Simulator and Builder Tests #838

Merged
merged 6 commits into from
Mar 5, 2024
Merged
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
20 changes: 14 additions & 6 deletions configs/cancun.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,15 @@
tag: main

- client: teku-bn
nametag: deneb
build_args:
baseimage: ethpandaops/teku
tag: master
- client: teku-vc
nametag: deneb
build_args:
baseimage: ethpandaops/teku
tag: master

- client: prysm-bn
nametag: deneb
Expand All @@ -53,24 +61,24 @@
- client: lighthouse-bn
nametag: deneb
build_args:
baseimage: sigp/lighthouse
tag: deneb-modern
baseimage: ethpandaops/lighthouse
tag: unstable-linux-amd64
- client: lighthouse-vc
nametag: deneb
build_args:
baseimage: sigp/lighthouse
tag: deneb-modern
baseimage: ethpandaops/lighthouse
tag: unstable-linux-amd64

- client: lodestar-bn
nametag: deneb
build_args:
baseimage: ethpandaops/lodestar
tag: deneb-builder
tag: unstable-linux-amd64
- client: lodestar-vc
nametag: deneb
build_args:
baseimage: ethpandaops/lodestar
tag: deneb-builder
tag: unstable-linux-amd64

- client: nimbus-bn
- client: nimbus-vc
89 changes: 0 additions & 89 deletions simulators/eth2/common/chain_generators/pow/pow.go

This file was deleted.

18 changes: 18 additions & 0 deletions simulators/eth2/common/clients/hive.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ type HiveManagedClient struct {
T *hivesim.T
OptionsGenerator HiveOptionsGenerator
HiveClientDefinition *hivesim.ClientDefinition
Port int64

hiveClient *hivesim.Client
extraStartOptions []hivesim.StartOption
Expand Down Expand Up @@ -63,13 +64,30 @@ func (h *HiveManagedClient) AddStartOption(opts ...interface{}) {
}
}

func (h *HiveManagedClient) GetAddress() string {
if h.hiveClient == nil {
return ""
}
if h.Port > 0 {
return fmt.Sprintf("http://%s:%d", h.hiveClient.IP, h.Port)
}
return fmt.Sprintf("http://%s", h.hiveClient.IP)
}

func (h *HiveManagedClient) GetIP() net.IP {
if h.hiveClient == nil {
return net.IP{}
}
return h.hiveClient.IP
}

func (h *HiveManagedClient) GetHost() string {
if h.hiveClient == nil {
return ""
}
return h.hiveClient.IP.String()
}

func (h *HiveManagedClient) Shutdown() error {
if err := h.T.Sim.StopClient(h.T.SuiteID, h.T.TestID, h.hiveClient.Container); err != nil {
return err
Expand Down
54 changes: 54 additions & 0 deletions simulators/eth2/common/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,62 @@ package config
import (
"bytes"
"io"
"math/big"
)

type ForkConfig struct {
TerminalTotalDifficulty *big.Int `json:"terminal_total_difficulty,omitempty"`
AltairForkEpoch *big.Int `json:"altair_fork_epoch,omitempty"`
BellatrixForkEpoch *big.Int `json:"bellatrix_fork_epoch,omitempty"`
CapellaForkEpoch *big.Int `json:"capella_fork_epoch,omitempty"`
DenebForkEpoch *big.Int `json:"deneb_fork_epoch,omitempty"`
}

// Choose a configuration value. `b` takes precedence
func choose(a, b *big.Int) *big.Int {
if b != nil {
return new(big.Int).Set(b)
}
if a != nil {
return new(big.Int).Set(a)
}
return nil
}

// Join two configurations. `b` takes precedence
func (a *ForkConfig) Join(b *ForkConfig) *ForkConfig {
if b == nil {
return a
}
if a == nil {
return b
}
c := ForkConfig{}
c.AltairForkEpoch = choose(a.AltairForkEpoch, b.AltairForkEpoch)
c.BellatrixForkEpoch = choose(a.BellatrixForkEpoch, b.BellatrixForkEpoch)
c.CapellaForkEpoch = choose(a.CapellaForkEpoch, b.CapellaForkEpoch)
c.DenebForkEpoch = choose(a.DenebForkEpoch, b.DenebForkEpoch)
c.TerminalTotalDifficulty = choose(
a.TerminalTotalDifficulty,
b.TerminalTotalDifficulty,
)
return &c
}

func (c *ForkConfig) GenesisBeaconFork() string {
if c.DenebForkEpoch != nil && c.DenebForkEpoch.Uint64() == 0 {
return "deneb"
} else if c.CapellaForkEpoch != nil && c.CapellaForkEpoch.Uint64() == 0 {
return "capella"
} else if c.BellatrixForkEpoch != nil && c.BellatrixForkEpoch.Uint64() == 0 {
return "bellatrix"
} else if c.AltairForkEpoch != nil && c.AltairForkEpoch.Uint64() == 0 {
return "altair"
} else {
return "phase0"
}
}

func BytesSource(data []byte) func() (io.ReadCloser, error) {
return func() (io.ReadCloser, error) {
return io.NopCloser(bytes.NewReader(data)), nil
Expand Down
Loading