Skip to content

Commit a6ff246

Browse files
fmorencydependabot[bot]github-actions[bot]julienrbrtmergify[bot]
authored
chore: release 0.50.8 (#2)
* build(deps): Bump github.com/cosmos/gogoproto from 1.4.12 to 1.5.0 (cosmos#20567) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * refactor(x/authz,x/feegrant): provide updated keeper in depinject (cosmos#20590) * docs: Update high level overview and introduction (backport cosmos#20535) (cosmos#20627) Co-authored-by: samricotta <[email protected]> Co-authored-by: marbar3778 <[email protected]> * fix: Properly parse json in the wait-tx command. (backport cosmos#20631) (cosmos#20660) Co-authored-by: Daniel Wedul <[email protected]> Co-authored-by: marbar3778 <[email protected]> * docs: remove Ineffective code block (backport cosmos#20703) (cosmos#20711) * feat(client): Add flag & reading mnemonic from file (backport cosmos#20690) (cosmos#20712) Co-authored-by: Hieu Vu <[email protected]> Co-authored-by: marbar3778 <[email protected]> * fix: nested multisig signatures using CLI (backport cosmos#20438) (cosmos#20692) Co-authored-by: Facundo Medica <[email protected]> Co-authored-by: marbar3778 <[email protected]> Co-authored-by: Facundo <[email protected]> * feat(client/v2): get keyring from context (backport cosmos#19646) (cosmos#20727) Co-authored-by: Julien Robert <[email protected]> * docs(x/group): orm codespace comment (backport cosmos#20749) (cosmos#20751) * feat: parse home flag earlier (backport cosmos#20771) (cosmos#20777) Co-authored-by: Julien Robert <[email protected]> * build(deps): Bump github.com/cometbft/cometbft from 0.38.7 to 0.38.8 (cosmos#20805) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * build(deps): Bump github.com/cometbft/cometbft from 0.38.8 to 0.38.9 (cosmos#20836) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * fix(simulation): fix the problem of `validator set is empty after InitGenesis` in simulation test (backport cosmos#18196) (cosmos#20897) Co-authored-by: Chenqun Lu <[email protected]> Co-authored-by: Julien Robert <[email protected]> * fix(simulation): Fix all problems `make test-sim-custom-genesis-fast` for simulation test. (backport cosmos#17911) (cosmos#20909) Co-authored-by: Chenqun Lu <[email protected]> Co-authored-by: Julien Robert <[email protected]> * chore: prepare v0.50.8 (cosmos#20910) --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Julien Robert <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: samricotta <[email protected]> Co-authored-by: marbar3778 <[email protected]> Co-authored-by: Daniel Wedul <[email protected]> Co-authored-by: Hieu Vu <[email protected]> Co-authored-by: Facundo Medica <[email protected]> Co-authored-by: Facundo <[email protected]> Co-authored-by: Chenqun Lu <[email protected]>
1 parent 779cc29 commit a6ff246

Some content is hidden

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

97 files changed

+973
-599
lines changed

.github/workflows/test.yml

-8
Original file line numberDiff line numberDiff line change
@@ -388,14 +388,6 @@ jobs:
388388
run: |
389389
cd simapp
390390
go test -mod=readonly -timeout 30m -tags='app_v1 norace ledger test_ledger_mock rocksdb_build' ./...
391-
- name: sonarcloud
392-
if: ${{ env.GIT_DIFF && !github.event.pull_request.draft && env.SONAR_TOKEN != null }}
393-
uses: SonarSource/sonarcloud-github-action@master
394-
env:
395-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
396-
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
397-
with:
398-
projectBaseDir: simapp/
399391
400392
test-collections:
401393
runs-on: ubuntu-latest

CHANGELOG.md

+17
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,23 @@ Ref: https://keepachangelog.com/en/1.0.0/
3838

3939
## [Unreleased]
4040

41+
## [v0.50.8](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.50.8) - 2024-07-15
42+
43+
## Features
44+
45+
* (client) [#20690](https://github.com/cosmos/cosmos-sdk/pull/20690) Import mnemonic from file
46+
47+
## Improvements
48+
49+
* (x/authz,x/feegrant) [#20590](https://github.com/cosmos/cosmos-sdk/pull/20590) Provide updated keeper in depinject for authz and feegrant modules.
50+
* [#20631](https://github.com/cosmos/cosmos-sdk/pull/20631) Fix json parsing in the wait-tx command.
51+
* (x/auth) [#20438](https://github.com/cosmos/cosmos-sdk/pull/20438) Add `--skip-signature-verification` flag to multisign command to allow nested multisigs.
52+
53+
## Bug Fixes
54+
55+
* (simulation) [#17911](https://github.com/cosmos/cosmos-sdk/pull/17911) Fix all problems with executing command `make test-sim-custom-genesis-fast` for simulation test.
56+
* (simulation) [#18196](https://github.com/cosmos/cosmos-sdk/pull/18196) Fix the problem of `validator set is empty after InitGenesis` in simulation test.
57+
4158
## [v0.50.7](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.50.7) - 2024-06-04
4259

4360
### Improvements

Makefile

+5-5
Original file line numberDiff line numberDiff line change
@@ -277,9 +277,9 @@ test-sim-nondeterminism-streaming:
277277

278278
test-sim-custom-genesis-fast:
279279
@echo "Running custom genesis simulation..."
280-
@echo "By default, ${HOME}/.gaiad/config/genesis.json will be used."
281-
@cd ${CURRENT_DIR}/simapp && go test -mod=readonly -run TestFullAppSimulation -Genesis=${HOME}/.gaiad/config/genesis.json \
282-
-Enabled=true -NumBlocks=100 -BlockSize=200 -Commit=true -Seed=99 -Period=5 -v -timeout 24h
280+
@echo "By default, ${HOME}/.simapp/config/genesis.json will be used."
281+
@cd ${CURRENT_DIR}/simapp && go test -mod=readonly -run TestFullAppSimulation -Genesis=${HOME}/.simapp/config/genesis.json \
282+
-Enabled=true -NumBlocks=100 -BlockSize=200 -Commit=true -Seed=99 -Period=5 -SigverifyTx=false -v -timeout 24h
283283

284284
test-sim-import-export: runsim
285285
@echo "Running application import/export simulation. This may take several minutes..."
@@ -291,8 +291,8 @@ test-sim-after-import: runsim
291291

292292
test-sim-custom-genesis-multi-seed: runsim
293293
@echo "Running multi-seed custom genesis simulation..."
294-
@echo "By default, ${HOME}/.gaiad/config/genesis.json will be used."
295-
@cd ${CURRENT_DIR}/simapp && $(BINDIR)/runsim -Genesis=${HOME}/.gaiad/config/genesis.json -SimAppPkg=. -ExitOnFail 400 5 TestFullAppSimulation
294+
@echo "By default, ${HOME}/.simapp/config/genesis.json will be used."
295+
@cd ${CURRENT_DIR}/simapp && $(BINDIR)/runsim -Genesis=${HOME}/.simapp/config/genesis.json -SigverifyTx=false -SimAppPkg=. -ExitOnFail 400 5 TestFullAppSimulation
296296

297297
test-sim-multi-seed-long: runsim
298298
@echo "Running long multi-seed application simulation. This may take awhile!"

RELEASE_NOTES.md

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Cosmos SDK v0.50.7 Release Notes
1+
# Cosmos SDK v0.50.8 Release Notes
22

33
💬 [**Release Discussion**](https://github.com/orgs/cosmos/discussions/58)
44

@@ -8,14 +8,12 @@ For this month patch release of the v0.50.x line, a few improvements were added
88

99
Notably, we added and fixed the following:
1010

11-
* Add extra checks in x/consensus `MsgUpdateParams` to prevent footguns when updating the consensus parameters.
12-
* Forgetting a field in a x/consensus parameter change gov proposal could lead to a chain halt.
13-
* The fix is in theory consensus breaking, but in practice, it is only a footgun prevention (the path only triggers if the proposal was executed and was invalid). Please ensure that all validators are on v0.50.7 before the execution of a `x/consensus` params update proposal.
14-
* Remove txs from the mempool when they fail in RecheckTX
11+
* Allow to import private key from mnemonic file using `<appd> keys add testing --recover --source ./mnemonic.txt`
12+
* Fixed the json parsing in `simd q wait-tx`
1513

1614
## 📝 Changelog
1715

18-
Check out the [changelog](https://github.com/cosmos/cosmos-sdk/blob/v0.50.7/CHANGELOG.md) for an exhaustive list of changes, or [compare changes](https://github.com/cosmos/cosmos-sdk/compare/release/v0.50.6...v0.50.7) from the last release.
16+
Check out the [changelog](https://github.com/cosmos/cosmos-sdk/blob/v0.50.8/CHANGELOG.md) for an exhaustive list of changes, or [compare changes](https://github.com/cosmos/cosmos-sdk/compare/v0.50.7...v0.50.8) from the last release.
1917

2018
Refer to the [upgrading guide](https://github.com/cosmos/cosmos-sdk/blob/release/v0.50.x/UPGRADING.md) when migrating from `v0.47.x` to `v0.50.1`.
2119
Note, that the next SDK release, v0.51, will not include `x/params` migration, when migrating from < v0.47, v0.50.x **or** v0.47.x, is a mandatory migration.

api/go.mod

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ go 1.20
44

55
require (
66
github.com/cosmos/cosmos-proto v1.0.0-beta.5
7-
github.com/cosmos/gogoproto v1.4.12
8-
google.golang.org/genproto/googleapis/api v0.0.0-20231120223509-83a465c0220f
9-
google.golang.org/grpc v1.61.1
7+
github.com/cosmos/gogoproto v1.5.0
8+
google.golang.org/genproto/googleapis/api v0.0.0-20240123012728-ef4313101c80
9+
google.golang.org/grpc v1.62.1
1010
google.golang.org/protobuf v1.33.0
1111
)
1212

@@ -17,6 +17,6 @@ require (
1717
golang.org/x/net v0.20.0 // indirect
1818
golang.org/x/sys v0.16.0 // indirect
1919
golang.org/x/text v0.14.0 // indirect
20-
google.golang.org/genproto v0.0.0-20231211222908-989df2bf70f3 // indirect
21-
google.golang.org/genproto/googleapis/rpc v0.0.0-20231212172506-995d672761c0 // indirect
20+
google.golang.org/genproto v0.0.0-20240123012728-ef4313101c80 // indirect
21+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 // indirect
2222
)

api/go.sum

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA=
22
github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec=
3-
github.com/cosmos/gogoproto v1.4.12 h1:vB6Lbe/rtnYGjQuFxkPiPYiCybqFT8QvLipDZP8JpFE=
4-
github.com/cosmos/gogoproto v1.4.12/go.mod h1:LnZob1bXRdUoqMMtwYlcR3wjiElmlC+FkjaZRv1/eLY=
3+
github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o=
4+
github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I=
55
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
66
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
77
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
@@ -14,13 +14,13 @@ golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU=
1414
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
1515
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
1616
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
17-
google.golang.org/genproto v0.0.0-20231211222908-989df2bf70f3 h1:1hfbdAfFbkmpg41000wDVqr7jUpK/Yo+LPnIxxGzmkg=
18-
google.golang.org/genproto v0.0.0-20231211222908-989df2bf70f3/go.mod h1:5RBcpGRxr25RbDzY5w+dmaqpSEvl8Gwl1x2CICf60ic=
19-
google.golang.org/genproto/googleapis/api v0.0.0-20231120223509-83a465c0220f h1:2yNACc1O40tTnrsbk9Cv6oxiW8pxI/pXj0wRtdlYmgY=
20-
google.golang.org/genproto/googleapis/api v0.0.0-20231120223509-83a465c0220f/go.mod h1:Uy9bTZJqmfrw2rIBxgGLnamc78euZULUBrLZ9XTITKI=
21-
google.golang.org/genproto/googleapis/rpc v0.0.0-20231212172506-995d672761c0 h1:/jFB8jK5R3Sq3i/lmeZO0cATSzFfZaJq1J2Euan3XKU=
22-
google.golang.org/genproto/googleapis/rpc v0.0.0-20231212172506-995d672761c0/go.mod h1:FUoWkonphQm3RhTS+kOEhF8h0iDpm4tdXolVCeZ9KKA=
23-
google.golang.org/grpc v1.61.1 h1:kLAiWrZs7YeDM6MumDe7m3y4aM6wacLzM1Y/wiLP9XY=
24-
google.golang.org/grpc v1.61.1/go.mod h1:VUbo7IFqmF1QtCAstipjG0GIoq49KvMe9+h1jFLBNJs=
17+
google.golang.org/genproto v0.0.0-20240123012728-ef4313101c80 h1:KAeGQVN3M9nD0/bQXnr/ClcEMJ968gUXJQ9pwfSynuQ=
18+
google.golang.org/genproto v0.0.0-20240123012728-ef4313101c80/go.mod h1:cc8bqMqtv9gMOr0zHg2Vzff5ULhhL2IXP4sbcn32Dro=
19+
google.golang.org/genproto/googleapis/api v0.0.0-20240123012728-ef4313101c80 h1:Lj5rbfG876hIAYFjqiJnPHfhXbv+nzTWfm04Fg/XSVU=
20+
google.golang.org/genproto/googleapis/api v0.0.0-20240123012728-ef4313101c80/go.mod h1:4jWUdICTdgc3Ibxmr8nAJiiLHwQBY0UI0XZcEMaFKaA=
21+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 h1:AjyfHzEPEFp/NpvfN5g+KDla3EMojjhRVZc1i7cj+oM=
22+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80/go.mod h1:PAREbraiVEVGVdTZsVWjSbbTtSyGbAgIIvni8a8CD5s=
23+
google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk=
24+
google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE=
2525
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
2626
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=

baseapp/baseapp.go

+4
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ type BaseApp struct {
9191
addrPeerFilter sdk.PeerFilter // filter peers by address and port
9292
idPeerFilter sdk.PeerFilter // filter peers by node ID
9393
fauxMerkleMode bool // if true, IAVL MountStores uses MountStoresDB for simulation speed.
94+
sigverifyTx bool // in the simulation test, since the account does not have a private key, we have to ignore the tx sigverify.
9495

9596
// manages snapshots, i.e. dumps of app state at certain intervals
9697
snapshotManager *snapshots.Manager
@@ -211,6 +212,7 @@ func NewBaseApp(
211212
msgServiceRouter: NewMsgServiceRouter(),
212213
txDecoder: txDecoder,
213214
fauxMerkleMode: false,
215+
sigverifyTx: true,
214216
queryGasLimit: math.MaxUint64,
215217
}
216218

@@ -667,6 +669,8 @@ func (app *BaseApp) getContextForTx(mode execMode, txBytes []byte) sdk.Context {
667669
WithGasMeter(storetypes.NewInfiniteGasMeter())
668670
// WithVoteInfos(app.voteInfos) // TODO: identify if this is needed
669671

672+
ctx = ctx.WithIsSigverifyTx(app.sigverifyTx)
673+
670674
ctx = ctx.WithConsensusParams(app.GetConsensusParams(ctx))
671675

672676
if mode == execModeReCheck {

baseapp/options.go

+5
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,11 @@ func (app *BaseApp) SetFauxMerkleMode() {
260260
app.fauxMerkleMode = true
261261
}
262262

263+
// SetNotSigverify during simulation testing, transaction signature verification needs to be ignored.
264+
func (app *BaseApp) SetNotSigverifyTx() {
265+
app.sigverifyTx = false
266+
}
267+
263268
// SetCommitMultiStoreTracer sets the store tracer on the BaseApp's underlying
264269
// CommitMultiStore.
265270
func (app *BaseApp) SetCommitMultiStoreTracer(w io.Writer) {

baseapp/test_helpers.go

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ func (app *BaseApp) SimDeliver(txEncoder sdk.TxEncoder, tx sdk.Tx) (sdk.GasInfo,
3535
if err != nil {
3636
return sdk.GasInfo{}, nil, errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "%s", err)
3737
}
38+
3839
gasInfo, result, _, err := app.runTx(execModeFinalize, bz)
3940
return gasInfo, result, err
4041
}

client/keys/add.go

+44-6
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import (
77
"encoding/json"
88
"errors"
99
"fmt"
10+
"io"
11+
"os"
1012
"sort"
1113

1214
"github.com/cosmos/go-bip39"
@@ -35,6 +37,7 @@ const (
3537
flagNoSort = "nosort"
3638
flagHDPath = "hd-path"
3739
flagPubKeyBase64 = "pubkey-base64"
40+
flagMnemonicSrc = "source"
3841

3942
// DefaultKeyPass contains the default key password for genesis transactions
4043
DefaultKeyPass = "12345678"
@@ -57,6 +60,11 @@ local keystore.
5760
Use the --pubkey flag to add arbitrary public keys to the keystore for constructing
5861
multisig transactions.
5962
63+
Use the --source flag to import mnemonic from a file in recover or interactive mode.
64+
Example:
65+
66+
keys add testing --recover --source ./mnemonic.txt
67+
6068
You can create and store a multisig key by passing the list of key names stored in a keyring
6169
and the minimum number of signatures required through --multisig-threshold. The keys are
6270
sorted by address, unless the flag --nosort is set.
@@ -83,6 +91,7 @@ Example:
8391
f.Uint32(flagAccount, 0, "Account number for HD derivation (less than equal 2147483647)")
8492
f.Uint32(flagIndex, 0, "Address index number for HD derivation (less than equal 2147483647)")
8593
f.String(flags.FlagKeyType, string(hd.Secp256k1Type), "Key signing algorithm to generate keys for")
94+
f.String(flagMnemonicSrc, "", "Import mnemonic from a file (only usable when recover or interactive is passed)")
8695

8796
// support old flags name for backwards compatibility
8897
f.SetNormalizeFunc(func(f *pflag.FlagSet, name string) pflag.NormalizedName {
@@ -270,19 +279,34 @@ func runAddCmd(ctx client.Context, cmd *cobra.Command, args []string, inBuf *buf
270279
var mnemonic, bip39Passphrase string
271280

272281
recoverFlag, _ := cmd.Flags().GetBool(flagRecover)
282+
mnemonicSrc, _ := cmd.Flags().GetString(flagMnemonicSrc)
273283
if recoverFlag {
274-
mnemonic, err = input.GetString("Enter your bip39 mnemonic", inBuf)
275-
if err != nil {
276-
return err
284+
if mnemonicSrc != "" {
285+
mnemonic, err = readMnemonicFromFile(mnemonicSrc)
286+
if err != nil {
287+
return err
288+
}
289+
} else {
290+
mnemonic, err = input.GetString("Enter your bip39 mnemonic", inBuf)
291+
if err != nil {
292+
return err
293+
}
277294
}
278295

279296
if !bip39.IsMnemonicValid(mnemonic) {
280297
return errors.New("invalid mnemonic")
281298
}
282299
} else if interactive {
283-
mnemonic, err = input.GetString("Enter your bip39 mnemonic, or hit enter to generate one.", inBuf)
284-
if err != nil {
285-
return err
300+
if mnemonicSrc != "" {
301+
mnemonic, err = readMnemonicFromFile(mnemonicSrc)
302+
if err != nil {
303+
return err
304+
}
305+
} else {
306+
mnemonic, err = input.GetString("Enter your bip39 mnemonic, or hit enter to generate one.", inBuf)
307+
if err != nil {
308+
return err
309+
}
286310
}
287311

288312
if !bip39.IsMnemonicValid(mnemonic) && mnemonic != "" {
@@ -377,3 +401,17 @@ func printCreate(cmd *cobra.Command, k *keyring.Record, showMnemonic bool, mnemo
377401

378402
return nil
379403
}
404+
405+
func readMnemonicFromFile(filePath string) (string, error) {
406+
file, err := os.Open(filePath)
407+
if err != nil {
408+
return "", err
409+
}
410+
defer file.Close()
411+
412+
bz, err := io.ReadAll(file)
413+
if err != nil {
414+
return "", err
415+
}
416+
return string(bz), nil
417+
}

client/keys/output_test.go

+24
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,30 @@ func TestBech32KeysOutput(t *testing.T) {
4444
require.Equal(t, "{Name:multisig Type:multi Address:cosmos1nf8lf6n4wa43rzmdzwe6hkrnw5guekhqt595cw PubKey:{\"@type\":\"/cosmos.crypto.multisig.LegacyAminoPubKey\",\"threshold\":1,\"public_keys\":[{\"@type\":\"/cosmos.crypto.secp256k1.PubKey\",\"key\":\"AurroA7jvfPd1AadmmOvWM2rJSwipXfRf8yD6pLbA2DJ\"}]} Mnemonic:}", fmt.Sprintf("%+v", out))
4545
}
4646

47+
// TestBech32KeysOutputNestedMsig tests that the output of a nested multisig key is correct
48+
func TestBech32KeysOutputNestedMsig(t *testing.T) {
49+
sk := secp256k1.PrivKey{Key: []byte{154, 49, 3, 117, 55, 232, 249, 20, 205, 216, 102, 7, 136, 72, 177, 2, 131, 202, 234, 81, 31, 208, 46, 244, 179, 192, 167, 163, 142, 117, 246, 13}}
50+
tmpKey := sk.PubKey()
51+
nestedMultiSig := kmultisig.NewLegacyAminoPubKey(1, []types.PubKey{tmpKey})
52+
multisigPk := kmultisig.NewLegacyAminoPubKey(2, []types.PubKey{tmpKey, nestedMultiSig})
53+
k, err := keyring.NewMultiRecord("multisig", multisigPk)
54+
require.NotNil(t, k)
55+
require.NoError(t, err)
56+
57+
pubKey, err := k.GetPubKey()
58+
require.NoError(t, err)
59+
60+
accAddr := sdk.AccAddress(pubKey.Address())
61+
expectedOutput, err := NewKeyOutput(k.Name, k.GetType(), accAddr, multisigPk)
62+
require.NoError(t, err)
63+
64+
out, err := MkAccKeyOutput(k)
65+
require.NoError(t, err)
66+
67+
require.Equal(t, expectedOutput, out)
68+
require.Equal(t, "{Name:multisig Type:multi Address:cosmos1nffp6v2j7wva4y4975exlrv8x5vh39axxt3swz PubKey:{\"@type\":\"/cosmos.crypto.multisig.LegacyAminoPubKey\",\"threshold\":2,\"public_keys\":[{\"@type\":\"/cosmos.crypto.secp256k1.PubKey\",\"key\":\"AurroA7jvfPd1AadmmOvWM2rJSwipXfRf8yD6pLbA2DJ\"},{\"@type\":\"/cosmos.crypto.multisig.LegacyAminoPubKey\",\"threshold\":1,\"public_keys\":[{\"@type\":\"/cosmos.crypto.secp256k1.PubKey\",\"key\":\"AurroA7jvfPd1AadmmOvWM2rJSwipXfRf8yD6pLbA2DJ\"}]}]} Mnemonic:}", fmt.Sprintf("%+v", out))
69+
}
70+
4771
func TestProtoMarshalJSON(t *testing.T) {
4872
require := require.New(t)
4973
pubkeys := generatePubKeys(3)

client/rpc/tx.go

+14-6
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,10 @@ func WaitTxCmd() *cobra.Command {
102102
Short: "Wait for a transaction to be included in a block",
103103
Long: `Subscribes to a CometBFT WebSocket connection and waits for a transaction event with the given hash.`,
104104
Example: fmt.Sprintf(`By providing the transaction hash:
105-
$ %[1]sd q wait-tx [hash]
105+
$ %[1]s q wait-tx [hash]
106106
107107
Or, by piping a "tx" command:
108-
$ %[1]sd tx [flags] | %[1]sd q wait-tx
108+
$ %[1]s tx [flags] | %[1]s q wait-tx
109109
`, version.AppName),
110110
Args: cobra.MaximumNArgs(1),
111111
RunE: func(cmd *cobra.Command, args []string) error {
@@ -200,13 +200,21 @@ $ %[1]sd tx [flags] | %[1]sd q wait-tx
200200
}
201201

202202
func parseHashFromInput(in []byte) ([]byte, error) {
203-
var resultTx coretypes.ResultTx
204-
if err := json.Unmarshal(in, &resultTx); err == nil {
203+
// The content of in is expected to be the result of a tx command which should be using GenerateOrBroadcastTxCLI.
204+
// That outputs a sdk.TxResponse as either the json or yaml. As json, we can't unmarshal it back into that struct,
205+
// though, because the height field ends up quoted which confuses json.Unmarshal (because it's for an int64 field).
206+
207+
// Try to find the txhash from json ouptut.
208+
resultTx := make(map[string]json.RawMessage)
209+
if err := json.Unmarshal(in, &resultTx); err == nil && len(resultTx["txhash"]) > 0 {
205210
// input was JSON, return the hash
206-
return resultTx.Hash, nil
211+
hash := strings.Trim(strings.TrimSpace(string(resultTx["txhash"])), `"`)
212+
if len(hash) > 0 {
213+
return hex.DecodeString(hash)
214+
}
207215
}
208216

209-
// try to parse the hash from the output of a tx command
217+
// Try to find the txhash from yaml output.
210218
lines := strings.Split(string(in), "\n")
211219
for _, line := range lines {
212220
if strings.HasPrefix(line, "txhash:") {

client/v2/CHANGELOG.md

+16-1
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,21 @@ Ref: https://keepachangelog.com/en/1.0.0/
3636

3737
## [Unreleased]
3838

39-
## [v2.0.0-beta.2] - 2024-XX-XX
39+
## [v2.0.0-beta.3] - 2024-07-15
40+
41+
### Features
42+
43+
* [#20771](https://github.com/cosmos/cosmos-sdk/pull/20771) Add `GetNodeHomeDirectory` helper in `client/v2/helpers`.
44+
45+
## [v2.0.0-beta.2] - 2024-06-19
46+
47+
### Features
48+
49+
* [#19039](https://github.com/cosmos/cosmos-sdk/pull/19039) Add support for pubkey in autocli.
4050

4151
### Improvements
4252

53+
* [#19646](https://github.com/cosmos/cosmos-sdk/pull/19646) Use keyring from command context.
4354
* (deps) [#19810](https://github.com/cosmos/cosmos-sdk/pull/19810) Upgrade SDK version due to prometheus breaking change.
4455
* (deps) [#19810](https://github.com/cosmos/cosmos-sdk/pull/19810) Bump `cosmossdk.io/store` to v1.1.0.
4556
* [#20083](https://github.com/cosmos/cosmos-sdk/pull/20083) Integrate latest version of cosmos-proto and improve version filtering.
@@ -56,6 +67,10 @@ Ref: https://keepachangelog.com/en/1.0.0/
5667
* [#19060](https://github.com/cosmos/cosmos-sdk/pull/19060) Simplify key flag parsing logic in flag handler.
5768
* [#20033](https://github.com/cosmos/cosmos-sdk/pull/20033) Respect output format from client ctx.
5869

70+
### API Breaking Changes
71+
72+
* [#19646](https://github.com/cosmos/cosmos-sdk/pull/19646) Remove keyring from `autocli.AppOptions` and `flag.Builder` options.
73+
5974
## [v2.0.0-beta.1] - 2023-11-07
6075

6176
This is the first tagged version of client/v2.

0 commit comments

Comments
 (0)