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(tests/systemtests): remove v2 checks #23098

Merged
merged 13 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
remaining
  • Loading branch information
aljo242 committed Jan 8, 2025
commit a78ebeee7b9dbe07fef71431a0a86d25d5c1d55f
2 changes: 1 addition & 1 deletion systemtests/system.go
aljo242 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ func (s *SystemUnderTest) AddFullnode(t *testing.T, beforeStart ...func(nodeNumb
configFile := filepath.Join(configPath, tomlFile)
_ = os.Remove(configFile)
_ = MustCopyFile(filepath.Join(WorkDir, s.nodePath(0), "config", tomlFile), configFile)
if tomlFile == "app.toml" && IsV2() {
if tomlFile == "app.toml" {
file := filepath.Join(WorkDir, s.nodePath(nodeNumber), "config", tomlFile)
EditToml(file, func(doc *tomledit.Document) {
SetValue(doc, fmt.Sprintf("%s:%d", node.IP, DefaultApiPort+nodeNumber), "grpc-gateway", "address")
Expand Down
2 changes: 1 addition & 1 deletion systemtests/test_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func RunTests(m *testing.M) {
waitTime := flag.Duration("wait-time", DefaultWaitTime, "time to wait for chain events")
nodesCount := flag.Int("nodes-count", 4, "number of nodes in the cluster")
blockTime := flag.Duration("block-time", 1000*time.Millisecond, "block creation time")
execBinary := flag.String("binary", "simd", "executable binary for server/ client side")
execBinary := flag.String("binary", "simdv2", "executable binary for server/ client side")
bech32Prefix := flag.String("bech32", "cosmos", "bech32 prefix to be used with addresses")
flag.BoolVar(&Verbose, "verbose", false, "verbose output")
flag.Parse()
Expand Down
7 changes: 1 addition & 6 deletions systemtests/testnet_init.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,7 @@ func (s ModifyConfigYamlInitializer) Initialize() {
"--output-dir=" + s.outputDir,
"--v=" + strconv.Itoa(s.initialNodesCount),
"--keyring-backend=test",
}

if IsV2() {
args = append(args, "--server.minimum-gas-prices="+s.minGasPrice)
} else {
args = append(args, "--minimum-gas-prices="+s.minGasPrice)
"--server.minimum-gas-prices=" + s.minGasPrice,
}

s.log(fmt.Sprintf("+++ %s %s\n", s.execBinary, strings.Join(args, " ")))
Expand Down
2 changes: 1 addition & 1 deletion tests/systemtests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Or via manual steps
```shell
make build
mkdir -p ./tests/systemtests/binaries
cp ./build/simd ./tests/systemtests/binaries/
cp ./build/simdv2 ./tests/systemtests/binaries/
```

### Manual test run
Expand Down
7 changes: 1 addition & 6 deletions tests/systemtests/cometbft_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,7 @@ func TestQueryStatus(t *testing.T) {
cli := systest.NewCLIWrapper(t, systest.Sut, systest.Verbose)
systest.Sut.StartChain(t)

var resp string
if systest.IsV2() {
resp = cli.CustomQuery("comet", "status")
} else {
resp = cli.CustomQuery("status")
}
resp := cli.CustomQuery("comet", "status")

// make sure the output has the validator moniker.
assert.Contains(t, resp, "\"moniker\":\"node0\"")
Expand Down
22 changes: 14 additions & 8 deletions tests/systemtests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,21 @@ module github.com/cosmos/cosmos-sdk/tests/systemtests
go 1.23

require (
cosmossdk.io/math v1.4.0
cosmossdk.io/math v1.5.0
cosmossdk.io/systemtests v1.0.0
github.com/cosmos/cosmos-sdk v0.50.11
)

require (
github.com/cockroachdb/apd/v3 v3.2.1 // indirect
github.com/cometbft/cometbft/api v1.0.0-rc.1 // indirect
github.com/creachadair/tomledit v0.0.26 // indirect
github.com/google/orderedcode v0.0.1 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
github.com/lib/pq v1.10.9 // indirect
github.com/minio/highwayhash v1.0.3 // indirect
)

require (
cosmossdk.io/api v0.7.6 // indirect
cosmossdk.io/collections v0.4.0 // indirect
Expand Down Expand Up @@ -38,7 +48,6 @@ require (
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect
github.com/cometbft/cometbft v0.38.15 // indirect
github.com/cometbft/cometbft-db v0.14.1 // indirect
github.com/cometbft/cometbft/api v1.0.0-rc.1 // indirect
github.com/cosmos/btcutil v1.0.5 // indirect
github.com/cosmos/cosmos-db v1.1.1 // indirect
github.com/cosmos/cosmos-proto v1.0.0-beta.5 // indirect
Expand All @@ -48,7 +57,6 @@ require (
github.com/cosmos/iavl v1.2.2 // indirect
github.com/cosmos/ics23/go v0.11.0 // indirect
github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect
github.com/creachadair/tomledit v0.0.26 // indirect
github.com/danieljoos/wincred v1.1.2 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect
Expand All @@ -75,7 +83,6 @@ require (
github.com/google/btree v1.1.3 // indirect
github.com/google/flatbuffers v1.12.1 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/orderedcode v0.0.1 // indirect
github.com/gorilla/handlers v1.5.1 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/gorilla/websocket v1.5.3 // indirect
Expand All @@ -87,7 +94,6 @@ require (
github.com/hashicorp/go-metrics v0.5.3 // indirect
github.com/hashicorp/go-plugin v1.6.2 // indirect
github.com/hashicorp/golang-lru v1.0.2 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hashicorp/yamux v0.1.2 // indirect
github.com/hdevalence/ed25519consensus v0.1.0 // indirect
Expand All @@ -100,12 +106,10 @@ require (
github.com/klauspost/cpuid/v2 v2.2.9 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/lib/pq v1.10.9 // indirect
github.com/linxGnu/grocksdb v1.9.7 // indirect
github.com/magiconair/properties v1.8.9 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/minio/highwayhash v1.0.3 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mtibben/percent v0.2.1 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
Expand Down Expand Up @@ -159,11 +163,13 @@ require (
google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20241202173237-19429a94021a // indirect
google.golang.org/grpc v1.68.1 // indirect
google.golang.org/protobuf v1.36.0 // indirect
google.golang.org/protobuf v1.36.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
gotest.tools/v3 v3.5.1 // indirect
nhooyr.io/websocket v1.8.6 // indirect
pgregory.net/rapid v1.1.0 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
)

replace cosmossdk.io/systemtests => ../../systemtests
12 changes: 6 additions & 6 deletions tests/systemtests/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@ cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0=
cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U=
cosmossdk.io/log v1.5.0 h1:dVdzPJW9kMrnAYyMf1duqacoidB9uZIl+7c6z0mnq0g=
cosmossdk.io/log v1.5.0/go.mod h1:Tr46PUJjiUthlwQ+hxYtUtPn4D/oCZXAkYevBeh5+FI=
cosmossdk.io/math v1.4.0 h1:XbgExXFnXmF/CccPPEto40gOO7FpWu9yWNAZPN3nkNQ=
cosmossdk.io/math v1.4.0/go.mod h1:O5PkD4apz2jZs4zqFdTr16e1dcaQCc5z6lkEnrrppuk=
cosmossdk.io/math v1.5.0 h1:sbOASxee9Zxdjd6OkzogvBZ25/hP929vdcYcBJQbkLc=
cosmossdk.io/math v1.5.0/go.mod h1:AAwwBmUhqtk2nlku174JwSll+/DepUXW3rWIXN5q+Nw=
cosmossdk.io/store v1.1.1 h1:NA3PioJtWDVU7cHHeyvdva5J/ggyLDkyH0hGHl2804Y=
cosmossdk.io/store v1.1.1/go.mod h1:8DwVTz83/2PSI366FERGbWSH7hL6sB7HbYp8bqksNwM=
cosmossdk.io/systemtests v1.0.0 h1:VuEj4aA//v1icbMoA6UMuWOwO6ejb6uK7PzSBT+Y460=
cosmossdk.io/systemtests v1.0.0/go.mod h1:6kl2MKa7tLoW8vgKx4ZgwAqWVD1T7eAiL5mc/9R7XGY=
cosmossdk.io/x/tx v1.0.0-alpha.3 h1:+55/JFH5QRqnFhOI2heH3DKsaNL0RpXcJOQNzUvHiaQ=
cosmossdk.io/x/tx v1.0.0-alpha.3/go.mod h1:h4pQ/j6Gfu8goB1R3Jbl4qY4RjYVNAsoylcleTXdSRg=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
Expand Down Expand Up @@ -115,6 +113,8 @@ github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWH
github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/cockroachdb/apd/v2 v2.0.2 h1:weh8u7Cneje73dDh+2tEVLUvyBc89iwepWCD8b8034E=
github.com/cockroachdb/apd/v2 v2.0.2/go.mod h1:DDxRlzC2lo3/vSlmSoS7JkqbbrARPuFOGr0B9pvN3Gw=
github.com/cockroachdb/apd/v3 v3.2.1 h1:U+8j7t0axsIgvQUqthuNm82HIrYXodOV2iWLWtEaIwg=
github.com/cockroachdb/apd/v3 v3.2.1/go.mod h1:klXJcjp+FffLTHlhIG69tezTDvdP065naDsHzKhYSqc=
github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8=
github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f h1:otljaYPt5hWxV3MUfO5dFPFiOXg9CyG5/kCfayTqsJ4=
github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU=
Expand Down Expand Up @@ -985,8 +985,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
google.golang.org/protobuf v1.36.0 h1:mjIs9gYtt56AzC4ZaffQuh88TZurBGhIJMBZGSxNerQ=
google.golang.org/protobuf v1.36.0/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
google.golang.org/protobuf v1.36.1 h1:yBPeRvTftaleIgM3PZ/WBIZ7XM/eEYAaEyCwvyjq/gk=
google.golang.org/protobuf v1.36.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
19 changes: 4 additions & 15 deletions tests/systemtests/snapshots_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,9 @@ func TestSnapshots(t *testing.T) {
// Stop all nodes
systest.Sut.StopChain()

var (
command string
restoreableDirs []string
)
node0Dir := systest.Sut.NodeDir(0)
if systest.IsV2() {
command = "store"
restoreableDirs = []string{fmt.Sprintf("%s/data/application.db", node0Dir), fmt.Sprintf("%s/data/ss", node0Dir)}
} else {
command = "snapshots"
restoreableDirs = []string{fmt.Sprintf("%s/data/application.db", node0Dir)}
}
command := "store"
restoreableDirs := []string{fmt.Sprintf("%s/data/application.db", node0Dir), fmt.Sprintf("%s/data/ss", node0Dir)}

// export snapshot at height 5
res := cli.RunCommandWithArgs(command, "export", "--height=5", fmt.Sprintf("--home=%s", node0Dir), disabledLog)
Expand Down Expand Up @@ -68,10 +59,8 @@ func TestSnapshots(t *testing.T) {
// Remove database
err := os.RemoveAll(fmt.Sprintf("%s/data/application.db", node0Dir))
require.NoError(t, err)
if systest.IsV2() {
require.NoError(t, os.RemoveAll(fmt.Sprintf("%s/data/ss", node0Dir)))
}

require.NoError(t, os.RemoveAll(fmt.Sprintf("%s/data/ss", node0Dir)))

res = cli.RunCommandWithArgs(command, "restore", "5", "3", fmt.Sprintf("--home=%s", node0Dir), disabledLog)
for _, dir := range restoreableDirs {
require.DirExists(t, dir)
Expand Down
7 changes: 2 additions & 5 deletions tests/systemtests/staking_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,8 @@ func TestStakeUnstake(t *testing.T) {
assert.Equal(t, int64(8999999), cli.QueryBalance(account1Addr, "stake"))

// check validator has been updated
if systest.IsV2() {
rsp = cli.CustomQuery("q", "comet", "block-results", gjson.Get(rsp, "height").String())
} else {
rsp = cli.CustomQuery("q", "block-results", gjson.Get(rsp, "height").String())
}
rsp = cli.CustomQuery("q", "comet", "block-results", gjson.Get(rsp, "height").String())

Comment on lines +45 to +46
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Remove unnecessary "q" prefix from query command

The "q" prefix in cli.CustomQuery("q", "comet", "block-results", ...) is inconsistent with both the official command pattern and other test files. Remove the prefix to match the standard format seen in cometbft_client_test.go.

🔗 Analysis chain

Verify query path consistency.

While removing version checks simplifies the code, the query path comet block-results differs from the pattern seen in other files (e.g., comet status in cometbft_client_test.go). Please verify if this should be standardized.

Run this script to check query path consistency across the codebase:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for consistency in comet query paths
# Test: Search for all comet query patterns to ensure consistency

echo "Searching for comet query patterns:"
rg -A 1 'CustomQuery\("q",\s*"comet"'

Length of output: 278


Script:

#!/bin/bash
# Search for all query patterns related to comet/cometbft
echo "Searching for all comet/cometbft related queries:"
rg -i "custom.*query.*comet|comet.*status|block.*results" -A 2

# Also search for specific file mentioned in the comment
echo -e "\nChecking cometbft_client_test.go specifically:"
fd "cometbft_client_test.go" --exec cat {}

Length of output: 29481

validatorUpdates := gjson.Get(rsp, "validator_updates").Array()
assert.NotEmpty(t, validatorUpdates)
vpk := gjson.Get(validatorUpdates[0].String(), "pub_key_bytes").String()
Expand Down
7 changes: 3 additions & 4 deletions tests/systemtests/unordered_tx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ import (
)

func TestUnorderedTXDuplicate(t *testing.T) {
if systest.IsV2() {
t.Skip("The unordered tx handling is not wired in v2")
return
}
// TODO: remove once unordered tx handling is working in v2
t.Skip("The unordered tx handling is not wired in v2")

// scenario: test unordered tx duplicate
// given a running chain with a tx in the unordered tx pool
// when a new tx with the same hash is broadcasted
Expand Down