forked from cerc-io/laconicd-deprecated
!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:
@@ -22,6 +22,7 @@ import (
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
tmrpctypes "github.com/tendermint/tendermint/rpc/core/types"
|
||||
|
||||
sdkmath "cosmossdk.io/math"
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/client/flags"
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keyring"
|
||||
@@ -74,6 +75,7 @@ func NewPublicAPI(
|
||||
viper.GetString(flags.FlagKeyringBackend),
|
||||
clientCtx.KeyringDir,
|
||||
clientCtx.Input,
|
||||
clientCtx.Codec,
|
||||
hd.EthSecp256k1Option(),
|
||||
)
|
||||
if err != nil {
|
||||
@@ -252,7 +254,11 @@ func (e *PublicAPI) Accounts() ([]common.Address, error) {
|
||||
}
|
||||
|
||||
for _, info := range infos {
|
||||
addressBytes := info.GetPubKey().Address().Bytes()
|
||||
pubKey, err := info.GetPubKey()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
addressBytes := pubKey.Address().Bytes()
|
||||
addresses = append(addresses, common.BytesToAddress(addressBytes))
|
||||
}
|
||||
|
||||
@@ -283,7 +289,7 @@ func (e *PublicAPI) GetBalance(address common.Address, blockNrOrHash rpctypes.Bl
|
||||
return nil, err
|
||||
}
|
||||
|
||||
val, ok := sdk.NewIntFromString(res.Balance)
|
||||
val, ok := sdkmath.NewIntFromString(res.Balance)
|
||||
if !ok {
|
||||
return nil, errors.New("invalid balance")
|
||||
}
|
||||
@@ -1116,7 +1122,7 @@ func (e *PublicAPI) GetProof(address common.Address, storageKeys []string, block
|
||||
accProofStr = proof.String()
|
||||
}
|
||||
|
||||
balance, ok := sdk.NewIntFromString(res.Balance)
|
||||
balance, ok := sdkmath.NewIntFromString(res.Balance)
|
||||
if !ok {
|
||||
return nil, errors.New("invalid balance")
|
||||
}
|
||||
|
||||
@@ -389,6 +389,7 @@ func (api *PublicFilterAPI) Logs(ctx context.Context, crit filters.FilterCriteri
|
||||
|
||||
txResponse, err := evmtypes.DecodeTxResponse(dataTx.TxResult.Result.Data)
|
||||
if err != nil {
|
||||
api.logger.Error("fail to decode tx response", "error", err)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -465,6 +466,7 @@ func (api *PublicFilterAPI) NewFilter(criteria filters.FilterCriteria) (rpc.ID,
|
||||
|
||||
txResponse, err := evmtypes.DecodeTxResponse(dataTx.TxResult.Result.Data)
|
||||
if err != nil {
|
||||
api.logger.Error("fail to decode tx response", "error", err)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -3,8 +3,9 @@ package miner
|
||||
import (
|
||||
"math/big"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
sdkmath "cosmossdk.io/math"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/client/flags"
|
||||
"github.com/cosmos/cosmos-sdk/client/tx"
|
||||
"github.com/cosmos/cosmos-sdk/server"
|
||||
@@ -114,7 +115,7 @@ func (api *API) SetEtherbase(etherbase common.Address) bool {
|
||||
txFactory = txFactory.WithGas(gas)
|
||||
|
||||
value := new(big.Int).SetUint64(gas * minGasPriceValue.Ceil().TruncateInt().Uint64())
|
||||
fees := sdk.Coins{sdk.NewCoin(denom, sdk.NewIntFromBigInt(value))}
|
||||
fees := sdk.Coins{sdk.NewCoin(denom, sdkmath.NewIntFromBigInt(value))}
|
||||
builder.SetFeeAmount(fees)
|
||||
builder.SetGasLimit(gas)
|
||||
|
||||
@@ -124,7 +125,7 @@ func (api *API) SetEtherbase(etherbase common.Address) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
if err := tx.Sign(txFactory, keyInfo.GetName(), builder, false); err != nil {
|
||||
if err := tx.Sign(txFactory, keyInfo.Name, builder, false); err != nil {
|
||||
api.logger.Debug("failed to sign tx", "error", err.Error())
|
||||
return false
|
||||
}
|
||||
@@ -177,7 +178,7 @@ func (api *API) SetGasPrice(gasPrice hexutil.Big) bool {
|
||||
unit = minGasPrices[0].Denom
|
||||
}
|
||||
|
||||
c := sdk.NewDecCoin(unit, sdk.NewIntFromBigInt(gasPrice.ToInt()))
|
||||
c := sdk.NewDecCoin(unit, sdkmath.NewIntFromBigInt(gasPrice.ToInt()))
|
||||
|
||||
appConf.SetMinGasPrices(sdk.DecCoins{c})
|
||||
sdkconfig.WriteConfigFile(api.ctx.Viper.ConfigFileUsed(), appConf)
|
||||
|
||||
@@ -106,7 +106,11 @@ func (api *PrivateAccountAPI) ListAccounts() ([]common.Address, error) {
|
||||
}
|
||||
|
||||
for _, info := range list {
|
||||
addrs = append(addrs, common.BytesToAddress(info.GetPubKey().Address()))
|
||||
pubKey, err := info.GetPubKey()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
addrs = append(addrs, common.BytesToAddress(pubKey.Address()))
|
||||
}
|
||||
|
||||
return addrs, nil
|
||||
@@ -135,7 +139,11 @@ func (api *PrivateAccountAPI) NewAccount(password string) (common.Address, error
|
||||
return common.Address{}, err
|
||||
}
|
||||
|
||||
addr := common.BytesToAddress(info.GetPubKey().Address().Bytes())
|
||||
pubKey, err := info.GetPubKey()
|
||||
if err != nil {
|
||||
return common.Address{}, err
|
||||
}
|
||||
addr := common.BytesToAddress(pubKey.Address().Bytes())
|
||||
api.logger.Info("Your new key was generated", "address", addr.String())
|
||||
api.logger.Info("Please backup your key file!", "path", os.Getenv("HOME")+"/.ethermint/"+name) // TODO: pass the correct binary
|
||||
api.logger.Info("Please remember your password!")
|
||||
|
||||
Reference in New Issue
Block a user