Skip to content

Commit 7c55f94

Browse files
authored
Merge branch 'master' into sahith/index-supply
2 parents a3559ce + 8106056 commit 7c55f94

File tree

87 files changed

+3504
-1152
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+3504
-1152
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ jobs:
201201
if: env.GIT_DIFF
202202
- name: test & coverage report creation
203203
run: |
204-
cat pkgs.txt.part.${{ matrix.part }} | xargs go test -mod=readonly -json -timeout 30m -race -tags='cgo ledger test_ledger_mock' > ${{ matrix.part }}-race-output.txt
204+
xargs --arg-file=pkgs.txt.part.${{ matrix.part }} go test -mod=readonly -json -timeout 30m -race -tags='cgo ledger test_ledger_mock' | tee ${{ matrix.part }}-race-output.txt
205205
if: env.GIT_DIFF
206206
- uses: actions/upload-artifact@v2
207207
with:

CHANGELOG.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
5151
* (x/distribution) [\#8473](https://github.com/cosmos/cosmos-sdk/pull/8473) On genesis init, if the distribution module account balance, coming from bank module state, does not match the one in distribution module state, the initialization will panic.
5252
* (client/keys) [\#8500](https://github.com/cosmos/cosmos-sdk/pull/8500) `InfoImporter` interface is removed from legacy keybase.
5353
* [\#8629](https://github.com/cosmos/cosmos-sdk/pull/8629) Deprecated `SetFullFundraiserPath` from `Config` in favor of `SetPurpose` and `SetCoinType`.
54+
* (x/upgrade) [\#8673](https://github.com/cosmos/cosmos-sdk/pull/8673) Remove IBC logic from x/upgrade. Deprecates IBC fields in an Upgrade Plan. IBC upgrade logic moved to 02-client and an IBC UpgradeProposal is added.
5455

5556
### State Machine Breaking
5657

@@ -65,11 +66,10 @@ Ref: https://keepachangelog.com/en/1.0.0/
6566

6667
* (x/bank) [\#8614](https://github.com/cosmos/cosmos-sdk/issues/8614) Add `Name` and `Symbol` fields to denom metadata
6768
* (x/auth) [\#8522](https://github.com/cosmos/cosmos-sdk/pull/8522) Allow to query all stored accounts
69+
* (x/ibc) [\#7949](https://github.com/cosmos/cosmos-sdk/issues/7949) Standardized channel `Acknowledgement` moved to its own file. Codec registration redundancy removed.
6870
* (crypto/types) [\#8600](https://github.com/cosmos/cosmos-sdk/pull/8600) `CompactBitArray`: optimize the `NumTrueBitsBefore` method and add an `Equal` method.
6971
* (store/cachekv), (x/bank/types) [\#8719](https://github.com/cosmos/cosmos-sdk/pull/8719) algorithmically fix pathologically slow code
7072

71-
72-
7373
### Bug Fixes
7474

7575
* (keyring) [#\8635](https://github.com/cosmos/cosmos-sdk/issues/8635) Remove hardcoded default passphrase value on `NewMnemonic`
@@ -78,6 +78,8 @@ Ref: https://keepachangelog.com/en/1.0.0/
7878
* (x/slashing) [\#8427](https://github.com/cosmos/cosmos-sdk/pull/8427) Fix query signing infos command
7979
* (server) [\#8399](https://github.com/cosmos/cosmos-sdk/pull/8399) fix gRPC-web flag default value
8080
* (server) [\#8641](https://github.com/cosmos/cosmos-sdk/pull/8641) Fix Tendermint and application configuration reading from file
81+
* (rest) [\#8730](https://github.com/cosmos/cosmos-sdk/pull/8730) Fix querying txs with multisigs on legacy REST endpoints.
82+
* (client/keys) [\#8639] (https://github.com/cosmos/cosmos-sdk/pull/8639) Fix keys migrate for mulitisig, offline, and ledger keys. The migrate command now takes a positional old_home_dir argument.
8183

8284
## [v0.41.3](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.41.3) - 2021-02-18
8385

Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ endif
4545
ifeq (cleveldb,$(findstring cleveldb,$(COSMOS_BUILD_OPTIONS)))
4646
build_tags += gcc
4747
endif
48-
build_tags += $(BUILD_TAGS)
49-
build_tags := $(strip $(build_tags))
5048

5149
whitespace :=
5250
whitespace += $(whitespace)
@@ -68,6 +66,7 @@ ifeq (cleveldb,$(findstring cleveldb,$(COSMOS_BUILD_OPTIONS)))
6866
endif
6967
ifeq (badgerdb,$(findstring badgerdb,$(COSMOS_BUILD_OPTIONS)))
7068
ldflags += -X github.com/cosmos/cosmos-sdk/types.DBBackend=badgerdb
69+
BUILD_TAGS += badgerdb
7170
endif
7271
# handle rocksdb
7372
ifeq (rocksdb,$(findstring rocksdb,$(COSMOS_BUILD_OPTIONS)))
@@ -87,6 +86,9 @@ endif
8786
ldflags += $(LDFLAGS)
8887
ldflags := $(strip $(ldflags))
8988

89+
build_tags += $(BUILD_TAGS)
90+
build_tags := $(strip $(build_tags))
91+
9092
BUILD_FLAGS := -tags "$(build_tags)" -ldflags '$(ldflags)'
9193
# check for nostrip option
9294
ifeq (,$(findstring nostrip,$(COSMOS_BUILD_OPTIONS)))

client/keys/migrate.go

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,18 @@ const migratePassphrase = "NOOP_PASSPHRASE"
2222
// MigrateCommand migrates key information from legacy keybase to OS secret store.
2323
func MigrateCommand() *cobra.Command {
2424
cmd := &cobra.Command{
25-
Use: "migrate",
25+
Use: "migrate <old_home_dir>",
2626
Short: "Migrate keys from the legacy (db-based) Keybase",
27-
Long: `Migrate key information from the legacy (db-based) Keybase to the new keyring-based Keybase.
27+
Long: `Migrate key information from the legacy (db-based) Keybase to the new keyring-based Keyring.
28+
The legacy Keybase used to persist keys in a LevelDB database stored in a 'keys' sub-directory of
29+
the old client application's home directory, e.g. $HOME/.gaiacli/keys/.
2830
For each key material entry, the command will prompt if the key should be skipped or not. If the key
2931
is not to be skipped, the passphrase must be entered. The key will only be migrated if the passphrase
3032
is correct. Otherwise, the command will exit and migration must be repeated.
3133
3234
It is recommended to run in 'dry-run' mode first to verify all key migration material.
3335
`,
34-
Args: cobra.ExactArgs(0),
36+
Args: cobra.ExactArgs(1),
3537
RunE: runMigrateCmd,
3638
}
3739

@@ -44,12 +46,12 @@ func runMigrateCmd(cmd *cobra.Command, args []string) error {
4446

4547
// instantiate legacy keybase
4648
var legacyKb keyring.LegacyKeybase
47-
legacyKb, err := NewLegacyKeyBaseFromDir(rootDir)
49+
legacyKb, err := NewLegacyKeyBaseFromDir(args[0])
4850
if err != nil {
4951
return err
5052
}
5153

52-
defer legacyKb.Close()
54+
defer func() { _ = legacyKb.Close() }()
5355

5456
// fetch list of keys from legacy keybase
5557
oldKeys, err := legacyKb.List()
@@ -71,7 +73,7 @@ func runMigrateCmd(cmd *cobra.Command, args []string) error {
7173
return errors.Wrap(err, "failed to create temporary directory for dryrun migration")
7274
}
7375

74-
defer os.RemoveAll(tmpDir)
76+
defer func() { _ = os.RemoveAll(tmpDir) }()
7577

7678
migrator, err = keyring.New(keyringServiceName, keyring.BackendTest, tmpDir, buf)
7779
} else {
@@ -91,11 +93,11 @@ func runMigrateCmd(cmd *cobra.Command, args []string) error {
9193
return nil
9294
}
9395

94-
for _, key := range oldKeys {
95-
keyName := key.GetName()
96-
keyType := key.GetType()
96+
for _, oldInfo := range oldKeys {
97+
keyName := oldInfo.GetName()
98+
keyType := oldInfo.GetType()
9799

98-
cmd.PrintErrf("Migrating key: '%s (%s)' ...\n", key.GetName(), keyType)
100+
cmd.PrintErrf("Migrating key: '%s (%s)' ...\n", keyName, keyType)
99101

100102
// allow user to skip migrating specific keys
101103
ok, err := input.GetConfirmation("Skip key migration?", buf, cmd.ErrOrStderr())
@@ -106,13 +108,15 @@ func runMigrateCmd(cmd *cobra.Command, args []string) error {
106108
continue
107109
}
108110

111+
// TypeLocal needs an additional step to ask password.
112+
// The other keyring types are handled by ImportInfo.
109113
if keyType != keyring.TypeLocal {
110-
pubkeyArmor, err := legacyKb.ExportPubKey(keyName)
111-
if err != nil {
112-
return err
114+
infoImporter, ok := migrator.(keyring.LegacyInfoImporter)
115+
if !ok {
116+
return fmt.Errorf("the Keyring implementation does not support import operations of Info types")
113117
}
114118

115-
if err := migrator.ImportPubKey(keyName, pubkeyArmor); err != nil {
119+
if err = infoImporter.ImportInfo(oldInfo); err != nil {
116120
return err
117121
}
118122

@@ -135,8 +139,9 @@ func runMigrateCmd(cmd *cobra.Command, args []string) error {
135139
if err := migrator.ImportPrivKey(keyName, armoredPriv, migratePassphrase); err != nil {
136140
return err
137141
}
142+
138143
}
139-
cmd.Print("Migration Complete")
144+
cmd.PrintErrln("Migration complete.")
140145

141146
return err
142147
}

client/keys/migrate_test.go

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,44 +5,38 @@ import (
55
"fmt"
66
"testing"
77

8+
"github.com/cosmos/cosmos-sdk/client"
9+
10+
"github.com/stretchr/testify/require"
11+
812
"github.com/otiai10/copy"
913
"github.com/stretchr/testify/assert"
10-
"github.com/tendermint/tendermint/libs/cli"
1114

12-
"github.com/cosmos/cosmos-sdk/client"
1315
"github.com/cosmos/cosmos-sdk/client/flags"
1416
"github.com/cosmos/cosmos-sdk/crypto/keyring"
1517
"github.com/cosmos/cosmos-sdk/testutil"
1618
)
1719

1820
func Test_runMigrateCmd(t *testing.T) {
19-
cmd := AddKeyCommand()
20-
_ = testutil.ApplyMockIODiscardOutErr(cmd)
21-
cmd.Flags().AddFlagSet(Commands("home").PersistentFlags())
22-
2321
kbHome := t.TempDir()
24-
2522
clientCtx := client.Context{}.WithKeyringDir(kbHome)
2623
ctx := context.WithValue(context.Background(), client.ClientContextKey, &clientCtx)
2724

28-
copy.Copy("testdata", kbHome)
29-
cmd.SetArgs([]string{
30-
"keyname1",
31-
fmt.Sprintf("--%s=%s", cli.OutputFlag, OutputFormatText),
32-
fmt.Sprintf("--%s=%s", flags.FlagKeyringBackend, keyring.BackendTest),
33-
})
34-
assert.NoError(t, cmd.ExecuteContext(ctx))
25+
require.NoError(t, copy.Copy("testdata", kbHome))
3526

36-
cmd = MigrateCommand()
27+
cmd := MigrateCommand()
3728
cmd.Flags().AddFlagSet(Commands("home").PersistentFlags())
38-
mockIn := testutil.ApplyMockIODiscardOutErr(cmd)
29+
//mockIn := testutil.ApplyMockIODiscardOutErr(cmd)
30+
mockIn, mockOut := testutil.ApplyMockIO(cmd)
3931

4032
cmd.SetArgs([]string{
41-
fmt.Sprintf("--%s=%s", flags.FlagHome, kbHome),
33+
kbHome,
34+
//fmt.Sprintf("--%s=%s", flags.FlagHome, kbHome),
4235
fmt.Sprintf("--%s=true", flags.FlagDryRun),
4336
fmt.Sprintf("--%s=%s", flags.FlagKeyringBackend, keyring.BackendTest),
4437
})
4538

46-
mockIn.Reset("test1234\ntest1234\n")
39+
mockIn.Reset("\n12345678\n\n\n\n\n")
40+
t.Log(mockOut.String())
4741
assert.NoError(t, cmd.ExecuteContext(ctx))
4842
}
825 Bytes
Binary file not shown.
244 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
MANIFEST-000005
1+
MANIFEST-000167
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
MANIFEST-000003
1+
MANIFEST-000165

0 commit comments

Comments
 (0)