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 all commits
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
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
4 changes: 0 additions & 4 deletions tests/systemtests/bankv2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ import (
)

func TestBankV2SendTxCmd(t *testing.T) {
// Currently only run with app v2
if !systest.IsV2() {
t.Skip()
}
// scenario: test bank send command
// given a running chain

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
8 changes: 3 additions & 5 deletions tests/systemtests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,14 @@ 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 (
buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.36.1-20241120201313-68e42a58b301.1 // indirect
buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.1-20240130113600-88ef6483f90f.1 // indirect
)

require (
cosmossdk.io/api v0.8.0 // indirect
cosmossdk.io/collections v0.4.0 // indirect
cosmossdk.io/core v0.11.0 // indirect
Expand All @@ -35,6 +32,7 @@ require (
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/cloudwego/base64x v0.1.4 // indirect
github.com/cloudwego/iasm v0.2.0 // indirect
github.com/cockroachdb/apd/v3 v3.2.1 // indirect
github.com/cockroachdb/errors v1.11.3 // indirect
github.com/cockroachdb/fifo v0.0.0-20240816210425-c5d0cb0b6fc0 // indirect
github.com/cockroachdb/logtags v0.0.0-20241215232642-bb51bb14a506 // indirect
Expand All @@ -53,7 +51,7 @@ 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.27 // 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 Down
10 changes: 6 additions & 4 deletions tests/systemtests/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ 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=
Expand Down Expand Up @@ -119,6 +119,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 @@ -170,8 +172,8 @@ github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5n
github.com/cosmos/ledger-cosmos-go v0.13.3/go.mod h1:HENcEP+VtahZFw38HZ3+LS3Iv5XV6svsnkk9vdJtLr8=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/creachadair/tomledit v0.0.27 h1:6xOpEnkKmcpT/gmKhabN0JXrqNX065lyje1/mXTSSIE=
github.com/creachadair/tomledit v0.0.27/go.mod h1:v1EWpgCisD3ct1kO8Gq4o4pdgX5JXD0rBI2PJ4UnPoA=
github.com/creachadair/tomledit v0.0.26 h1:MoDdgHIHZ5PctBVsAZDjxdxreWUEa9ObPKTRkk5PPwA=
github.com/creachadair/tomledit v0.0.26/go.mod h1:SJi1OxKpMyR141tq1lzsbPtIg3j8TeVPM/ZftfieD7o=
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/danieljoos/wincred v1.1.2 h1:QLdCxFs1/Yl4zduvBdcHB8goaYk9RARS2SgLLRuAyr0=
Expand Down
21 changes: 5 additions & 16 deletions tests/systemtests/group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,9 @@ func TestGroupCommands(t *testing.T) {
rsp = cli.RunAndWait(policyCmd...)
systest.RequireTxSuccess(t, rsp)

// TODO: remove isV2() check once v2 is integrated with grpc gateway
var groupPoliciesResp, policyAddrQuery string
if systest.IsV2() {
groupPoliciesResp = cli.CustomQuery("q", "group", "group-policies-by-group", groupId)
policyAddrQuery = fmt.Sprintf("group_policies.#(decision_policy.value.threshold==%d).address", threshold)
} else {
groupPoliciesResp = string(systest.GetRequest(t, fmt.Sprintf("%s/cosmos/group/v1/group_policies_by_group/%s", baseurl, groupId)))
policyAddrQuery = fmt.Sprintf("group_policies.#(decision_policy.threshold==%d).address", threshold)
}
groupPoliciesResp := string(systest.GetRequest(t, fmt.Sprintf("%s/cosmos/group/v1/group_policies_by_group/%s", baseurl, groupId)))
policyAddrQuery := fmt.Sprintf("group_policies.#(decision_policy.threshold==%d).address", threshold)

require.Equal(t, gjson.Get(groupPoliciesResp, "pagination.total").Int(), int64(threshold))
policyAddr := gjson.Get(groupPoliciesResp, policyAddrQuery).String()
require.NotEmpty(t, policyAddr)
Expand Down Expand Up @@ -122,12 +116,7 @@ func TestGroupCommands(t *testing.T) {
systest.RequireTxSuccess(t, rsp)

// query votes
// TODO: remove isV2() check once v2 is integrated with grpc gateway
var voteResp string
if systest.IsV2() {
voteResp = cli.CustomQuery("q", "group", "vote", proposalId, valAddr)
} else {
voteResp = string(systest.GetRequest(t, fmt.Sprintf("%s/cosmos/group/v1/vote_by_proposal_voter/%s/%s", baseurl, proposalId, valAddr)))
}
voteResp := string(systest.GetRequest(t, fmt.Sprintf("%s/cosmos/group/v1/vote_by_proposal_voter/%s/%s", baseurl, proposalId, valAddr)))

require.Equal(t, "VOTE_OPTION_YES", gjson.Get(voteResp, "vote.option").String())
}
4 changes: 0 additions & 4 deletions tests/systemtests/mint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,6 @@ func TestMintQueries(t *testing.T) {

for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
// TODO: remove below check once grpc gateway is implemented in v2
if systest.IsV2() {
return
}
resp := systest.GetRequestWithHeaders(t, tc.url, tc.headers, http.StatusOK)
require.JSONEq(t, tc.expOut, string(resp))
})
Expand Down
24 changes: 4 additions & 20 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,9 +59,7 @@ 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 {
Expand All @@ -95,12 +84,7 @@ func TestPrune(t *testing.T) {
node0Dir := systest.Sut.NodeDir(0)

// prune
var command []string
if systest.IsV2() {
command = []string{"store", "prune", "--store.keep-recent=1"}
} else {
command = []string{"prune", "everything"}
}
command := []string{"store", "prune", "--store.keep-recent=1"}
res := cli.RunCommandWithArgs(append(command, fmt.Sprintf("--home=%s", node0Dir), disabledLog)...)
require.Contains(t, res, "successfully pruned the application root multi stores")
}
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
Loading