refactor(test)!: refactor `simapp.Setup` function (#9938)
<!-- The default pull request template is for types feat, fix, or refactor. For other templates, add one of the following parameters to the url: - template=docs.md - template=other.md --> ## Description ref: #8961 <!-- Add a description of the changes that this PR introduces and the files that are the most critical to review. --> Following up on [#9697](https://github.com/cosmos/cosmos-sdk/pull/9697#pullrequestreview-727295733), this PR is the first step for the #8961. --- ### Author Checklist *All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow up issues.* I have... - [x] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [x] added `!` to the type prefix if API or client breaking change - [x] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting)) - [x] provided a link to the relevant issue or specification - [ ] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules) - [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing) - [x] added a changelog entry to `CHANGELOG.md` - [ ] included comments for [documenting Go code](https://blog.golang.org/godoc) - [ ] updated the relevant documentation or specification - [ ] reviewed "Files changed" and left comments if necessary - [ ] confirmed all CI checks have passed ### Reviewers Checklist *All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items.* I have... - [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] confirmed `!` in the type prefix if API or client breaking change - [ ] confirmed all author checklist items have been addressed - [ ] reviewed state machine logic - [ ] reviewed API design and naming - [ ] reviewed documentation is accurate - [ ] reviewed tests and test coverage - [ ] manually tested (if applicable)
This commit is contained in:
parent
30228653ba
commit
23e864bc98
|
@ -65,6 +65,8 @@ Ref: https://keepachangelog.com/en/1.0.0/
|
|||
* [\#9576](https://github.com/cosmos/cosmos-sdk/pull/9576) Add debug error message to `sdkerrors.QueryResult` when enabled
|
||||
* [\#9650](https://github.com/cosmos/cosmos-sdk/pull/9650) Removed deprecated message handler implementation from the SDK modules.
|
||||
* (x/bank) [\#9832] (https://github.com/cosmos/cosmos-sdk/pull/9832) `AddressFromBalancesStore` renamed to `AddressAndDenomFromBalancesStore`.
|
||||
* (tests) [\#9938](https://github.com/cosmos/cosmos-sdk/pull/9938) `simapp.Setup` accepts additional `testing.T` argument.
|
||||
|
||||
|
||||
### Client Breaking Changes
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ type IntegrationTestSuite struct {
|
|||
|
||||
func (s *IntegrationTestSuite) SetupSuite() {
|
||||
s.T().Log("setting up integration test suite")
|
||||
s.app = simapp.Setup(false)
|
||||
s.app = simapp.Setup(s.T(), false)
|
||||
s.cfg = network.DefaultConfig()
|
||||
s.cfg.NumValidators = 1
|
||||
|
||||
|
|
|
@ -61,14 +61,14 @@ func setup(withGenesis bool, invCheckPeriod uint) (*SimApp, GenesisState) {
|
|||
}
|
||||
|
||||
// Setup initializes a new SimApp. A Nop logger is set in SimApp.
|
||||
func Setup(isCheckTx bool) *SimApp {
|
||||
func Setup(t *testing.T, isCheckTx bool) *SimApp {
|
||||
t.Helper()
|
||||
|
||||
app, genesisState := setup(!isCheckTx, 5)
|
||||
if !isCheckTx {
|
||||
// init chain must be called to stop deliverState from being nil
|
||||
stateBytes, err := json.MarshalIndent(genesisState, "", " ")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
require.NoError(t, err)
|
||||
|
||||
// Initialize the chain
|
||||
app.InitChain(
|
||||
|
|
|
@ -2,6 +2,7 @@ package query_test
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/store/prefix"
|
||||
|
@ -15,7 +16,7 @@ import (
|
|||
var addr1 = sdk.AccAddress([]byte("addr1"))
|
||||
|
||||
func (s *paginationTestSuite) TestFilteredPaginations() {
|
||||
app, ctx, appCodec := setupTest()
|
||||
app, ctx, appCodec := setupTest(s.T())
|
||||
|
||||
var balances sdk.Coins
|
||||
for i := 0; i < numBalances; i++ {
|
||||
|
@ -90,7 +91,7 @@ func (s *paginationTestSuite) TestFilteredPaginations() {
|
|||
}
|
||||
|
||||
func (s *paginationTestSuite) TestReverseFilteredPaginations() {
|
||||
app, ctx, appCodec := setupTest()
|
||||
app, ctx, appCodec := setupTest(s.T())
|
||||
|
||||
var balances sdk.Coins
|
||||
for i := 0; i < numBalances; i++ {
|
||||
|
@ -170,8 +171,8 @@ func (s *paginationTestSuite) TestReverseFilteredPaginations() {
|
|||
|
||||
}
|
||||
|
||||
func ExampleFilteredPaginate() {
|
||||
app, ctx, _ := setupTest()
|
||||
func ExampleFilteredPaginate(t *testing.T) {
|
||||
app, ctx, _ := setupTest(t)
|
||||
|
||||
var balances sdk.Coins
|
||||
for i := 0; i < numBalances; i++ {
|
||||
|
|
|
@ -61,7 +61,7 @@ func (s *paginationTestSuite) TestParsePagination() {
|
|||
}
|
||||
|
||||
func (s *paginationTestSuite) TestPagination() {
|
||||
app, ctx, _ := setupTest()
|
||||
app, ctx, _ := setupTest(s.T())
|
||||
queryHelper := baseapp.NewQueryServerTestHelper(ctx, app.InterfaceRegistry())
|
||||
types.RegisterQueryServer(queryHelper, app.BankKeeper)
|
||||
queryClient := types.NewQueryClient(queryHelper)
|
||||
|
@ -170,7 +170,7 @@ func (s *paginationTestSuite) TestPagination() {
|
|||
}
|
||||
|
||||
func (s *paginationTestSuite) TestReversePagination() {
|
||||
app, ctx, _ := setupTest()
|
||||
app, ctx, _ := setupTest(s.T())
|
||||
queryHelper := baseapp.NewQueryServerTestHelper(ctx, app.InterfaceRegistry())
|
||||
types.RegisterQueryServer(queryHelper, app.BankKeeper)
|
||||
queryClient := types.NewQueryClient(queryHelper)
|
||||
|
@ -293,8 +293,8 @@ func (s *paginationTestSuite) TestReversePagination() {
|
|||
s.Require().Nil(res.Pagination.NextKey)
|
||||
}
|
||||
|
||||
func ExamplePaginate() {
|
||||
app, ctx, _ := setupTest()
|
||||
func ExamplePaginate(t *testing.T) {
|
||||
app, ctx, _ := setupTest(t)
|
||||
|
||||
var balances sdk.Coins
|
||||
|
||||
|
@ -335,8 +335,8 @@ func ExamplePaginate() {
|
|||
// balances:<denom:"foo0denom" amount:"100" > pagination:<next_key:"foo1denom" total:2 >
|
||||
}
|
||||
|
||||
func setupTest() (*simapp.SimApp, sdk.Context, codec.Codec) {
|
||||
app := simapp.Setup(false)
|
||||
func setupTest(t *testing.T) (*simapp.SimApp, sdk.Context, codec.Codec) {
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{Height: 1})
|
||||
appCodec := app.AppCodec()
|
||||
|
||||
|
|
|
@ -192,7 +192,7 @@ func (suite *AnteTestSuite) TestSigVerification() {
|
|||
// In the meantime, we want to make double-sure amino compatibility works.
|
||||
// ref: https://github.com/cosmos/cosmos-sdk/issues/7229
|
||||
func (suite *AnteTestSuite) TestSigVerification_ExplicitAmino() {
|
||||
suite.app, suite.ctx = createTestApp(true)
|
||||
suite.app, suite.ctx = createTestApp(suite.T(), true)
|
||||
suite.ctx = suite.ctx.WithBlockHeight(1)
|
||||
|
||||
// Set up TxConfig.
|
||||
|
|
|
@ -41,8 +41,8 @@ type AnteTestSuite struct {
|
|||
}
|
||||
|
||||
// returns context and app with params set on account keeper
|
||||
func createTestApp(isCheckTx bool) (*simapp.SimApp, sdk.Context) {
|
||||
app := simapp.Setup(isCheckTx)
|
||||
func createTestApp(t *testing.T, isCheckTx bool) (*simapp.SimApp, sdk.Context) {
|
||||
app := simapp.Setup(t, isCheckTx)
|
||||
ctx := app.BaseApp.NewContext(isCheckTx, tmproto.Header{})
|
||||
app.AccountKeeper.SetParams(ctx, authtypes.DefaultParams())
|
||||
|
||||
|
@ -51,7 +51,7 @@ func createTestApp(isCheckTx bool) (*simapp.SimApp, sdk.Context) {
|
|||
|
||||
// SetupTest setups a new test, with new app, context, and anteHandler.
|
||||
func (suite *AnteTestSuite) SetupTest(isCheckTx bool) {
|
||||
suite.app, suite.ctx = createTestApp(isCheckTx)
|
||||
suite.app, suite.ctx = createTestApp(suite.T(), isCheckTx)
|
||||
suite.ctx = suite.ctx.WithBlockHeight(1)
|
||||
|
||||
// Set up TxConfig.
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package keeper_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/simapp"
|
||||
|
@ -9,8 +11,8 @@ import (
|
|||
)
|
||||
|
||||
// returns context and app with params set on account keeper
|
||||
func createTestApp(isCheckTx bool) (*simapp.SimApp, sdk.Context) {
|
||||
app := simapp.Setup(isCheckTx)
|
||||
func createTestApp(t *testing.T, isCheckTx bool) (*simapp.SimApp, sdk.Context) {
|
||||
app := simapp.Setup(t, isCheckTx)
|
||||
ctx := app.BaseApp.NewContext(isCheckTx, tmproto.Header{})
|
||||
app.AccountKeeper.SetParams(ctx, authtypes.DefaultParams())
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
func BenchmarkAccountMapperGetAccountFound(b *testing.B) {
|
||||
b.ReportAllocs()
|
||||
app, ctx := createTestApp(false)
|
||||
app, ctx := createTestApp(&testing.T{}, false)
|
||||
|
||||
// assumes b.N < 2**24
|
||||
for i := 0; i < b.N; i++ {
|
||||
|
@ -27,7 +27,7 @@ func BenchmarkAccountMapperGetAccountFound(b *testing.B) {
|
|||
|
||||
func BenchmarkAccountMapperSetAccount(b *testing.B) {
|
||||
b.ReportAllocs()
|
||||
app, ctx := createTestApp(false)
|
||||
app, ctx := createTestApp(&testing.T{}, false)
|
||||
|
||||
b.ResetTimer()
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ type KeeperTestSuite struct {
|
|||
}
|
||||
|
||||
func (suite *KeeperTestSuite) SetupTest() {
|
||||
suite.app, suite.ctx = createTestApp(true)
|
||||
suite.app, suite.ctx = createTestApp(suite.T(), true)
|
||||
|
||||
queryHelper := baseapp.NewQueryServerTestHelper(suite.ctx, suite.app.InterfaceRegistry())
|
||||
types.RegisterQueryServer(queryHelper, suite.app.AccountKeeper)
|
||||
|
@ -46,7 +46,7 @@ func TestKeeperTestSuite(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestAccountMapperGetSet(t *testing.T) {
|
||||
app, ctx := createTestApp(true)
|
||||
app, ctx := createTestApp(t, true)
|
||||
addr := sdk.AccAddress([]byte("some---------address"))
|
||||
|
||||
// no account before its created
|
||||
|
@ -76,7 +76,7 @@ func TestAccountMapperGetSet(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestAccountMapperRemoveAccount(t *testing.T) {
|
||||
app, ctx := createTestApp(true)
|
||||
app, ctx := createTestApp(t, true)
|
||||
addr1 := sdk.AccAddress([]byte("addr1---------------"))
|
||||
addr2 := sdk.AccAddress([]byte("addr2---------------"))
|
||||
|
||||
|
@ -109,7 +109,7 @@ func TestAccountMapperRemoveAccount(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestGetSetParams(t *testing.T) {
|
||||
app, ctx := createTestApp(true)
|
||||
app, ctx := createTestApp(t, true)
|
||||
params := types.DefaultParams()
|
||||
|
||||
app.AccountKeeper.SetParams(ctx, params)
|
||||
|
@ -119,7 +119,7 @@ func TestGetSetParams(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestSupply_ValidatePermissions(t *testing.T) {
|
||||
app, _ := createTestApp(true)
|
||||
app, _ := createTestApp(t, true)
|
||||
|
||||
// add module accounts to supply keeper
|
||||
maccPerms := simapp.GetMaccPerms()
|
||||
|
|
|
@ -16,7 +16,7 @@ import (
|
|||
)
|
||||
|
||||
func TestQueryAccount(t *testing.T) {
|
||||
app, ctx := createTestApp(true)
|
||||
app, ctx := createTestApp(t, true)
|
||||
legacyQuerierCdc := codec.NewAminoCodec(app.LegacyAmino())
|
||||
|
||||
req := abci.RequestQuery{
|
||||
|
|
|
@ -549,7 +549,7 @@ func TestMigrateVestingAccounts(t *testing.T) {
|
|||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{
|
||||
Time: time.Now(),
|
||||
})
|
||||
|
|
|
@ -12,7 +12,7 @@ import (
|
|||
)
|
||||
|
||||
func TestItCreatesModuleAccountOnInitBlock(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
app.InitChain(
|
||||
|
|
|
@ -29,7 +29,7 @@ func TestVerifySignature(t *testing.T) {
|
|||
chainId = "test-chain"
|
||||
)
|
||||
|
||||
app, ctx := createTestApp(false)
|
||||
app, ctx := createTestApp(t, false)
|
||||
ctx = ctx.WithBlockHeight(1)
|
||||
|
||||
cdc := codec.NewLegacyAmino()
|
||||
|
@ -97,8 +97,8 @@ func TestVerifySignature(t *testing.T) {
|
|||
}
|
||||
|
||||
// returns context and app with params set on account keeper
|
||||
func createTestApp(isCheckTx bool) (*simapp.SimApp, sdk.Context) {
|
||||
app := simapp.Setup(isCheckTx)
|
||||
func createTestApp(t *testing.T, isCheckTx bool) (*simapp.SimApp, sdk.Context) {
|
||||
app := simapp.Setup(t, isCheckTx)
|
||||
ctx := app.BaseApp.NewContext(isCheckTx, tmproto.Header{})
|
||||
app.AccountKeeper.SetParams(ctx, types.DefaultParams())
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ var (
|
|||
)
|
||||
|
||||
func TestDecodeStore(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
cdc := simapp.MakeTestEncodingConfig().Codec
|
||||
acc := types.NewBaseAccountWithAddress(delAddr1)
|
||||
dec := simulation.NewDecodeStore(app.AccountKeeper)
|
||||
|
|
|
@ -10,6 +10,7 @@ import (
|
|||
yaml "gopkg.in/yaml.v2"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
|
||||
"github.com/cosmos/cosmos-sdk/simapp"
|
||||
"github.com/cosmos/cosmos-sdk/testutil/testdata"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||
|
@ -59,6 +60,7 @@ func TestBaseSequence(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestBaseAccountMarshal(t *testing.T) {
|
||||
app := simapp.Setup(t, false)
|
||||
_, pub, addr := testdata.KeyTestPubAddr()
|
||||
acc := types.NewBaseAccountWithAddress(addr)
|
||||
seq := uint64(7)
|
||||
|
|
|
@ -5,7 +5,6 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
app = simapp.Setup(false)
|
||||
ecdc = simapp.MakeTestEncodingConfig()
|
||||
appCodec, legacyAmino = ecdc.Codec, ecdc.Amino
|
||||
)
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
package types_test
|
||||
|
||||
import (
|
||||
"github.com/cosmos/cosmos-sdk/simapp"
|
||||
)
|
||||
|
||||
var (
|
||||
app = simapp.Setup(false)
|
||||
)
|
|
@ -5,9 +5,12 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/suite"
|
||||
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
|
||||
tmtime "github.com/tendermint/tendermint/types/time"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
|
||||
"github.com/cosmos/cosmos-sdk/simapp"
|
||||
"github.com/cosmos/cosmos-sdk/testutil/testdata"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||
|
@ -19,6 +22,20 @@ var (
|
|||
feeDenom = "fee"
|
||||
)
|
||||
|
||||
type VestingAccountTestSuite struct {
|
||||
suite.Suite
|
||||
|
||||
app *simapp.SimApp
|
||||
ctx sdk.Context
|
||||
}
|
||||
|
||||
func (s *VestingAccountTestSuite) SetupTest() {
|
||||
checkTx := false
|
||||
s.app = simapp.Setup(s.T(), checkTx)
|
||||
|
||||
s.ctx = s.app.BaseApp.NewContext(checkTx, tmproto.Header{Height: 1})
|
||||
}
|
||||
|
||||
func TestGetVestedCoinsContVestingAcc(t *testing.T) {
|
||||
now := tmtime.Now()
|
||||
endTime := now.Add(24 * time.Hour)
|
||||
|
@ -735,72 +752,80 @@ func TestGenesisAccountValidate(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestContinuousVestingAccountMarshal(t *testing.T) {
|
||||
func (s *VestingAccountTestSuite) TestContinuousVestingAccountMarshal() {
|
||||
app := s.app
|
||||
require := s.Require()
|
||||
baseAcc, coins := initBaseAccount()
|
||||
baseVesting := types.NewBaseVestingAccount(baseAcc, coins, time.Now().Unix())
|
||||
acc := types.NewContinuousVestingAccountRaw(baseVesting, baseVesting.EndTime)
|
||||
|
||||
bz, err := app.AccountKeeper.MarshalAccount(acc)
|
||||
require.Nil(t, err)
|
||||
require.Nil(err)
|
||||
|
||||
acc2, err := app.AccountKeeper.UnmarshalAccount(bz)
|
||||
require.Nil(t, err)
|
||||
require.IsType(t, &types.ContinuousVestingAccount{}, acc2)
|
||||
require.Equal(t, acc.String(), acc2.String())
|
||||
require.Nil(err)
|
||||
require.IsType(&types.ContinuousVestingAccount{}, acc2)
|
||||
require.Equal(acc.String(), acc2.String())
|
||||
|
||||
// error on bad bytes
|
||||
_, err = app.AccountKeeper.UnmarshalAccount(bz[:len(bz)/2])
|
||||
require.NotNil(t, err)
|
||||
require.NotNil(err)
|
||||
}
|
||||
|
||||
func TestPeriodicVestingAccountMarshal(t *testing.T) {
|
||||
func (s *VestingAccountTestSuite) TestPeriodicVestingAccountMarshal() {
|
||||
app := s.app
|
||||
require := s.Require()
|
||||
baseAcc, coins := initBaseAccount()
|
||||
acc := types.NewPeriodicVestingAccount(baseAcc, coins, time.Now().Unix(), types.Periods{types.Period{3600, coins}})
|
||||
|
||||
bz, err := app.AccountKeeper.MarshalAccount(acc)
|
||||
require.Nil(t, err)
|
||||
require.Nil(err)
|
||||
|
||||
acc2, err := app.AccountKeeper.UnmarshalAccount(bz)
|
||||
require.Nil(t, err)
|
||||
require.IsType(t, &types.PeriodicVestingAccount{}, acc2)
|
||||
require.Equal(t, acc.String(), acc2.String())
|
||||
require.Nil(err)
|
||||
require.IsType(&types.PeriodicVestingAccount{}, acc2)
|
||||
require.Equal(acc.String(), acc2.String())
|
||||
|
||||
// error on bad bytes
|
||||
_, err = app.AccountKeeper.UnmarshalAccount(bz[:len(bz)/2])
|
||||
require.NotNil(t, err)
|
||||
require.NotNil(err)
|
||||
}
|
||||
|
||||
func TestDelayedVestingAccountMarshal(t *testing.T) {
|
||||
func (s *VestingAccountTestSuite) TestDelayedVestingAccountMarshal() {
|
||||
app := s.app
|
||||
require := s.Require()
|
||||
baseAcc, coins := initBaseAccount()
|
||||
acc := types.NewDelayedVestingAccount(baseAcc, coins, time.Now().Unix())
|
||||
|
||||
bz, err := app.AccountKeeper.MarshalAccount(acc)
|
||||
require.Nil(t, err)
|
||||
require.Nil(err)
|
||||
|
||||
acc2, err := app.AccountKeeper.UnmarshalAccount(bz)
|
||||
require.Nil(t, err)
|
||||
require.IsType(t, &types.DelayedVestingAccount{}, acc2)
|
||||
require.Equal(t, acc.String(), acc2.String())
|
||||
require.Nil(err)
|
||||
require.IsType(&types.DelayedVestingAccount{}, acc2)
|
||||
require.Equal(acc.String(), acc2.String())
|
||||
|
||||
// error on bad bytes
|
||||
_, err = app.AccountKeeper.UnmarshalAccount(bz[:len(bz)/2])
|
||||
require.NotNil(t, err)
|
||||
require.NotNil(err)
|
||||
}
|
||||
func TestPermanentLockedAccountMarshal(t *testing.T) {
|
||||
func (s *VestingAccountTestSuite) TestPermanentLockedAccountMarshal() {
|
||||
app := s.app
|
||||
require := s.Require()
|
||||
baseAcc, coins := initBaseAccount()
|
||||
acc := types.NewPermanentLockedAccount(baseAcc, coins)
|
||||
|
||||
bz, err := app.AccountKeeper.MarshalAccount(acc)
|
||||
require.Nil(t, err)
|
||||
require.Nil(err)
|
||||
|
||||
acc2, err := app.AccountKeeper.UnmarshalAccount(bz)
|
||||
require.Nil(t, err)
|
||||
require.IsType(t, &types.PermanentLockedAccount{}, acc2)
|
||||
require.Equal(t, acc.String(), acc2.String())
|
||||
require.Nil(err)
|
||||
require.IsType(&types.PermanentLockedAccount{}, acc2)
|
||||
require.Equal(acc.String(), acc2.String())
|
||||
|
||||
// error on bad bytes
|
||||
_, err = app.AccountKeeper.UnmarshalAccount(bz[:len(bz)/2])
|
||||
require.NotNil(t, err)
|
||||
require.NotNil(err)
|
||||
}
|
||||
|
||||
func initBaseAccount() (*authtypes.BaseAccount, sdk.Coins) {
|
||||
|
@ -810,3 +835,7 @@ func initBaseAccount() (*authtypes.BaseAccount, sdk.Coins) {
|
|||
|
||||
return bacc, origCoins
|
||||
}
|
||||
|
||||
func TestVestingAccountTestSuite(t *testing.T) {
|
||||
suite.Run(t, new(VestingAccountTestSuite))
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ type GenesisTestSuite struct {
|
|||
|
||||
func (suite *GenesisTestSuite) SetupTest() {
|
||||
checkTx := false
|
||||
app := simapp.Setup(checkTx)
|
||||
app := simapp.Setup(suite.T(), checkTx)
|
||||
|
||||
suite.ctx = app.BaseApp.NewContext(checkTx, tmproto.Header{Height: 1})
|
||||
suite.keeper = app.AuthzKeeper
|
||||
|
|
|
@ -28,7 +28,7 @@ type TestSuite struct {
|
|||
}
|
||||
|
||||
func (s *TestSuite) SetupTest() {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(s.T(), false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
now := tmtime.Now()
|
||||
ctx = ctx.WithBlockHeader(tmproto.Header{Time: now})
|
||||
|
|
|
@ -15,7 +15,7 @@ import (
|
|||
)
|
||||
|
||||
func TestRandomizedGenState(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
|
||||
s := rand.NewSource(1)
|
||||
r := rand.New(s)
|
||||
|
|
|
@ -27,7 +27,7 @@ type SimTestSuite struct {
|
|||
|
||||
func (suite *SimTestSuite) SetupTest() {
|
||||
checkTx := false
|
||||
app := simapp.Setup(checkTx)
|
||||
app := simapp.Setup(suite.T(), checkTx)
|
||||
suite.app = app
|
||||
suite.ctx = app.BaseApp.NewContext(checkTx, tmproto.Header{})
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ func (suite *IntegrationTestSuite) initKeepersWithmAccPerms(blockedAddrs map[str
|
|||
}
|
||||
|
||||
func (suite *IntegrationTestSuite) SetupTest() {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(suite.T(), false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
app.AccountKeeper.SetParams(ctx, authtypes.DefaultParams())
|
||||
|
|
|
@ -26,7 +26,7 @@ type SimTestSuite struct {
|
|||
|
||||
func (suite *SimTestSuite) SetupTest() {
|
||||
checkTx := false
|
||||
app := simapp.Setup(checkTx)
|
||||
app := simapp.Setup(suite.T(), checkTx)
|
||||
suite.app = app
|
||||
suite.ctx = app.BaseApp.NewContext(checkTx, tmproto.Header{})
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ var (
|
|||
)
|
||||
|
||||
func TestSendAuthorization(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
authorization := types.NewSendAuthorization(coins1000)
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ type CapabilityTestSuite struct {
|
|||
|
||||
func (suite *CapabilityTestSuite) SetupTest() {
|
||||
checkTx := false
|
||||
app := simapp.Setup(checkTx)
|
||||
app := simapp.Setup(suite.T(), checkTx)
|
||||
cdc := app.AppCodec()
|
||||
|
||||
// create new keeper so we can define custom scoping before init and seal
|
||||
|
|
|
@ -25,7 +25,7 @@ type KeeperTestSuite struct {
|
|||
|
||||
func (suite *KeeperTestSuite) SetupTest() {
|
||||
checkTx := false
|
||||
app := simapp.Setup(checkTx)
|
||||
app := simapp.Setup(suite.T(), checkTx)
|
||||
cdc := app.AppCodec()
|
||||
|
||||
// create new keeper so we can define custom scoping before init and seal
|
||||
|
|
|
@ -12,14 +12,14 @@ import (
|
|||
)
|
||||
|
||||
func TestLogger(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
|
||||
ctx := app.NewContext(true, tmproto.Header{})
|
||||
require.Equal(t, ctx.Logger(), app.CrisisKeeper.Logger(ctx))
|
||||
}
|
||||
|
||||
func TestInvariants(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
app.Commit()
|
||||
app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: app.LastBlockHeight() + 1}})
|
||||
|
||||
|
@ -32,7 +32,7 @@ func TestInvariants(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestAssertInvariants(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
app.Commit()
|
||||
app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: app.LastBlockHeight() + 1}})
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ import (
|
|||
)
|
||||
|
||||
func TestAllocateTokensToValidatorWithCommission(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
addrs := simapp.AddTestAddrs(app, ctx, 3, sdk.NewInt(1234))
|
||||
|
@ -45,7 +45,7 @@ func TestAllocateTokensToValidatorWithCommission(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestAllocateTokensToManyValidators(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
addrs := simapp.AddTestAddrs(app, ctx, 2, sdk.NewInt(1234))
|
||||
|
@ -116,7 +116,7 @@ func TestAllocateTokensToManyValidators(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestAllocateTokensTruncation(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
addrs := simapp.AddTestAddrs(app, ctx, 3, sdk.NewInt(1234))
|
||||
|
|
|
@ -15,7 +15,7 @@ import (
|
|||
)
|
||||
|
||||
func TestCalculateRewardsBasic(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
tstaking := teststaking.NewHelper(t, ctx, app.StakingKeeper)
|
||||
|
||||
|
@ -69,7 +69,7 @@ func TestCalculateRewardsBasic(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestCalculateRewardsAfterSlash(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
addr := simapp.AddTestAddrs(app, ctx, 2, sdk.NewInt(100000000))
|
||||
|
@ -132,7 +132,7 @@ func TestCalculateRewardsAfterSlash(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestCalculateRewardsAfterManySlashes(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
tstaking := teststaking.NewHelper(t, ctx, app.StakingKeeper)
|
||||
|
@ -207,7 +207,7 @@ func TestCalculateRewardsAfterManySlashes(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestCalculateRewardsMultiDelegator(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
tstaking := teststaking.NewHelper(t, ctx, app.StakingKeeper)
|
||||
|
@ -270,7 +270,7 @@ func TestCalculateRewardsMultiDelegator(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestWithdrawDelegationRewardsBasic(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
balancePower := int64(1000)
|
||||
|
@ -341,7 +341,7 @@ func TestWithdrawDelegationRewardsBasic(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestCalculateRewardsAfterManySlashesInSameBlock(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
addr := simapp.AddTestAddrs(app, ctx, 1, sdk.NewInt(1000000000))
|
||||
|
@ -409,7 +409,7 @@ func TestCalculateRewardsAfterManySlashesInSameBlock(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestCalculateRewardsMultiDelegatorMultiSlash(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
tstaking := teststaking.NewHelper(t, ctx, app.StakingKeeper)
|
||||
|
@ -483,7 +483,7 @@ func TestCalculateRewardsMultiDelegatorMultiSlash(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestCalculateRewardsMultiDelegatorMultWithdraw(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
tstaking := teststaking.NewHelper(t, ctx, app.StakingKeeper)
|
||||
|
@ -628,7 +628,7 @@ func TestCalculateRewardsMultiDelegatorMultWithdraw(t *testing.T) {
|
|||
}
|
||||
|
||||
func Test100PercentCommissionReward(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
tstaking := teststaking.NewHelper(t, ctx, app.StakingKeeper)
|
||||
|
|
|
@ -30,7 +30,7 @@ type KeeperTestSuite struct {
|
|||
}
|
||||
|
||||
func (suite *KeeperTestSuite) SetupTest() {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(suite.T(), false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
queryHelper := baseapp.NewQueryServerTestHelper(ctx, app.InterfaceRegistry())
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
)
|
||||
|
||||
func TestSetWithdrawAddr(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
addr := simapp.AddTestAddrs(app, ctx, 2, sdk.NewInt(1000000000))
|
||||
|
@ -36,7 +36,7 @@ func TestSetWithdrawAddr(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestWithdrawValidatorCommission(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
valCommission := sdk.DecCoins{
|
||||
|
@ -88,7 +88,7 @@ func TestWithdrawValidatorCommission(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestGetTotalRewards(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
valCommission := sdk.DecCoins{
|
||||
|
@ -109,7 +109,7 @@ func TestGetTotalRewards(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestFundCommunityPool(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
addr := simapp.AddTestAddrs(app, ctx, 2, sdk.ZeroInt())
|
||||
|
|
|
@ -116,7 +116,7 @@ func TestQueries(t *testing.T) {
|
|||
types.RegisterLegacyAminoCodec(cdc)
|
||||
banktypes.RegisterLegacyAminoCodec(cdc)
|
||||
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
addr := simapp.AddTestAddrs(app, ctx, 1, sdk.NewInt(1000000000))
|
||||
|
|
|
@ -13,7 +13,7 @@ import (
|
|||
)
|
||||
|
||||
func TestItCreatesModuleAccountOnInitBlock(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
app.InitChain(
|
||||
|
|
|
@ -26,7 +26,7 @@ func testProposal(recipient sdk.AccAddress, amount sdk.Coins) *types.CommunityPo
|
|||
}
|
||||
|
||||
func TestProposalHandlerPassed(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
recipient := delAddr1
|
||||
|
@ -55,7 +55,7 @@ func TestProposalHandlerPassed(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestProposalHandlerFailed(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
recipient := delAddr1
|
||||
|
|
|
@ -215,7 +215,7 @@ type SimTestSuite struct {
|
|||
|
||||
func (suite *SimTestSuite) SetupTest() {
|
||||
checkTx := false
|
||||
app := simapp.Setup(checkTx)
|
||||
app := simapp.Setup(suite.T(), checkTx)
|
||||
suite.app = app
|
||||
suite.ctx = app.BaseApp.NewContext(checkTx, tmproto.Header{})
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ import (
|
|||
)
|
||||
|
||||
func TestProposalContents(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
// initialize parameters
|
||||
|
|
|
@ -26,7 +26,7 @@ type GenesisTestSuite struct {
|
|||
|
||||
func (suite *GenesisTestSuite) SetupTest() {
|
||||
checkTx := false
|
||||
app := simapp.Setup(checkTx)
|
||||
app := simapp.Setup(suite.T(), checkTx)
|
||||
|
||||
suite.ctx = app.BaseApp.NewContext(checkTx, tmproto.Header{Height: 1})
|
||||
suite.keeper = app.EvidenceKeeper
|
||||
|
|
|
@ -80,7 +80,7 @@ type KeeperTestSuite struct {
|
|||
|
||||
func (suite *KeeperTestSuite) SetupTest() {
|
||||
checkTx := false
|
||||
app := simapp.Setup(checkTx)
|
||||
app := simapp.Setup(suite.T(), checkTx)
|
||||
|
||||
// recreate keeper in order to use custom testing types
|
||||
evidenceKeeper := keeper.NewKeeper(
|
||||
|
|
|
@ -16,7 +16,7 @@ import (
|
|||
)
|
||||
|
||||
func TestDecodeStore(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
dec := simulation.NewDecodeStore(app.EvidenceKeeper)
|
||||
|
||||
delPk1 := ed25519.GenPrivKey().PubKey()
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
)
|
||||
|
||||
func TestBasicFeeValidAllow(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
badTime := ctx.BlockTime().AddDate(0, 0, -1)
|
||||
|
|
|
@ -13,7 +13,7 @@ import (
|
|||
)
|
||||
|
||||
func TestGrant(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
addr, err := sdk.AccAddressFromBech32("cosmos1qk93t4j0yyzgqgt6k5qf8deh8fq6smpn3ntu3x")
|
||||
require.NoError(t, err)
|
||||
addr2, err := sdk.AccAddressFromBech32("cosmos1p9qh4ldfd6n0qehujsal4k7g0e37kel90rc4ts")
|
||||
|
|
|
@ -23,7 +23,7 @@ type GenesisTestSuite struct {
|
|||
|
||||
func (suite *GenesisTestSuite) SetupTest() {
|
||||
checkTx := false
|
||||
app := simapp.Setup(checkTx)
|
||||
app := simapp.Setup(suite.T(), checkTx)
|
||||
suite.ctx = app.BaseApp.NewContext(checkTx, tmproto.Header{Height: 1})
|
||||
suite.keeper = app.FeeGrantKeeper
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ func TestKeeperTestSuite(t *testing.T) {
|
|||
}
|
||||
|
||||
func (suite *KeeperTestSuite) SetupTest() {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(suite.T(), false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
suite.app = app
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
)
|
||||
|
||||
func TestPeriodicFeeValidAllow(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{
|
||||
Time: time.Now(),
|
||||
})
|
||||
|
|
|
@ -15,7 +15,7 @@ import (
|
|||
)
|
||||
|
||||
func TestRandomizedGenState(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
|
||||
s := rand.NewSource(1)
|
||||
r := rand.New(s)
|
||||
|
|
|
@ -27,7 +27,7 @@ type SimTestSuite struct {
|
|||
|
||||
func (suite *SimTestSuite) SetupTest() {
|
||||
checkTx := false
|
||||
app := simapp.Setup(checkTx)
|
||||
app := simapp.Setup(suite.T(), checkTx)
|
||||
suite.app = app
|
||||
suite.ctx = app.BaseApp.NewContext(checkTx, tmproto.Header{
|
||||
Time: time.Now(),
|
||||
|
|
|
@ -45,7 +45,7 @@ type GenTxTestSuite struct {
|
|||
|
||||
func (suite *GenTxTestSuite) SetupTest() {
|
||||
checkTx := false
|
||||
app := simapp.Setup(checkTx)
|
||||
app := simapp.Setup(suite.T(), checkTx)
|
||||
suite.ctx = app.BaseApp.NewContext(checkTx, tmproto.Header{})
|
||||
suite.app = app
|
||||
suite.encodingConfig = simapp.MakeTestEncodingConfig()
|
||||
|
|
|
@ -19,7 +19,7 @@ import (
|
|||
)
|
||||
|
||||
func TestTickExpiredDepositPeriod(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
addrs := simapp.AddTestAddrs(app, ctx, 10, valTokens)
|
||||
|
||||
|
@ -72,7 +72,7 @@ func TestTickExpiredDepositPeriod(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestTickMultipleExpiredDepositPeriod(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
addrs := simapp.AddTestAddrs(app, ctx, 10, valTokens)
|
||||
|
||||
|
@ -149,7 +149,7 @@ func TestTickMultipleExpiredDepositPeriod(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestTickPassedDepositPeriod(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
addrs := simapp.AddTestAddrs(app, ctx, 10, valTokens)
|
||||
|
||||
|
@ -202,7 +202,7 @@ func TestTickPassedDepositPeriod(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestTickPassedVotingPeriod(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
addrs := simapp.AddTestAddrs(app, ctx, 10, valTokens)
|
||||
|
||||
|
@ -268,7 +268,7 @@ func TestTickPassedVotingPeriod(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestProposalPassedEndblocker(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
addrs := simapp.AddTestAddrs(app, ctx, 10, valTokens)
|
||||
|
||||
|
@ -321,7 +321,7 @@ func TestProposalPassedEndblocker(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestEndBlockerProposalHandlerFailed(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
addrs := simapp.AddTestAddrs(app, ctx, 1, valTokens)
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ import (
|
|||
)
|
||||
|
||||
func TestImportExportQueues(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
addrs := simapp.AddTestAddrs(app, ctx, 2, valTokens)
|
||||
|
||||
|
@ -113,7 +113,7 @@ func TestImportExportQueues(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestImportExportQueues_ErrorUnconsistentState(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
require.Panics(t, func() {
|
||||
gov.InitGenesis(ctx, app.AccountKeeper, app.BankKeeper, app.GovKeeper, &types.GenesisState{
|
||||
|
@ -134,7 +134,7 @@ func TestImportExportQueues_ErrorUnconsistentState(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestEqualProposals(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
addrs := simapp.AddTestAddrs(app, ctx, 2, valTokens)
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import (
|
|||
)
|
||||
|
||||
func TestDeposits(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
TestAddrs := simapp.AddTestAddrsIncremental(app, ctx, 2, sdk.NewInt(10000000))
|
||||
|
|
|
@ -44,7 +44,7 @@ func (h *MockGovHooksReceiver) AfterProposalVotingPeriodEnded(ctx sdk.Context, p
|
|||
}
|
||||
|
||||
func TestHooks(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
minDeposit := app.GovKeeper.GetDepositParams(ctx).MinDeposit
|
||||
|
|
|
@ -23,7 +23,7 @@ type KeeperTestSuite struct {
|
|||
}
|
||||
|
||||
func (suite *KeeperTestSuite) SetupTest() {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(suite.T(), false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
queryHelper := baseapp.NewQueryServerTestHelper(ctx, app.InterfaceRegistry())
|
||||
|
@ -37,7 +37,7 @@ func (suite *KeeperTestSuite) SetupTest() {
|
|||
}
|
||||
|
||||
func TestIncrementProposalNumber(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
tp := TestProposal
|
||||
|
@ -58,7 +58,7 @@ func TestIncrementProposalNumber(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestProposalQueues(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
// create test proposals
|
||||
|
|
|
@ -145,7 +145,7 @@ func getQueriedVotes(t *testing.T, ctx sdk.Context, cdc *codec.LegacyAmino, quer
|
|||
}
|
||||
|
||||
func TestQueries(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
legacyQuerierCdc := app.LegacyAmino()
|
||||
querier := keeper.NewQuerier(app.GovKeeper, legacyQuerierCdc)
|
||||
|
@ -304,7 +304,7 @@ func TestQueries(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestPaginatedVotesQuery(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
legacyQuerierCdc := app.LegacyAmino()
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
)
|
||||
|
||||
func TestTallyNoOneVotes(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
createValidators(t, ctx, app, []int64{5, 5, 5})
|
||||
|
@ -36,7 +36,7 @@ func TestTallyNoOneVotes(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestTallyNoQuorum(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
createValidators(t, ctx, app, []int64{2, 5, 0})
|
||||
|
@ -61,7 +61,7 @@ func TestTallyNoQuorum(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestTallyOnlyValidatorsAllYes(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
addrs, _ := createValidators(t, ctx, app, []int64{5, 5, 5})
|
||||
|
@ -87,7 +87,7 @@ func TestTallyOnlyValidatorsAllYes(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestTallyOnlyValidators51No(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
valAccAddrs, _ := createValidators(t, ctx, app, []int64{5, 6, 0})
|
||||
|
@ -111,7 +111,7 @@ func TestTallyOnlyValidators51No(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestTallyOnlyValidators51Yes(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
valAccAddrs, _ := createValidators(t, ctx, app, []int64{5, 6, 0})
|
||||
|
@ -136,7 +136,7 @@ func TestTallyOnlyValidators51Yes(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestTallyOnlyValidatorsVetoed(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
valAccAddrs, _ := createValidators(t, ctx, app, []int64{6, 6, 7})
|
||||
|
@ -162,7 +162,7 @@ func TestTallyOnlyValidatorsVetoed(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestTallyOnlyValidatorsAbstainPasses(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
valAccAddrs, _ := createValidators(t, ctx, app, []int64{6, 6, 7})
|
||||
|
@ -188,7 +188,7 @@ func TestTallyOnlyValidatorsAbstainPasses(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestTallyOnlyValidatorsAbstainFails(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
valAccAddrs, _ := createValidators(t, ctx, app, []int64{6, 6, 7})
|
||||
|
@ -214,7 +214,7 @@ func TestTallyOnlyValidatorsAbstainFails(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestTallyOnlyValidatorsNonVoter(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
valAccAddrs, _ := createValidators(t, ctx, app, []int64{5, 6, 7})
|
||||
|
@ -240,7 +240,7 @@ func TestTallyOnlyValidatorsNonVoter(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestTallyDelgatorOverride(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
addrs, valAddrs := createValidators(t, ctx, app, []int64{5, 6, 7})
|
||||
|
@ -276,7 +276,7 @@ func TestTallyDelgatorOverride(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestTallyDelgatorInherit(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
addrs, vals := createValidators(t, ctx, app, []int64{5, 6, 7})
|
||||
|
@ -311,7 +311,7 @@ func TestTallyDelgatorInherit(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestTallyDelgatorMultipleOverride(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
addrs, vals := createValidators(t, ctx, app, []int64{5, 6, 7})
|
||||
|
@ -351,7 +351,7 @@ func TestTallyDelgatorMultipleOverride(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestTallyDelgatorMultipleInherit(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
createValidators(t, ctx, app, []int64{25, 6, 7})
|
||||
|
@ -392,7 +392,7 @@ func TestTallyDelgatorMultipleInherit(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestTallyJailedValidator(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
addrs, valAddrs := createValidators(t, ctx, app, []int64{25, 6, 7})
|
||||
|
@ -435,7 +435,7 @@ func TestTallyJailedValidator(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestTallyValidatorMultipleDelegations(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
addrs, valAddrs := createValidators(t, ctx, app, []int64{10, 10, 10})
|
||||
|
|
|
@ -12,7 +12,7 @@ import (
|
|||
)
|
||||
|
||||
func TestVotes(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
addrs := simapp.AddTestAddrsIncremental(app, ctx, 5, sdk.NewInt(30000000))
|
||||
|
|
|
@ -13,7 +13,7 @@ import (
|
|||
)
|
||||
|
||||
func TestItCreatesModuleAccountOnInitBlock(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
app.InitChain(
|
||||
|
|
|
@ -56,7 +56,7 @@ func mockWeightedProposalContent(n int) []simtypes.WeightedProposalContent {
|
|||
|
||||
// TestWeightedOperations tests the weights of the operations.
|
||||
func TestWeightedOperations(t *testing.T) {
|
||||
app, ctx := createTestApp(false)
|
||||
app, ctx := createTestApp(t, false)
|
||||
ctx.WithChainID("test-chain")
|
||||
|
||||
cdc := app.AppCodec()
|
||||
|
@ -98,7 +98,7 @@ func TestWeightedOperations(t *testing.T) {
|
|||
// TestSimulateMsgSubmitProposal tests the normal scenario of a valid message of type TypeMsgSubmitProposal.
|
||||
// Abonormal scenarios, where the message is created by an errors are not tested here.
|
||||
func TestSimulateMsgSubmitProposal(t *testing.T) {
|
||||
app, ctx := createTestApp(false)
|
||||
app, ctx := createTestApp(t, false)
|
||||
|
||||
// setup 3 accounts
|
||||
s := rand.NewSource(1)
|
||||
|
@ -128,7 +128,7 @@ func TestSimulateMsgSubmitProposal(t *testing.T) {
|
|||
// TestSimulateMsgDeposit tests the normal scenario of a valid message of type TypeMsgDeposit.
|
||||
// Abonormal scenarios, where the message is created by an errors are not tested here.
|
||||
func TestSimulateMsgDeposit(t *testing.T) {
|
||||
app, ctx := createTestApp(false)
|
||||
app, ctx := createTestApp(t, false)
|
||||
blockTime := time.Now().UTC()
|
||||
ctx = ctx.WithBlockTime(blockTime)
|
||||
|
||||
|
@ -170,7 +170,7 @@ func TestSimulateMsgDeposit(t *testing.T) {
|
|||
// TestSimulateMsgVote tests the normal scenario of a valid message of type TypeMsgVote.
|
||||
// Abonormal scenarios, where the message is created by an errors are not tested here.
|
||||
func TestSimulateMsgVote(t *testing.T) {
|
||||
app, ctx := createTestApp(false)
|
||||
app, ctx := createTestApp(t, false)
|
||||
blockTime := time.Now().UTC()
|
||||
ctx = ctx.WithBlockTime(blockTime)
|
||||
|
||||
|
@ -212,7 +212,7 @@ func TestSimulateMsgVote(t *testing.T) {
|
|||
// TestSimulateMsgVoteWeighted tests the normal scenario of a valid message of type TypeMsgVoteWeighted.
|
||||
// Abonormal scenarios, where the message is created by an errors are not tested here.
|
||||
func TestSimulateMsgVoteWeighted(t *testing.T) {
|
||||
app, ctx := createTestApp(false)
|
||||
app, ctx := createTestApp(t, false)
|
||||
blockTime := time.Now().UTC()
|
||||
ctx = ctx.WithBlockTime(blockTime)
|
||||
|
||||
|
@ -252,8 +252,8 @@ func TestSimulateMsgVoteWeighted(t *testing.T) {
|
|||
}
|
||||
|
||||
// returns context and an app with updated mint keeper
|
||||
func createTestApp(isCheckTx bool) (*simapp.SimApp, sdk.Context) {
|
||||
app := simapp.Setup(isCheckTx)
|
||||
func createTestApp(t *testing.T, isCheckTx bool) (*simapp.SimApp, sdk.Context) {
|
||||
app := simapp.Setup(t, isCheckTx)
|
||||
|
||||
ctx := app.BaseApp.NewContext(isCheckTx, tmproto.Header{})
|
||||
app.MintKeeper.SetParams(ctx, minttypes.DefaultParams())
|
||||
|
|
|
@ -22,7 +22,7 @@ type MintTestSuite struct {
|
|||
}
|
||||
|
||||
func (suite *MintTestSuite) SetupTest() {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(suite.T(), false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
queryHelper := baseapp.NewQueryServerTestHelper(ctx, app.InterfaceRegistry())
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package keeper_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/simapp"
|
||||
|
@ -9,8 +11,8 @@ import (
|
|||
)
|
||||
|
||||
// returns context and an app with updated mint keeper
|
||||
func createTestApp(isCheckTx bool) (*simapp.SimApp, sdk.Context) {
|
||||
app := simapp.Setup(isCheckTx)
|
||||
func createTestApp(t *testing.T, isCheckTx bool) (*simapp.SimApp, sdk.Context) {
|
||||
app := simapp.Setup(t, isCheckTx)
|
||||
|
||||
ctx := app.BaseApp.NewContext(isCheckTx, tmproto.Header{})
|
||||
app.MintKeeper.SetParams(ctx, types.DefaultParams())
|
||||
|
|
|
@ -15,7 +15,7 @@ import (
|
|||
)
|
||||
|
||||
func TestNewQuerier(t *testing.T) {
|
||||
app, ctx := createTestApp(true)
|
||||
app, ctx := createTestApp(t, true)
|
||||
legacyQuerierCdc := codec.NewAminoCodec(app.LegacyAmino())
|
||||
querier := keep.NewQuerier(app.MintKeeper, legacyQuerierCdc.LegacyAmino)
|
||||
|
||||
|
@ -38,7 +38,7 @@ func TestNewQuerier(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestQueryParams(t *testing.T) {
|
||||
app, ctx := createTestApp(true)
|
||||
app, ctx := createTestApp(t, true)
|
||||
legacyQuerierCdc := codec.NewAminoCodec(app.LegacyAmino())
|
||||
querier := keep.NewQuerier(app.MintKeeper, legacyQuerierCdc.LegacyAmino)
|
||||
|
||||
|
@ -54,7 +54,7 @@ func TestQueryParams(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestQueryInflation(t *testing.T) {
|
||||
app, ctx := createTestApp(true)
|
||||
app, ctx := createTestApp(t, true)
|
||||
legacyQuerierCdc := codec.NewAminoCodec(app.LegacyAmino())
|
||||
querier := keep.NewQuerier(app.MintKeeper, legacyQuerierCdc.LegacyAmino)
|
||||
|
||||
|
@ -70,7 +70,7 @@ func TestQueryInflation(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestQueryAnnualProvisions(t *testing.T) {
|
||||
app, ctx := createTestApp(true)
|
||||
app, ctx := createTestApp(t, true)
|
||||
legacyQuerierCdc := codec.NewAminoCodec(app.LegacyAmino())
|
||||
querier := keep.NewQuerier(app.MintKeeper, legacyQuerierCdc.LegacyAmino)
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ import (
|
|||
)
|
||||
|
||||
func TestItCreatesModuleAccountOnInitBlock(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
app.InitChain(
|
||||
|
|
|
@ -26,7 +26,8 @@ type KeeperTestSuite struct {
|
|||
}
|
||||
|
||||
func (suite *KeeperTestSuite) SetupTest() {
|
||||
suite.app, suite.ctx = createTestApp(true)
|
||||
suite.app = simapp.Setup(suite.T(), false)
|
||||
suite.ctx = suite.app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
queryHelper := baseapp.NewQueryServerTestHelper(suite.ctx, suite.app.InterfaceRegistry())
|
||||
proposal.RegisterQueryServer(queryHelper, suite.app.ParamsKeeper)
|
||||
|
@ -37,14 +38,6 @@ func TestKeeperTestSuite(t *testing.T) {
|
|||
suite.Run(t, new(KeeperTestSuite))
|
||||
}
|
||||
|
||||
// returns context and app
|
||||
func createTestApp(isCheckTx bool) (*simapp.SimApp, sdk.Context) {
|
||||
app := simapp.Setup(isCheckTx)
|
||||
ctx := app.BaseApp.NewContext(isCheckTx, tmproto.Header{})
|
||||
|
||||
return app, ctx
|
||||
}
|
||||
|
||||
func validateNoOp(_ interface{}) error { return nil }
|
||||
|
||||
func TestKeeper(t *testing.T) {
|
||||
|
|
|
@ -24,7 +24,7 @@ type HandlerTestSuite struct {
|
|||
}
|
||||
|
||||
func (suite *HandlerTestSuite) SetupTest() {
|
||||
suite.app = simapp.Setup(false)
|
||||
suite.app = simapp.Setup(suite.T(), false)
|
||||
suite.ctx = suite.app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
suite.govHandler = params.NewParamChangeProposalHandler(suite.app.ParamsKeeper)
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ import (
|
|||
)
|
||||
|
||||
func TestBeginBlocker(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
pks := simapp.CreateTestPubKeys(1)
|
||||
|
|
|
@ -15,7 +15,7 @@ import (
|
|||
)
|
||||
|
||||
func TestExportAndInitGenesis(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
app.SlashingKeeper.SetParams(ctx, testslashing.TestParams())
|
||||
|
|
|
@ -28,7 +28,7 @@ type SlashingTestSuite struct {
|
|||
}
|
||||
|
||||
func (suite *SlashingTestSuite) SetupTest() {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(suite.T(), false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
app.AccountKeeper.SetParams(ctx, authtypes.DefaultParams())
|
||||
|
|
|
@ -16,7 +16,7 @@ import (
|
|||
)
|
||||
|
||||
func TestUnJailNotBonded(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
p := app.StakingKeeper.GetParams(ctx)
|
||||
|
@ -82,7 +82,7 @@ func TestUnJailNotBonded(t *testing.T) {
|
|||
// Ensure that SigningInfo.StartHeight is set correctly
|
||||
// and that they are not immediately jailed
|
||||
func TestHandleNewValidator(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
addrDels := simapp.AddTestAddrsIncremental(app, ctx, 1, app.StakingKeeper.TokensFromConsensusPower(ctx, 200))
|
||||
|
@ -126,7 +126,7 @@ func TestHandleNewValidator(t *testing.T) {
|
|||
// Ensure that they're only slashed once
|
||||
func TestHandleAlreadyJailed(t *testing.T) {
|
||||
// initial setup
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
addrDels := simapp.AddTestAddrsIncremental(app, ctx, 1, app.StakingKeeper.TokensFromConsensusPower(ctx, 200))
|
||||
|
@ -180,7 +180,7 @@ func TestValidatorDippingInAndOut(t *testing.T) {
|
|||
|
||||
// initial setup
|
||||
// TestParams set the SignedBlocksWindow to 1000 and MaxMissedBlocksPerWindow to 500
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
app.SlashingKeeper.SetParams(ctx, testslashing.TestParams())
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ import (
|
|||
)
|
||||
|
||||
func TestNewQuerier(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
app.SlashingKeeper.SetParams(ctx, testslashing.TestParams())
|
||||
legacyQuerierCdc := codec.NewAminoCodec(app.LegacyAmino())
|
||||
|
@ -34,7 +34,7 @@ func TestNewQuerier(t *testing.T) {
|
|||
func TestQueryParams(t *testing.T) {
|
||||
cdc := codec.NewLegacyAmino()
|
||||
legacyQuerierCdc := codec.NewAminoCodec(cdc)
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
app.SlashingKeeper.SetParams(ctx, testslashing.TestParams())
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ import (
|
|||
)
|
||||
|
||||
func TestGetSetValidatorSigningInfo(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
addrDels := simapp.AddTestAddrsIncremental(app, ctx, 1, app.StakingKeeper.TokensFromConsensusPower(ctx, 200))
|
||||
|
||||
|
@ -37,7 +37,7 @@ func TestGetSetValidatorSigningInfo(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestGetSetValidatorMissedBlockBitArray(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
addrDels := simapp.AddTestAddrsIncremental(app, ctx, 1, app.StakingKeeper.TokensFromConsensusPower(ctx, 200))
|
||||
|
||||
|
@ -49,7 +49,7 @@ func TestGetSetValidatorMissedBlockBitArray(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestTombstoned(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
addrDels := simapp.AddTestAddrsIncremental(app, ctx, 1, app.StakingKeeper.TokensFromConsensusPower(ctx, 200))
|
||||
|
||||
|
@ -73,7 +73,7 @@ func TestTombstoned(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestJailUntil(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
addrDels := simapp.AddTestAddrsIncremental(app, ctx, 1, app.StakingKeeper.TokensFromConsensusPower(ctx, 200))
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ import (
|
|||
|
||||
// TestWeightedOperations tests the weights of the operations.
|
||||
func TestWeightedOperations(t *testing.T) {
|
||||
app, ctx := createTestApp(false)
|
||||
app, ctx := createTestApp(t, false)
|
||||
ctx.WithChainID("test-chain")
|
||||
|
||||
cdc := app.AppCodec()
|
||||
|
@ -54,7 +54,7 @@ func TestWeightedOperations(t *testing.T) {
|
|||
// TestSimulateMsgUnjail tests the normal scenario of a valid message of type types.MsgUnjail.
|
||||
// Abonormal scenarios, where the message is created by an errors, are not tested here.
|
||||
func TestSimulateMsgUnjail(t *testing.T) {
|
||||
app, ctx := createTestApp(false)
|
||||
app, ctx := createTestApp(t, false)
|
||||
blockTime := time.Now().UTC()
|
||||
ctx = ctx.WithBlockTime(blockTime)
|
||||
|
||||
|
@ -104,8 +104,8 @@ func TestSimulateMsgUnjail(t *testing.T) {
|
|||
}
|
||||
|
||||
// returns context and an app with updated mint keeper
|
||||
func createTestApp(isCheckTx bool) (*simapp.SimApp, sdk.Context) {
|
||||
app := simapp.Setup(isCheckTx)
|
||||
func createTestApp(t *testing.T, isCheckTx bool) (*simapp.SimApp, sdk.Context) {
|
||||
app := simapp.Setup(t, isCheckTx)
|
||||
|
||||
ctx := app.BaseApp.NewContext(isCheckTx, tmproto.Header{})
|
||||
app.MintKeeper.SetParams(ctx, minttypes.DefaultParams())
|
||||
|
|
|
@ -2,6 +2,7 @@ package staking_test
|
|||
|
||||
import (
|
||||
"math/big"
|
||||
"testing"
|
||||
|
||||
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
|
||||
|
||||
|
@ -35,8 +36,8 @@ var (
|
|||
|
||||
// getBaseSimappWithCustomKeeper Returns a simapp with custom StakingKeeper
|
||||
// to avoid messing with the hooks.
|
||||
func getBaseSimappWithCustomKeeper() (*codec.LegacyAmino, *simapp.SimApp, sdk.Context) {
|
||||
app := simapp.Setup(false)
|
||||
func getBaseSimappWithCustomKeeper(t *testing.T) (*codec.LegacyAmino, *simapp.SimApp, sdk.Context) {
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
appCodec := app.AppCodec()
|
||||
|
|
|
@ -20,15 +20,15 @@ import (
|
|||
"github.com/cosmos/cosmos-sdk/x/staking/types"
|
||||
)
|
||||
|
||||
func bootstrapGenesisTest(numAddrs int) (*simapp.SimApp, sdk.Context, []sdk.AccAddress) {
|
||||
_, app, ctx := getBaseSimappWithCustomKeeper()
|
||||
func bootstrapGenesisTest(t *testing.T, numAddrs int) (*simapp.SimApp, sdk.Context, []sdk.AccAddress) {
|
||||
_, app, ctx := getBaseSimappWithCustomKeeper(t)
|
||||
|
||||
addrDels, _ := generateAddresses(app, ctx, numAddrs, sdk.NewInt(10000))
|
||||
return app, ctx, addrDels
|
||||
}
|
||||
|
||||
func TestInitGenesis(t *testing.T) {
|
||||
app, ctx, addrs := bootstrapGenesisTest(10)
|
||||
app, ctx, addrs := bootstrapGenesisTest(t, 10)
|
||||
|
||||
valTokens := app.StakingKeeper.TokensFromConsensusPower(ctx, 1)
|
||||
|
||||
|
@ -107,7 +107,7 @@ func TestInitGenesis(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestInitGenesis_PoolsBalanceMismatch(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.NewContext(false, tmproto.Header{})
|
||||
|
||||
consPub, err := codectypes.NewAnyWithValue(PKs[0])
|
||||
|
@ -155,7 +155,7 @@ func TestInitGenesisLargeValidatorSet(t *testing.T) {
|
|||
size := 200
|
||||
require.True(t, size > 100)
|
||||
|
||||
app, ctx, addrs := bootstrapGenesisTest(200)
|
||||
app, ctx, addrs := bootstrapGenesisTest(t, 200)
|
||||
|
||||
params := app.StakingKeeper.GetParams(ctx)
|
||||
delegations := []types.Delegation{}
|
||||
|
|
|
@ -23,8 +23,8 @@ func init() {
|
|||
|
||||
// createTestInput Returns a simapp with custom StakingKeeper
|
||||
// to avoid messing with the hooks.
|
||||
func createTestInput() (*codec.LegacyAmino, *simapp.SimApp, sdk.Context) {
|
||||
app := simapp.Setup(false)
|
||||
func createTestInput(t *testing.T) (*codec.LegacyAmino, *simapp.SimApp, sdk.Context) {
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
app.StakingKeeper = keeper.NewKeeper(
|
||||
|
|
|
@ -17,7 +17,7 @@ import (
|
|||
|
||||
// tests GetDelegation, GetDelegatorDelegations, SetDelegation, RemoveDelegation, GetDelegatorDelegations
|
||||
func TestDelegation(t *testing.T) {
|
||||
_, app, ctx := createTestInput()
|
||||
_, app, ctx := createTestInput(t)
|
||||
|
||||
addrDels := simapp.AddTestAddrsIncremental(app, ctx, 3, sdk.NewInt(10000))
|
||||
valAddrs := simapp.ConvertAddrsToValAddrs(addrDels)
|
||||
|
@ -133,7 +133,7 @@ func TestDelegation(t *testing.T) {
|
|||
|
||||
// tests Get/Set/Remove UnbondingDelegation
|
||||
func TestUnbondingDelegation(t *testing.T) {
|
||||
_, app, ctx := createTestInput()
|
||||
_, app, ctx := createTestInput(t)
|
||||
|
||||
delAddrs := simapp.AddTestAddrsIncremental(app, ctx, 2, sdk.NewInt(10000))
|
||||
valAddrs := simapp.ConvertAddrsToValAddrs(delAddrs)
|
||||
|
@ -179,7 +179,7 @@ func TestUnbondingDelegation(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestUnbondDelegation(t *testing.T) {
|
||||
_, app, ctx := createTestInput()
|
||||
_, app, ctx := createTestInput(t)
|
||||
|
||||
delAddrs := simapp.AddTestAddrsIncremental(app, ctx, 1, sdk.NewInt(10000))
|
||||
valAddrs := simapp.ConvertAddrsToValAddrs(delAddrs)
|
||||
|
@ -218,7 +218,7 @@ func TestUnbondDelegation(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestUnbondingDelegationsMaxEntries(t *testing.T) {
|
||||
_, app, ctx := createTestInput()
|
||||
_, app, ctx := createTestInput(t)
|
||||
|
||||
addrDels := simapp.AddTestAddrsIncremental(app, ctx, 1, sdk.NewInt(10000))
|
||||
addrVals := simapp.ConvertAddrsToValAddrs(addrDels)
|
||||
|
@ -300,7 +300,7 @@ func TestUnbondingDelegationsMaxEntries(t *testing.T) {
|
|||
//// test undelegating self delegation from a validator pushing it below MinSelfDelegation
|
||||
//// shift it from the bonded to unbonding state and jailed
|
||||
func TestUndelegateSelfDelegationBelowMinSelfDelegation(t *testing.T) {
|
||||
_, app, ctx := createTestInput()
|
||||
_, app, ctx := createTestInput(t)
|
||||
|
||||
addrDels := simapp.AddTestAddrsIncremental(app, ctx, 1, sdk.NewInt(10000))
|
||||
addrVals := simapp.ConvertAddrsToValAddrs(addrDels)
|
||||
|
@ -360,7 +360,7 @@ func TestUndelegateSelfDelegationBelowMinSelfDelegation(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestUndelegateFromUnbondingValidator(t *testing.T) {
|
||||
_, app, ctx := createTestInput()
|
||||
_, app, ctx := createTestInput(t)
|
||||
delTokens := app.StakingKeeper.TokensFromConsensusPower(ctx, 10)
|
||||
delCoins := sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), delTokens))
|
||||
|
||||
|
@ -446,7 +446,7 @@ func TestUndelegateFromUnbondingValidator(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestUndelegateFromUnbondedValidator(t *testing.T) {
|
||||
_, app, ctx := createTestInput()
|
||||
_, app, ctx := createTestInput(t)
|
||||
delTokens := app.StakingKeeper.TokensFromConsensusPower(ctx, 10)
|
||||
delCoins := sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), delTokens))
|
||||
|
||||
|
@ -527,7 +527,7 @@ func TestUndelegateFromUnbondedValidator(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestUnbondingAllDelegationFromValidator(t *testing.T) {
|
||||
_, app, ctx := createTestInput()
|
||||
_, app, ctx := createTestInput(t)
|
||||
delTokens := app.StakingKeeper.TokensFromConsensusPower(ctx, 10)
|
||||
delCoins := sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), delTokens))
|
||||
|
||||
|
@ -600,7 +600,7 @@ func TestUnbondingAllDelegationFromValidator(t *testing.T) {
|
|||
|
||||
// Make sure that that the retrieving the delegations doesn't affect the state
|
||||
func TestGetRedelegationsFromSrcValidator(t *testing.T) {
|
||||
_, app, ctx := createTestInput()
|
||||
_, app, ctx := createTestInput(t)
|
||||
|
||||
addrDels := simapp.AddTestAddrsIncremental(app, ctx, 2, sdk.NewInt(0))
|
||||
addrVals := simapp.ConvertAddrsToValAddrs(addrDels)
|
||||
|
@ -627,7 +627,7 @@ func TestGetRedelegationsFromSrcValidator(t *testing.T) {
|
|||
|
||||
// tests Get/Set/Remove/Has UnbondingDelegation
|
||||
func TestRedelegation(t *testing.T) {
|
||||
_, app, ctx := createTestInput()
|
||||
_, app, ctx := createTestInput(t)
|
||||
|
||||
addrDels := simapp.AddTestAddrsIncremental(app, ctx, 2, sdk.NewInt(0))
|
||||
addrVals := simapp.ConvertAddrsToValAddrs(addrDels)
|
||||
|
@ -690,7 +690,7 @@ func TestRedelegation(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestRedelegateToSameValidator(t *testing.T) {
|
||||
_, app, ctx := createTestInput()
|
||||
_, app, ctx := createTestInput(t)
|
||||
|
||||
addrDels := simapp.AddTestAddrsIncremental(app, ctx, 1, sdk.NewInt(0))
|
||||
addrVals := simapp.ConvertAddrsToValAddrs(addrDels)
|
||||
|
@ -719,7 +719,7 @@ func TestRedelegateToSameValidator(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestRedelegationMaxEntries(t *testing.T) {
|
||||
_, app, ctx := createTestInput()
|
||||
_, app, ctx := createTestInput(t)
|
||||
|
||||
addrDels := simapp.AddTestAddrsIncremental(app, ctx, 2, sdk.NewInt(0))
|
||||
addrVals := simapp.ConvertAddrsToValAddrs(addrDels)
|
||||
|
@ -775,7 +775,7 @@ func TestRedelegationMaxEntries(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestRedelegateSelfDelegation(t *testing.T) {
|
||||
_, app, ctx := createTestInput()
|
||||
_, app, ctx := createTestInput(t)
|
||||
|
||||
addrDels := simapp.AddTestAddrsIncremental(app, ctx, 2, sdk.NewInt(0))
|
||||
addrVals := simapp.ConvertAddrsToValAddrs(addrDels)
|
||||
|
@ -831,7 +831,7 @@ func TestRedelegateSelfDelegation(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestRedelegateFromUnbondingValidator(t *testing.T) {
|
||||
_, app, ctx := createTestInput()
|
||||
_, app, ctx := createTestInput(t)
|
||||
|
||||
addrDels := simapp.AddTestAddrsIncremental(app, ctx, 2, sdk.NewInt(0))
|
||||
addrVals := simapp.ConvertAddrsToValAddrs(addrDels)
|
||||
|
@ -913,7 +913,7 @@ func TestRedelegateFromUnbondingValidator(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestRedelegateFromUnbondedValidator(t *testing.T) {
|
||||
_, app, ctx := createTestInput()
|
||||
_, app, ctx := createTestInput(t)
|
||||
|
||||
addrDels := simapp.AddTestAddrsIncremental(app, ctx, 2, sdk.NewInt(0))
|
||||
addrVals := simapp.ConvertAddrsToValAddrs(addrDels)
|
||||
|
|
|
@ -24,7 +24,7 @@ func IsValSetSorted(data []types.Validator, powerReduction sdk.Int) bool {
|
|||
}
|
||||
|
||||
func TestHistoricalInfo(t *testing.T) {
|
||||
_, app, ctx := createTestInput()
|
||||
_, app, ctx := createTestInput(t)
|
||||
|
||||
addrDels := simapp.AddTestAddrsIncremental(app, ctx, 50, sdk.NewInt(0))
|
||||
addrVals := simapp.ConvertAddrsToValAddrs(addrDels)
|
||||
|
@ -51,7 +51,7 @@ func TestHistoricalInfo(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestTrackHistoricalInfo(t *testing.T) {
|
||||
_, app, ctx := createTestInput()
|
||||
_, app, ctx := createTestInput(t)
|
||||
|
||||
addrDels := simapp.AddTestAddrsIncremental(app, ctx, 50, sdk.NewInt(0))
|
||||
addrVals := simapp.ConvertAddrsToValAddrs(addrDels)
|
||||
|
@ -129,7 +129,7 @@ func TestTrackHistoricalInfo(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestGetAllHistoricalInfo(t *testing.T) {
|
||||
_, app, ctx := createTestInput()
|
||||
_, app, ctx := createTestInput(t)
|
||||
|
||||
addrDels := simapp.AddTestAddrsIncremental(app, ctx, 50, sdk.NewInt(0))
|
||||
addrVals := simapp.ConvertAddrsToValAddrs(addrDels)
|
||||
|
|
|
@ -26,7 +26,7 @@ type KeeperTestSuite struct {
|
|||
}
|
||||
|
||||
func (suite *KeeperTestSuite) SetupTest() {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(suite.T(), false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
querier := keeper.Querier{Keeper: app.StakingKeeper}
|
||||
|
@ -51,7 +51,7 @@ func (suite *KeeperTestSuite) SetupTest() {
|
|||
suite.app, suite.ctx, suite.queryClient, suite.addrs, suite.vals = app, ctx, queryClient, addrs, validators
|
||||
}
|
||||
func TestParams(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
expParams := types.DefaultParams()
|
||||
|
|
|
@ -17,7 +17,7 @@ import (
|
|||
)
|
||||
|
||||
func TestNewQuerier(t *testing.T) {
|
||||
cdc, app, ctx := createTestInput()
|
||||
cdc, app, ctx := createTestInput(t)
|
||||
|
||||
addrs := simapp.AddTestAddrs(app, ctx, 500, sdk.NewInt(10000))
|
||||
_, addrAcc2 := addrs[0], addrs[1]
|
||||
|
@ -109,7 +109,7 @@ func TestNewQuerier(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestQueryParametersPool(t *testing.T) {
|
||||
cdc, app, ctx := createTestInput()
|
||||
cdc, app, ctx := createTestInput(t)
|
||||
legacyQuerierCdc := codec.NewAminoCodec(app.LegacyAmino())
|
||||
querier := keeper.NewQuerier(app.StakingKeeper, legacyQuerierCdc.LegacyAmino)
|
||||
|
||||
|
@ -135,7 +135,7 @@ func TestQueryParametersPool(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestQueryValidators(t *testing.T) {
|
||||
cdc, app, ctx := createTestInput()
|
||||
cdc, app, ctx := createTestInput(t)
|
||||
params := app.StakingKeeper.GetParams(ctx)
|
||||
legacyQuerierCdc := codec.NewAminoCodec(app.LegacyAmino())
|
||||
querier := keeper.NewQuerier(app.StakingKeeper, legacyQuerierCdc.LegacyAmino)
|
||||
|
@ -203,7 +203,7 @@ func TestQueryValidators(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestQueryDelegation(t *testing.T) {
|
||||
cdc, app, ctx := createTestInput()
|
||||
cdc, app, ctx := createTestInput(t)
|
||||
params := app.StakingKeeper.GetParams(ctx)
|
||||
legacyQuerierCdc := codec.NewAminoCodec(app.LegacyAmino())
|
||||
querier := keeper.NewQuerier(app.StakingKeeper, legacyQuerierCdc.LegacyAmino)
|
||||
|
@ -452,7 +452,7 @@ func TestQueryValidatorDelegations_Pagination(t *testing.T) {
|
|||
},
|
||||
}
|
||||
|
||||
cdc, app, ctx := createTestInput()
|
||||
cdc, app, ctx := createTestInput(t)
|
||||
legacyQuerierCdc := codec.NewAminoCodec(app.LegacyAmino())
|
||||
querier := keeper.NewQuerier(app.StakingKeeper, legacyQuerierCdc.LegacyAmino)
|
||||
|
||||
|
@ -537,7 +537,7 @@ func TestQueryValidatorDelegations_Pagination(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestQueryRedelegations(t *testing.T) {
|
||||
cdc, app, ctx := createTestInput()
|
||||
cdc, app, ctx := createTestInput(t)
|
||||
legacyQuerierCdc := codec.NewAminoCodec(app.LegacyAmino())
|
||||
querier := keeper.NewQuerier(app.StakingKeeper, legacyQuerierCdc.LegacyAmino)
|
||||
|
||||
|
@ -609,7 +609,7 @@ func TestQueryRedelegations(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestQueryUnbondingDelegation(t *testing.T) {
|
||||
cdc, app, ctx := createTestInput()
|
||||
cdc, app, ctx := createTestInput(t)
|
||||
legacyQuerierCdc := codec.NewAminoCodec(app.LegacyAmino())
|
||||
querier := keeper.NewQuerier(app.StakingKeeper, legacyQuerierCdc.LegacyAmino)
|
||||
|
||||
|
@ -705,7 +705,7 @@ func TestQueryUnbondingDelegation(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestQueryHistoricalInfo(t *testing.T) {
|
||||
cdc, app, ctx := createTestInput()
|
||||
cdc, app, ctx := createTestInput(t)
|
||||
legacyQuerierCdc := codec.NewAminoCodec(cdc)
|
||||
querier := keeper.NewQuerier(app.StakingKeeper, legacyQuerierCdc.LegacyAmino)
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ import (
|
|||
|
||||
// bootstrapSlashTest creates 3 validators and bootstrap the app.
|
||||
func bootstrapSlashTest(t *testing.T, power int64) (*simapp.SimApp, sdk.Context, []sdk.AccAddress, []sdk.ValAddress) {
|
||||
_, app, ctx := createTestInput()
|
||||
_, app, ctx := createTestInput(t)
|
||||
|
||||
addrDels, addrVals := generateAddresses(app, ctx, 100)
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ func newMonikerValidator(t testing.TB, operator sdk.ValAddress, pubKey cryptotyp
|
|||
}
|
||||
|
||||
func bootstrapValidatorTest(t testing.TB, power int64, numAddrs int) (*simapp.SimApp, sdk.Context, []sdk.AccAddress, []sdk.ValAddress) {
|
||||
_, app, ctx := createTestInput()
|
||||
_, app, ctx := createTestInput(&testing.T{})
|
||||
|
||||
addrDels, addrVals := generateAddresses(app, ctx, numAddrs)
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ import (
|
|||
)
|
||||
|
||||
func TestItCreatesModuleAccountOnInitBlock(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
app.InitChain(
|
||||
|
|
|
@ -24,7 +24,7 @@ import (
|
|||
// TestWeightedOperations tests the weights of the operations.
|
||||
func TestWeightedOperations(t *testing.T) {
|
||||
|
||||
app, ctx := createTestApp(false)
|
||||
app, ctx := createTestApp(t, false)
|
||||
|
||||
ctx.WithChainID("test-chain")
|
||||
|
||||
|
@ -64,7 +64,7 @@ func TestWeightedOperations(t *testing.T) {
|
|||
// TestSimulateMsgCreateValidator tests the normal scenario of a valid message of type TypeMsgCreateValidator.
|
||||
// Abonormal scenarios, where the message are created by an errors are not tested here.
|
||||
func TestSimulateMsgCreateValidator(t *testing.T) {
|
||||
app, ctx := createTestApp(false)
|
||||
app, ctx := createTestApp(t, false)
|
||||
|
||||
// setup 3 accounts
|
||||
s := rand.NewSource(1)
|
||||
|
@ -96,7 +96,7 @@ func TestSimulateMsgCreateValidator(t *testing.T) {
|
|||
// TestSimulateMsgEditValidator tests the normal scenario of a valid message of type TypeMsgEditValidator.
|
||||
// Abonormal scenarios, where the message is created by an errors are not tested here.
|
||||
func TestSimulateMsgEditValidator(t *testing.T) {
|
||||
app, ctx := createTestApp(false)
|
||||
app, ctx := createTestApp(t, false)
|
||||
blockTime := time.Now().UTC()
|
||||
ctx = ctx.WithBlockTime(blockTime)
|
||||
|
||||
|
@ -133,7 +133,7 @@ func TestSimulateMsgEditValidator(t *testing.T) {
|
|||
// TestSimulateMsgDelegate tests the normal scenario of a valid message of type TypeMsgDelegate.
|
||||
// Abonormal scenarios, where the message is created by an errors are not tested here.
|
||||
func TestSimulateMsgDelegate(t *testing.T) {
|
||||
app, ctx := createTestApp(false)
|
||||
app, ctx := createTestApp(t, false)
|
||||
blockTime := time.Now().UTC()
|
||||
ctx = ctx.WithBlockTime(blockTime)
|
||||
|
||||
|
@ -169,7 +169,7 @@ func TestSimulateMsgDelegate(t *testing.T) {
|
|||
// TestSimulateMsgUndelegate tests the normal scenario of a valid message of type TypeMsgUndelegate.
|
||||
// Abonormal scenarios, where the message is created by an errors are not tested here.
|
||||
func TestSimulateMsgUndelegate(t *testing.T) {
|
||||
app, ctx := createTestApp(false)
|
||||
app, ctx := createTestApp(t, false)
|
||||
blockTime := time.Now().UTC()
|
||||
ctx = ctx.WithBlockTime(blockTime)
|
||||
|
||||
|
@ -215,7 +215,7 @@ func TestSimulateMsgUndelegate(t *testing.T) {
|
|||
// TestSimulateMsgBeginRedelegate tests the normal scenario of a valid message of type TypeMsgBeginRedelegate.
|
||||
// Abonormal scenarios, where the message is created by an errors, are not tested here.
|
||||
func TestSimulateMsgBeginRedelegate(t *testing.T) {
|
||||
app, ctx := createTestApp(false)
|
||||
app, ctx := createTestApp(t, false)
|
||||
blockTime := time.Now().UTC()
|
||||
ctx = ctx.WithBlockTime(blockTime)
|
||||
|
||||
|
@ -263,9 +263,9 @@ func TestSimulateMsgBeginRedelegate(t *testing.T) {
|
|||
}
|
||||
|
||||
// returns context and an app with updated mint keeper
|
||||
func createTestApp(isCheckTx bool) (*simapp.SimApp, sdk.Context) {
|
||||
func createTestApp(t *testing.T, isCheckTx bool) (*simapp.SimApp, sdk.Context) {
|
||||
// sdk.PowerReduction = sdk.NewIntFromBigInt(new(big.Int).Exp(big.NewInt(10), big.NewInt(18), nil))
|
||||
app := simapp.Setup(isCheckTx)
|
||||
app := simapp.Setup(t, isCheckTx)
|
||||
|
||||
ctx := app.BaseApp.NewContext(isCheckTx, tmproto.Header{})
|
||||
app.MintKeeper.SetParams(ctx, minttypes.DefaultParams())
|
||||
|
|
|
@ -21,7 +21,7 @@ var (
|
|||
)
|
||||
|
||||
func TestAuthzAuthorizations(t *testing.T) {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
// verify ValidateBasic returns error for the AUTHORIZATION_TYPE_UNSPECIFIED authorization type
|
||||
|
|
|
@ -28,7 +28,7 @@ type IntegrationTestSuite struct {
|
|||
|
||||
func (s *IntegrationTestSuite) SetupSuite() {
|
||||
s.T().Log("setting up integration test suite")
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(s.T(), false)
|
||||
s.app = app
|
||||
s.ctx = app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ type UpgradeTestSuite struct {
|
|||
}
|
||||
|
||||
func (suite *UpgradeTestSuite) SetupTest() {
|
||||
suite.app = simapp.Setup(false)
|
||||
suite.app = simapp.Setup(suite.T(), false)
|
||||
suite.ctx = suite.app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
queryHelper := baseapp.NewQueryServerTestHelper(suite.ctx, suite.app.InterfaceRegistry())
|
||||
|
|
|
@ -24,7 +24,7 @@ type KeeperTestSuite struct {
|
|||
}
|
||||
|
||||
func (s *KeeperTestSuite) SetupTest() {
|
||||
app := simapp.Setup(false)
|
||||
app := simapp.Setup(s.T(), false)
|
||||
homeDir := filepath.Join(s.T().TempDir(), "x_upgrade_keeper_test")
|
||||
app.UpgradeKeeper = keeper.NewKeeper( // recreate keeper in order to use a custom home path
|
||||
make(map[int64]bool), app.GetKey(types.StoreKey), app.AppCodec(), homeDir, app.BaseApp,
|
||||
|
|
Loading…
Reference in New Issue