Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
julienrbrt committed Aug 25, 2022
1 parent 1f37ec8 commit f70b07c
Show file tree
Hide file tree
Showing 17 changed files with 288 additions and 115 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* [#12187](https://github.com/cosmos/cosmos-sdk/pull/12187) Add batch operation for x/nft module.
* [#12693](https://github.com/cosmos/cosmos-sdk/pull/12693) Make sure the order of each node is consistent when emitting proto events.
* [#12455](https://github.com/cosmos/cosmos-sdk/pull/12455) Show attempts count in error for signing.
* [#12886](https://github.com/cosmos/cosmos-sdk/pull/12886) Amortize cost of processing cache KV store
* [#12885](https://github.com/cosmos/cosmos-sdk/pull/12885) Amortize cost of processing cache KV store
* [#12953](https://github.com/cosmos/cosmos-sdk/pull/12953) Change the default priority mechanism to be based on gas price.

### State Machine Breaking
Expand Down
20 changes: 18 additions & 2 deletions tests/e2e/crisis/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@ package crisis
import (
"fmt"

tmcli "github.com/tendermint/tendermint/libs/cli"

"github.com/gogo/protobuf/proto"
"github.com/stretchr/testify/suite"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli"
"github.com/cosmos/cosmos-sdk/testutil/network"
sdk "github.com/cosmos/cosmos-sdk/types"
authcli "github.com/cosmos/cosmos-sdk/x/auth/client/cli"
"github.com/cosmos/cosmos-sdk/x/crisis/client/cli"
)

Expand Down Expand Up @@ -73,7 +77,7 @@ func (s *IntegrationTestSuite) TestNewMsgVerifyInvariantTxCmd() {
true, 0, nil,
},
{
"valid transaction",
"valid traclientCtx.Codec.UnmarshalJSON(out.Bytes(), nsaction",
[]string{
"bank", "total-supply",
fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()),
Expand All @@ -100,8 +104,20 @@ func (s *IntegrationTestSuite) TestNewMsgVerifyInvariantTxCmd() {
s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String())

txResp := tc.respType.(*sdk.TxResponse)
s.Require().Equal(tc.expectedCode, txResp.Code)
s.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode)
}
})
}
}

func (s *IntegrationTestSuite) checkTxCode(clientCtx client.Context, txHash string, expectedCode uint32) {
s.Require().NoError(s.network.WaitForNextBlock())

cmd := authcli.QueryTxCmd()
out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, []string{txHash, fmt.Sprintf("--%s=json", tmcli.OutputFlag)})
s.Require().NoError(err)

var response sdk.TxResponse
s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response), out.String())
s.Require().Equal(expectedCode, response.Code, out.String())
}
22 changes: 18 additions & 4 deletions tests/e2e/slashing/client/testutil/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ import (
"github.com/stretchr/testify/suite"
tmcli "github.com/tendermint/tendermint/libs/cli"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli"
"github.com/cosmos/cosmos-sdk/testutil/network"
sdk "github.com/cosmos/cosmos-sdk/types"
authcli "github.com/cosmos/cosmos-sdk/x/auth/client/cli"
"github.com/cosmos/cosmos-sdk/x/slashing/client/cli"
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
)

type EndToEndTestSuite struct {
Expand All @@ -35,8 +38,7 @@ func (s *EndToEndTestSuite) SetupSuite() {
s.network, err = network.New(s.T(), s.T().TempDir(), s.cfg)
s.Require().NoError(err)

_, err = s.network.WaitForHeight(1)
s.Require().NoError(err)
s.Require().NoError(s.network.WaitForNextBlock())
}

// TearDownSuite performs cleanup logic after all the tests, i.e. once after the
Expand Down Expand Up @@ -159,7 +161,7 @@ func (s *EndToEndTestSuite) TestNewUnjailTxCmd() {
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // sync mode as there are no funds yet
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()),
},
false, 0, &sdk.TxResponse{},
false, slashingtypes.ErrValidatorNotJailed.ABCICode(), &sdk.TxResponse{},
},
}

Expand All @@ -178,8 +180,20 @@ func (s *EndToEndTestSuite) TestNewUnjailTxCmd() {
s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String())

txResp := tc.respType.(*sdk.TxResponse)
s.Require().Equal(tc.expectedCode, txResp.Code, out.String())
s.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode)
}
})
}
}

func (s *EndToEndTestSuite) checkTxCode(clientCtx client.Context, txHash string, expectedCode uint32) {
s.Require().NoError(s.network.WaitForNextBlock())

cmd := authcli.QueryTxCmd()
out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, []string{txHash, fmt.Sprintf("--%s=json", tmcli.OutputFlag)})
s.Require().NoError(err)

var response sdk.TxResponse
s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response), out.String())
s.Require().Equal(expectedCode, response.Code, out.String())
}
3 changes: 0 additions & 3 deletions tests/e2e/tx/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,6 @@ func (s *IntegrationTestSuite) TestQueryBySig() {

s.Require().NoError(s.network.WaitForNextBlock())

// wait for tx to be included
s.network.WaitForNextBlock()

// get the signature out of the builder
sigs, err := txb.GetTx().GetSignaturesV2()
s.Require().NoError(err)
Expand Down
6 changes: 2 additions & 4 deletions x/auth/client/testutil/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -1551,8 +1551,9 @@ func (s *IntegrationTestSuite) TestSignWithMultiSignersAminoJSON() {
signedTxFile.Name(),
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync),
)

require.NoError(err)
require.NoError(s.network.WaitForNextBlock())

var txRes sdk.TxResponse
require.NoError(val0.ClientCtx.Codec.UnmarshalJSON(res.Bytes(), &txRes))
require.Equal(uint32(0), txRes.Code, txRes.RawLog)
Expand All @@ -1566,10 +1567,7 @@ func (s *IntegrationTestSuite) TestSignWithMultiSignersAminoJSON() {
require.Equal(sdk.NewCoins(val0Coin, val1Coin), queryRes.Balances)
}

// TODO to re-enable in #12274
func (s *IntegrationTestSuite) TestAuxSigner() {
s.T().Skip()

require := s.Require()
val := s.network.Validators[0]
val0Coin := sdk.NewCoin(fmt.Sprintf("%stoken", val.Moniker), sdk.NewInt(10))
Expand Down
1 change: 1 addition & 0 deletions x/authz/client/testutil/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ func (s *IntegrationTestSuite) TestQueryGrantsGRPC() {
fmt.Sprintf("--%s=%d", cli.FlagExpiration, time.Now().Add(time.Minute*time.Duration(120)).Unix()),
})
s.Require().NoError(err)
s.Require().NoError(s.network.WaitForNextBlock())
},
func(g *authz.QueryGrantsResponse) {
s.Require().Len(g.Grants, 2)
Expand Down
2 changes: 2 additions & 0 deletions x/authz/client/testutil/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ func (s *IntegrationTestSuite) TestQueryAuthorizations() {
},
)
s.Require().NoError(err)
s.Require().NoError(s.network.WaitForNextBlock())

testCases := []struct {
name string
Expand Down Expand Up @@ -112,6 +113,7 @@ func (s *IntegrationTestSuite) TestQueryAuthorization() {
},
)
s.Require().NoError(err)
s.Require().NoError(s.network.WaitForNextBlock())

testCases := []struct {
name string
Expand Down
Loading

0 comments on commit f70b07c

Please sign in to comment.