mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-27 00:35:18 +00:00
fix test
This commit is contained in:
parent
c0f3951b40
commit
7991406367
@ -65,8 +65,7 @@ var (
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
// set the address prefixes
|
// set the address prefixes
|
||||||
config := sdk.GetConfig()
|
chaincfg.SetSDKConfig()
|
||||||
app.SetBech32AddressPrefixes(config)
|
|
||||||
// config.Seal()
|
// config.Seal()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ import (
|
|||||||
tmtime "github.com/tendermint/tendermint/types/time"
|
tmtime "github.com/tendermint/tendermint/types/time"
|
||||||
|
|
||||||
"github.com/0glabs/0g-chain/app"
|
"github.com/0glabs/0g-chain/app"
|
||||||
|
"github.com/0glabs/0g-chain/chaincfg"
|
||||||
"github.com/0glabs/0g-chain/x/bep3/keeper"
|
"github.com/0glabs/0g-chain/x/bep3/keeper"
|
||||||
"github.com/0glabs/0g-chain/x/bep3/types"
|
"github.com/0glabs/0g-chain/x/bep3/types"
|
||||||
)
|
)
|
||||||
@ -25,8 +26,7 @@ type GenesisTestSuite struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (suite *GenesisTestSuite) SetupTest() {
|
func (suite *GenesisTestSuite) SetupTest() {
|
||||||
config := sdk.GetConfig()
|
chaincfg.SetSDKConfig()
|
||||||
app.SetBech32AddressPrefixes(config)
|
|
||||||
|
|
||||||
tApp := app.NewTestApp()
|
tApp := app.NewTestApp()
|
||||||
suite.ctx = tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()})
|
suite.ctx = tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()})
|
||||||
|
@ -14,6 +14,7 @@ import (
|
|||||||
tmtime "github.com/tendermint/tendermint/types/time"
|
tmtime "github.com/tendermint/tendermint/types/time"
|
||||||
|
|
||||||
"github.com/0glabs/0g-chain/app"
|
"github.com/0glabs/0g-chain/app"
|
||||||
|
"github.com/0glabs/0g-chain/chaincfg"
|
||||||
"github.com/0glabs/0g-chain/x/bep3/keeper"
|
"github.com/0glabs/0g-chain/x/bep3/keeper"
|
||||||
"github.com/0glabs/0g-chain/x/bep3/types"
|
"github.com/0glabs/0g-chain/x/bep3/types"
|
||||||
)
|
)
|
||||||
@ -27,8 +28,7 @@ type AssetTestSuite struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (suite *AssetTestSuite) SetupTest() {
|
func (suite *AssetTestSuite) SetupTest() {
|
||||||
config := sdk.GetConfig()
|
chaincfg.SetSDKConfig()
|
||||||
app.SetBech32AddressPrefixes(config)
|
|
||||||
|
|
||||||
// Initialize test app and set context
|
// Initialize test app and set context
|
||||||
tApp := app.NewTestApp()
|
tApp := app.NewTestApp()
|
||||||
|
@ -12,6 +12,7 @@ import (
|
|||||||
tmtime "github.com/tendermint/tendermint/types/time"
|
tmtime "github.com/tendermint/tendermint/types/time"
|
||||||
|
|
||||||
"github.com/0glabs/0g-chain/app"
|
"github.com/0glabs/0g-chain/app"
|
||||||
|
"github.com/0glabs/0g-chain/chaincfg"
|
||||||
"github.com/0glabs/0g-chain/x/bep3/keeper"
|
"github.com/0glabs/0g-chain/x/bep3/keeper"
|
||||||
"github.com/0glabs/0g-chain/x/bep3/types"
|
"github.com/0glabs/0g-chain/x/bep3/types"
|
||||||
)
|
)
|
||||||
@ -27,8 +28,7 @@ type KeeperTestSuite struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (suite *KeeperTestSuite) SetupTest() {
|
func (suite *KeeperTestSuite) SetupTest() {
|
||||||
config := sdk.GetConfig()
|
chaincfg.SetSDKConfig()
|
||||||
app.SetBech32AddressPrefixes(config)
|
|
||||||
suite.ResetChain()
|
suite.ResetChain()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ import (
|
|||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
|
|
||||||
"github.com/0glabs/0g-chain/app"
|
"github.com/0glabs/0g-chain/app"
|
||||||
|
"github.com/0glabs/0g-chain/chaincfg"
|
||||||
"github.com/0glabs/0g-chain/x/bep3"
|
"github.com/0glabs/0g-chain/x/bep3"
|
||||||
"github.com/0glabs/0g-chain/x/bep3/keeper"
|
"github.com/0glabs/0g-chain/x/bep3/keeper"
|
||||||
"github.com/0glabs/0g-chain/x/bep3/types"
|
"github.com/0glabs/0g-chain/x/bep3/types"
|
||||||
@ -40,8 +41,7 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (suite *AtomicSwapTestSuite) SetupTest() {
|
func (suite *AtomicSwapTestSuite) SetupTest() {
|
||||||
config := sdk.GetConfig()
|
chaincfg.SetSDKConfig()
|
||||||
app.SetBech32AddressPrefixes(config)
|
|
||||||
|
|
||||||
// Initialize test app and set context
|
// Initialize test app and set context
|
||||||
tApp := app.NewTestApp()
|
tApp := app.NewTestApp()
|
||||||
|
@ -13,6 +13,7 @@ import (
|
|||||||
"github.com/tendermint/tendermint/libs/bytes"
|
"github.com/tendermint/tendermint/libs/bytes"
|
||||||
|
|
||||||
app "github.com/0glabs/0g-chain/app"
|
app "github.com/0glabs/0g-chain/app"
|
||||||
|
"github.com/0glabs/0g-chain/chaincfg"
|
||||||
"github.com/0glabs/0g-chain/x/bep3/types"
|
"github.com/0glabs/0g-chain/x/bep3/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -25,7 +26,7 @@ type migrateTestSuite struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *migrateTestSuite) SetupTest() {
|
func (s *migrateTestSuite) SetupTest() {
|
||||||
app.SetSDKConfig()
|
chaincfg.SetSDKConfig()
|
||||||
|
|
||||||
s.v16genstate = types.GenesisState{
|
s.v16genstate = types.GenesisState{
|
||||||
PreviousBlockTime: time.Date(2021, 4, 8, 15, 0, 0, 0, time.UTC),
|
PreviousBlockTime: time.Date(2021, 4, 8, 15, 0, 0, 0, time.UTC),
|
||||||
|
@ -9,7 +9,7 @@ import (
|
|||||||
sdkmath "cosmossdk.io/math"
|
sdkmath "cosmossdk.io/math"
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
|
|
||||||
"github.com/0glabs/0g-chain/app"
|
"github.com/0glabs/0g-chain/chaincfg"
|
||||||
"github.com/0glabs/0g-chain/x/bep3/types"
|
"github.com/0glabs/0g-chain/x/bep3/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -99,8 +99,7 @@ func (suite *GenesisTestSuite) TestValidate() {
|
|||||||
|
|
||||||
for _, tc := range testCases {
|
for _, tc := range testCases {
|
||||||
suite.Run(tc.name, func() {
|
suite.Run(tc.name, func() {
|
||||||
config := sdk.GetConfig()
|
chaincfg.SetSDKConfig()
|
||||||
app.SetBech32AddressPrefixes(config)
|
|
||||||
var gs types.GenesisState
|
var gs types.GenesisState
|
||||||
if tc.name == "default" {
|
if tc.name == "default" {
|
||||||
gs = types.DefaultGenesisState()
|
gs = types.DefaultGenesisState()
|
||||||
|
@ -8,7 +8,7 @@ import (
|
|||||||
"github.com/tendermint/tendermint/crypto"
|
"github.com/tendermint/tendermint/crypto"
|
||||||
tmbytes "github.com/tendermint/tendermint/libs/bytes"
|
tmbytes "github.com/tendermint/tendermint/libs/bytes"
|
||||||
|
|
||||||
"github.com/0glabs/0g-chain/app"
|
"github.com/0glabs/0g-chain/chaincfg"
|
||||||
"github.com/0glabs/0g-chain/x/bep3/types"
|
"github.com/0glabs/0g-chain/x/bep3/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
app.SetSDKConfig()
|
chaincfg.SetSDKConfig()
|
||||||
|
|
||||||
// Must be set after SetSDKConfig to use 0g Bech32 prefix instead of cosmos
|
// Must be set after SetSDKConfig to use 0g Bech32 prefix instead of cosmos
|
||||||
binanceAddrs = []sdk.AccAddress{
|
binanceAddrs = []sdk.AccAddress{
|
||||||
@ -40,8 +40,7 @@ type MsgTestSuite struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (suite *MsgTestSuite) SetupTest() {
|
func (suite *MsgTestSuite) SetupTest() {
|
||||||
config := sdk.GetConfig()
|
chaincfg.SetSDKConfig()
|
||||||
app.SetBech32AddressPrefixes(config)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *MsgTestSuite) TestMsgCreateAtomicSwap() {
|
func (suite *MsgTestSuite) TestMsgCreateAtomicSwap() {
|
||||||
|
@ -10,6 +10,7 @@ import (
|
|||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
|
|
||||||
"github.com/0glabs/0g-chain/app"
|
"github.com/0glabs/0g-chain/app"
|
||||||
|
"github.com/0glabs/0g-chain/chaincfg"
|
||||||
"github.com/0glabs/0g-chain/x/bep3/types"
|
"github.com/0glabs/0g-chain/x/bep3/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -20,8 +21,7 @@ type ParamsTestSuite struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (suite *ParamsTestSuite) SetupTest() {
|
func (suite *ParamsTestSuite) SetupTest() {
|
||||||
config := sdk.GetConfig()
|
chaincfg.SetSDKConfig()
|
||||||
app.SetBech32AddressPrefixes(config)
|
|
||||||
_, addrs := app.GeneratePrivKeyAddressPairs(1)
|
_, addrs := app.GeneratePrivKeyAddressPairs(1)
|
||||||
suite.addr = addrs[0]
|
suite.addr = addrs[0]
|
||||||
supply1 := types.SupplyLimit{
|
supply1 := types.SupplyLimit{
|
||||||
|
@ -11,6 +11,7 @@ import (
|
|||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
|
|
||||||
"github.com/0glabs/0g-chain/app"
|
"github.com/0glabs/0g-chain/app"
|
||||||
|
"github.com/0glabs/0g-chain/chaincfg"
|
||||||
"github.com/0glabs/0g-chain/x/bep3/types"
|
"github.com/0glabs/0g-chain/x/bep3/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -23,8 +24,7 @@ type AtomicSwapTestSuite struct {
|
|||||||
|
|
||||||
func (suite *AtomicSwapTestSuite) SetupTest() {
|
func (suite *AtomicSwapTestSuite) SetupTest() {
|
||||||
// Generate 10 addresses
|
// Generate 10 addresses
|
||||||
config := sdk.GetConfig()
|
chaincfg.SetSDKConfig()
|
||||||
app.SetBech32AddressPrefixes(config)
|
|
||||||
_, addrs := app.GeneratePrivKeyAddressPairs(10)
|
_, addrs := app.GeneratePrivKeyAddressPairs(10)
|
||||||
|
|
||||||
// Generate 10 timestamps and random number hashes
|
// Generate 10 timestamps and random number hashes
|
||||||
|
@ -7,6 +7,7 @@ import (
|
|||||||
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
|
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
|
||||||
|
|
||||||
"github.com/0glabs/0g-chain/app"
|
"github.com/0glabs/0g-chain/app"
|
||||||
|
"github.com/0glabs/0g-chain/chaincfg"
|
||||||
"github.com/0glabs/0g-chain/x/committee/keeper"
|
"github.com/0glabs/0g-chain/x/committee/keeper"
|
||||||
"github.com/0glabs/0g-chain/x/committee/types"
|
"github.com/0glabs/0g-chain/x/committee/types"
|
||||||
)
|
)
|
||||||
@ -25,8 +26,7 @@ type Suite struct {
|
|||||||
|
|
||||||
// SetupTest instantiates a new app, keepers, and sets suite state
|
// SetupTest instantiates a new app, keepers, and sets suite state
|
||||||
func (suite *Suite) SetupTest() {
|
func (suite *Suite) SetupTest() {
|
||||||
config := sdk.GetConfig()
|
chaincfg.SetSDKConfig()
|
||||||
app.SetBech32AddressPrefixes(config)
|
|
||||||
suite.App = app.NewTestApp()
|
suite.App = app.NewTestApp()
|
||||||
suite.Keeper = suite.App.GetCommitteeKeeper()
|
suite.Keeper = suite.App.GetCommitteeKeeper()
|
||||||
suite.BankKeeper = suite.App.GetBankKeeper()
|
suite.BankKeeper = suite.App.GetBankKeeper()
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/0glabs/0g-chain/app"
|
"github.com/0glabs/0g-chain/app"
|
||||||
|
"github.com/0glabs/0g-chain/chaincfg"
|
||||||
"github.com/0glabs/0g-chain/x/evmutil/testutil"
|
"github.com/0glabs/0g-chain/x/evmutil/testutil"
|
||||||
"github.com/0glabs/0g-chain/x/evmutil/types"
|
"github.com/0glabs/0g-chain/x/evmutil/types"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
@ -13,7 +14,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestMsgConvertCoinToERC20(t *testing.T) {
|
func TestMsgConvertCoinToERC20(t *testing.T) {
|
||||||
app.SetSDKConfig()
|
chaincfg.SetSDKConfig()
|
||||||
|
|
||||||
type errArgs struct {
|
type errArgs struct {
|
||||||
expectPass bool
|
expectPass bool
|
||||||
@ -109,7 +110,7 @@ func TestMsgConvertCoinToERC20(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestMsgConvertERC20ToCoin(t *testing.T) {
|
func TestMsgConvertERC20ToCoin(t *testing.T) {
|
||||||
app.SetSDKConfig()
|
chaincfg.SetSDKConfig()
|
||||||
|
|
||||||
type errArgs struct {
|
type errArgs struct {
|
||||||
expectPass bool
|
expectPass bool
|
||||||
|
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
|
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
|
||||||
|
|
||||||
"github.com/0glabs/0g-chain/app"
|
"github.com/0glabs/0g-chain/chaincfg"
|
||||||
"github.com/0glabs/0g-chain/x/evmutil/testutil"
|
"github.com/0glabs/0g-chain/x/evmutil/testutil"
|
||||||
"github.com/0glabs/0g-chain/x/evmutil/types"
|
"github.com/0glabs/0g-chain/x/evmutil/types"
|
||||||
)
|
)
|
||||||
@ -19,7 +19,7 @@ type ParamsTestSuite struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (suite *ParamsTestSuite) SetupTest() {
|
func (suite *ParamsTestSuite) SetupTest() {
|
||||||
app.SetSDKConfig()
|
chaincfg.SetSDKConfig()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *ParamsTestSuite) TestDefault() {
|
func (suite *ParamsTestSuite) TestDefault() {
|
||||||
|
@ -10,6 +10,7 @@ import (
|
|||||||
"github.com/stretchr/testify/suite"
|
"github.com/stretchr/testify/suite"
|
||||||
|
|
||||||
app "github.com/0glabs/0g-chain/app"
|
app "github.com/0glabs/0g-chain/app"
|
||||||
|
"github.com/0glabs/0g-chain/chaincfg"
|
||||||
v015issuance "github.com/0glabs/0g-chain/x/issuance/legacy/v0_15"
|
v015issuance "github.com/0glabs/0g-chain/x/issuance/legacy/v0_15"
|
||||||
v016issuance "github.com/0glabs/0g-chain/x/issuance/types"
|
v016issuance "github.com/0glabs/0g-chain/x/issuance/types"
|
||||||
)
|
)
|
||||||
@ -24,7 +25,7 @@ type migrateTestSuite struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *migrateTestSuite) SetupTest() {
|
func (s *migrateTestSuite) SetupTest() {
|
||||||
app.SetSDKConfig()
|
chaincfg.SetSDKConfig()
|
||||||
|
|
||||||
s.v15genstate = v015issuance.GenesisState{
|
s.v15genstate = v015issuance.GenesisState{
|
||||||
Params: v015issuance.Params{},
|
Params: v015issuance.Params{},
|
||||||
|
@ -9,6 +9,7 @@ import (
|
|||||||
"github.com/stretchr/testify/suite"
|
"github.com/stretchr/testify/suite"
|
||||||
|
|
||||||
app "github.com/0glabs/0g-chain/app"
|
app "github.com/0glabs/0g-chain/app"
|
||||||
|
"github.com/0glabs/0g-chain/chaincfg"
|
||||||
v015pricefeed "github.com/0glabs/0g-chain/x/pricefeed/legacy/v0_15"
|
v015pricefeed "github.com/0glabs/0g-chain/x/pricefeed/legacy/v0_15"
|
||||||
v016pricefeed "github.com/0glabs/0g-chain/x/pricefeed/types"
|
v016pricefeed "github.com/0glabs/0g-chain/x/pricefeed/types"
|
||||||
)
|
)
|
||||||
@ -23,7 +24,7 @@ type migrateTestSuite struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *migrateTestSuite) SetupTest() {
|
func (s *migrateTestSuite) SetupTest() {
|
||||||
app.SetSDKConfig()
|
chaincfg.SetSDKConfig()
|
||||||
|
|
||||||
s.v15genstate = v015pricefeed.GenesisState{
|
s.v15genstate = v015pricefeed.GenesisState{
|
||||||
Params: v015pricefeed.Params{},
|
Params: v015pricefeed.Params{},
|
||||||
|
Loading…
Reference in New Issue
Block a user