From fad5424ed1ef09c32baa6b710acd02436b8bb236 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Federico=20Kunze=20K=C3=BCllmer?= <31522760+fedekunze@users.noreply.github.com> Date: Sat, 24 Jul 2021 04:46:13 -0400 Subject: [PATCH] keys: fix `secp256k1` key creation (#346) * keys: fix secp256k1 key creation * c++ --- CHANGELOG.md | 1 + Makefile | 4 +++- client/keys/{keysadd.go => add.go} | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) rename client/keys/{keysadd.go => add.go} (97%) diff --git a/CHANGELOG.md b/CHANGELOG.md index f0ed81a34b..895c2ef0b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -74,6 +74,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Bug Fixes +* (keys) [tharsis#346](https://github.com/tharsis/ethermint/pull/346) Fix `keys add` command with `--ledger` flag for the `secp256k1` signing algorithm. * (evm) [tharsis#291](https://github.com/tharsis/ethermint/pull/291) Use block proposer address (validator operator) for `COINBASE` opcode. * (rpc) [tharsis#81](https://github.com/tharsis/ethermint/pull/81) Fix transaction hashing and decoding on `eth_sendTransaction`. * (rpc) [tharsis#45](https://github.com/tharsis/ethermint/pull/45) Use `EmptyUncleHash` and `EmptyRootHash` for empty ethereum `Header` fields. diff --git a/Makefile b/Makefile index 47d496012d..539592e869 100755 --- a/Makefile +++ b/Makefile @@ -3,6 +3,7 @@ PACKAGES_NOSIMULATION=$(shell go list ./... | grep -v '/simulation') PACKAGES_SIMTEST=$(shell go list ./... | grep '/simulation') VERSION := $(shell echo $(shell git describe --always) | sed 's/^v//') +TMVERSION := $(shell go list -m github.com/tendermint/tendermint | sed 's:.* ::') COMMIT := $(shell git log -1 --format='%H') LEDGER_ENABLED ?= true BINDIR ?= $(GOPATH)/bin @@ -64,7 +65,8 @@ ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=ethermint \ -X github.com/cosmos/cosmos-sdk/version.AppName=$(ETHERMINT_BINARY) \ -X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \ -X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT) \ - -X "github.com/cosmos/cosmos-sdk/version.BuildTags=$(build_tags_comma_sep)" + -X "github.com/cosmos/cosmos-sdk/version.BuildTags=$(build_tags_comma_sep)" \ + -X github.com/tendermint/tendermint/version.TMCoreSemVer=$(TMVERSION) # DB backend selection ifeq (cleveldb,$(findstring cleveldb,$(COSMOS_BUILD_OPTIONS))) diff --git a/client/keys/keysadd.go b/client/keys/add.go similarity index 97% rename from client/keys/keysadd.go rename to client/keys/add.go index 9565ea1ff3..40eef62efe 100644 --- a/client/keys/keysadd.go +++ b/client/keys/add.go @@ -79,7 +79,7 @@ Example: f.Uint32(flagCoinType, sdk.GetConfig().GetCoinType(), "coin type number for HD derivation") f.Uint32(flagAccount, 0, "Account number for HD derivation") f.Uint32(flagIndex, 0, "Address index number for HD derivation") - f.String(flags.FlagKeyAlgorithm, string(hd.Secp256k1Type), "Key signing algorithm to generate keys for") + f.String(flags.FlagKeyAlgorithm, string(etherminthd.EthSecp256k1Type), "Key signing algorithm to generate keys for") return cmd } @@ -206,8 +206,8 @@ func RunAddCmd(ctx client.Context, cmd *cobra.Command, args []string, inBuf *buf // If we're using ledger, only thing we need is the path and the bech32 prefix. if useLedger { bech32PrefixAccAddr := sdk.GetConfig().GetBech32AccountAddrPrefix() - info, err := kb.SaveLedgerKey(name, etherminthd.EthSecp256k1, bech32PrefixAccAddr, coinType, account, index) + info, err := kb.SaveLedgerKey(name, algo, bech32PrefixAccAddr, coinType, account, index) if err != nil { return err }