Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
cc87da7
simulators/eth2/common: Deneb refactor
marioevz Sep 20, 2023
07f599c
simulators/eth2: update go.mod on all simulators
marioevz Sep 21, 2023
d4c9962
simulators/eth2/dencun: working commit
marioevz Sep 21, 2023
fddedd0
go.mod
marioevz Sep 21, 2023
565042d
simulators/eth2/dencun: fix dependencies
marioevz Sep 21, 2023
89813c9
simulators/eth2: zrnt update
marioevz Sep 22, 2023
a4e2187
simulators/eth2/common: fix print issue
marioevz Sep 22, 2023
3fc8945
simulators/eth2/common: fix genesis time
marioevz Sep 22, 2023
cc9fd84
simulators/eth2/common: Add wait for sync method
marioevz Sep 22, 2023
20b742c
simulators/eth2: Update eth2api
marioevz Sep 22, 2023
c54598d
simulators/eth2/dencun: Add sync suite
marioevz Sep 22, 2023
270f90a
simulators/eth2: go.mod update eth-clients
marioevz Sep 22, 2023
789a75c
simulators/eth2/dencun: code cleanup
marioevz Sep 23, 2023
a3614ef
simulators/eth2: remove geth replace
marioevz Sep 25, 2023
d2923ee
simulators/eth2: go.work update
marioevz Sep 25, 2023
daf904d
simulators/eth2/withdrawals: Update to latest common
marioevz Sep 25, 2023
cc05012
simulators/eth2/engine: remove pre-merge tests, fix updates to common
marioevz Sep 25, 2023
211eb9a
simulators/eth2: zrnt update again
marioevz Sep 25, 2023
79d368f
simulators/eth2/common: Add blob verification
marioevz Sep 25, 2023
32a0062
simulators/eth2/dencun: Add blob verification from the Beacon API
marioevz Sep 25, 2023
fd5e0a0
simulators/eth2/dencun: Add Re-org tests
marioevz Sep 26, 2023
1278903
simulators/eth2/common: add deneb preset to bundle
marioevz Sep 26, 2023
a101a2b
simulators/eth2/common: Disable track-fcu
marioevz Sep 27, 2023
97c4678
simulators/eth2: update zrnt
marioevz Sep 27, 2023
e9bc6f6
simulators/eth2/dencun: Rename base suite
marioevz Sep 28, 2023
719b492
simulators/eth2/common: Add verification blob comparison
marioevz Sep 28, 2023
06abed4
simulators/eth2/dencun: Add wait for epochs after deneb
marioevz Sep 28, 2023
8cd1103
simulators/eth2/dencun: Tx spammer changes
marioevz Sep 28, 2023
be028cc
simulators/eth2/dencun: Refactor test waits
marioevz Sep 28, 2023
7afed7d
simulators/eth2/dencun: README updates
marioevz Oct 2, 2023
4d6776e
simulators/eth2/dencun: Builder README updates
marioevz Oct 2, 2023
518d8ed
simulators/eth2/testnet: fix
marioevz Oct 2, 2023
a31e033
libhive: Return client types in the order defied in client-file
marioevz Oct 4, 2023
f894b73
configs/cancun: Add evil teku
marioevz Oct 4, 2023
debaf41
simulators/eth2/dencun: add evil teku suite
marioevz Oct 4, 2023
00c840b
Update teku_bn.sh
tbenr Oct 4, 2023
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
4 changes: 3 additions & 1 deletion clients/teku-bn/teku_bn.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,6 @@ echo Starting Teku Beacon Node
--data-storage-mode=ARCHIVE \
--Xstartup-target-peer-count=0 \
--p2p-subscribe-all-subnets-enabled \
--Xtrusted-setup="$trusted_setup_path"
--Xtrusted-setup="$trusted_setup_path" \
--Xpeer-rate-limit=100000 \
--Xpeer-request-limit=1000
11 changes: 11 additions & 0 deletions configs/cancun.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,17 @@
github: paradigmxyz/reth
tag: main

