Skip to content

Commit 05de813

Browse files
authored
Merge PR #3626: Release v0.31.2
2 parents af93506 + 639ea1e commit 05de813

27 files changed

+605
-212
lines changed

CHANGELOG.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,38 @@
11
# Changelog
22

3+
## 0.31.2
4+
5+
BREAKING CHANGES
6+
7+
* SDK
8+
* [\#3592](https://github.com/cosmos/cosmos-sdk/issues/3592) Drop deprecated keybase implementation's
9+
New constructor in favor of a new
10+
crypto/keys.New(string, string) implementation that
11+
returns a lazy keybase instance. Remove client.MockKeyBase,
12+
superseded by crypto/keys.NewInMemory()
13+
14+
IMPROVEMENTS
15+
16+
* SDK
17+
* [\#3604](https://github.com/cosmos/cosmos-sdk/pulls/3604) Improve SDK funds related error messages and allow for unicode in
18+
JSON ABCI log.
19+
20+
* Tendermint
21+
* [\#3563](https://github.com/cosmos/cosmos-sdk/3563) Update to Tendermint version `0.30.0-rc0`
22+
23+
24+
BUG FIXES
25+
26+
* Gaia
27+
* [\#3585] Fix setting the tx hash in `NewResponseFormatBroadcastTxCommit`.
28+
* [\#3585] Return an empty `TxResponse` when Tendermint returns an empty
29+
`ResultBroadcastTx`.
30+
31+
* SDK
32+
* [\#3582](https://github.com/cosmos/cosmos-sdk/pull/3582) Running `make test_unit` was failing due to a missing tag
33+
* [\#3617](https://github.com/cosmos/cosmos-sdk/pull/3582) Fix fee comparison when the required fees does not contain any denom
34+
present in the tx fees.
35+
336
## 0.31.0
437

538
BREAKING CHANGES

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ test_ledger:
151151
@go test -v `go list github.com/cosmos/cosmos-sdk/crypto` -tags='cgo ledger'
152152

153153
test_unit:
154-
@VERSION=$(VERSION) go test $(PACKAGES_NOSIMULATION) -tags='test_ledger_mock'
154+
@VERSION=$(VERSION) go test $(PACKAGES_NOSIMULATION) -tags='ledger test_ledger_mock'
155155

156156
test_race:
157157
@VERSION=$(VERSION) go test -race $(PACKAGES_NOSIMULATION)

PENDING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,4 @@ BUG FIXES
4848

4949
* SDK
5050

51-
* Tendermint
51+
* Tendermint

client/keys.go

Lines changed: 0 additions & 14 deletions
This file was deleted.

client/keys/add.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ the flag --nosort is set.
7777
cmd.Flags().Bool(flagNoBackup, false, "Don't print out seed phrase (if others are watching the terminal)")
7878
cmd.Flags().Bool(flagDryRun, false, "Perform action, but don't add key to local keystore")
7979
cmd.Flags().Uint32(flagAccount, 0, "Account number for HD derivation")
80-
cmd.Flags().Uint32(flagIndex, 0, "Index number for HD derivation")
80+
cmd.Flags().Uint32(flagIndex, 0, "Address index number for HD derivation")
8181
return cmd
8282
}
8383

@@ -104,7 +104,7 @@ func runAddCmd(_ *cobra.Command, args []string) error {
104104
if viper.GetBool(flagDryRun) {
105105
// we throw this away, so don't enforce args,
106106
// we want to get a new random seed phrase quickly
107-
kb = client.MockKeyBase()
107+
kb = keys.NewInMemory()
108108
encryptPassword = app.DefaultKeyPass
109109
} else {
110110
kb, err = NewKeyBaseFromHomeFlag()
@@ -309,7 +309,7 @@ func printCreate(info keys.Info, showMnemonic bool, mnemonic string) error {
309309

310310
// function to just create a new seed to display in the UI before actually persisting it in the keybase
311311
func generateMnemonic(algo keys.SigningAlgo) string {
312-
kb := client.MockKeyBase()
312+
kb := keys.NewInMemory()
313313
pass := app.DefaultKeyPass
314314
name := "inmemorykey"
315315
_, seed, _ := kb.CreateMnemonic(name, keys.English, pass, algo)

client/keys/add_ledger_test.go

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
//+build ledger,test_ledger_mock
2+
3+
package keys
4+
5+
import (
6+
"bufio"
7+
"strings"
8+
"testing"
9+
10+
"github.com/cosmos/cosmos-sdk/crypto/keys"
11+
sdk "github.com/cosmos/cosmos-sdk/types"
12+
13+
"github.com/spf13/viper"
14+
"github.com/tendermint/tendermint/libs/cli"
15+
16+
"github.com/cosmos/cosmos-sdk/tests"
17+
18+
"github.com/cosmos/cosmos-sdk/client"
19+
20+
"github.com/stretchr/testify/assert"
21+
)
22+
23+
func Test_runAddCmdLedger(t *testing.T) {
24+
cmd := addKeyCommand()
25+
assert.NotNil(t, cmd)
26+
27+
// Prepare a keybase
28+
kbHome, kbCleanUp := tests.NewTestCaseDir(t)
29+
assert.NotNil(t, kbHome)
30+
defer kbCleanUp()
31+
viper.Set(cli.HomeFlag, kbHome)
32+
viper.Set(client.FlagUseLedger, true)
33+
34+
/// Test Text
35+
viper.Set(cli.OutputFlag, OutputFormatText)
36+
// Now enter password
37+
cleanUp1 := client.OverrideStdin(bufio.NewReader(strings.NewReader("test1234\ntest1234\n")))
38+
defer cleanUp1()
39+
err := runAddCmd(cmd, []string{"keyname1"})
40+
assert.NoError(t, err)
41+
42+
// Now check that it has been stored properly
43+
kb, err := NewKeyBaseFromHomeFlag()
44+
assert.NoError(t, err)
45+
assert.NotNil(t, kb)
46+
key1, err := kb.Get("keyname1")
47+
assert.NoError(t, err)
48+
assert.NotNil(t, key1)
49+
50+
assert.Equal(t, "keyname1", key1.GetName())
51+
assert.Equal(t, keys.TypeLedger, key1.GetType())
52+
assert.Equal(t,
53+
"cosmospub1addwnpepqd87l8xhcnrrtzxnkql7k55ph8fr9jarf4hn6udwukfprlalu8lgw0urza0",
54+
sdk.MustBech32ifyAccPub(key1.GetPubKey()))
55+
}

client/keys/add_test.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ func Test_runAddCmdBasic(t *testing.T) {
2323
cmd := addKeyCommand()
2424
assert.NotNil(t, cmd)
2525

26-
// Missing input (enter password)
27-
err := runAddCmd(cmd, []string{"keyname"})
28-
assert.EqualError(t, err, "EOF")
29-
3026
// Prepare a keybase
3127
kbHome, kbCleanUp := tests.NewTestCaseDir(t)
3228
assert.NotNil(t, kbHome)
@@ -38,7 +34,7 @@ func Test_runAddCmdBasic(t *testing.T) {
3834
// Now enter password
3935
cleanUp1 := client.OverrideStdin(bufio.NewReader(strings.NewReader("test1234\ntest1234\n")))
4036
defer cleanUp1()
41-
err = runAddCmd(cmd, []string{"keyname1"})
37+
err := runAddCmd(cmd, []string{"keyname1"})
4238
assert.NoError(t, err)
4339

4440
/// Test Text - Replace? >> FAIL

client/keys/keys/keys.db/LOCK

Whitespace-only changes.

client/keys/utils.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@ import (
1414
sdk "github.com/cosmos/cosmos-sdk/types"
1515
)
1616

17-
// KeyDBName is the directory under root where we store the keys
17+
// available output formats.
1818
const (
19-
KeyDBName = "keys"
2019
OutputFormatText = "text"
2120
OutputFormatJSON = "json"
21+
22+
// defaultKeyDBName is the client's subdirectory where keys are stored.
23+
defaultKeyDBName = "keys"
2224
)
2325

2426
type bechKeyOutFn func(keyInfo keys.Info) (KeyOutput, error)
@@ -87,7 +89,7 @@ func NewKeyBaseFromDir(rootDir string) (keys.Keybase, error) {
8789
func NewInMemoryKeyBase() keys.Keybase { return keys.NewInMemory() }
8890

8991
func getLazyKeyBaseFromDir(rootDir string) (keys.Keybase, error) {
90-
return keys.NewLazyKeybase(KeyDBName, filepath.Join(rootDir, "keys")), nil
92+
return keys.New(defaultKeyDBName, filepath.Join(rootDir, "keys")), nil
9193
}
9294

9395
// create a list of KeyOutput in bech32 format

client/lcd/test_helpers.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,7 @@ func doTransferWithGas(
682682
) (res *http.Response, body string, receiveAddr sdk.AccAddress) {
683683

684684
// create receive address
685-
kb := client.MockKeyBase()
685+
kb := crkeys.NewInMemory()
686686

687687
receiveInfo, _, err := kb.CreateMnemonic(
688688
"receive_address", crkeys.English, gapp.DefaultKeyPass, crkeys.SigningAlgo("secp256k1"),
@@ -724,7 +724,7 @@ func doTransferWithGasAccAuto(
724724
) (res *http.Response, body string, receiveAddr sdk.AccAddress) {
725725

726726
// create receive address
727-
kb := client.MockKeyBase()
727+
kb := crkeys.NewInMemory()
728728

729729
receiveInfo, _, err := kb.CreateMnemonic(
730730
"receive_address", crkeys.English, gapp.DefaultKeyPass, crkeys.SigningAlgo("secp256k1"),

0 commit comments

Comments
 (0)