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

test: adds the ability to run txsim as knuu instance for testground sanity test #3244

Merged
merged 71 commits into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from 63 commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
f83f6f5
the same sanity test with the older version of main and txsim
staheri14 Mar 26, 2024
d6007d3
increase bw to 500MiB/s
staheri14 Mar 27, 2024
34aef77
removes the redundant waiting for the instance being running
staheri14 Mar 27, 2024
e55201c
reduces the seq count to 1
staheri14 Mar 27, 2024
30fc16b
adds go sums
staheri14 Mar 27, 2024
a62ad72
adds the ability to pass rpc endpoint
staheri14 Mar 27, 2024
5e77f11
increases timeout commit and propose
staheri14 Mar 28, 2024
7f0adc1
increase bw and timeoutcommit
staheri14 Apr 1, 2024
1cfafc6
uses testground app version
staheri14 Apr 1, 2024
e6ad88e
creates up to 5 blobs per txsim PFB
staheri14 Apr 1, 2024
47649b3
imports testground package
staheri14 Apr 1, 2024
6249066
increases resources per validator and returns block times in nanoseconds
staheri14 Apr 1, 2024
2b5a038
increases gov max square size
staheri14 Apr 1, 2024
6030f51
Merge remote-tracking branch 'origin/main' into sanaz/old-version-san…
staheri14 Apr 1, 2024
9af08d3
points to the latest txsim
staheri14 Apr 1, 2024
dc929b9
fix genesis account creation in e2e tests
cmwaters Apr 2, 2024
3192104
Merge branch 'main' into sanaz/old-version-sanity-test
staheri14 Apr 2, 2024
e8c1812
Merge branch 'cal/genesis-account-e2e' into sanaz/old-version-sanity-…
staheri14 Apr 2, 2024
242f4ee
comments out testground version
staheri14 Apr 2, 2024
6a1d9d6
deletes unused comments and introduces max resources var
staheri14 Apr 2, 2024
2441b83
adds some defaults for max resources for each instance type
staheri14 Apr 2, 2024
e6527c0
removes plotting utils
staheri14 Apr 2, 2024
e6b1d39
adds txsim account to the genesis
staheri14 Apr 2, 2024
ce95b43
removes plot dependencies
staheri14 Apr 2, 2024
f793a56
brings back default app version to the latest
staheri14 Apr 2, 2024
53871ec
deletes plots
staheri14 Apr 2, 2024
96f7af0
reverts updates on the DefaultGovMaxSquareSize value
staheri14 Apr 2, 2024
3a1cf52
resets the configs
staheri14 Apr 2, 2024
443221d
cleans up comments
staheri14 Apr 2, 2024
898f5a3
deletes rpc endpoint assignment for txsims
staheri14 Apr 2, 2024
1ccb17d
fixes an issue
staheri14 Apr 2, 2024
c0cb9a5
uses default namespace
staheri14 Apr 2, 2024
745c6d4
adds further logs
staheri14 Apr 2, 2024
cddfd9f
adds more logs
staheri14 Apr 2, 2024
fc7e035
further formatting and logs
staheri14 Apr 2, 2024
fe6e16e
returns error if acc cannot be added
staheri14 Apr 2, 2024
ec31d07
removes unused parts of the code
staheri14 Apr 2, 2024
2178d8e
deletes unused defaults
staheri14 Apr 3, 2024
1fe0ea3
upgrades txsim version
staheri14 Apr 3, 2024
e7c3752
Merge branch 'main' into sanaz/testground-sanity-test
staheri14 Apr 3, 2024
b2fcfa1
extends clean up process for txsim
staheri14 Apr 3, 2024
2283114
uses 'Keyring' whenever the function involves operation on KeyringAcc…
staheri14 Apr 3, 2024
a52a41c
includes node's name in the directory log
staheri14 Apr 3, 2024
48a1e6f
Merge branch 'main' into sanaz/testground-sanity-test
staheri14 Apr 3, 2024
df35b19
aligns func name with the doc
staheri14 Apr 3, 2024
a04f2db
adds missing godocs
staheri14 Apr 3, 2024
869d991
uses structural logs
staheri14 Apr 3, 2024
8fcceb3
reverts test namespace
staheri14 Apr 3, 2024
52e4e50
exposes resources fields
staheri14 Apr 3, 2024
bc11bce
adds field description
staheri14 Apr 3, 2024
31e43c4
Merge remote-tracking branch 'origin/main' into sanaz/testground-sani…
staheri14 Apr 4, 2024
61da6d4
renames to CreateTxClients
staheri14 Apr 4, 2024
de60542
utilizes testnet seed
staheri14 Apr 4, 2024
d580860
addresses first round of comments
staheri14 Apr 4, 2024
73018f2
hardcodes poll time to 1 second
staheri14 Apr 4, 2024
f1b3ec8
fixes a bug
staheri14 Apr 4, 2024
fd9e7ae
moves info log after checking for errors
staheri14 Apr 4, 2024
cd99696
sets a specific version for txsim image
staheri14 Apr 4, 2024
f98393e
Merge branch 'main' into sanaz/testground-sanity-test
staheri14 Apr 4, 2024
391bf08
go mod update
staheri14 Apr 4, 2024
ceda79d
adheres to the v2 module name
staheri14 Apr 4, 2024
9d99f46
makes logs consistent
staheri14 Apr 5, 2024
ea9336a
bumps txsim version
staheri14 Apr 5, 2024
6276a74
renames txsimNodes to txClients
staheri14 Apr 5, 2024
bdfb643
Merge remote-tracking branch 'origin/main' into sanaz/testground-sani…
staheri14 Apr 5, 2024
d331fe4
Revert "go mod update"
staheri14 Apr 5, 2024
260906e
go.sum update
staheri14 Apr 5, 2024
821cf94
reverts the test namespace
staheri14 Apr 5, 2024
7fd36fb
Merge branch 'main' into sanaz/testground-sanity-test
staheri14 Apr 5, 2024
4ae67c7
Merge branch 'main' into sanaz/testground-sanity-test
staheri14 Apr 5, 2024
d33e122
Merge remote-tracking branch 'origin/main' into sanaz/testground-sani…
staheri14 Apr 5, 2024
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
2 changes: 0 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ require (
github.com/hashicorp/go-getter v1.7.0 // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
github.com/hashicorp/go-safetemp v1.0.0 // indirect
github.com/hashicorp/go-uuid v1.0.2 // indirect
github.com/hashicorp/go-version v1.6.0 // indirect
github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
Expand Down Expand Up @@ -185,7 +184,6 @@ require (
github.com/rakyll/statik v0.1.7 // indirect
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/regen-network/cosmos-proto v0.3.1 // indirect
github.com/rivo/uniseg v0.4.4 // indirect
github.com/rs/cors v1.8.3 // indirect
github.com/sasha-s/go-deadlock v0.3.1 // indirect
github.com/shirou/gopsutil v3.21.6+incompatible // indirect
Expand Down
7 changes: 3 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -832,9 +832,8 @@ github.com/hashicorp/go-safetemp v1.0.0/go.mod h1:oaerMy3BhqiTbVye6QuFhFtIceqFoD
github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU=
github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4=
github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/go-uuid v1.0.1 h1:fv1ep09latC32wFoVwnqcnKJGnMSdBanPczbHAYm1BE=
github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/go-uuid v1.0.2 h1:cfejS+Tpcp13yd5nYHWDI6qVCny6wyX2Mt5SGur2IGE=
github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek=
github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
Expand Down Expand Up @@ -1187,8 +1186,8 @@ github.com/regen-network/cosmos-proto v0.3.1/go.mod h1:jO0sVX6a1B36nmE8C9xBFXpNw
github.com/regen-network/protobuf v1.3.3-alpha.regen.1 h1:OHEc+q5iIAXpqiqFKeLpu5NwTIkVXUs48vFMwzqpqY4=
github.com/regen-network/protobuf v1.3.3-alpha.regen.1/go.mod h1:2DjTFR1HhMQhiWC5sZ4OhQ3+NtdbZ6oBDKQwq5Ou+FI=
github.com/retailnext/hllpp v1.0.1-0.20180308014038-101a6d2f8b52/go.mod h1:RDpi1RftBQPUCDRw6SmxeaREsAaRKnOclghuzp/WRzc=
github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis=
github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRrjvIXnJho=
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
Expand Down
8 changes: 8 additions & 0 deletions test/e2e/defaults.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package e2e

var defaultResources = Resources{
MemoryRequest: "200Mi",
MemoryLimit: "200Mi",
CPU: "300m",
Volume: "1Gi",
}
40 changes: 38 additions & 2 deletions test/e2e/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/celestiaorg/celestia-app/v2/test/util/genesis"
"github.com/celestiaorg/knuu/pkg/knuu"
serverconfig "github.com/cosmos/cosmos-sdk/server/config"
"github.com/rs/zerolog/log"
"github.com/tendermint/tendermint/config"
"github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/p2p"
Expand All @@ -25,6 +26,7 @@ const (
secp256k1Type = "secp256k1"
ed25519Type = "ed25519"
remoteRootDir = "/home/celestia/.celestia-app"
txsimRootDir = "/home/celestia"
)

type Node struct {
Expand All @@ -41,12 +43,25 @@ type Node struct {
grpcProxyPort int
}

// Resources defines the resource requirements for a Node.
type Resources struct {
// MemoryRequest specifies the initial memory allocation for the Node.
MemoryRequest string
// MemoryLimit specifies the maximum memory allocation for the Node.
MemoryLimit string
// CPU specifies the CPU allocation for the Node.
CPU string
// Volume specifies the storage volume allocation for the Node.
Volume string
}

func NewNode(
name, version string,
startHeight, selfDelegation int64,
peers []string,
signerKey, networkKey crypto.PrivKey,
upgradeHeight int64,
resources Resources,
grafana *GrafanaInfo,
) (*Node, error) {
instance, err := knuu.NewInstance(name)
Expand Down Expand Up @@ -82,11 +97,11 @@ func NewNode(
return nil, fmt.Errorf("error setting jaeger exporter: %v", err)
}
}
err = instance.SetMemory("200Mi", "200Mi")
err = instance.SetMemory(resources.MemoryRequest, resources.MemoryLimit)
if err != nil {
return nil, err
}
err = instance.SetCPU("300m")
err = instance.SetCPU(resources.CPU)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -124,6 +139,9 @@ func (n *Node) Init(genesis *types.GenesisDoc, peers []string) error {
// Initialize file directories
rootDir := os.TempDir()
nodeDir := filepath.Join(rootDir, n.Name)
log.Info().Str("name", n.Name).
Str("directory", nodeDir).
Msg("Creating validator's config and data directories")
for _, dir := range []string{
filepath.Join(nodeDir, "config"),
filepath.Join(nodeDir, "data"),
Expand Down Expand Up @@ -213,6 +231,24 @@ func (n Node) AddressGRPC() string {
return fmt.Sprintf("127.0.0.1:%d", n.grpcProxyPort)
}

// RemoteAddressGRPC retrieves the gRPC endpoint address of a node within the cluster.
func (n Node) RemoteAddressGRPC() (string, error) {
ip, err := n.Instance.GetIP()
if err != nil {
return "", err
}
return fmt.Sprintf("%s:%d", ip, grpcPort), nil
}

// RemoteAddressRPC retrieves the RPC endpoint address of a node within the cluster.
func (n Node) RemoteAddressRPC() (string, error) {
ip, err := n.Instance.GetIP()
if err != nil {
return "", err
}
return fmt.Sprintf("%s:%d", ip, rpcPort), nil
}

func (n Node) IsValidator() bool {
return n.SelfDelegation != 0
}
Expand Down
6 changes: 4 additions & 2 deletions test/e2e/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ func MakeConfig(node *Node) (*config.Config, error) {
cfg.RPC.ListenAddress = "tcp://0.0.0.0:26657"
cfg.P2P.ExternalAddress = fmt.Sprintf("tcp://%v", node.AddressP2P(false))
cfg.P2P.PersistentPeers = strings.Join(node.InitialPeers, ",")
cfg.Consensus.TimeoutPropose = time.Second
cfg.Consensus.TimeoutCommit = time.Second
cfg.P2P.SendRate = 5 * 1024 * 1024 // 5MiB/s
cfg.P2P.RecvRate = 5 * 1024 * 1024 // 5MiB/s
cfg.Consensus.TimeoutPropose = 1 * time.Second
cfg.Consensus.TimeoutCommit = 1 * time.Second
cfg.Instrumentation.Prometheus = true
return cfg, nil
}
Expand Down
12 changes: 10 additions & 2 deletions test/e2e/simple_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,21 @@ func TestE2ESimple(t *testing.T) {
testnet, err := New(t.Name(), seed, GetGrafanaInfoFromEnvVar())
require.NoError(t, err)
t.Cleanup(testnet.Cleanup)
require.NoError(t, testnet.CreateGenesisNodes(4, latestVersion, 10000000, 0))

kr, err := testnet.CreateAccount("alice", 1e12)
t.Log("Creating testnet validators")
require.NoError(t, testnet.CreateGenesisNodes(4, latestVersion, 10000000,
0, defaultResources))

t.Log("Creating account")
kr, err := testnet.CreateAccount("alice", 1e12, "")
require.NoError(t, err)

t.Log("Setting up testnet")
require.NoError(t, testnet.Setup())
t.Log("Starting testnet")
require.NoError(t, testnet.Start())

t.Log("Running txsim")
sequences := txsim.NewBlobSequence(txsim.NewRange(200, 4000), txsim.NewRange(1, 3)).Clone(5)
sequences = append(sequences, txsim.NewSendSequence(4, 1000, 100).Clone(5)...)

Expand All @@ -64,6 +71,7 @@ func TestE2ESimple(t *testing.T) {
err = txsim.Run(ctx, testnet.GRPCEndpoints()[0], kr, encCfg, opts, sequences...)
require.True(t, errors.Is(err, context.DeadlineExceeded), err.Error())

t.Log("Reading blockchain")
blockchain, err := testnode.ReadBlockchain(context.Background(), testnet.Node(0).AddressRPC())
require.NoError(t, err)

Expand Down
Loading
Loading