From e4dbbf64d5ad3774b392df2deee2821deedc6734 Mon Sep 17 00:00:00 2001 From: evan-forbes Date: Sun, 24 Sep 2023 22:41:02 -0500 Subject: [PATCH] fix: some debugging and increase to 5 nodes using txsim --- go.work.sum | 3 +- .../{sanity => standard}/plan.toml | 12 ++--- test/testground/go.mod | 5 +- test/testground/go.sum | 5 +- test/testground/network/consensus_node.go | 2 +- test/testground/network/follower.go | 7 ++- test/testground/network/genesis.go | 6 +-- test/testground/network/leader.go | 53 +++++++------------ test/testground/network/params.go | 25 ++++++++- test/testground/network/sync.go | 6 +-- test/testground/network/topology.go | 24 ++++----- test/testground/results.out | 0 12 files changed, 78 insertions(+), 70 deletions(-) rename test/testground/compositions/{sanity => standard}/plan.toml (87%) create mode 100644 test/testground/results.out diff --git a/go.work.sum b/go.work.sum index 2b566b031f..bff6777a02 100644 --- a/go.work.sum +++ b/go.work.sum @@ -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= @@ -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= @@ -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= diff --git a/test/testground/compositions/sanity/plan.toml b/test/testground/compositions/standard/plan.toml similarity index 87% rename from test/testground/compositions/sanity/plan.toml rename to test/testground/compositions/standard/plan.toml index b9450b0dba..09f931646c 100644 --- a/test/testground/compositions/sanity/plan.toml +++ b/test/testground/compositions/standard/plan.toml @@ -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 @@ -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" @@ -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" diff --git a/test/testground/go.mod b/test/testground/go.mod index c77c7fa5e0..c30dd79bba 100644 --- a/test/testground/go.mod +++ b/test/testground/go.mod @@ -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 ) @@ -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 diff --git a/test/testground/go.sum b/test/testground/go.sum index d4069c77ca..21f4bf360b 100644 --- a/test/testground/go.sum +++ b/test/testground/go.sum @@ -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= @@ -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= diff --git a/test/testground/network/consensus_node.go b/test/testground/network/consensus_node.go index 50f1624f15..7296e94f08 100644 --- a/test/testground/network/consensus_node.go +++ b/test/testground/network/consensus_node.go @@ -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 } diff --git a/test/testground/network/follower.go b/test/testground/network/follower.go index d066ed8d99..836d2bd114 100644 --- a/test/testground/network/follower.go +++ b/test/testground/network/follower.go @@ -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 } diff --git a/test/testground/network/genesis.go b/test/testground/network/genesis.go index e91b38a6c1..d9da108332 100644 --- a/test/testground/network/genesis.go +++ b/test/testground/network/genesis.go @@ -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, @@ -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, } diff --git a/test/testground/network/leader.go b/test/testground/network/leader.go index c9fa839d1c..2a0b61b728 100644 --- a/test/testground/network/leader.go +++ b/test/testground/network/leader.go @@ -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 } @@ -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 { @@ -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 } @@ -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 { @@ -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)) @@ -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 { @@ -198,6 +182,8 @@ func (l *Leader) subscribeAndRecordBlocks(ctx context.Context, runenv *runtime.R return err } + lastBlockTime := time.Now() + for { select { case ev := <-events: @@ -205,7 +191,8 @@ func (l *Leader) subscribeAndRecordBlocks(ctx context.Context, runenv *runtime.R 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 } diff --git a/test/testground/network/params.go b/test/testground/network/params.go index 4f3b13afd7..203b05d96c 100644 --- a/test/testground/network/params.go +++ b/test/testground/network/params.go @@ -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" ) @@ -39,6 +43,7 @@ type Params struct { Timeout time.Duration Pex bool Configurators []Configurator + GenesisModifiers []genesis.Modifier PerPeerBandwidth int BlobsPerSeq int BlobSequences int @@ -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{} @@ -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() @@ -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 +} diff --git a/test/testground/network/sync.go b/test/testground/network/sync.go index 80f5d2f871..3704ba7896 100644 --- a/test/testground/network/sync.go +++ b/test/testground/network/sync.go @@ -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" @@ -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 diff --git a/test/testground/network/topology.go b/test/testground/network/topology.go index a9773a8abb..7f394969da 100644 --- a/test/testground/network/topology.go +++ b/test/testground/network/topology.go @@ -8,7 +8,7 @@ import ( ) const ( - ConfiguratorParam = "configurator" + TopologyParam = "topology" ConnectAllTopology = "connect_all" ConnectSubsetTopology = "connect_subset" PersistentPeerCountParamKey = "persistent-peer-count" @@ -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 } diff --git a/test/testground/results.out b/test/testground/results.out new file mode 100644 index 0000000000..e69de29bb2