From 2e1bb81b65f5f473db9ff08feaaecbc451ef0569 Mon Sep 17 00:00:00 2001 From: SpekalsG3 Date: Thu, 31 Oct 2024 14:35:17 +0300 Subject: [PATCH] fix(prefixes): move function into app --- app/app.go | 10 ++++++++++ cmd/archwayd/root.go | 9 +-------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/app/app.go b/app/app.go index 50ea5186..eee6c103 100644 --- a/app/app.go +++ b/app/app.go @@ -162,6 +162,7 @@ import ( extendedGov "github.com/archway-network/archway/x/gov" "github.com/CosmWasm/wasmd/x/wasm" + wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" archwayappparams "github.com/archway-network/archway/app/params" archway "github.com/archway-network/archway/types" @@ -233,6 +234,15 @@ var ( _ servertypes.Application = (*ArchwayApp)(nil) ) +func SetPrefixes() { + cfg := sdk.GetConfig() + cfg.SetBech32PrefixForAccount(appconst.Bech32PrefixAccAddr, appconst.Bech32PrefixAccPub) + cfg.SetBech32PrefixForValidator(appconst.Bech32PrefixValAddr, appconst.Bech32PrefixValPub) + cfg.SetBech32PrefixForConsensusNode(appconst.Bech32PrefixConsAddr, appconst.Bech32PrefixConsPub) + cfg.SetAddressVerifier(wasmtypes.VerifyAddressLen()) + cfg.Seal() +} + func init() { // sets the default power reduction in order to ensure that on high precision numbers, which is a default for archway // the network does not get stalled due to an integer overflow in some edge cases. diff --git a/cmd/archwayd/root.go b/cmd/archwayd/root.go index 5a18d3ec..c98bc3ae 100644 --- a/cmd/archwayd/root.go +++ b/cmd/archwayd/root.go @@ -17,7 +17,6 @@ import ( "github.com/cosmos/cosmos-sdk/client/rpc" "github.com/cosmos/cosmos-sdk/server" servertypes "github.com/cosmos/cosmos-sdk/server/types" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/version" authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" @@ -32,7 +31,6 @@ import ( "github.com/CosmWasm/wasmd/x/wasm" wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" - wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" "github.com/archway-network/archway/app" "github.com/archway-network/archway/app/appconst" @@ -42,12 +40,7 @@ import ( // NewRootCmd creates a new root command for archwayd. It is called once in the // main function. func NewRootCmd() (*cobra.Command, params.EncodingConfig) { - cfg := sdk.GetConfig() - cfg.SetBech32PrefixForAccount(appconst.Bech32PrefixAccAddr, appconst.Bech32PrefixAccPub) - cfg.SetBech32PrefixForValidator(appconst.Bech32PrefixValAddr, appconst.Bech32PrefixValPub) - cfg.SetBech32PrefixForConsensusNode(appconst.Bech32PrefixConsAddr, appconst.Bech32PrefixConsPub) - cfg.SetAddressVerifier(wasmtypes.VerifyAddressLen()) - cfg.Seal() + app.SetPrefixes() encodingConfig := app.MakeEncodingConfig() tempApp := app.NewArchwayApp(log.NewNopLogger(), dbm.NewMemDB(), nil, true, nil, tempDir(), 0, encodingConfig, simtestutil.NewAppOptionsWithFlagHome(tempDir()), []wasmkeeper.Option{})