Skip to content

Commit

Permalink
fix: some debugging and increase to 5 nodes using txsim
Browse files Browse the repository at this point in the history
  • Loading branch information
evan-forbes committed Sep 25, 2023
1 parent bc943c0 commit e4dbbf6
Show file tree
Hide file tree
Showing 12 changed files with 78 additions and 70 deletions.
3 changes: 1 addition & 2 deletions go.work.sum
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ github.com/deckarep/golang-set v1.8.0 h1:sk9/l/KqpunDwP7pSjUg0keiOOLEnOBHzykLrsP
github.com/denis-tingaikin/go-header v0.4.3/go.mod h1:0wOCWuN71D5qIgE2nz9KrKmuYBAC2Mra5RassOIQ2/c=
github.com/dlclark/regexp2 v1.7.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
github.com/dop251/goja v0.0.0-20230605162241-28ee0ee714f3/go.mod h1:QMWlm50DNe14hD7t24KEqZuUdC9sOTy8W6XbCU1mlw4=
github.com/dop251/goja v0.0.0-20230806174421-c933cf95e127/go.mod h1:QMWlm50DNe14hD7t24KEqZuUdC9sOTy8W6XbCU1mlw4=
github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633 h1:H2pdYOb3KQ1/YsqVWoWNLQO+fusocsw354rqGTZtAgw=
github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ=
github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
Expand Down Expand Up @@ -235,7 +236,6 @@ github.com/hashicorp/serf v0.9.8/go.mod h1:TXZNMjZQijwlDvp+r0b63xZ45H7JmCmgg4gpT
github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg=
github.com/hudl/fargo v1.4.0/go.mod h1:9Ai6uvFy5fQNq6VPKtg+Ceq1+eTY4nKUlR2JElEOcDo=
github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
github.com/influxdata/influxdb v1.8.3 h1:WEypI1BQFTT4teLM+1qkEcvUi0dAvopAI/ir0vAiBg8=
github.com/informalsystems/tm-load-test v1.3.0/go.mod h1:OQ5AQ9TbT5hKWBNIwsMjn6Bf4O0U4b1kRc+0qZlQJKw=
github.com/jdxcode/netrc v0.0.0-20210204082910-926c7f70242a/go.mod h1:Zi/ZFkEqFHTm7qkjyNJjaWH4LQA9LQhGJyF0lTYGpxw=
github.com/jgautheron/goconst v1.5.1/go.mod h1:aAosetZ5zaeC/2EfMeRswtxUFBpe2Hr7HzkgX4fanO4=
Expand Down Expand Up @@ -369,7 +369,6 @@ golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
gonum.org/v1/gonum v0.8.2/go.mod h1:oe/vMfY3deqTw+1EZJhuvEW2iwGF1bW9wwu7XCu0+v0=
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[metadata]
name = "sanity"
name = "standard"
author = "core-app"

[global]
plan = "core-app"
case = "entrypoint"
total_instances = 3
total_instances = 5
builder = "docker:generic"
runner = "cluster:k8s"
disable_metrics = false
Expand All @@ -16,15 +16,15 @@ timeout = "25m"
halt_height = "28"
latency = "0"
bandwidth = "420Mib"
validators = "3"
validators = "5"
topology = "connect_all"
pex = "false"
timeout_propose = "10s"
timeout_commit = "11s"
per_peer_bandwidth = "5Mib"
blob_sequences = "1"
blob_sizes = "100"
blobs_per_sequence = "1"
blob_sizes = "100000"
blobs_per_sequence = "10"
inbound_peer_count = "40"
outbound_peer_count = "10"
gov_max_square_size = "128"
Expand All @@ -38,7 +38,7 @@ builder = "docker:generic"
memory = "8Gi"
cpu = "4"
[groups.instances]
count = 3
count = 5
percentage = 0.0
[groups.build_config]
build_base_image = "golang:1.21.0"
Expand Down
5 changes: 2 additions & 3 deletions test/testground/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ module github.com/celestiaorg/celestia-app/test/testground
go 1.21.1

