!feat(deps): Upgrade cosmos-sdk to v0.46.0 (#1168)

* Reuse cosmos-sdk client library to create keyring

Extracted from https://github.com/evmos/ethermint/pull/1168
Cleanup cmd code for easier to migration to cosmos-sdk 0.46

* Update cosmos-sdk v0.46

prepare for implementing cosmos-sdk feemarket and tx prioritization

changelog

refactor cmd

use sdkmath

fix lint

fix unit tests

fix unit test genesis

fix unit tests

fix unit test env setup

fix unit tests

fix unit tests

register PrivKey impl

fix extension options

fix lint

fix unit tests

make HandlerOption.Validate private

gofumpt

fix msg response decoding

fix sim test

bump cosmos-sdk version

fix sim test

sdk 46

fix unit test

fix unit tests

update ibc-go
This commit is contained in:
yihuang
2022-07-28 15:43:49 +02:00
committed by GitHub
parent 36cbb52004
commit 29d3abcf09
90 changed files with 1379 additions and 974 deletions
+2 -1
View File
@@ -5,6 +5,7 @@ import (
"math/rand"
"testing"
sdkmath "cosmossdk.io/math"
"github.com/stretchr/testify/require"
"github.com/cosmos/cosmos-sdk/codec"
@@ -31,7 +32,7 @@ func TestRandomizedGenState(t *testing.T) {
Rand: r,
NumBonded: 3,
Accounts: simtypes.RandomAccounts(r, 3),
InitialStake: 1000,
InitialStake: sdkmath.NewInt(1000),
GenState: make(map[string]json.RawMessage),
}
+6 -4
View File
@@ -7,6 +7,8 @@ import (
"math/rand"
"time"
sdkmath "cosmossdk.io/math"
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
@@ -123,7 +125,7 @@ func SimulateEthCreateContract(ak types.AccountKeeper, k *keeper.Keeper) simtype
from := common.BytesToAddress(simAccount.Address)
nonce := k.GetNonce(ctx, from)
ctorArgs, err := types.ERC20Contract.ABI.Pack("", from, sdk.NewIntWithDecimal(1000, 18).BigInt())
ctorArgs, err := types.ERC20Contract.ABI.Pack("", from, sdkmath.NewIntWithDecimal(1000, 18).BigInt())
if err != nil {
return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgEthereumTx, "can not pack owner and supply"), nil, err
}
@@ -192,7 +194,7 @@ func SimulateEthTx(
return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgEthereumTx, "can not sign ethereum tx"), nil, err
}
_, _, err = ctx.bapp.Deliver(txConfig.TxEncoder(), signedTx)
_, _, err = ctx.bapp.SimDeliver(txConfig.TxEncoder(), signedTx)
if err != nil {
return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgEthereumTx, "failed to deliver tx"), nil, err
}
@@ -258,7 +260,7 @@ func RandomTransferableAmount(ctx *simulateContext, address common.Address, esti
amount = new(big.Int).Set(spendable)
return amount, nil
}
simAmount, err := simtypes.RandPositiveInt(ctx.rand, sdk.NewIntFromBigInt(spendable))
simAmount, err := simtypes.RandPositiveInt(ctx.rand, sdkmath.NewIntFromBigInt(spendable))
if err != nil {
return nil, err
}
@@ -291,7 +293,7 @@ func GetSignedTx(ctx *simulateContext, txBuilder client.TxBuilder, msg *types.Ms
return nil, err
}
fees := sdk.NewCoins(sdk.NewCoin(ctx.keeper.GetParams(ctx.context).EvmDenom, sdk.NewIntFromBigInt(txData.Fee())))
fees := sdk.NewCoins(sdk.NewCoin(ctx.keeper.GetParams(ctx.context).EvmDenom, sdkmath.NewIntFromBigInt(txData.Fee())))
builder.SetFeeAmount(fees)
builder.SetGasLimit(msg.GetGas())