bump SDK to v0.39.1 (#386)

* bump sdk version to v0.39.0 candidate

* updates

* update evm

* bump commit

* more changes

* build

* genesis

* fix tests

* fix tests

* bump commit

* bump commit

* bump commit

* add keygen func

* bump version to 0.39.0-rc0

* update AnteHandler

* fix TxDecoder

* lint

* fix test

* update statedb

* changelog

* fixes

* remove extra files

* update make test-import

* rename test

* bump SDK version to final release

* update to 0.39.1-rc1

* fix evm tests

* update RPC

* minor fixes

* update to rc2

* bump to v0.39.1

* fix personal API

* fix string type cast ambiguity (#449)

* init

* fix estimate gas test

* minor genesis change

* remove comments from unstable commit (stargate release)

Co-authored-by: Alessio Treglia <quadrispro@ubuntu.com>
This commit is contained in:
Federico Kunze
2020-08-23 17:41:54 -04:00
committed by GitHub
co-authored by Alessio Treglia
parent 6fa5fafb12
commit 261f86fdf2
65 changed files with 688 additions and 2696 deletions
+10 -10
View File
@@ -6,21 +6,21 @@ import (
"os"
"strings"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/input"
"github.com/cosmos/cosmos-sdk/client/lcd"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
"github.com/cosmos/cosmos-sdk/crypto/keys"
sdk "github.com/cosmos/cosmos-sdk/types"
authrest "github.com/cosmos/cosmos-sdk/x/auth/client/rest"
"github.com/cosmos/ethermint/app"
"github.com/cosmos/ethermint/crypto"
"github.com/ethereum/go-ethereum/rpc"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
const (
@@ -45,7 +45,7 @@ func registerRoutes(rs *lcd.RestServer) {
accountName := viper.GetString(flagUnlockKey)
accountNames := strings.Split(accountName, ",")
var keys []crypto.PrivKeySecp256k1
var privkeys []crypto.PrivKeySecp256k1
if len(accountName) > 0 {
var err error
inBuf := bufio.NewReader(os.Stdin)
@@ -53,9 +53,9 @@ func registerRoutes(rs *lcd.RestServer) {
keyringBackend := viper.GetString(flags.FlagKeyringBackend)
passphrase := ""
switch keyringBackend {
case keyring.BackendOS:
case keys.BackendOS:
break
case keyring.BackendFile:
case keys.BackendFile:
passphrase, err = input.GetPassword(
"Enter password to unlock key for RPC API: ",
inBuf)
@@ -64,13 +64,13 @@ func registerRoutes(rs *lcd.RestServer) {
}
}
keys, err = unlockKeyFromNameAndPassphrase(accountNames, passphrase)
privkeys, err = unlockKeyFromNameAndPassphrase(accountNames, passphrase)
if err != nil {
panic(err)
}
}
apis := GetRPCAPIs(rs.CliCtx, keys)
apis := GetRPCAPIs(rs.CliCtx, privkeys)
// TODO: Allow cli to configure modules https://github.com/ChainSafe/ethermint/issues/74
whitelist := make(map[string]bool)
@@ -103,7 +103,7 @@ func registerRoutes(rs *lcd.RestServer) {
}
func unlockKeyFromNameAndPassphrase(accountNames []string, passphrase string) ([]crypto.PrivKeySecp256k1, error) {
keybase, err := keyring.NewKeyring(
keybase, err := keys.NewKeyring(
sdk.KeyringServiceName(),
viper.GetString(flags.FlagKeyringBackend),
viper.GetString(flags.FlagHome),
+8 -12
View File
@@ -7,13 +7,10 @@ import (
"log"
"math/big"
"strconv"
"strings"
"sync"
"github.com/gogo/protobuf/jsonpb"
"github.com/spf13/viper"
"github.com/cosmos/ethermint/codec"
"github.com/cosmos/ethermint/crypto"
params "github.com/cosmos/ethermint/rpc/args"
emint "github.com/cosmos/ethermint/types"
@@ -34,11 +31,11 @@ import (
"github.com/cosmos/cosmos-sdk/client/context"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
"github.com/cosmos/cosmos-sdk/crypto/keys"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/x/auth"
authclient "github.com/cosmos/cosmos-sdk/x/auth/client"
authclient "github.com/cosmos/cosmos-sdk/x/auth/client/utils"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
)
@@ -137,7 +134,7 @@ func (e *PublicEthAPI) Accounts() ([]common.Address, error) {
addresses := make([]common.Address, 0) // return [] instead of nil if empty
keybase, err := keyring.NewKeyring(
keybase, err := keys.NewKeyring(
sdk.KeyringServiceName(),
viper.GetString(flags.FlagKeyringBackend),
viper.GetString(flags.FlagHome),
@@ -205,8 +202,7 @@ func (e *PublicEthAPI) GetTransactionCount(address common.Address, blockNum Bloc
// Get nonce (sequence) from account
from := sdk.AccAddress(address.Bytes())
authclient.Codec = codec.NewAppCodec(ctx.Codec)
accRet := authtypes.NewAccountRetriever(authclient.Codec, ctx)
accRet := authtypes.NewAccountRetriever(ctx)
err := accRet.EnsureExists(from)
if err != nil {
@@ -524,7 +520,7 @@ func (e *PublicEthAPI) doCall(
}
var simResponse sdk.SimulationResponse
if err := jsonpb.Unmarshal(strings.NewReader(string(res)), &simResponse); err != nil {
if err := ctx.Codec.UnmarshalBinaryBare(res, &simResponse); err != nil {
return nil, err
}
@@ -625,7 +621,8 @@ type Transaction struct {
func bytesToEthTx(cliCtx context.CLIContext, bz []byte) (*evmtypes.MsgEthereumTx, error) {
var stdTx sdk.Tx
err := cliCtx.Codec.UnmarshalBinaryBare(bz, &stdTx)
// TODO: switch to UnmarshalBinaryBare on SDK v0.40.0
err := cliCtx.Codec.UnmarshalBinaryLengthPrefixed(bz, &stdTx)
if err != nil {
return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error())
}
@@ -932,8 +929,7 @@ func (e *PublicEthAPI) generateFromArgs(args params.SendTxArgs) (*evmtypes.MsgEt
if args.Nonce == nil {
// Get nonce (sequence) from account
from := sdk.AccAddress(args.From.Bytes())
authclient.Codec = codec.NewAppCodec(e.cliCtx.Codec)
accRet := authtypes.NewAccountRetriever(authclient.Codec, e.cliCtx)
accRet := authtypes.NewAccountRetriever(e.cliCtx)
err = accRet.EnsureExists(from)
if err != nil {
+6 -6
View File
@@ -11,7 +11,7 @@ import (
sdkcontext "github.com/cosmos/cosmos-sdk/client/context"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
"github.com/cosmos/cosmos-sdk/crypto/keys"
sdk "github.com/cosmos/cosmos-sdk/types"
emintcrypto "github.com/cosmos/ethermint/crypto"
params "github.com/cosmos/ethermint/rpc/args"
@@ -29,7 +29,7 @@ type PersonalEthAPI struct {
ethAPI *PublicEthAPI
nonceLock *AddrLocker
keys []emintcrypto.PrivKeySecp256k1
keyInfos []keyring.Info
keyInfos []keys.Info
keybaseLock sync.Mutex
}
@@ -51,12 +51,12 @@ func NewPersonalEthAPI(cliCtx sdkcontext.CLIContext, ethAPI *PublicEthAPI, nonce
return api
}
func (e *PersonalEthAPI) getKeybaseInfo() ([]keyring.Info, error) {
func (e *PersonalEthAPI) getKeybaseInfo() ([]keys.Info, error) {
e.keybaseLock.Lock()
defer e.keybaseLock.Unlock()
if e.cliCtx.Keybase == nil {
keybase, err := keyring.NewKeyring(
keybase, err := keys.NewKeyring(
sdk.KeyringServiceName(),
viper.GetString(flags.FlagKeyringBackend),
viper.GetString(flags.FlagHome),
@@ -75,7 +75,7 @@ func (e *PersonalEthAPI) getKeybaseInfo() ([]keyring.Info, error) {
// ImportRawKey stores the given hex encoded ECDSA key into the key directory,
// encrypting it with the passphrase.
// Currently, this is not implemented since the feature is not supported by the keyring.
// Currently, this is not implemented since the feature is not supported by the keys.
func (e *PersonalEthAPI) ImportRawKey(privkey, password string) (common.Address, error) {
_, err := crypto.HexToECDSA(privkey)
if err != nil {
@@ -122,7 +122,7 @@ func (e *PersonalEthAPI) NewAccount(password string) (common.Address, error) {
}
name := "key_" + time.Now().UTC().Format(time.RFC3339)
info, _, err := e.cliCtx.Keybase.CreateMnemonic(name, keyring.English, password, emintcrypto.EthSecp256k1)
info, _, err := e.cliCtx.Keybase.CreateMnemonic(name, keys.English, password, emintcrypto.EthSecp256k1)
if err != nil {
return common.Address{}, err
}