diff --git a/cli_test/test_helpers.go b/cli_test/test_helpers.go index 28ea6509..d3bfc0c1 100644 --- a/cli_test/test_helpers.go +++ b/cli_test/test_helpers.go @@ -65,8 +65,7 @@ var ( func init() { // set the address prefixes - config := sdk.GetConfig() - app.SetBech32AddressPrefixes(config) + chaincfg.SetSDKConfig() // config.Seal() } diff --git a/x/bep3/genesis_test.go b/x/bep3/genesis_test.go index 704f5295..819ef11e 100644 --- a/x/bep3/genesis_test.go +++ b/x/bep3/genesis_test.go @@ -11,6 +11,7 @@ import ( tmtime "github.com/tendermint/tendermint/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" ) @@ -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()}) diff --git a/x/bep3/keeper/asset_test.go b/x/bep3/keeper/asset_test.go index 82263b5c..e1ec5b5c 100644 --- a/x/bep3/keeper/asset_test.go +++ b/x/bep3/keeper/asset_test.go @@ -14,6 +14,7 @@ import ( tmtime "github.com/tendermint/tendermint/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() diff --git a/x/bep3/keeper/keeper_test.go b/x/bep3/keeper/keeper_test.go index 6db9a7ce..730ca4c5 100644 --- a/x/bep3/keeper/keeper_test.go +++ b/x/bep3/keeper/keeper_test.go @@ -12,6 +12,7 @@ import ( tmtime "github.com/tendermint/tendermint/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() } diff --git a/x/bep3/keeper/swap_test.go b/x/bep3/keeper/swap_test.go index 14c84f66..9b6cb91b 100644 --- a/x/bep3/keeper/swap_test.go +++ b/x/bep3/keeper/swap_test.go @@ -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() diff --git a/x/bep3/legacy/v0_17/migrate_test.go b/x/bep3/legacy/v0_17/migrate_test.go index 492b5cf0..e5136899 100644 --- a/x/bep3/legacy/v0_17/migrate_test.go +++ b/x/bep3/legacy/v0_17/migrate_test.go @@ -13,6 +13,7 @@ import ( "github.com/tendermint/tendermint/libs/bytes" 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), diff --git a/x/bep3/types/genesis_test.go b/x/bep3/types/genesis_test.go index 0b516c2e..eecbde98 100644 --- a/x/bep3/types/genesis_test.go +++ b/x/bep3/types/genesis_test.go @@ -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() diff --git a/x/bep3/types/msg_test.go b/x/bep3/types/msg_test.go index 5cce2e92..eb59d1f1 100644 --- a/x/bep3/types/msg_test.go +++ b/x/bep3/types/msg_test.go @@ -8,7 +8,7 @@ import ( "github.com/tendermint/tendermint/crypto" 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" ) @@ -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() { diff --git a/x/bep3/types/params_test.go b/x/bep3/types/params_test.go index 4a42663a..b09665d3 100644 --- a/x/bep3/types/params_test.go +++ b/x/bep3/types/params_test.go @@ -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{ diff --git a/x/bep3/types/swap_test.go b/x/bep3/types/swap_test.go index 411d116f..995fedb6 100644 --- a/x/bep3/types/swap_test.go +++ b/x/bep3/types/swap_test.go @@ -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 diff --git a/x/committee/testutil/suite.go b/x/committee/testutil/suite.go index 6ccf5398..65ec40b4 100644 --- a/x/committee/testutil/suite.go +++ b/x/committee/testutil/suite.go @@ -7,6 +7,7 @@ import ( tmproto "github.com/tendermint/tendermint/proto/tendermint/types" "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() diff --git a/x/evmutil/types/msg_test.go b/x/evmutil/types/msg_test.go index 119feaa9..2faa1efd 100644 --- a/x/evmutil/types/msg_test.go +++ b/x/evmutil/types/msg_test.go @@ -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 @@ -109,7 +110,7 @@ func TestMsgConvertCoinToERC20(t *testing.T) { } func TestMsgConvertERC20ToCoin(t *testing.T) { - app.SetSDKConfig() + chaincfg.SetSDKConfig() type errArgs struct { expectPass bool diff --git a/x/evmutil/types/params_test.go b/x/evmutil/types/params_test.go index 30d1a290..8daabd0a 100644 --- a/x/evmutil/types/params_test.go +++ b/x/evmutil/types/params_test.go @@ -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() { diff --git a/x/issuance/legacy/v0_16/migrate_test.go b/x/issuance/legacy/v0_16/migrate_test.go index aad8b522..822de87e 100644 --- a/x/issuance/legacy/v0_16/migrate_test.go +++ b/x/issuance/legacy/v0_16/migrate_test.go @@ -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{}, diff --git a/x/pricefeed/legacy/v0_16/migrate_test.go b/x/pricefeed/legacy/v0_16/migrate_test.go index eb1658b2..fdbdf8ec 100644 --- a/x/pricefeed/legacy/v0_16/migrate_test.go +++ b/x/pricefeed/legacy/v0_16/migrate_test.go @@ -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{},