mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-25 15:55:18 +00:00
ffef832d45
- Upgrade cosmos-sdk to v0.44.5 from v0.39.2 - Add Legacy Tx Endpoint for backwards compatibility - Add IBC v1.2.3 Support Co-authored-by: DracoLi <draco@dracoli.com> Co-authored-by: drklee3 <derrick@dlee.dev> Co-authored-by: denalimarsh <denalimarsh@gmail.com> Co-authored-by: Draco Li <draco@kava.io> Co-authored-by: Nick DeLuca <nickdeluca08@gmail.com> Co-authored-by: Kevin Davis <karzak@users.noreply.github.com> Co-authored-by: Denali Marsh <denali@kava.io>
67 lines
1.6 KiB
Go
67 lines
1.6 KiB
Go
package kavadist_test
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/stretchr/testify/suite"
|
|
|
|
tmtime "github.com/tendermint/tendermint/types/time"
|
|
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
|
|
"github.com/kava-labs/kava/x/kavadist"
|
|
testutil "github.com/kava-labs/kava/x/kavadist/testutil"
|
|
"github.com/kava-labs/kava/x/kavadist/types"
|
|
)
|
|
|
|
type genesisTestSuite struct {
|
|
testutil.Suite
|
|
}
|
|
|
|
func (suite *genesisTestSuite) TestInitGenesis_ValidationPanic() {
|
|
invalidState := types.NewGenesisState(
|
|
types.Params{
|
|
Active: true,
|
|
Periods: []types.Period{
|
|
{
|
|
Start: time.Date(2021, 1, 1, 1, 1, 1, 1, time.UTC),
|
|
End: tmtime.Canonical(time.Unix(1, 0)),
|
|
Inflation: sdk.OneDec(),
|
|
},
|
|
},
|
|
},
|
|
tmtime.Canonical(time.Unix(1, 0)),
|
|
)
|
|
|
|
suite.Require().Panics(func() {
|
|
kavadist.InitGenesis(suite.Ctx, suite.Keeper, suite.AccountKeeper, invalidState)
|
|
}, "expected init genesis to panic with invalid state")
|
|
}
|
|
|
|
func (suite *genesisTestSuite) TestInitAndExportGenesis() {
|
|
state := types.NewGenesisState(
|
|
types.Params{
|
|
Active: true,
|
|
Periods: []types.Period{
|
|
{
|
|
Start: time.Date(2021, 1, 1, 1, 1, 1, 1, time.UTC),
|
|
End: time.Date(2021, 2, 1, 1, 1, 1, 1, time.UTC),
|
|
Inflation: sdk.OneDec(),
|
|
},
|
|
},
|
|
},
|
|
time.Date(2020, 1, 2, 1, 1, 1, 1, time.UTC),
|
|
)
|
|
|
|
kavadist.InitGenesis(suite.Ctx, suite.Keeper, suite.AccountKeeper, state)
|
|
suite.Require().Equal(state.Params, suite.Keeper.GetParams(suite.Ctx))
|
|
|
|
exportedState := kavadist.ExportGenesis(suite.Ctx, suite.Keeper)
|
|
suite.Require().Equal(state, exportedState)
|
|
}
|
|
|
|
func TestGenesisTestSuite(t *testing.T) {
|
|
suite.Run(t, new(genesisTestSuite))
|
|
}
|