Skip to content

Commit

Permalink
avoid using hardcoded bech32 prefix in distribution precompile
Browse files Browse the repository at this point in the history
  • Loading branch information
MalteHerrmann committed Aug 21, 2024
1 parent c167e7e commit 03c017d
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions precompiles/distribution/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion x/evm/keeper/grpc_query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion x/evm/keeper/params_test.go
Original file line number Diff line number Diff line change
@@ -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"
)
Expand Down
2 changes: 1 addition & 1 deletion x/evm/keeper/state_transition_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package keeper_test

import (
"fmt"
example_app "github.com/evmos/os/example_chain"
"math"
"math/big"

Expand All @@ -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"
Expand Down

0 comments on commit 03c017d

Please sign in to comment.