From 03c017d386b66ce322f7f46eb77a36a879d51c8f Mon Sep 17 00:00:00 2001 From: MalteHerrmann Date: Wed, 21 Aug 2024 08:54:49 +0200 Subject: [PATCH] avoid using hardcoded bech32 prefix in distribution precompile --- precompiles/distribution/types.go | 3 +-- x/evm/keeper/grpc_query_test.go | 2 +- x/evm/keeper/params_test.go | 2 +- x/evm/keeper/state_transition_test.go | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/precompiles/distribution/types.go b/precompiles/distribution/types.go index 5ca2a4e..fd9dac9 100644 --- a/precompiles/distribution/types.go +++ b/precompiles/distribution/types.go @@ -13,7 +13,6 @@ import ( distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types" "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/common" - chainconfig "github.com/evmos/os/example_chain/osd/config" cmn "github.com/evmos/os/precompiles/common" ) @@ -83,7 +82,7 @@ func NewMsgSetWithdrawAddress(args []interface{}) (*distributiontypes.MsgSetWith // If the withdrawer address is a hex address, convert it to a bech32 address. if common.IsHexAddress(withdrawerAddress) { var err error - withdrawerAddress, err = sdk.Bech32ifyAddressBytes(chainconfig.Bech32Prefix, common.HexToAddress(withdrawerAddress).Bytes()) + withdrawerAddress, err = sdk.Bech32ifyAddressBytes(sdk.GetConfig().GetBech32AccountAddrPrefix(), common.HexToAddress(withdrawerAddress).Bytes()) if err != nil { return nil, common.Address{}, err } diff --git a/x/evm/keeper/grpc_query_test.go b/x/evm/keeper/grpc_query_test.go index 0de7b89..a3a6b25 100644 --- a/x/evm/keeper/grpc_query_test.go +++ b/x/evm/keeper/grpc_query_test.go @@ -3,7 +3,6 @@ package keeper_test import ( "encoding/json" "fmt" - example_app "github.com/evmos/os/example_chain" "math/big" sdkmath "cosmossdk.io/math" @@ -12,6 +11,7 @@ import ( "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/crypto" ethparams "github.com/ethereum/go-ethereum/params" + example_app "github.com/evmos/os/example_chain" "github.com/evmos/os/server/config" "github.com/evmos/os/testutil" utiltx "github.com/evmos/os/testutil/tx" diff --git a/x/evm/keeper/params_test.go b/x/evm/keeper/params_test.go index 4f21776..bba342e 100644 --- a/x/evm/keeper/params_test.go +++ b/x/evm/keeper/params_test.go @@ -1,9 +1,9 @@ package keeper_test import ( - example_app "github.com/evmos/os/example_chain" "reflect" + example_app "github.com/evmos/os/example_chain" "github.com/evmos/os/testutil" "github.com/evmos/os/x/evm/types" ) diff --git a/x/evm/keeper/state_transition_test.go b/x/evm/keeper/state_transition_test.go index bff278b..1fa30ca 100644 --- a/x/evm/keeper/state_transition_test.go +++ b/x/evm/keeper/state_transition_test.go @@ -2,7 +2,6 @@ package keeper_test import ( "fmt" - example_app "github.com/evmos/os/example_chain" "math" "math/big" @@ -18,6 +17,7 @@ import ( "github.com/ethereum/go-ethereum/core" ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/params" + example_app "github.com/evmos/os/example_chain" "github.com/evmos/os/testutil" utiltx "github.com/evmos/os/testutil/tx" "github.com/evmos/os/x/evm/keeper"