This commit is contained in:
Solovyov1796 2024-05-01 16:07:32 +08:00 committed by 0g-wh
parent 89d3829646
commit d1c3f36bbe
15 changed files with 31 additions and 30 deletions

View File

@ -65,8 +65,7 @@ var (
func init() {
// set the address prefixes
config := sdk.GetConfig()
app.SetBech32AddressPrefixes(config)
chaincfg.SetSDKConfig()
// config.Seal()
}

View File

@ -11,6 +11,7 @@ import (
"github.com/stretchr/testify/suite"
"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/types"
)
@ -25,8 +26,7 @@ type GenesisTestSuite struct {
}
func (suite *GenesisTestSuite) SetupTest() {
config := sdk.GetConfig()
app.SetBech32AddressPrefixes(config)
chaincfg.SetSDKConfig()
tApp := app.NewTestApp()
suite.ctx = tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()})

View File

@ -14,6 +14,7 @@ import (
tmtime "github.com/cometbft/cometbft/types/time"
"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/types"
)
@ -27,8 +28,7 @@ type AssetTestSuite struct {
}
func (suite *AssetTestSuite) SetupTest() {
config := sdk.GetConfig()
app.SetBech32AddressPrefixes(config)
chaincfg.SetSDKConfig()
// Initialize test app and set context
tApp := app.NewTestApp()

View File

@ -12,6 +12,7 @@ import (
tmtime "github.com/cometbft/cometbft/types/time"
"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/types"
)
@ -27,8 +28,7 @@ type KeeperTestSuite struct {
}
func (suite *KeeperTestSuite) SetupTest() {
config := sdk.GetConfig()
app.SetBech32AddressPrefixes(config)
chaincfg.SetSDKConfig()
suite.ResetChain()
}

View File

@ -13,6 +13,7 @@ import (
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"
"github.com/0glabs/0g-chain/x/bep3/keeper"
"github.com/0glabs/0g-chain/x/bep3/types"
@ -40,8 +41,7 @@ const (
)
func (suite *AtomicSwapTestSuite) SetupTest() {
config := sdk.GetConfig()
app.SetBech32AddressPrefixes(config)
chaincfg.SetSDKConfig()
// Initialize test app and set context
tApp := app.NewTestApp()

View File

@ -13,6 +13,7 @@ import (
"github.com/stretchr/testify/suite"
app "github.com/0glabs/0g-chain/app"
"github.com/0glabs/0g-chain/chaincfg"
"github.com/0glabs/0g-chain/x/bep3/types"
)
@ -25,7 +26,7 @@ type migrateTestSuite struct {
}
func (s *migrateTestSuite) SetupTest() {
app.SetSDKConfig()
chaincfg.SetSDKConfig()
s.v16genstate = types.GenesisState{
PreviousBlockTime: time.Date(2021, 4, 8, 15, 0, 0, 0, time.UTC),

View File

@ -9,7 +9,7 @@ import (
sdkmath "cosmossdk.io/math"
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"
)
@ -99,8 +99,7 @@ func (suite *GenesisTestSuite) TestValidate() {
for _, tc := range testCases {
suite.Run(tc.name, func() {
config := sdk.GetConfig()
app.SetBech32AddressPrefixes(config)
chaincfg.SetSDKConfig()
var gs types.GenesisState
if tc.name == "default" {
gs = types.DefaultGenesisState()

View File

@ -8,7 +8,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/stretchr/testify/suite"
"github.com/0glabs/0g-chain/app"
"github.com/0glabs/0g-chain/chaincfg"
"github.com/0glabs/0g-chain/x/bep3/types"
)
@ -22,7 +22,7 @@ var (
)
func init() {
app.SetSDKConfig()
chaincfg.SetSDKConfig()
// Must be set after SetSDKConfig to use 0g Bech32 prefix instead of cosmos
binanceAddrs = []sdk.AccAddress{
@ -40,8 +40,7 @@ type MsgTestSuite struct {
}
func (suite *MsgTestSuite) SetupTest() {
config := sdk.GetConfig()
app.SetBech32AddressPrefixes(config)
chaincfg.SetSDKConfig()
}
func (suite *MsgTestSuite) TestMsgCreateAtomicSwap() {

View File

@ -10,6 +10,7 @@ import (
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"
)
@ -20,8 +21,7 @@ type ParamsTestSuite struct {
}
func (suite *ParamsTestSuite) SetupTest() {
config := sdk.GetConfig()
app.SetBech32AddressPrefixes(config)
chaincfg.SetSDKConfig()
_, addrs := app.GeneratePrivKeyAddressPairs(1)
suite.addr = addrs[0]
supply1 := types.SupplyLimit{

View File

@ -11,6 +11,7 @@ import (
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"
)
@ -23,8 +24,7 @@ type AtomicSwapTestSuite struct {
func (suite *AtomicSwapTestSuite) SetupTest() {
// Generate 10 addresses
config := sdk.GetConfig()
app.SetBech32AddressPrefixes(config)
chaincfg.SetSDKConfig()
_, addrs := app.GeneratePrivKeyAddressPairs(10)
// Generate 10 timestamps and random number hashes

View File

@ -7,6 +7,7 @@ import (
"github.com/stretchr/testify/suite"
"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/types"
)
@ -25,8 +26,7 @@ type Suite struct {
// SetupTest instantiates a new app, keepers, and sets suite state
func (suite *Suite) SetupTest() {
config := sdk.GetConfig()
app.SetBech32AddressPrefixes(config)
chaincfg.SetSDKConfig()
suite.App = app.NewTestApp()
suite.Keeper = suite.App.GetCommitteeKeeper()
suite.BankKeeper = suite.App.GetBankKeeper()

View File

@ -4,6 +4,7 @@ import (
"testing"
"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/types"
"github.com/stretchr/testify/require"
@ -13,7 +14,7 @@ import (
)
func TestMsgConvertCoinToERC20(t *testing.T) {
app.SetSDKConfig()
chaincfg.SetSDKConfig()
type errArgs struct {
expectPass bool
@ -118,7 +119,7 @@ func TestMsgConvertCoinToERC20(t *testing.T) {
}
func TestMsgConvertERC20ToCoin(t *testing.T) {
app.SetSDKConfig()
chaincfg.SetSDKConfig()
type errArgs struct {
expectPass bool

View File

@ -9,7 +9,7 @@ import (
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/types"
)
@ -19,7 +19,7 @@ type ParamsTestSuite struct {
}
func (suite *ParamsTestSuite) SetupTest() {
app.SetSDKConfig()
chaincfg.SetSDKConfig()
}
func (suite *ParamsTestSuite) TestDefault() {

View File

@ -10,6 +10,7 @@ import (
"github.com/stretchr/testify/suite"
app "github.com/0glabs/0g-chain/app"
"github.com/0glabs/0g-chain/chaincfg"
v015issuance "github.com/0glabs/0g-chain/x/issuance/legacy/v0_15"
v016issuance "github.com/0glabs/0g-chain/x/issuance/types"
)
@ -24,7 +25,7 @@ type migrateTestSuite struct {
}
func (s *migrateTestSuite) SetupTest() {
app.SetSDKConfig()
chaincfg.SetSDKConfig()
s.v15genstate = v015issuance.GenesisState{
Params: v015issuance.Params{},

View File

@ -9,6 +9,7 @@ import (
"github.com/stretchr/testify/suite"
app "github.com/0glabs/0g-chain/app"
"github.com/0glabs/0g-chain/chaincfg"
v015pricefeed "github.com/0glabs/0g-chain/x/pricefeed/legacy/v0_15"
v016pricefeed "github.com/0glabs/0g-chain/x/pricefeed/types"
)
@ -23,7 +24,7 @@ type migrateTestSuite struct {
}
func (s *migrateTestSuite) SetupTest() {
app.SetSDKConfig()
chaincfg.SetSDKConfig()
s.v15genstate = v015pricefeed.GenesisState{
Params: v015pricefeed.Params{},