From ded6b47aea992af05dc2171b6e8c27617602387c Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Tue, 15 Aug 2023 10:40:45 +0200 Subject: [PATCH 01/13] feat(x/gov): add MsgSubmitProposal SetMsgs method (#17387) --- CHANGELOG.md | 1 + x/gov/types/v1/msgs.go | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 672b22f3ea43..589ea2b2919c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Improvements +* (x/gov) [#17387](https://github.com/cosmos/cosmos-sdk/pull/17387) Add `MsgSubmitProposal` `SetMsgs` method. * (x/gov) [#17354](https://github.com/cosmos/cosmos-sdk/issues/17354) Emit `VoterAddr` in `proposal_vote` event. * (x/group, x/gov) [#17220](https://github.com/cosmos/cosmos-sdk/pull/17220) Add `--skip-metadata` flag in `draft-proposal` to skip metadata prompt. * (x/genutil) [#17296](https://github.com/cosmos/cosmos-sdk/pull/17296) Add `MigrateHandler` to allow reuse migrate genesis related function. diff --git a/x/gov/types/v1/msgs.go b/x/gov/types/v1/msgs.go index f1b1667d59d5..64fefce8d357 100644 --- a/x/gov/types/v1/msgs.go +++ b/x/gov/types/v1/msgs.go @@ -46,6 +46,18 @@ func (m *MsgSubmitProposal) GetMsgs() ([]sdk.Msg, error) { return sdktx.GetMsgs(m.Messages, "sdk.MsgProposal") } +// SetMsgs packs sdk.Msg's into m.Messages Any's +// NOTE: this will overwrite any existing messages +func (m *MsgSubmitProposal) SetMsgs(msgs []sdk.Msg) error { + anys, err := sdktx.SetMsgs(msgs) + if err != nil { + return err + } + + m.Messages = anys + return nil +} + // Route implements the sdk.Msg interface. func (m MsgSubmitProposal) Route() string { return types.RouterKey } From 0a28ba9f3f15c0297eaa970d511123fea0328a6a Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Wed, 16 Aug 2023 08:59:43 +0000 Subject: [PATCH 02/13] chore(x/gov): update proposal.json go doc (backport #17397) (#17403) Co-authored-by: johnzhu0907 <90296451+johnzhu0907@users.noreply.github.com> Co-authored-by: Julien Robert --- x/gov/client/cli/tx.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/x/gov/client/cli/tx.go b/x/gov/client/cli/tx.go index 16f1ca1d9e75..b31cedc5e80d 100644 --- a/x/gov/client/cli/tx.go +++ b/x/gov/client/cli/tx.go @@ -106,9 +106,9 @@ Where proposal.json contains: ], // metadata can be any of base64 encoded, raw text, stringified json, IPFS link to json // see below for example metadata - "metadata: "4pIMOgIGx1vZGU=", - "deposit": "10stake" - "title: "My proposal" + "metadata": "4pIMOgIGx1vZGU=", + "deposit": "10stake", + "title": "My proposal", "summary": "A short summary of my proposal" } From 72a6397f13be4e66d4b094f28376ad8d8e76e3ef Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Wed, 16 Aug 2023 21:43:20 +0200 Subject: [PATCH 03/13] fix: use correct config key for db_backend (backport #17406) (#17411) Co-authored-by: Julien Robert --- CHANGELOG.md | 1 + server/config/toml.go | 3 +-- server/util.go | 2 +- server/util_test.go | 11 +++++++++++ 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 589ea2b2919c..f4c2a79626a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -47,6 +47,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Bug Fixes +* (server) [#17181](https://github.com/cosmos/cosmos-sdk/pull/17181) Fix `db_backend` lookup fallback from `config.toml`. * (runtime) [#17284](https://github.com/cosmos/cosmos-sdk/pull/17284) Properly allow to combine depinject-enabled modules and non-depinject-enabled modules in app v2. * (baseapp) [#17159](https://github.com/cosmos/cosmos-sdk/pull/17159) Validators can propose blocks that exceed the gas limit. * (baseapp) [#16547](https://github.com/cosmos/cosmos-sdk/pull/16547) Ensure a transaction's gas limit cannot exceed the block gas limit. diff --git a/server/config/toml.go b/server/config/toml.go index 666d9846322c..1ec7ce6a2e2d 100644 --- a/server/config/toml.go +++ b/server/config/toml.go @@ -83,8 +83,7 @@ iavl-lazy-loading = {{ .BaseConfig.IAVLLazyLoading }} # AppDBBackend defines the database backend type to use for the application and snapshots DBs. # An empty string indicates that a fallback will be used. -# First fallback is the deprecated compile-time types.DBBackend value. -# Second fallback (if the types.DBBackend also isn't set), is the db-backend value set in Tendermint's config.toml. +# The fallback is the db_backend value set in Tendermint's config.toml. app-db-backend = "{{ .BaseConfig.AppDBBackend }}" ############################################################################### diff --git a/server/util.go b/server/util.go index 58323b0d2108..9a6ae40f786e 100644 --- a/server/util.go +++ b/server/util.go @@ -392,7 +392,7 @@ func WaitForQuitSignals() ErrorCode { func GetAppDBBackend(opts types.AppOptions) dbm.BackendType { rv := cast.ToString(opts.Get("app-db-backend")) if len(rv) == 0 { - rv = cast.ToString(opts.Get("db-backend")) + rv = cast.ToString(opts.Get("db_backend")) } if len(rv) != 0 { return dbm.BackendType(rv) diff --git a/server/util_test.go b/server/util_test.go index 85e14a625e38..2b897c919258 100644 --- a/server/util_test.go +++ b/server/util_test.go @@ -10,8 +10,10 @@ import ( "strings" "testing" + db "github.com/cometbft/cometbft-db" tmcfg "github.com/cometbft/cometbft/config" "github.com/spf13/cobra" + "github.com/spf13/viper" "github.com/stretchr/testify/require" "github.com/cosmos/cosmos-sdk/client" @@ -38,6 +40,15 @@ func preRunETestImpl(cmd *cobra.Command, args []string) error { return cancelledInPreRun } +func TestGetAppDBBackend(t *testing.T) { + v := viper.New() + require.Equal(t, server.GetAppDBBackend(v), db.GoLevelDBBackend) + v.Set("db_backend", "dbtype1") // value from CometBFT config + require.Equal(t, server.GetAppDBBackend(v), db.BackendType("dbtype1")) + v.Set("app-db-backend", "dbtype2") // value from app.toml + require.Equal(t, server.GetAppDBBackend(v), db.BackendType("dbtype2")) +} + func TestInterceptConfigsPreRunHandlerCreatesConfigFilesWhenMissing(t *testing.T) { tempDir := t.TempDir() cmd := server.StartCmd(nil, "/foobar") From 612f0fef02074d66acd969a903bb7724350aa35c Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 17 Aug 2023 16:44:19 +0000 Subject: [PATCH 04/13] feat: import hex keys (backport #17424) (#17433) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Julián Toledano Co-authored-by: Julien Robert --- CHANGELOG.md | 4 +++ client/keys/import.go | 23 +++++++++++++ client/keys/import_test.go | 57 ++++++++++++++++++++++++++++++++ client/keys/root.go | 1 + client/keys/root_test.go | 2 +- crypto/keyring/keyring.go | 30 +++++++++++++++-- crypto/keyring/keyring_test.go | 59 ++++++++++++++++++++++++++++++++++ 7 files changed, 173 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f4c2a79626a8..8c1c62454403 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,10 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [Unreleased] +### Features + +* (keyring) [#17424](https://github.com/cosmos/cosmos-sdk/pull/17424) Allows to import private keys encoded in hex. + ### Improvements * (x/gov) [#17387](https://github.com/cosmos/cosmos-sdk/pull/17387) Add `MsgSubmitProposal` `SetMsgs` method. diff --git a/client/keys/import.go b/client/keys/import.go index a9d5c185acb7..98ccb6547ff0 100644 --- a/client/keys/import.go +++ b/client/keys/import.go @@ -2,12 +2,16 @@ package keys import ( "bufio" + "fmt" "os" "github.com/spf13/cobra" "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/input" + "github.com/cosmos/cosmos-sdk/crypto/hd" + "github.com/cosmos/cosmos-sdk/version" ) // ImportKeyCommand imports private keys from a keyfile. @@ -38,3 +42,22 @@ func ImportKeyCommand() *cobra.Command { }, } } + +func ImportKeyHexCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "import-hex ", + Short: "Import private keys into the local keybase", + Long: fmt.Sprintf("Import hex encoded private key into the local keybase.\nSupported key-types can be obtained with:\n%s list-key-types", version.AppName), + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + keyType, _ := cmd.Flags().GetString(flags.FlagKeyType) + return clientCtx.Keyring.ImportPrivKeyHex(args[0], args[1], keyType) + }, + } + cmd.Flags().String(flags.FlagKeyType, string(hd.Secp256k1Type), "private key signing algorithm kind") + return cmd +} diff --git a/client/keys/import_test.go b/client/keys/import_test.go index 5ab732632a51..4deae56b250d 100644 --- a/client/keys/import_test.go +++ b/client/keys/import_test.go @@ -115,3 +115,60 @@ HbP+c6JmeJy9JXe2rbbF1QtCX1gLqGcDQPBXiCtFvP7/8wTZtVOPj8vREzhZ9ElO }) } } + +func Test_runImportHexCmd(t *testing.T) { + cdc := clienttestutil.MakeTestCodec(t) + testCases := []struct { + name string + keyringBackend string + hexKey string + keyType string + expectError bool + }{ + { + name: "test backend success", + keyringBackend: keyring.BackendTest, + hexKey: "0xa3e57952e835ed30eea86a2993ac2a61c03e74f2085b3635bd94aa4d7ae0cfdf", + keyType: "secp256k1", + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + cmd := ImportKeyHexCommand() + cmd.Flags().AddFlagSet(Commands("home").PersistentFlags()) + mockIn := testutil.ApplyMockIODiscardOutErr(cmd) + + // Now add a temporary keybase + kbHome := t.TempDir() + kb, err := keyring.New(sdk.KeyringServiceName(), tc.keyringBackend, kbHome, nil, cdc) + require.NoError(t, err) + + clientCtx := client.Context{}. + WithKeyringDir(kbHome). + WithKeyring(kb). + WithInput(mockIn). + WithCodec(cdc) + ctx := context.WithValue(context.Background(), client.ClientContextKey, &clientCtx) + + t.Cleanup(cleanupKeys(t, kb, "keyname1")) + + defer func() { + _ = os.RemoveAll(kbHome) + }() + + cmd.SetArgs([]string{ + "keyname1", tc.hexKey, + fmt.Sprintf("--%s=%s", flags.FlagKeyType, tc.keyType), + fmt.Sprintf("--%s=%s", flags.FlagKeyringBackend, tc.keyringBackend), + }) + + err = cmd.ExecuteContext(ctx) + if tc.expectError { + require.Error(t, err) + } else { + require.NoError(t, err) + } + }) + } +} diff --git a/client/keys/root.go b/client/keys/root.go index 6faf2f462ce2..e4c9b5a30b8d 100644 --- a/client/keys/root.go +++ b/client/keys/root.go @@ -42,6 +42,7 @@ The pass backend requires GnuPG: https://gnupg.org/ AddKeyCommand(), ExportKeyCommand(), ImportKeyCommand(), + ImportKeyHexCommand(), ListKeysCmd(), ListKeyTypesCmd(), ShowKeysCmd(), diff --git a/client/keys/root_test.go b/client/keys/root_test.go index 20b3f1a23472..08a2a934ec4e 100644 --- a/client/keys/root_test.go +++ b/client/keys/root_test.go @@ -11,5 +11,5 @@ func TestCommands(t *testing.T) { assert.Assert(t, rootCommands != nil) // Commands are registered - assert.Equal(t, 11, len(rootCommands.Commands())) + assert.Equal(t, 12, len(rootCommands.Commands())) } diff --git a/crypto/keyring/keyring.go b/crypto/keyring/keyring.go index af0d4f8aae4f..e33b5ead7d62 100644 --- a/crypto/keyring/keyring.go +++ b/crypto/keyring/keyring.go @@ -43,6 +43,8 @@ const ( // temporary pass phrase for exporting a key during a key rename passPhrase = "temp" + // prefix for exported hex private keys + hexPrefix = "0x" ) var ( @@ -113,7 +115,8 @@ type Signer interface { type Importer interface { // ImportPrivKey imports ASCII armored passphrase-encrypted private keys. ImportPrivKey(uid, armor, passphrase string) error - + // ImportPrivKeyHex imports hex encoded keys. + ImportPrivKeyHex(uid, privKey, algoStr string) error // ImportPubKey imports ASCII armored public keys. ImportPubKey(uid string, armor string) error } @@ -333,7 +336,30 @@ func (ks keystore) ImportPrivKey(uid, armor, passphrase string) error { return nil } -func (ks keystore) ImportPubKey(uid string, armor string) error { +func (ks keystore) ImportPrivKeyHex(uid, privKey, algoStr string) error { + if _, err := ks.Key(uid); err == nil { + return fmt.Errorf("cannot overwrite key: %s", uid) + } + if privKey[:2] == hexPrefix { + privKey = privKey[2:] + } + decodedPriv, err := hex.DecodeString(privKey) + if err != nil { + return err + } + algo, err := NewSigningAlgoFromString(algoStr, ks.options.SupportedAlgos) + if err != nil { + return err + } + priv := algo.Generate()(decodedPriv) + _, err = ks.writeLocalKey(uid, priv) + if err != nil { + return err + } + return nil +} + +func (ks keystore) ImportPubKey(uid, armor string) error { if _, err := ks.Key(uid); err == nil { return fmt.Errorf("cannot overwrite key: %s", uid) } diff --git a/crypto/keyring/keyring_test.go b/crypto/keyring/keyring_test.go index e2d994187752..0d816915b9a1 100644 --- a/crypto/keyring/keyring_test.go +++ b/crypto/keyring/keyring_test.go @@ -10,6 +10,7 @@ import ( "github.com/99designs/keyring" "github.com/cosmos/go-bip39" + "github.com/pkg/errors" "github.com/stretchr/testify/require" "github.com/cosmos/cosmos-sdk/codec" @@ -1449,6 +1450,64 @@ func TestRenameKey(t *testing.T) { } } +func TestImportPrivKeyHex(t *testing.T) { + cdc := getCodec() + tests := []struct { + name string + uid string + backend string + hexKey string + algo string + expectedErr error + }{ + { + name: "correct import", + uid: "hexImport", + backend: BackendTest, + hexKey: "0xa3e57952e835ed30eea86a2993ac2a61c03e74f2085b3635bd94aa4d7ae0cfdf", + algo: "secp256k1", + expectedErr: nil, + }, + { + name: "correct import without prefix", + uid: "hexImport", + backend: BackendTest, + hexKey: "a3e57952e835ed30eea86a2993ac2a61c03e74f2085b3635bd94aa4d7ae0cfdf", + algo: "secp256k1", + expectedErr: nil, + }, + { + name: "wrong hex length", + uid: "hexImport", + backend: BackendTest, + hexKey: "0xae57952e835ed30eea86a2993ac2a61c03e74f2085b3635bd94aa4d7ae0cfdf", + algo: "secp256k1", + expectedErr: hex.ErrLength, + }, + { + name: "unsupported algo", + uid: "hexImport", + backend: BackendTest, + hexKey: "0xa3e57952e835ed30eea86a2993ac2a61c03e74f2085b3635bd94aa4d7ae0cfdf", + algo: "notSupportedAlgo", + expectedErr: errors.New("provided algorithm \"notSupportedAlgo\" is not supported"), + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + kb, err := New("TestExport", tt.backend, t.TempDir(), nil, cdc) + require.NoError(t, err) + err = kb.ImportPrivKeyHex(tt.uid, tt.hexKey, tt.algo) + if tt.expectedErr == nil { + require.NoError(t, err) + } else { + require.Error(t, err) + require.ErrorContains(t, err, tt.expectedErr.Error()) + } + }) + } +} + func requireEqualRenamedKey(t *testing.T, key *Record, mnemonic *Record, nameMatch bool) { if nameMatch { require.Equal(t, key.Name, mnemonic.Name) From 32b23f56f7430cadb3d5c35903fa239566af4716 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 18 Aug 2023 08:55:44 +0000 Subject: [PATCH 05/13] feat: add event-query-tx-for cmd to subscribe and wait for transaction (backport #17274) (#17435) Co-authored-by: mmsqe Co-authored-by: Julien Robert Co-authored-by: marbar3778 --- CHANGELOG.md | 1 + client/rpc/tx.go | 140 ++++++++++++++++++++++++++++++++++++++++ simapp/simd/cmd/root.go | 1 + 3 files changed, 142 insertions(+) create mode 100644 client/rpc/tx.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c1c62454403..5edd1b875f52 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Features +* (client/rpc) [#17274](https://github.com/cosmos/cosmos-sdk/pull/17274) Add `QueryEventForTxCmd` cmd to subscribe and wait event for transaction by hash. * (keyring) [#17424](https://github.com/cosmos/cosmos-sdk/pull/17424) Allows to import private keys encoded in hex. ### Improvements diff --git a/client/rpc/tx.go b/client/rpc/tx.go new file mode 100644 index 000000000000..f77d6cf0a140 --- /dev/null +++ b/client/rpc/tx.go @@ -0,0 +1,140 @@ +package rpc + +import ( + "context" + "encoding/hex" + "fmt" + "strings" + "time" + + rpchttp "github.com/cometbft/cometbft/rpc/client/http" + coretypes "github.com/cometbft/cometbft/rpc/core/types" + tmtypes "github.com/cometbft/cometbft/types" + "github.com/spf13/cobra" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/errors" +) + +func newTxResponseCheckTx(res *coretypes.ResultBroadcastTxCommit) *sdk.TxResponse { + if res == nil { + return nil + } + + var txHash string + if res.Hash != nil { + txHash = res.Hash.String() + } + + parsedLogs, _ := sdk.ParseABCILogs(res.CheckTx.Log) + + return &sdk.TxResponse{ + Height: res.Height, + TxHash: txHash, + Codespace: res.CheckTx.Codespace, + Code: res.CheckTx.Code, + Data: strings.ToUpper(hex.EncodeToString(res.CheckTx.Data)), + RawLog: res.CheckTx.Log, + Logs: parsedLogs, + Info: res.CheckTx.Info, + GasWanted: res.CheckTx.GasWanted, + GasUsed: res.CheckTx.GasUsed, + Events: res.CheckTx.Events, + } +} + +func newTxResponseDeliverTx(res *coretypes.ResultBroadcastTxCommit) *sdk.TxResponse { + if res == nil { + return nil + } + + var txHash string + if res.Hash != nil { + txHash = res.Hash.String() + } + + parsedLogs, _ := sdk.ParseABCILogs(res.DeliverTx.Log) + + return &sdk.TxResponse{ + Height: res.Height, + TxHash: txHash, + Codespace: res.DeliverTx.Codespace, + Code: res.DeliverTx.Code, + Data: strings.ToUpper(hex.EncodeToString(res.DeliverTx.Data)), + RawLog: res.DeliverTx.Log, + Logs: parsedLogs, + Info: res.DeliverTx.Info, + GasWanted: res.DeliverTx.GasWanted, + GasUsed: res.DeliverTx.GasUsed, + Events: res.DeliverTx.Events, + } +} + +func newResponseFormatBroadcastTxCommit(res *coretypes.ResultBroadcastTxCommit) *sdk.TxResponse { + if res == nil { + return nil + } + + if !res.CheckTx.IsOK() { + return newTxResponseCheckTx(res) + } + + return newTxResponseDeliverTx(res) +} + +// QueryEventForTxCmd returns a CLI command that subscribes to a WebSocket connection and waits for a transaction event with the given hash. +func QueryEventForTxCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "event-query-tx-for [hash]", + Short: "Query for a transaction by hash", + Long: `Subscribes to a CometBFT WebSocket connection and waits for a transaction event with the given hash.`, + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + c, err := rpchttp.New(clientCtx.NodeURI, "/websocket") + if err != nil { + return err + } + if err := c.Start(); err != nil { + return err + } + defer c.Stop() //nolint:errcheck // ignore stop error + + ctx, cancel := context.WithTimeout(context.Background(), time.Second*15) + defer cancel() + + hash := args[0] + query := fmt.Sprintf("%s='%s' AND %s='%s'", tmtypes.EventTypeKey, tmtypes.EventTx, tmtypes.TxHashKey, hash) + const subscriber = "subscriber" + eventCh, err := c.Subscribe(ctx, subscriber, query) + if err != nil { + return fmt.Errorf("failed to subscribe to tx: %w", err) + } + defer c.UnsubscribeAll(context.Background(), subscriber) //nolint:errcheck // ignore unsubscribe error + + select { + case evt := <-eventCh: + if txe, ok := evt.Data.(tmtypes.EventDataTx); ok { + res := &coretypes.ResultBroadcastTxCommit{ + DeliverTx: txe.Result, + Hash: tmtypes.Tx(txe.Tx).Hash(), + Height: txe.Height, + } + return clientCtx.PrintProto(newResponseFormatBroadcastTxCommit(res)) + } + case <-ctx.Done(): + return errors.ErrLogic.Wrapf("timed out waiting for event, the transaction could have already been included or wasn't yet included") + } + return nil + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} diff --git a/simapp/simd/cmd/root.go b/simapp/simd/cmd/root.go index 6bb213832cd0..a6270721d16d 100644 --- a/simapp/simd/cmd/root.go +++ b/simapp/simd/cmd/root.go @@ -214,6 +214,7 @@ func queryCommand() *cobra.Command { } cmd.AddCommand( + rpc.QueryEventForTxCmd(), authcmd.GetAccountCmd(), rpc.ValidatorCommand(), rpc.BlockCommand(), From 2db1247538657267122e0a4fb7e5f4cf979d396f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 21 Aug 2023 17:26:14 +0200 Subject: [PATCH 06/13] build(deps): Bump cosmossdk.io/math from 1.0.1 to 1.1.2 (#17492) 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 --- core/go.mod | 2 +- go.mod | 2 +- go.sum | 4 ++-- simapp/go.mod | 2 +- simapp/go.sum | 4 ++-- tests/go.mod | 2 +- tests/go.sum | 4 ++-- tools/cosmovisor/go.mod | 2 +- tools/cosmovisor/go.sum | 4 ++-- tools/rosetta/go.mod | 2 +- tools/rosetta/go.sum | 4 ++-- tx/go.mod | 2 +- tx/go.sum | 4 ++-- 13 files changed, 19 insertions(+), 19 deletions(-) diff --git a/core/go.mod b/core/go.mod index 67d6cb7fcd11..ba049d847a13 100644 --- a/core/go.mod +++ b/core/go.mod @@ -5,7 +5,7 @@ go 1.19 require ( cosmossdk.io/api v0.3.1 cosmossdk.io/depinject v1.0.0-alpha.4 - cosmossdk.io/math v1.0.1 + cosmossdk.io/math v1.1.2 github.com/cosmos/cosmos-proto v1.0.0-beta.2 github.com/stretchr/testify v1.8.4 google.golang.org/grpc v1.55.0 diff --git a/go.mod b/go.mod index 997ec96d4e3b..cdfe78b9c7bf 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( cosmossdk.io/depinject v1.0.0-alpha.4 cosmossdk.io/errors v1.0.0 cosmossdk.io/log v1.2.0 - cosmossdk.io/math v1.0.1 + cosmossdk.io/math v1.1.2 cosmossdk.io/tools/rosetta v0.2.1 github.com/99designs/keyring v1.2.1 github.com/armon/go-metrics v0.4.1 diff --git a/go.sum b/go.sum index 2f5a127047f9..efa5ed12b5a5 100644 --- a/go.sum +++ b/go.sum @@ -197,8 +197,8 @@ cosmossdk.io/errors v1.0.0 h1:nxF07lmlBbB8NKQhtJ+sJm6ef5uV1XkvPXG2bUntb04= cosmossdk.io/errors v1.0.0/go.mod h1:+hJZLuhdDE0pYN8HkOrVNwrIOYvUGnn6+4fjnJs/oV0= cosmossdk.io/log v1.2.0 h1:BbykkDsutXPSy8RojFB3KZEWyvMsToLy0ykb/ZhsLqQ= cosmossdk.io/log v1.2.0/go.mod h1:GNSCc/6+DhFIj1aLn/j7Id7PaO8DzNylUZoOYBL9+I4= -cosmossdk.io/math v1.0.1 h1:Qx3ifyOPaMLNH/89WeZFH268yCvU4xEcnPLu3sJqPPg= -cosmossdk.io/math v1.0.1/go.mod h1:Ygz4wBHrgc7g0N+8+MrnTfS9LLn9aaTGa9hKopuym5k= +cosmossdk.io/math v1.1.2 h1:ORZetZCTyWkI5GlZ6CZS28fMHi83ZYf+A2vVnHNzZBM= +cosmossdk.io/math v1.1.2/go.mod h1:l2Gnda87F0su8a/7FEKJfFdJrM0JZRXQaohlgJeyQh0= cosmossdk.io/tools/rosetta v0.2.1 h1:ddOMatOH+pbxWbrGJKRAawdBkPYLfKXutK9IETnjYxw= cosmossdk.io/tools/rosetta v0.2.1/go.mod h1:Pqdc1FdvkNV3LcNIkYWt2RQY6IP1ge6YWZk8MhhO9Hw= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= diff --git a/simapp/go.mod b/simapp/go.mod index e0ef72894532..41c30bce8f6b 100644 --- a/simapp/go.mod +++ b/simapp/go.mod @@ -6,7 +6,7 @@ require ( cosmossdk.io/api v0.3.1 cosmossdk.io/core v0.5.1 cosmossdk.io/depinject v1.0.0-alpha.4 - cosmossdk.io/math v1.0.1 + cosmossdk.io/math v1.1.2 cosmossdk.io/tools/rosetta v0.2.1 github.com/cometbft/cometbft v0.37.2 github.com/cometbft/cometbft-db v0.7.0 diff --git a/simapp/go.sum b/simapp/go.sum index 44a729b42474..fdc3b9887625 100644 --- a/simapp/go.sum +++ b/simapp/go.sum @@ -197,8 +197,8 @@ cosmossdk.io/errors v1.0.0 h1:nxF07lmlBbB8NKQhtJ+sJm6ef5uV1XkvPXG2bUntb04= cosmossdk.io/errors v1.0.0/go.mod h1:+hJZLuhdDE0pYN8HkOrVNwrIOYvUGnn6+4fjnJs/oV0= cosmossdk.io/log v1.2.0 h1:BbykkDsutXPSy8RojFB3KZEWyvMsToLy0ykb/ZhsLqQ= cosmossdk.io/log v1.2.0/go.mod h1:GNSCc/6+DhFIj1aLn/j7Id7PaO8DzNylUZoOYBL9+I4= -cosmossdk.io/math v1.0.1 h1:Qx3ifyOPaMLNH/89WeZFH268yCvU4xEcnPLu3sJqPPg= -cosmossdk.io/math v1.0.1/go.mod h1:Ygz4wBHrgc7g0N+8+MrnTfS9LLn9aaTGa9hKopuym5k= +cosmossdk.io/math v1.1.2 h1:ORZetZCTyWkI5GlZ6CZS28fMHi83ZYf+A2vVnHNzZBM= +cosmossdk.io/math v1.1.2/go.mod h1:l2Gnda87F0su8a/7FEKJfFdJrM0JZRXQaohlgJeyQh0= cosmossdk.io/tools/rosetta v0.2.1 h1:ddOMatOH+pbxWbrGJKRAawdBkPYLfKXutK9IETnjYxw= cosmossdk.io/tools/rosetta v0.2.1/go.mod h1:Pqdc1FdvkNV3LcNIkYWt2RQY6IP1ge6YWZk8MhhO9Hw= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= diff --git a/tests/go.mod b/tests/go.mod index d2da4b7f5ca6..22481e24b45e 100644 --- a/tests/go.mod +++ b/tests/go.mod @@ -5,7 +5,7 @@ go 1.19 require ( cosmossdk.io/api v0.3.1 cosmossdk.io/depinject v1.0.0-alpha.4 - cosmossdk.io/math v1.0.1 + cosmossdk.io/math v1.1.2 cosmossdk.io/simapp v0.0.0-00010101000000-000000000000 github.com/cometbft/cometbft v0.37.2 github.com/cometbft/cometbft-db v0.7.0 diff --git a/tests/go.sum b/tests/go.sum index 7a9578e0a1ce..74d42af548d6 100644 --- a/tests/go.sum +++ b/tests/go.sum @@ -197,8 +197,8 @@ cosmossdk.io/errors v1.0.0 h1:nxF07lmlBbB8NKQhtJ+sJm6ef5uV1XkvPXG2bUntb04= cosmossdk.io/errors v1.0.0/go.mod h1:+hJZLuhdDE0pYN8HkOrVNwrIOYvUGnn6+4fjnJs/oV0= cosmossdk.io/log v1.2.0 h1:BbykkDsutXPSy8RojFB3KZEWyvMsToLy0ykb/ZhsLqQ= cosmossdk.io/log v1.2.0/go.mod h1:GNSCc/6+DhFIj1aLn/j7Id7PaO8DzNylUZoOYBL9+I4= -cosmossdk.io/math v1.0.1 h1:Qx3ifyOPaMLNH/89WeZFH268yCvU4xEcnPLu3sJqPPg= -cosmossdk.io/math v1.0.1/go.mod h1:Ygz4wBHrgc7g0N+8+MrnTfS9LLn9aaTGa9hKopuym5k= +cosmossdk.io/math v1.1.2 h1:ORZetZCTyWkI5GlZ6CZS28fMHi83ZYf+A2vVnHNzZBM= +cosmossdk.io/math v1.1.2/go.mod h1:l2Gnda87F0su8a/7FEKJfFdJrM0JZRXQaohlgJeyQh0= cosmossdk.io/tools/rosetta v0.2.1 h1:ddOMatOH+pbxWbrGJKRAawdBkPYLfKXutK9IETnjYxw= cosmossdk.io/tools/rosetta v0.2.1/go.mod h1:Pqdc1FdvkNV3LcNIkYWt2RQY6IP1ge6YWZk8MhhO9Hw= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= diff --git a/tools/cosmovisor/go.mod b/tools/cosmovisor/go.mod index 73f5a5f94345..f50c9bc0673b 100644 --- a/tools/cosmovisor/go.mod +++ b/tools/cosmovisor/go.mod @@ -21,7 +21,7 @@ require ( cosmossdk.io/core v0.5.1 // indirect cosmossdk.io/depinject v1.0.0-alpha.4 // indirect cosmossdk.io/errors v1.0.0 // indirect - cosmossdk.io/math v1.0.1 // indirect + cosmossdk.io/math v1.1.2 // indirect filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect diff --git a/tools/cosmovisor/go.sum b/tools/cosmovisor/go.sum index d7b8796f6e12..17e4a8b5fd11 100644 --- a/tools/cosmovisor/go.sum +++ b/tools/cosmovisor/go.sum @@ -195,8 +195,8 @@ cosmossdk.io/depinject v1.0.0-alpha.4 h1:PLNp8ZYAMPTUKyG9IK2hsbciDWqna2z1Wsl98ok cosmossdk.io/depinject v1.0.0-alpha.4/go.mod h1:HeDk7IkR5ckZ3lMGs/o91AVUc7E596vMaOmslGFM3yU= cosmossdk.io/errors v1.0.0 h1:nxF07lmlBbB8NKQhtJ+sJm6ef5uV1XkvPXG2bUntb04= cosmossdk.io/errors v1.0.0/go.mod h1:+hJZLuhdDE0pYN8HkOrVNwrIOYvUGnn6+4fjnJs/oV0= -cosmossdk.io/math v1.0.1 h1:Qx3ifyOPaMLNH/89WeZFH268yCvU4xEcnPLu3sJqPPg= -cosmossdk.io/math v1.0.1/go.mod h1:Ygz4wBHrgc7g0N+8+MrnTfS9LLn9aaTGa9hKopuym5k= +cosmossdk.io/math v1.1.2 h1:ORZetZCTyWkI5GlZ6CZS28fMHi83ZYf+A2vVnHNzZBM= +cosmossdk.io/math v1.1.2/go.mod h1:l2Gnda87F0su8a/7FEKJfFdJrM0JZRXQaohlgJeyQh0= cosmossdk.io/tools/rosetta v0.2.1 h1:ddOMatOH+pbxWbrGJKRAawdBkPYLfKXutK9IETnjYxw= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.0.0 h1:0wAIcmJUqRdI8IJ/3eGi5/HwXZWPujYXXlkrQogz0Ek= diff --git a/tools/rosetta/go.mod b/tools/rosetta/go.mod index 12f0fa16582a..58a61b0b26d3 100644 --- a/tools/rosetta/go.mod +++ b/tools/rosetta/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/tools/rosetta go 1.19 require ( - cosmossdk.io/math v1.0.1 + cosmossdk.io/math v1.1.2 github.com/btcsuite/btcd/btcec/v2 v2.3.2 github.com/coinbase/rosetta-sdk-go/types v1.0.0 github.com/cometbft/cometbft v0.37.2 diff --git a/tools/rosetta/go.sum b/tools/rosetta/go.sum index 6b494b5b64eb..6951d53f5661 100644 --- a/tools/rosetta/go.sum +++ b/tools/rosetta/go.sum @@ -43,8 +43,8 @@ cosmossdk.io/depinject v1.0.0-alpha.4 h1:PLNp8ZYAMPTUKyG9IK2hsbciDWqna2z1Wsl98ok cosmossdk.io/depinject v1.0.0-alpha.4/go.mod h1:HeDk7IkR5ckZ3lMGs/o91AVUc7E596vMaOmslGFM3yU= cosmossdk.io/errors v1.0.0 h1:nxF07lmlBbB8NKQhtJ+sJm6ef5uV1XkvPXG2bUntb04= cosmossdk.io/errors v1.0.0/go.mod h1:+hJZLuhdDE0pYN8HkOrVNwrIOYvUGnn6+4fjnJs/oV0= -cosmossdk.io/math v1.0.1 h1:Qx3ifyOPaMLNH/89WeZFH268yCvU4xEcnPLu3sJqPPg= -cosmossdk.io/math v1.0.1/go.mod h1:Ygz4wBHrgc7g0N+8+MrnTfS9LLn9aaTGa9hKopuym5k= +cosmossdk.io/math v1.1.2 h1:ORZetZCTyWkI5GlZ6CZS28fMHi83ZYf+A2vVnHNzZBM= +cosmossdk.io/math v1.1.2/go.mod h1:l2Gnda87F0su8a/7FEKJfFdJrM0JZRXQaohlgJeyQh0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.0.0 h1:0wAIcmJUqRdI8IJ/3eGi5/HwXZWPujYXXlkrQogz0Ek= filippo.io/edwards25519 v1.0.0/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= diff --git a/tx/go.mod b/tx/go.mod index d8a12a20e154..e9cdb1578bc7 100644 --- a/tx/go.mod +++ b/tx/go.mod @@ -5,7 +5,7 @@ go 1.19 require ( cosmossdk.io/api v0.3.1 cosmossdk.io/core v0.3.2 - cosmossdk.io/math v1.0.1 + cosmossdk.io/math v1.1.2 github.com/cosmos/cosmos-proto v1.0.0-beta.2 github.com/stretchr/testify v1.8.4 google.golang.org/protobuf v1.30.0 diff --git a/tx/go.sum b/tx/go.sum index 39fc85b94cd6..df646bb19df2 100644 --- a/tx/go.sum +++ b/tx/go.sum @@ -1,7 +1,7 @@ cosmossdk.io/api v0.3.1 h1:NNiOclKRR0AOlO4KIqeaG6PS6kswOMhHD0ir0SscNXE= cosmossdk.io/api v0.3.1/go.mod h1:DfHfMkiNA2Uhy8fj0JJlOCYOBp4eWUUJ1te5zBGNyIw= -cosmossdk.io/math v1.0.1 h1:Qx3ifyOPaMLNH/89WeZFH268yCvU4xEcnPLu3sJqPPg= -cosmossdk.io/math v1.0.1/go.mod h1:Ygz4wBHrgc7g0N+8+MrnTfS9LLn9aaTGa9hKopuym5k= +cosmossdk.io/math v1.1.2 h1:ORZetZCTyWkI5GlZ6CZS28fMHi83ZYf+A2vVnHNzZBM= +cosmossdk.io/math v1.1.2/go.mod h1:l2Gnda87F0su8a/7FEKJfFdJrM0JZRXQaohlgJeyQh0= github.com/cosmos/cosmos-proto v1.0.0-beta.2 h1:X3OKvWgK9Gsejo0F1qs5l8Qn6xJV/AzgIWR2wZ8Nua8= github.com/cosmos/cosmos-proto v1.0.0-beta.2/go.mod h1:+XRCLJ14pr5HFEHIUcn51IKXD1Fy3rkEQqt4WqmN4V0= github.com/cosmos/gogoproto v1.4.10 h1:QH/yT8X+c0F4ZDacDv3z+xE3WU1P1Z3wQoLMBRJoKuI= From dffcde2def54326eb254edf944c9f6d2399aeaea Mon Sep 17 00:00:00 2001 From: Tom <54514587+GAtom22@users.noreply.github.com> Date: Wed, 23 Aug 2023 11:24:54 -0300 Subject: [PATCH 07/13] chore(docs): remove deprecated prop type (#17510) --- x/gov/README.md | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/x/gov/README.md b/x/gov/README.md index 1e645c7e2da2..ca87ccad6067 100644 --- a/x/gov/README.md +++ b/x/gov/README.md @@ -1146,22 +1146,6 @@ Example (`cancel-software-upgrade`): simd tx gov submit-legacy-proposal cancel-software-upgrade --title="Test Proposal" --description="testing" --deposit="100000000stake" --from cosmos1.. ``` -Example (`community-pool-spend`): - -```bash -simd tx gov submit-legacy-proposal community-pool-spend proposal.json --from cosmos1.. -``` - -```json -{ - "title": "Test Proposal", - "description": "testing, 1, 2, 3", - "recipient": "cosmos1..", - "amount": "10000000stake", - "deposit": "10000000stake" -} -``` - Example (`param-change`): ```bash From bdbc1d6196a90dac1d59795145af8977c78ef7b4 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 24 Aug 2023 19:03:00 +0000 Subject: [PATCH 08/13] fix(x/authz): GetAuthorizations (backport #17334) (#17524) Co-authored-by: devon <80245700+devon-chain@users.noreply.github.com> Co-authored-by: Julien Robert --- CHANGELOG.md | 1 + x/authz/keeper/keeper.go | 2 +- x/authz/keeper/keeper_test.go | 21 +++++++++++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5edd1b875f52..0f60cf30ea35 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -52,6 +52,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Bug Fixes +* (x/authz) [#17524](https://github.com/cosmos/cosmos-sdk/pull/17524) Fix an issue where the `cachedValue` of an authorization would not be correcty populated when there are multiple authorizations returned in `GetAuthorizations`. * (server) [#17181](https://github.com/cosmos/cosmos-sdk/pull/17181) Fix `db_backend` lookup fallback from `config.toml`. * (runtime) [#17284](https://github.com/cosmos/cosmos-sdk/pull/17284) Properly allow to combine depinject-enabled modules and non-depinject-enabled modules in app v2. * (baseapp) [#17159](https://github.com/cosmos/cosmos-sdk/pull/17159) Validators can propose blocks that exceed the gas limit. diff --git a/x/authz/keeper/keeper.go b/x/authz/keeper/keeper.go index 788b87418e23..8e077e7674f2 100644 --- a/x/authz/keeper/keeper.go +++ b/x/authz/keeper/keeper.go @@ -234,9 +234,9 @@ func (k Keeper) GetAuthorizations(ctx sdk.Context, grantee sdk.AccAddress, grant iter := sdk.KVStorePrefixIterator(store, key) defer iter.Close() - var authorization authz.Grant var authorizations []authz.Authorization for ; iter.Valid(); iter.Next() { + var authorization authz.Grant if err := k.cdc.Unmarshal(iter.Value(), &authorization); err != nil { return nil, err } diff --git a/x/authz/keeper/keeper_test.go b/x/authz/keeper/keeper_test.go index c9d3189ca055..80d8aef18377 100644 --- a/x/authz/keeper/keeper_test.go +++ b/x/authz/keeper/keeper_test.go @@ -470,6 +470,27 @@ func (s *TestSuite) TestGetAuthorization() { } } +func (s *TestSuite) TestGetAuthorizations() { + require := s.Require() + addr1 := s.addrs[1] + addr2 := s.addrs[2] + + genAuthMulti := authz.NewGenericAuthorization(sdk.MsgTypeURL(&banktypes.MsgMultiSend{})) + genAuthSend := authz.NewGenericAuthorization(sdk.MsgTypeURL(&banktypes.MsgSend{})) + + start := s.ctx.BlockHeader().Time + expired := start.Add(time.Duration(1) * time.Second) + + s.Require().NoError(s.authzKeeper.SaveGrant(s.ctx, addr1, addr2, genAuthMulti, &expired), "creating multi send grant 1->2") + s.Require().NoError(s.authzKeeper.SaveGrant(s.ctx, addr1, addr2, genAuthSend, &expired), "creating send grant 1->2") + + authzs, err := s.authzKeeper.GetAuthorizations(s.ctx, addr1, addr2) + require.NoError(err) + require.Len(authzs, 2) + require.Equal(sdk.MsgTypeURL(&banktypes.MsgMultiSend{}), authzs[0].MsgTypeURL()) + require.Equal(sdk.MsgTypeURL(&banktypes.MsgSend{}), authzs[1].MsgTypeURL()) +} + func TestTestSuite(t *testing.T) { suite.Run(t, new(TestSuite)) } From dea01ddff95ae96facd3a8652460d7484bb1a1d6 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 25 Aug 2023 15:26:02 +0000 Subject: [PATCH 09/13] docs: update x/group create-proposal to submit-proposal (backport #17544) (#17548) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Félix C. Morency <1102868+fmorency@users.noreply.github.com> --- x/group/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/x/group/README.md b/x/group/README.md index 260e79622fca..71d91ccb4a24 100644 --- a/x/group/README.md +++ b/x/group/README.md @@ -1128,18 +1128,18 @@ Example: simd tx group update-group-policy-decision-policy cosmos1.. cosmos1.. '{"@type":"/cosmos.group.v1.ThresholdDecisionPolicy", "threshold":"2", "windows": {"voting_period": "120h", "min_execution_period": "0s"}}' ``` -#### create-proposal +#### submit-proposal -The `create-proposal` command allows users to submit a new proposal. +The `submit-proposal` command allows users to submit a new proposal. ```bash -simd tx group create-proposal [group-policy-account] [proposer[,proposer]*] [msg_tx_json_file] [metadata] [flags] +simd tx group submit-proposal [group-policy-account] [proposer[,proposer]*] [msg_tx_json_file] [metadata] [flags] ``` Example: ```bash -simd tx group create-proposal cosmos1.. cosmos1.. msg_tx.json "AQ==" +simd tx group submit-proposal cosmos1.. cosmos1.. msg_tx.json "AQ==" ``` #### withdraw-proposal From 4bba75e24e6c68f4067b51846eef8ff4d549f9b5 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 25 Aug 2023 16:25:32 +0000 Subject: [PATCH 10/13] docs(x/group): fix submit-proposal help json example (backport #17546) (#17551) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Félix C. Morency <1102868+fmorency@users.noreply.github.com> --- x/group/client/cli/tx.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x/group/client/cli/tx.go b/x/group/client/cli/tx.go index 93dc5627d16b..332ae32a34d5 100644 --- a/x/group/client/cli/tx.go +++ b/x/group/client/cli/tx.go @@ -566,13 +566,13 @@ Parameters: "from_address": "cosmos1...", "to_address": "cosmos1...", "amount":[{"denom": "stake","amount": "10"}] - "title": "My proposal", - "summary": "This is a proposal to send 10 stake to cosmos1...", } ], // metadata can be any of base64 encoded, raw text, stringified json, IPFS link to json // see below for example metadata "metadata": "4pIMOgIGx1vZGU=", // base64-encoded metadata + "title": "My proposal", + "summary": "This is a proposal to send 10 stake to cosmos1...", "proposers": ["cosmos1...", "cosmos1..."], } From c9144f02dda85d2bbf09115a134ba7f81c9a5052 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 28 Aug 2023 09:08:59 +0200 Subject: [PATCH 11/13] build(deps): Bump cosmossdk.io/log from 1.2.0 to 1.2.1 (#17557) --- go.mod | 2 +- go.sum | 4 ++-- simapp/go.mod | 2 +- simapp/go.sum | 4 ++-- tests/go.mod | 2 +- tests/go.sum | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index cdfe78b9c7bf..b8c8ac122d25 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( cosmossdk.io/core v0.5.1 cosmossdk.io/depinject v1.0.0-alpha.4 cosmossdk.io/errors v1.0.0 - cosmossdk.io/log v1.2.0 + cosmossdk.io/log v1.2.1 cosmossdk.io/math v1.1.2 cosmossdk.io/tools/rosetta v0.2.1 github.com/99designs/keyring v1.2.1 diff --git a/go.sum b/go.sum index efa5ed12b5a5..f827f8cff5d1 100644 --- a/go.sum +++ b/go.sum @@ -195,8 +195,8 @@ cosmossdk.io/depinject v1.0.0-alpha.4 h1:PLNp8ZYAMPTUKyG9IK2hsbciDWqna2z1Wsl98ok cosmossdk.io/depinject v1.0.0-alpha.4/go.mod h1:HeDk7IkR5ckZ3lMGs/o91AVUc7E596vMaOmslGFM3yU= cosmossdk.io/errors v1.0.0 h1:nxF07lmlBbB8NKQhtJ+sJm6ef5uV1XkvPXG2bUntb04= cosmossdk.io/errors v1.0.0/go.mod h1:+hJZLuhdDE0pYN8HkOrVNwrIOYvUGnn6+4fjnJs/oV0= -cosmossdk.io/log v1.2.0 h1:BbykkDsutXPSy8RojFB3KZEWyvMsToLy0ykb/ZhsLqQ= -cosmossdk.io/log v1.2.0/go.mod h1:GNSCc/6+DhFIj1aLn/j7Id7PaO8DzNylUZoOYBL9+I4= +cosmossdk.io/log v1.2.1 h1:Xc1GgTCicniwmMiKwDxUjO4eLhPxoVdI9vtMW8Ti/uk= +cosmossdk.io/log v1.2.1/go.mod h1:GNSCc/6+DhFIj1aLn/j7Id7PaO8DzNylUZoOYBL9+I4= cosmossdk.io/math v1.1.2 h1:ORZetZCTyWkI5GlZ6CZS28fMHi83ZYf+A2vVnHNzZBM= cosmossdk.io/math v1.1.2/go.mod h1:l2Gnda87F0su8a/7FEKJfFdJrM0JZRXQaohlgJeyQh0= cosmossdk.io/tools/rosetta v0.2.1 h1:ddOMatOH+pbxWbrGJKRAawdBkPYLfKXutK9IETnjYxw= diff --git a/simapp/go.mod b/simapp/go.mod index 41c30bce8f6b..03ca91587aaf 100644 --- a/simapp/go.mod +++ b/simapp/go.mod @@ -27,7 +27,7 @@ require ( cloud.google.com/go/iam v1.1.0 // indirect cloud.google.com/go/storage v1.30.1 // indirect cosmossdk.io/errors v1.0.0 // indirect - cosmossdk.io/log v1.2.0 // indirect + cosmossdk.io/log v1.2.1 // indirect filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect diff --git a/simapp/go.sum b/simapp/go.sum index fdc3b9887625..1c7da6fee9c6 100644 --- a/simapp/go.sum +++ b/simapp/go.sum @@ -195,8 +195,8 @@ cosmossdk.io/depinject v1.0.0-alpha.4 h1:PLNp8ZYAMPTUKyG9IK2hsbciDWqna2z1Wsl98ok cosmossdk.io/depinject v1.0.0-alpha.4/go.mod h1:HeDk7IkR5ckZ3lMGs/o91AVUc7E596vMaOmslGFM3yU= cosmossdk.io/errors v1.0.0 h1:nxF07lmlBbB8NKQhtJ+sJm6ef5uV1XkvPXG2bUntb04= cosmossdk.io/errors v1.0.0/go.mod h1:+hJZLuhdDE0pYN8HkOrVNwrIOYvUGnn6+4fjnJs/oV0= -cosmossdk.io/log v1.2.0 h1:BbykkDsutXPSy8RojFB3KZEWyvMsToLy0ykb/ZhsLqQ= -cosmossdk.io/log v1.2.0/go.mod h1:GNSCc/6+DhFIj1aLn/j7Id7PaO8DzNylUZoOYBL9+I4= +cosmossdk.io/log v1.2.1 h1:Xc1GgTCicniwmMiKwDxUjO4eLhPxoVdI9vtMW8Ti/uk= +cosmossdk.io/log v1.2.1/go.mod h1:GNSCc/6+DhFIj1aLn/j7Id7PaO8DzNylUZoOYBL9+I4= cosmossdk.io/math v1.1.2 h1:ORZetZCTyWkI5GlZ6CZS28fMHi83ZYf+A2vVnHNzZBM= cosmossdk.io/math v1.1.2/go.mod h1:l2Gnda87F0su8a/7FEKJfFdJrM0JZRXQaohlgJeyQh0= cosmossdk.io/tools/rosetta v0.2.1 h1:ddOMatOH+pbxWbrGJKRAawdBkPYLfKXutK9IETnjYxw= diff --git a/tests/go.mod b/tests/go.mod index 22481e24b45e..8f18aa90c67e 100644 --- a/tests/go.mod +++ b/tests/go.mod @@ -28,7 +28,7 @@ require ( cloud.google.com/go/storage v1.30.1 // indirect cosmossdk.io/core v0.5.1 // indirect cosmossdk.io/errors v1.0.0 // indirect - cosmossdk.io/log v1.2.0 // indirect + cosmossdk.io/log v1.2.1 // indirect cosmossdk.io/tools/rosetta v0.2.1 // indirect filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect diff --git a/tests/go.sum b/tests/go.sum index 74d42af548d6..7c189c147ae2 100644 --- a/tests/go.sum +++ b/tests/go.sum @@ -195,8 +195,8 @@ cosmossdk.io/depinject v1.0.0-alpha.4 h1:PLNp8ZYAMPTUKyG9IK2hsbciDWqna2z1Wsl98ok cosmossdk.io/depinject v1.0.0-alpha.4/go.mod h1:HeDk7IkR5ckZ3lMGs/o91AVUc7E596vMaOmslGFM3yU= cosmossdk.io/errors v1.0.0 h1:nxF07lmlBbB8NKQhtJ+sJm6ef5uV1XkvPXG2bUntb04= cosmossdk.io/errors v1.0.0/go.mod h1:+hJZLuhdDE0pYN8HkOrVNwrIOYvUGnn6+4fjnJs/oV0= -cosmossdk.io/log v1.2.0 h1:BbykkDsutXPSy8RojFB3KZEWyvMsToLy0ykb/ZhsLqQ= -cosmossdk.io/log v1.2.0/go.mod h1:GNSCc/6+DhFIj1aLn/j7Id7PaO8DzNylUZoOYBL9+I4= +cosmossdk.io/log v1.2.1 h1:Xc1GgTCicniwmMiKwDxUjO4eLhPxoVdI9vtMW8Ti/uk= +cosmossdk.io/log v1.2.1/go.mod h1:GNSCc/6+DhFIj1aLn/j7Id7PaO8DzNylUZoOYBL9+I4= cosmossdk.io/math v1.1.2 h1:ORZetZCTyWkI5GlZ6CZS28fMHi83ZYf+A2vVnHNzZBM= cosmossdk.io/math v1.1.2/go.mod h1:l2Gnda87F0su8a/7FEKJfFdJrM0JZRXQaohlgJeyQh0= cosmossdk.io/tools/rosetta v0.2.1 h1:ddOMatOH+pbxWbrGJKRAawdBkPYLfKXutK9IETnjYxw= From 273bb7dbdfa08f065f5380895f0a3304aacb743e Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 31 Aug 2023 11:35:18 +0200 Subject: [PATCH 12/13] docs: improve DeductFeeDecorator godoc (backport #17559) (#17590) Co-authored-by: Rootul P --- x/auth/ante/fee.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/x/auth/ante/fee.go b/x/auth/ante/fee.go index 80141ef0b5dc..66b2ba3684a9 100644 --- a/x/auth/ante/fee.go +++ b/x/auth/ante/fee.go @@ -12,9 +12,9 @@ import ( // the effective fee should be deducted later, and the priority should be returned in abci response. type TxFeeChecker func(ctx sdk.Context, tx sdk.Tx) (sdk.Coins, int64, error) -// DeductFeeDecorator deducts fees from the first signer of the tx -// If the first signer does not have the funds to pay for the fees, return with InsufficientFunds error -// Call next AnteHandler if fees successfully deducted +// DeductFeeDecorator deducts fees from the fee payer. The fee payer is the fee granter (if specified) or first signer of the tx. +// If the fee payer does not have the funds to pay for the fees, return an InsufficientFunds error. +// Call next AnteHandler if fees successfully deducted. // CONTRACT: Tx must implement FeeTx interface to use DeductFeeDecorator type DeductFeeDecorator struct { accountKeeper AccountKeeper From 2e9e5d6eea24d6c11eddc9c002c66e89ae036187 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Thu, 31 Aug 2023 17:26:33 +0200 Subject: [PATCH 13/13] chore: prepare v0.47.5 (#17407) --- CHANGELOG.md | 3 ++- RELEASE_NOTES.md | 14 ++++++++------ x/authz/keeper/keeper.go | 2 +- x/authz/keeper/keeper_test.go | 21 --------------------- 4 files changed, 11 insertions(+), 29 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f60cf30ea35..02203d95b8b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,8 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [Unreleased] +## [v0.47.5](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.5) - 2023-09-01 + ### Features * (client/rpc) [#17274](https://github.com/cosmos/cosmos-sdk/pull/17274) Add `QueryEventForTxCmd` cmd to subscribe and wait event for transaction by hash. @@ -52,7 +54,6 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Bug Fixes -* (x/authz) [#17524](https://github.com/cosmos/cosmos-sdk/pull/17524) Fix an issue where the `cachedValue` of an authorization would not be correcty populated when there are multiple authorizations returned in `GetAuthorizations`. * (server) [#17181](https://github.com/cosmos/cosmos-sdk/pull/17181) Fix `db_backend` lookup fallback from `config.toml`. * (runtime) [#17284](https://github.com/cosmos/cosmos-sdk/pull/17284) Properly allow to combine depinject-enabled modules and non-depinject-enabled modules in app v2. * (baseapp) [#17159](https://github.com/cosmos/cosmos-sdk/pull/17159) Validators can propose blocks that exceed the gas limit. diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 846f81db1fc4..0f7b616d64de 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,15 +1,17 @@ -# Cosmos SDK v0.47.4 Release Notes +# Cosmos SDK v0.47.5 Release Notes 💬 [**Release Discussion**](https://github.com/orgs/cosmos/discussions/categories/announcements) ## 🚀 Highlights -Missed the v0.47.0 announcement? Read it [here](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.0). -For this fourth patch release of the `v0.47.x` line, some of the notable changes include: +Get ready for v0.50.0 and start integrating with the next [Cosmos SDK](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.50.0-rc.0) release. -* An improvement in ` prune` UX. -* Improving the error handling when there is a snapshot creation failure. +For this 5th patch release of the `v0.47.x` line, some of the notable changes include: -Check out the [changelog](https://github.com/cosmos/cosmos-sdk/blob/v0.47.4/CHANGELOG.md) for an exhaustive list of changes or [compare changes](https://github.com/cosmos/cosmos-sdk/compare/release/v0.47.3...v0.47.4) from last release. +* A new command for importing private keys encoded in hex. This complements the existing `import` command that supports mnemonic and key files. + Use ` keys import ` to import a private key encoded in hex. +* A new command, `rpc.QueryEventForTxCmd` for querying a transaction by its hash and blocking until the transaction is included in a block. It is useful as an alternative to the legacy `--sync block`. + +Check out the [changelog](https://github.com/cosmos/cosmos-sdk/blob/v0.47.5/CHANGELOG.md) for an exhaustive list of changes or [compare changes](https://github.com/cosmos/cosmos-sdk/compare/release/v0.47.4...v0.47.5) from last release. Refer to the [upgrading guide](https://github.com/cosmos/cosmos-sdk/blob/release/v0.47.x/UPGRADING.md) when migrating from `v0.46.x` to `v0.47.0`. diff --git a/x/authz/keeper/keeper.go b/x/authz/keeper/keeper.go index 8e077e7674f2..788b87418e23 100644 --- a/x/authz/keeper/keeper.go +++ b/x/authz/keeper/keeper.go @@ -234,9 +234,9 @@ func (k Keeper) GetAuthorizations(ctx sdk.Context, grantee sdk.AccAddress, grant iter := sdk.KVStorePrefixIterator(store, key) defer iter.Close() + var authorization authz.Grant var authorizations []authz.Authorization for ; iter.Valid(); iter.Next() { - var authorization authz.Grant if err := k.cdc.Unmarshal(iter.Value(), &authorization); err != nil { return nil, err } diff --git a/x/authz/keeper/keeper_test.go b/x/authz/keeper/keeper_test.go index 80d8aef18377..c9d3189ca055 100644 --- a/x/authz/keeper/keeper_test.go +++ b/x/authz/keeper/keeper_test.go @@ -470,27 +470,6 @@ func (s *TestSuite) TestGetAuthorization() { } } -func (s *TestSuite) TestGetAuthorizations() { - require := s.Require() - addr1 := s.addrs[1] - addr2 := s.addrs[2] - - genAuthMulti := authz.NewGenericAuthorization(sdk.MsgTypeURL(&banktypes.MsgMultiSend{})) - genAuthSend := authz.NewGenericAuthorization(sdk.MsgTypeURL(&banktypes.MsgSend{})) - - start := s.ctx.BlockHeader().Time - expired := start.Add(time.Duration(1) * time.Second) - - s.Require().NoError(s.authzKeeper.SaveGrant(s.ctx, addr1, addr2, genAuthMulti, &expired), "creating multi send grant 1->2") - s.Require().NoError(s.authzKeeper.SaveGrant(s.ctx, addr1, addr2, genAuthSend, &expired), "creating send grant 1->2") - - authzs, err := s.authzKeeper.GetAuthorizations(s.ctx, addr1, addr2) - require.NoError(err) - require.Len(authzs, 2) - require.Equal(sdk.MsgTypeURL(&banktypes.MsgMultiSend{}), authzs[0].MsgTypeURL()) - require.Equal(sdk.MsgTypeURL(&banktypes.MsgSend{}), authzs[1].MsgTypeURL()) -} - func TestTestSuite(t *testing.T) { suite.Run(t, new(TestSuite)) }