From cf2216968a1fda7254a5cd0eec9e73a397afe3a0 Mon Sep 17 00:00:00 2001 From: Marko Date: Thu, 9 Jan 2025 09:43:01 +0100 Subject: [PATCH] refactor(systemtests): remove v2 checks (#23098) Co-authored-by: aljo242 --- tests/systemtests/README.md | 2 +- tests/systemtests/bankv2_test.go | 4 ---- tests/systemtests/cometbft_client_test.go | 7 +------ tests/systemtests/go.mod | 8 +++----- tests/systemtests/go.sum | 10 ++++++---- tests/systemtests/group_test.go | 21 +++++--------------- tests/systemtests/mint_test.go | 4 ---- tests/systemtests/snapshots_test.go | 24 ++++------------------- tests/systemtests/staking_test.go | 7 ++----- tests/systemtests/unordered_tx_test.go | 7 +++---- 10 files changed, 25 insertions(+), 69 deletions(-) diff --git a/tests/systemtests/README.md b/tests/systemtests/README.md index d2aa7112d5be..ee281c1f4815 100644 --- a/tests/systemtests/README.md +++ b/tests/systemtests/README.md @@ -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 diff --git a/tests/systemtests/bankv2_test.go b/tests/systemtests/bankv2_test.go index 03debeb771fe..cc7145f8741f 100644 --- a/tests/systemtests/bankv2_test.go +++ b/tests/systemtests/bankv2_test.go @@ -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 diff --git a/tests/systemtests/cometbft_client_test.go b/tests/systemtests/cometbft_client_test.go index dbaa3e6d14ee..0eadcdb1ca29 100644 --- a/tests/systemtests/cometbft_client_test.go +++ b/tests/systemtests/cometbft_client_test.go @@ -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\"") diff --git a/tests/systemtests/go.mod b/tests/systemtests/go.mod index 955c08f073a7..66307ba5a8ac 100644 --- a/tests/systemtests/go.mod +++ b/tests/systemtests/go.mod @@ -3,7 +3,7 @@ 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 ) @@ -11,9 +11,6 @@ require ( 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 @@ -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 @@ -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 diff --git a/tests/systemtests/go.sum b/tests/systemtests/go.sum index 0fdedda689cc..461b2ce04143 100644 --- a/tests/systemtests/go.sum +++ b/tests/systemtests/go.sum @@ -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= @@ -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= @@ -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= diff --git a/tests/systemtests/group_test.go b/tests/systemtests/group_test.go index fd7e6ef448bf..2f7215bc7858 100644 --- a/tests/systemtests/group_test.go +++ b/tests/systemtests/group_test.go @@ -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) @@ -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()) } diff --git a/tests/systemtests/mint_test.go b/tests/systemtests/mint_test.go index e6712c4af327..f51cfbab93b4 100644 --- a/tests/systemtests/mint_test.go +++ b/tests/systemtests/mint_test.go @@ -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)) }) diff --git a/tests/systemtests/snapshots_test.go b/tests/systemtests/snapshots_test.go index 6fae39749eb4..70a7b4f59f88 100644 --- a/tests/systemtests/snapshots_test.go +++ b/tests/systemtests/snapshots_test.go @@ -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) @@ -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 { @@ -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") } diff --git a/tests/systemtests/staking_test.go b/tests/systemtests/staking_test.go index b1b3829a9d1f..37b8ae8fa315 100644 --- a/tests/systemtests/staking_test.go +++ b/tests/systemtests/staking_test.go @@ -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()) + validatorUpdates := gjson.Get(rsp, "validator_updates").Array() assert.NotEmpty(t, validatorUpdates) vpk := gjson.Get(validatorUpdates[0].String(), "pub_key_bytes").String() diff --git a/tests/systemtests/unordered_tx_test.go b/tests/systemtests/unordered_tx_test.go index aec8f914130c..46069326c706 100644 --- a/tests/systemtests/unordered_tx_test.go +++ b/tests/systemtests/unordered_tx_test.go @@ -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