require (
github.com/celestiaorg/celestia-app v1.0.0-rc0.0.20230919215657-e2d325755a40
github.com/celestiaorg/celestia-app v1.0.0-rc0.0.20230923010153-bc943c049dd1
github.com/cosmos/cosmos-sdk v0.46.14
github.com/influxdata/influxdb v1.8.3
github.com/stretchr/testify v1.8.4
github.com/tendermint/tendermint v0.34.28
github.com/testground/sdk-go v0.3.0
)
Expand Down Expand Up @@ -164,6 +162,7 @@ require (
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.14.0 // indirect
github.com/stretchr/testify v1.8.4 // indirect
github.com/subosito/gotenv v1.4.1 // indirect
github.com/supranational/blst v0.3.11 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect
Expand Down
5 changes: 2 additions & 3 deletions test/testground/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ github.com/bytedance/sonic v1.8.0 h1:ea0Xadu+sHlu7x5O3gKhRpQ1IKiMrSiHttPF0ybECuA
github.com/bytedance/sonic v1.8.0/go.mod h1:i736AoUSYt75HyZLoJW9ERYxcy6eaN6h4BZXU064P/U=
github.com/c-bata/go-prompt v0.2.2/go.mod h1:VzqtzE2ksDBcdln8G7mk2RX9QyGjH+OVqOCSiVIqS34=
github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ=
github.com/celestiaorg/celestia-app v1.0.0-rc0.0.20230919215657-e2d325755a40 h1:cgvExGQAZExH+rnQL6zOHsDewm4XG6ZwfkJ5JPD+Udc=
github.com/celestiaorg/celestia-app v1.0.0-rc0.0.20230919215657-e2d325755a40/go.mod h1:mlISBhKW66V9PkDqQegyJPS4380TT0Y6qNw/5IurpcM=
github.com/celestiaorg/celestia-app v1.0.0-rc0.0.20230923010153-bc943c049dd1 h1:TPMXCf7Ye6MOv4a/3qx8aygUXEckiWPi/6HrV5+/OOE=
github.com/celestiaorg/celestia-app v1.0.0-rc0.0.20230923010153-bc943c049dd1/go.mod h1:mlISBhKW66V9PkDqQegyJPS4380TT0Y6qNw/5IurpcM=
github.com/celestiaorg/celestia-core v1.27.0-tm-v0.34.28 h1:BE7JFZ1SYpwM9OfL9cPcjlO5xjIbDPgdFkJNouyl6jA=
github.com/celestiaorg/celestia-core v1.27.0-tm-v0.34.28/go.mod h1:1GT0RfdNqOXvyR3Hq4ROcNBknQNz9E6K5l3Cla9eFFk=
github.com/celestiaorg/cosmos-sdk v1.18.0-sdk-v0.46.14 h1:dDfoQJOlVNj4HufJ1lBLTo2k3/L/255MIiKmEQziDmw=
Expand Down Expand Up @@ -724,7 +724,6 @@ github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANyt
github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc=
github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/influxdata/flux v0.65.1/go.mod h1:J754/zds0vvpfwuq7Gc2wRdVwEodfpCFM7mYlOw2LqY=
github.com/influxdata/influxdb v1.8.3 h1:WEypI1BQFTT4teLM+1qkEcvUi0dAvopAI/ir0vAiBg8=
github.com/influxdata/influxdb v1.8.3/go.mod h1:JugdFhsvvI8gadxOI6noqNeeBHvWNTbfYGtiAn+2jhI=
github.com/influxdata/influxdb-client-go/v2 v2.4.0/go.mod h1:vLNHdxTJkIf2mSLvGrpj8TCcISApPoXkaxP8g9uRlW8=
github.com/influxdata/influxdb-client-go/v2 v2.12.2 h1:uYABKdrEKlYm+++qfKdbgaHKBPmoWR5wpbmj6MBB/2g=
Expand Down
2 changes: 1 addition & 1 deletion test/testground/network/consensus_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func (cn *ConsensusNode) Bootstrap(ctx context.Context, runenv *runtime.RunEnv,
return nil, err
}

params, err := ParseParams(runenv)
params, err := ParseParams(cn.ecfg, runenv)
if err != nil {
return nil, err
}
Expand Down
7 changes: 6 additions & 1 deletion test/testground/network/follower.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,12 @@ func (f *Follower) Plan(ctx context.Context, runenv *runtime.RunEnv, initCtx *ru
return err
}

err = f.Init(homeDir, tcfg.Genesis, tcfg.ConsensusNodeConfigs[f.Name])
metaCfg, has := tcfg.ConsensusNodeConfigs[f.Name]
if !has {
return fmt.Errorf("no config for this node: %s", f.Name)
}

err = f.Init(homeDir, tcfg.Genesis, metaCfg)
if err != nil {
return err
}
Expand Down
6 changes: 3 additions & 3 deletions test/testground/network/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
// Genesis will create a valid genesis doc with funded addresses.
func GenesisDoc(
ecfg encoding.Config,
chainID string,
params *Params,
gentxs []json.RawMessage,
addrs []string,
pubkeys []cryptotypes.PubKey,
Expand Down Expand Up @@ -72,9 +72,9 @@ func GenesisDoc(

// Create the genesis doc
genesisDoc := &coretypes.GenesisDoc{
ChainID: chainID,
ChainID: params.ChainID,
GenesisTime: time.Now(),
ConsensusParams: app.DefaultConsensusParams(),
ConsensusParams: StandardConsensusParams(params),
AppState: stateBz,
}

Expand Down
53 changes: 20 additions & 33 deletions test/testground/network/leader.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (l *Leader) Plan(ctx context.Context, runenv *runtime.RunEnv, initCtx *run.
}

// create Genesis and distribute it to all nodes
genesis, err := l.GenesisEvent(ctx, runenv, initCtx, packets)
genesis, err := l.GenesisEvent(ctx, l.params, packets)
if err != nil {
return err
}
Expand All @@ -41,7 +41,7 @@ func (l *Leader) Plan(ctx context.Context, runenv *runtime.RunEnv, initCtx *run.
return err
}

// apply the topology functions to the configs to create a specific network.
// apply the configurator functions to the testground config. This step is responsible for hardcoding any topolgy
for _, configurator := range l.params.Configurators {
tcfg, err = configurator(tcfg)
if err != nil {
Expand All @@ -54,7 +54,12 @@ func (l *Leader) Plan(ctx context.Context, runenv *runtime.RunEnv, initCtx *run.
return err
}

err = l.Init(homeDir, tcfg.Genesis, tcfg.ConsensusNodeConfigs[l.Name])
metaCfg, has := tcfg.ConsensusNodeConfigs[l.Name]
if !has {
return fmt.Errorf("no config for this node: %s", l.Name)
}

err = l.Init(homeDir, tcfg.Genesis, metaCfg)
if err != nil {
return err
}
Expand All @@ -80,42 +85,21 @@ func (l *Leader) Execute(ctx context.Context, runenv *runtime.RunEnv, initCtx *r

time.Sleep(time.Second * 20)

// seqs := runenv.IntParam(BlobSequencesParam)
seqs := runenv.IntParam(BlobSequencesParam)
size := runenv.IntParam(BlobSizesParam)
count := runenv.IntParam(BlobsPerSeqParam)

sizes := make([]int, count)
for i := 0; i < count; i++ {
sizes[i] = size
}

// issue a command to start txsim
cmd := NewSubmitRandomPFBsCommand(
"txsim",
time.Minute*1,
sizes...,
)
cmd := NewRunTxSimCommand("txsim-0", time.Minute*5, RunTxSimCommandArgs{
BlobSequences: seqs,
BlobSize: size,
BlobCount: count,
})

_, err := initCtx.SyncClient.Publish(ctx, CommandTopic, cmd)
if err != nil {
return err
}

// runenv.RecordMessage(fmt.Sprintf("submitting PFB"))

// tctx, cancel := context.WithTimeout(ctx, time.Second*60)
// defer cancel()

// resp, err := l.SubmitRandomPFB(tctx, 1000)
// if err != nil {
// return err
// }
// if resp == nil {
// return errors.New("submit pfb response was nil")
// }

// runenv.RecordMessage(fmt.Sprintf("leader submittedPFB code %d space %s", resp.Code, resp.Codespace))

runenv.RecordMessage(fmt.Sprintf("leader waiting for halt height %d", l.params.HaltHeight))
_, err = l.cctx.WaitForHeightWithTimeout(int64(l.params.HaltHeight), time.Minute*30)
if err != nil {
Expand Down Expand Up @@ -155,7 +139,7 @@ func (l *Leader) Retro(ctx context.Context, runenv *runtime.RunEnv, initCtx *run
return nil
}

func (l *Leader) GenesisEvent(ctx context.Context, runenv *runtime.RunEnv, initCtx *run.InitContext, packets []PeerPacket) (*coretypes.GenesisDoc, error) {
func (l *Leader) GenesisEvent(ctx context.Context, params *Params, packets []PeerPacket) (*coretypes.GenesisDoc, error) {
pubKeys := make([]cryptotypes.PubKey, 0)
addrs := make([]string, 0)
gentxs := make([]json.RawMessage, 0, len(packets))
Expand All @@ -169,7 +153,7 @@ func (l *Leader) GenesisEvent(ctx context.Context, runenv *runtime.RunEnv, initC
gentxs = append(gentxs, packet.GenTx)
}

return GenesisDoc(l.ecfg, l.params.ChainID, gentxs, addrs, pubKeys)
return GenesisDoc(l.ecfg, l.params, gentxs, addrs, pubKeys, params.GenesisModifiers...)
}

func SerializePublicKey(pubKey cryptotypes.PubKey) string {
Expand Down Expand Up @@ -198,14 +182,17 @@ func (l *Leader) subscribeAndRecordBlocks(ctx context.Context, runenv *runtime.R
return err
}

lastBlockTime := time.Now()

for {
select {
case ev := <-events:
newBlock, ok := ev.Data.(coretypes.EventDataNewBlock)
if !ok {
return fmt.Errorf("unexpected event type: %T", ev.Data)
}
runenv.RecordMessage(fmt.Sprintf("leader height %d max block size bytes %d", newBlock.Block.Height, newBlock.Block.Size()))
blockTime := lastBlockTime.Sub(newBlock.Block.Time)
runenv.RecordMessage(fmt.Sprintf("leader height %d time %v size bytes %d", newBlock.Block.Height, blockTime, newBlock.Block.Size()))
case <-ctx.Done():
return nil
}
Expand Down
25 changes: 23 additions & 2 deletions test/testground/network/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@ import (
"time"

"github.com/celestiaorg/celestia-app/app"
"github.com/celestiaorg/celestia-app/app/encoding"
"github.com/celestiaorg/celestia-app/test/util/genesis"
blobtypes "github.com/celestiaorg/celestia-app/x/blob/types"
srvconfig "github.com/cosmos/cosmos-sdk/server/config"
tmconfig "github.com/tendermint/tendermint/config"
"github.com/tendermint/tendermint/crypto/ed25519"
"github.com/tendermint/tendermint/p2p"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
"github.com/testground/sdk-go/runtime"
)

Expand Down Expand Up @@ -39,6 +43,7 @@ type Params struct {
Timeout time.Duration
Pex bool
Configurators []Configurator
GenesisModifiers []genesis.Modifier
PerPeerBandwidth int
BlobsPerSeq int
BlobSequences int
Expand All @@ -51,7 +56,7 @@ type Params struct {
TimeoutPropose time.Duration
}

func ParseParams(runenv *runtime.RunEnv) (*Params, error) {
func ParseParams(ecfg encoding.Config, runenv *runtime.RunEnv) (*Params, error) {
var err error
p := &Params{}

Expand Down Expand Up @@ -97,6 +102,8 @@ func ParseParams(runenv *runtime.RunEnv) (*Params, error) {
return nil, err
}

p.GenesisModifiers = p.getGenesisModifiers(ecfg)

p.Pex = runenv.BooleanParam(PexParam)

return p, p.ValidateBasic()
Expand Down Expand Up @@ -130,11 +137,25 @@ func StandardCometConfig(params *Params) *tmconfig.Config {
return cmtcfg
}

func StandardAppConfig() *srvconfig.Config {
func StandardAppConfig(_ *Params) *srvconfig.Config {
return app.DefaultAppConfig()
}

func StandardConsensusParams(params *Params) *tmproto.ConsensusParams {
cp := app.DefaultConsensusParams()
cp.Block.MaxBytes = int64(params.MaxBlockBytes)
return cp
}

func peerID(ip string, networkKey ed25519.PrivKey) string {
nodeID := string(p2p.PubKeyToID(networkKey.PubKey()))
return fmt.Sprintf("%s@%s:26656", nodeID, ip)
}

func (p *Params) getGenesisModifiers(ecfg encoding.Config) []genesis.Modifier {
var modifiers []genesis.Modifier
blobParams := blobtypes.DefaultParams()
blobParams.GovMaxSquareSize = uint64(p.GovMaxSquareSize)
modifiers = append(modifiers, genesis.SetBlobParams(ecfg.Codec, blobParams))
return modifiers
}
6 changes: 3 additions & 3 deletions test/testground/network/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"fmt"
"sort"

"github.com/celestiaorg/celestia-app/app"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
srvconfig "github.com/cosmos/cosmos-sdk/server/config"
tmconfig "github.com/tendermint/tendermint/config"
Expand Down Expand Up @@ -79,8 +78,9 @@ func NewTestgroundConfig(params *Params, genesis *coretypes.GenesisDoc, pps []Pe
}
for _, pp := range pps {
cfg.ConsensusNodeConfigs[pp.Name()] = ConsensusNodeMetaConfig{
CmtConfig: StandardCometConfig(params),
AppConfig: app.DefaultAppConfig(),
CmtConfig: StandardCometConfig(params),
AppConfig: StandardAppConfig(params),
PeerPacket: pp,
}
}
return cfg, nil
Expand Down
24 changes: 11 additions & 13 deletions test/testground/network/topology.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
)

const (
ConfiguratorParam = "configurator"
TopologyParam = "topology"
ConnectAllTopology = "connect_all"
ConnectSubsetTopology = "connect_subset"
PersistentPeerCountParamKey = "persistent-peer-count"
Expand All @@ -20,23 +20,21 @@ func DefaultTopologies() []string {
}
}

// GetConfigurators
func GetConfigurators(runenv *runtime.RunEnv) ([]Configurator, error) {
topology := runenv.StringParam(ConfiguratorParam)
topology := runenv.StringParam(TopologyParam)
if topology == "" {
topology = ConnectAllTopology
}
ops := make([]Configurator, 0)
// TODO: fix the toml parser so that it can handle string arrays
for _, topology := range []string{topology} {
switch topology {
case ConnectAllTopology:
ops = append(ops, ConnectAll)
// case ConnectSubsetTopology:
// numPeers := runenv.IntParam(PersistentPeerCountParamKey)
// ops = append(ops, ConnectSubset(numPeers))
default:
return nil, fmt.Errorf("unknown topology func: %s", topology)
}
switch topology {
case ConnectAllTopology:
ops = append(ops, ConnectAll)
// case ConnectSubsetTopology:
// numPeers := runenv.IntParam(PersistentPeerCountParamKey)
// ops = append(ops, ConnectSubset(numPeers))
default:
return nil, fmt.Errorf("unknown topology func: %s", topology)
}
return ops, nil
}
Expand Down
Empty file added test/testground/results.out
Empty file.

0 comments on commit e4dbbf6

Please sign in to comment.