- client: teku-bn
nametag: evil
build_args:
baseimage: ethpandaops/teku
tag: evil-blobs-fb6275a
- client: teku-vc
nametag: evil
build_args:
baseimage: ethpandaops/teku
tag: evil-blobs-fb6275a

- client: teku-bn
- client: teku-vc

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ require (
github.com/VictoriaMetrics/fastcache v1.12.0 // indirect
github.com/allegro/bigcache v1.2.1 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bits-and-blooms/bitset v1.5.0 // indirect
github.com/bits-and-blooms/bitset v1.7.0 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cockroachdb/errors v1.9.1 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5
github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g=
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.5.0 h1:NpE8frKRLGHIcEzkR+gZhiioW1+WbYV6fKwD6ZIpQT8=
github.com/bits-and-blooms/bitset v1.5.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA=
github.com/bits-and-blooms/bitset v1.7.0 h1:YjAGVd3XmtK9ktAbX8Zg2g2PwLIMjGREZJHlV4j7NEo=
github.com/bits-and-blooms/bitset v1.7.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA=
github.com/btcsuite/btcd/btcec/v2 v2.3.2 h1:5n0X6hX0Zk+6omWcihdYvdAlGf2DfasC0GMf7DClJ3U=
github.com/btcsuite/btcd/btcec/v2 v2.3.2/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04=
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U=
Expand Down
6 changes: 3 additions & 3 deletions hivesim/hive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -400,9 +400,9 @@ func TestStartClientInitialNetworks(t *testing.T) {
}

func newFakeAPI(hooks *fakes.BackendHooks) (*libhive.TestManager, *httptest.Server) {
defs := map[string]*libhive.ClientDefinition{
"client-1": {Name: "client-1", Image: "/ignored/in/api", Version: "client-1-version", Meta: libhive.ClientMetadata{Roles: []string{"eth1"}}},
"client-2": {Name: "client-2", Image: "/not/exposed/", Version: "client-2-version", Meta: libhive.ClientMetadata{Roles: []string{"beacon"}}},
defs := []*libhive.ClientDefinition{
{Name: "client-1", Image: "/ignored/in/api", Version: "client-1-version", Meta: libhive.ClientMetadata{Roles: []string{"eth1"}}},
{Name: "client-2", Image: "/not/exposed/", Version: "client-2-version", Meta: libhive.ClientMetadata{Roles: []string{"beacon"}}},
}
env := libhive.SimEnv{}
backend := fakes.NewContainerBackend(hooks)
Expand Down
19 changes: 6 additions & 13 deletions internal/libhive/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"net/http"
"path"
"path/filepath"
"sort"
"strconv"
"strings"
"time"
Expand Down Expand Up @@ -61,14 +60,7 @@ type simAPI struct {

// getClientTypes returns all known client types.
func (api *simAPI) getClientTypes(w http.ResponseWriter, r *http.Request) {
clients := make([]*ClientDefinition, 0, len(api.tm.clientDefs))
for _, def := range api.tm.clientDefs {
clients = append(clients, def)
}
sort.Slice(clients, func(i, j int) bool {
return clients[i].Name < clients[j].Name
})
serveJSON(w, clients)
serveJSON(w, api.tm.clientDefs)
}

// startSuite starts a suite.
Expand Down Expand Up @@ -332,11 +324,12 @@ func (api *simAPI) checkClient(req *simapi.NodeConfig) (*ClientDefinition, error
if req.Client == "" {
return nil, errors.New("missing client type in start request")
}
def, ok := api.tm.clientDefs[req.Client]
if !ok {
return nil, errors.New("unknown client type in start request")
for _, client := range api.tm.clientDefs {
if client.Name == req.Client {
return client, nil
}
}
return def, nil
return nil, errors.New("unknown client type in start request")
}

// checkClientNetworks pre-checks the existence of initial networks for a client container.
Expand Down
33 changes: 20 additions & 13 deletions internal/libhive/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type Runner struct {

// This holds the image names of all built simulators.
simImages map[string]string
clientDefs map[string]*ClientDefinition
clientDefs []*ClientDefinition
}

func NewRunner(inv Inventory, b Builder, cb ContainerBackend) *Runner {
Expand Down Expand Up @@ -58,11 +58,11 @@ func (r *Runner) buildClients(ctx context.Context, clientList []ClientDesignator
return errors.New("client list is empty, cannot simulate")
}

r.clientDefs = make(map[string]*ClientDefinition, len(clientList))
r.clientDefs = make([]*ClientDefinition, len(clientList))

var anyBuilt bool
log15.Info(fmt.Sprintf("building %d clients...", len(clientList)))
for _, client := range clientList {
for i, client := range clientList {
image, err := r.builder.BuildClientImage(ctx, client)
if err != nil {
continue
Expand All @@ -72,7 +72,7 @@ func (r *Runner) buildClients(ctx context.Context, clientList []ClientDesignator
if err != nil {
log15.Warn("can't read version info of "+client.Client, "image", image, "err", err)
}
r.clientDefs[client.Name()] = &ClientDefinition{
r.clientDefs[i] = &ClientDefinition{
Name: client.Name(),
Version: strings.TrimSpace(string(version)),
Image: image,
Expand Down Expand Up @@ -117,8 +117,11 @@ func (r *Runner) RunDevMode(ctx context.Context, env SimEnv, endpoint string) er
if err := createWorkspace(env.LogDir); err != nil {
return err
}

tm := NewTestManager(env, r.container, r.clientDefs)
clientDefs := make([]*ClientDefinition, 0)
for _, def := range r.clientDefs {
clientDefs = append(clientDefs, def)
}
tm := NewTestManager(env, r.container, clientDefs)
defer func() {
if err := tm.Terminate(); err != nil {
log15.Error("could not terminate test manager", "error", err)
Expand Down Expand Up @@ -159,19 +162,23 @@ HIVE_SIMULATOR=http://%v
func (r *Runner) run(ctx context.Context, sim string, env SimEnv) (SimResult, error) {
log15.Info(fmt.Sprintf("running simulation: %s", sim))

clientDefs := make(map[string]*ClientDefinition)
clientDefs := make([]*ClientDefinition, 0)
if env.ClientList == nil {
// Unspecified, make all clients available.
for name, def := range r.clientDefs {
clientDefs[name] = def
}
clientDefs = append(clientDefs, r.clientDefs...)
} else {
for _, client := range env.ClientList {
def, ok := r.clientDefs[client.Client]
if !ok {
found := false
for _, def := range r.clientDefs {
if def.Name == client.Client {
clientDefs = append(clientDefs, def)
found = true
break
}
}
if !found {
return SimResult{}, fmt.Errorf("unknown client %q in simulation client list", client.Client)
}
clientDefs[client.Client] = def
}
}

Expand Down
4 changes: 2 additions & 2 deletions internal/libhive/testmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ type SimResult struct {
type TestManager struct {
config SimEnv
backend ContainerBackend
clientDefs map[string]*ClientDefinition
clientDefs []*ClientDefinition

simContainerID string
simLogFile string
Expand All @@ -80,7 +80,7 @@ type TestManager struct {
results map[TestSuiteID]*TestSuite
}

func NewTestManager(config SimEnv, b ContainerBackend, clients map[string]*ClientDefinition) *TestManager {
func NewTestManager(config SimEnv, b ContainerBackend, clients []*ClientDefinition) *TestManager {
return &TestManager{
clientDefs: clients,
config: config,
Expand Down
89 changes: 0 additions & 89 deletions simulators/eth2/common/chain_generators/pow/pow.go

This file was deleted.

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