Skip to content

Commit f573ec9

Browse files
authored
Merge branch 'main' into julien/7809-gaiad-tx-bank-multi-send-cli
2 parents 5e5260f + 0c0b4da commit f573ec9

Some content is hidden

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

41 files changed

+688
-532
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
8888

8989
### API Breaking Changes
9090

91+
* (types) [#11788](https://github.com/cosmos/cosmos-sdk/pull/11788) The `Int` and `Uint` types have been moved to their own dedicated module, `math`. Aliases are kept in the SDK's root `types` package, however, it is encouraged to utilize the new `math` module. As a result, the `Int#ToDec` API has been removed.
9192
* (grpc) [\#11642](https://github.com/cosmos/cosmos-sdk/pull/11642) The `RegisterTendermintService` method in the `tmservice` package now requires a `abciQueryFn` query function parameter.
9293
* [\#11496](https://github.com/cosmos/cosmos-sdk/pull/11496) Refactor abstractions for snapshot and pruning; snapshot intervals eventually pruned; unit tests.
9394
* (types) [\#11689](https://github.com/cosmos/cosmos-sdk/pull/11689) Make `Coins#Sub` and `Coins#SafeSub` consistent with `Coins#Add`.
@@ -173,7 +174,8 @@ Ref: https://keepachangelog.com/en/1.0.0/
173174

174175
### CLI Breaking Changes
175176

176-
* [\#9695](https://github.com/cosmos/cosmos-sdk/pull/9695) `<app> keys migrate` CLI command now takes no arguments
177+
* (cli) [\#11818](https://github.com/cosmos/cosmos-sdk/pull/11818) CLI transactions preview now respect the chosen `--output` flag format (json or text).
178+
* [\#9695](https://github.com/cosmos/cosmos-sdk/pull/9695) `<app> keys migrate` CLI command now takes no arguments.
177179
* [\#9246](https://github.com/cosmos/cosmos-sdk/pull/9246) Removed the CLI flag `--setup-config-only` from the `testnet` command and added the subcommand `init-files`.
178180
* [\#9780](https://github.com/cosmos/cosmos-sdk/pull/9780) Use sigs.k8s.io for yaml, which might lead to minor YAML output changes
179181
* [\#10625](https://github.com/cosmos/cosmos-sdk/pull/10625) Rename `--fee-account` CLI flag to `--fee-granter`

client/context.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package client
22

33
import (
44
"bufio"
5+
"encoding/json"
56
"fmt"
67
"io"
78
"os"
@@ -305,6 +306,12 @@ func (ctx Context) PrintObjectLegacy(toPrint interface{}) error {
305306
return ctx.printOutput(out)
306307
}
307308

309+
// PrintRaw is a variant of PrintProto that doesn't require a proto.Message type
310+
// and uses a raw JSON message. No marshaling is performed.
311+
func (ctx Context) PrintRaw(toPrint json.RawMessage) error {
312+
return ctx.printOutput(toPrint)
313+
}
314+
308315
func (ctx Context) printOutput(out []byte) error {
309316
var err error
310317
if ctx.OutputFormat == "text" {

client/context_test.go

Lines changed: 47 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package client_test
33
import (
44
"bytes"
55
"context"
6+
"encoding/json"
67
"os"
78
"strings"
89
"testing"
@@ -25,7 +26,7 @@ func TestMain(m *testing.M) {
2526
os.Exit(m.Run())
2627
}
2728

28-
func TestContext_PrintObject(t *testing.T) {
29+
func TestContext_PrintProto(t *testing.T) {
2930
ctx := client.Context{}
3031

3132
animal := &testdata.Dog{
@@ -39,9 +40,7 @@ func TestContext_PrintObject(t *testing.T) {
3940
X: 10,
4041
}
4142

42-
//
4343
// proto
44-
//
4544
registry := testdata.NewTestInterfaceRegistry()
4645
ctx = ctx.WithCodec(codec.NewProtoCodec(registry))
4746

@@ -68,15 +67,28 @@ func TestContext_PrintObject(t *testing.T) {
6867
size: big
6968
x: "10"
7069
`, buf.String())
70+
}
71+
72+
func TestContext_PrintObjectLegacy(t *testing.T) {
73+
ctx := client.Context{}
74+
75+
animal := &testdata.Dog{
76+
Size_: "big",
77+
Name: "Spot",
78+
}
79+
any, err := types.NewAnyWithValue(animal)
80+
require.NoError(t, err)
81+
hasAnimal := &testdata.HasAnimal{
82+
Animal: any,
83+
X: 10,
84+
}
7185

72-
//
7386
// amino
74-
//
7587
amino := testdata.NewTestAmino()
7688
ctx = ctx.WithLegacyAmino(&codec.LegacyAmino{Amino: amino})
7789

7890
// json
79-
buf = &bytes.Buffer{}
91+
buf := &bytes.Buffer{}
8092
ctx = ctx.WithOutput(buf)
8193
ctx.OutputFormat = "json"
8294
err = ctx.PrintObjectLegacy(hasAnimal)
@@ -103,6 +115,35 @@ value:
103115
`, buf.String())
104116
}
105117

118+
func TestContext_PrintRaw(t *testing.T) {
119+
ctx := client.Context{}
120+
hasAnimal := json.RawMessage(`{"animal":{"@type":"/testdata.Dog","size":"big","name":"Spot"},"x":"10"}`)
121+
122+
// json
123+
buf := &bytes.Buffer{}
124+
ctx = ctx.WithOutput(buf)
125+
ctx.OutputFormat = "json"
126+
err := ctx.PrintRaw(hasAnimal)
127+
require.NoError(t, err)
128+
require.Equal(t,
129+
`{"animal":{"@type":"/testdata.Dog","size":"big","name":"Spot"},"x":"10"}
130+
`, buf.String())
131+
132+
// yaml
133+
buf = &bytes.Buffer{}
134+
ctx = ctx.WithOutput(buf)
135+
ctx.OutputFormat = "text"
136+
err = ctx.PrintRaw(hasAnimal)
137+
require.NoError(t, err)
138+
require.Equal(t,
139+
`animal:
140+
'@type': /testdata.Dog
141+
name: Spot
142+
size: big
143+
x: "10"
144+
`, buf.String())
145+
}
146+
106147
func TestCLIQueryConn(t *testing.T) {
107148
cfg := network.DefaultConfig()
108149
cfg.NumValidators = 1

client/tx/tx.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package tx
33
import (
44
"bufio"
55
"context"
6+
"encoding/json"
67
"errors"
78
"fmt"
89
"os"
@@ -87,12 +88,14 @@ func BroadcastTx(clientCtx client.Context, txf Factory, msgs ...sdk.Msg) error {
8788
}
8889

8990
if !clientCtx.SkipConfirm {
90-
out, err := clientCtx.TxConfig.TxJSONEncoder()(tx.GetTx())
91+
txBytes, err := clientCtx.TxConfig.TxJSONEncoder()(tx.GetTx())
9192
if err != nil {
9293
return err
9394
}
9495

95-
_, _ = fmt.Fprintf(os.Stderr, "%s\n\n", out)
96+
if err := clientCtx.PrintRaw(json.RawMessage(txBytes)); err != nil {
97+
_, _ = fmt.Fprintf(os.Stderr, "%s\n", txBytes)
98+
}
9699

97100
buf := bufio.NewReader(os.Stdin)
98101
ok, err := input.GetConfirmation("confirm transaction before signing and broadcasting", buf, os.Stderr)

contrib/images/simd-dlv/Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@ FROM golang:1.18-alpine AS build
22

33
RUN apk add build-base git linux-headers libc-dev
44
RUN go install github.com/go-delve/delve/cmd/dlv@latest
5+
56
WORKDIR /work
67
COPY go.mod go.sum /work/
78
COPY db/go.mod db/go.sum /work/db/
9+
COPY errors/go.mod errors/go.sum /work/errors/
10+
COPY math/go.mod math/go.sum /work/math/
11+
812
RUN go mod download
913
COPY ./ /work
1014
RUN LEDGER_ENABLED=false make COSMOS_BUILD_OPTIONS="debug,nostrip" clean build

contrib/images/simd-env/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
FROM golang:1.18-alpine AS build
2+
23
RUN apk add build-base git linux-headers
4+
35
WORKDIR /work
46
COPY go.mod go.sum /work/
57
COPY db/go.mod db/go.sum /work/db/
68
COPY errors/go.mod errors/go.sum /work/errors/
9+
COPY math/go.mod math/go.sum /work/math/
710

811
RUN go mod download
912
COPY ./ /work

errors/CHANGELOG.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,14 @@ Change log entries are to be added to the Unreleased section under the
1515
appropriate stanza (see below). Each entry should ideally include a tag and
1616
the Github issue reference in the following format:
1717
18-
* (<tag>) \#<issue-number> message
19-
20-
The issue numbers will later be link-ified during the release process so you do
21-
not have to worry about including a link manually, but you can if you wish.
18+
* (<tag>) [#<issue-number>] Changelog message.
2219
2320
Types of changes (Stanzas):
2421
2522
"Features" for new features.
2623
"Improvements" for changes in existing functionality.
2724
"Deprecated" for soon-to-be removed features.
2825
"Bug Fixes" for any bug fixes.
29-
"Client Breaking" for breaking Protobuf, gRPC and REST routes used by end-users.
30-
"CLI Breaking" for breaking CLI commands.
3126
"API Breaking" for breaking exported APIs used by developers building on SDK.
3227
Ref: https://keepachangelog.com/en/1.0.0/
3328
-->

go.mod

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ require (
1515
github.com/cosmos/cosmos-sdk/api v0.1.0
1616
github.com/cosmos/cosmos-sdk/db v1.0.0-beta.1
1717
github.com/cosmos/cosmos-sdk/errors v1.0.0-beta.5
18+
github.com/cosmos/cosmos-sdk/math v1.0.0-beta.1
1819
github.com/cosmos/go-bip39 v1.0.0
1920
github.com/cosmos/iavl v0.18.0
2021
github.com/cosmos/ledger-cosmos-go v0.11.1
@@ -149,14 +150,14 @@ require (
149150
nhooyr.io/websocket v1.8.6 // indirect
150151
)
151152

152-
replace github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1
153+
replace (
154+
github.com/99designs/keyring => github.com/cosmos/keyring v1.1.7-0.20210622111912-ef00f8ac3d76
155+
github.com/cosmos/cosmos-sdk/db => ./db
153156

154-
replace github.com/99designs/keyring => github.com/cosmos/keyring v1.1.7-0.20210622111912-ef00f8ac3d76
155-
156-
// Fix upstream GHSA-h395-qcrw-5vmq vulnerability.
157-
// TODO Remove it: https://github.com/cosmos/cosmos-sdk/issues/10409
158-
replace github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.7.0
159-
160-
replace github.com/cosmos/cosmos-sdk/db => ./db
157+
// Fix upstream GHSA-h395-qcrw-5vmq vulnerability.
158+
// TODO Remove it: https://github.com/cosmos/cosmos-sdk/issues/10409
159+
github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.7.0
160+
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1
161+
)
161162

162163
retract v0.43.0

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,8 @@ github.com/cosmos/cosmos-sdk/api v0.1.0 h1:xfSKM0e9p+EJTMQnf5PbWE6VT8ruxTABIJ64R
244244
github.com/cosmos/cosmos-sdk/api v0.1.0/go.mod h1:CupqQBskAOiTXO1XDZ/wrtWzN/wTxUvbQmOqdUhR8wI=
245245
github.com/cosmos/cosmos-sdk/errors v1.0.0-beta.5 h1:9ebZL9/nCkaxer3kWWHs0YT8OOmHd7xohULM8Weep7M=
246246
github.com/cosmos/cosmos-sdk/errors v1.0.0-beta.5/go.mod h1:wDFkBmFsFolsfsAfsLON7xX0EuWIvNxMO7NDjrijYU8=
247+
github.com/cosmos/cosmos-sdk/math v1.0.0-beta.1 h1:f2cco+9IQ24jB4Ba8QDeoiXuQSa6D3oOYy5ugM9Y4no=
248+
github.com/cosmos/cosmos-sdk/math v1.0.0-beta.1/go.mod h1:7jTTC6GESpBoLVYu77g3zPCQORcyZmX2ttXxWmXrQ2U=
247249
github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY=
248250
github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw=
249251
github.com/cosmos/iavl v0.18.0 h1:02ur4vnalMR2GuWCFNkuseUcl/BCVmg9tOeHOGiZOkE=

math/CHANGELOG.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<!--
2+
Guiding Principles:
3+
4+
Changelogs are for humans, not machines.
5+
There should be an entry for every single version.
6+
The same types of changes should be grouped.
7+
Versions and sections should be linkable.
8+
The latest version comes first.
9+
The release date of each version is displayed.
10+
Mention whether you follow Semantic Versioning.
11+
12+
Usage:
13+
14+
Change log entries are to be added to the Unreleased section under the
15+
appropriate stanza (see below). Each entry should ideally include a tag and
16+
the Github issue reference in the following format:
17+
18+
* (<tag>) [#<issue-number>] Changelog message.
19+
20+
Types of changes (Stanzas):
21+
22+
"Features" for new features.
23+
"Improvements" for changes in existing functionality.
24+
"Deprecated" for soon-to-be removed features.
25+
"Bug Fixes" for any bug fixes.
26+
"API Breaking" for breaking exported APIs used by developers building on SDK.
27+
Ref: https://keepachangelog.com/en/1.0.0/
28+
-->
29+
30+
# Changelog
31+
32+
## [Unreleased]

0 commit comments

Comments
 (0)