From 5f8efefe6ace713b628ecf95ad9e8bc9538856fe Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Fri, 6 May 2022 16:27:38 +0200 Subject: [PATCH] feat: add feegrant query to see allowances from a given granter (backport #10947) (#11885) --- CHANGELOG.md | 2687 ++++++++++++++--- .../base/tendermint/v1beta1/query.proto | 16 +- .../cosmos/store/snapshots/v1/snapshot.proto | 3 +- proto/cosmos/tx/signing/v1beta1/signing.proto | 2 +- proto/cosmos/tx/v1beta1/service.proto | 6 +- types/tx/signing/signing.pb.go | 82 +- x/authz/authz.pb.go | 2 + x/authz/keeper/keys.go | 8 + x/authz/query.pb.go | 8 +- x/distribution/types/keys.go | 85 +- x/feegrant/client/cli/tx_test.go | 134 +- x/feegrant/keeper/grpc_query.go | 39 + x/feegrant/keeper/grpc_query_test.go | 72 +- x/feegrant/key.go | 32 +- x/feegrant/key_test.go | 25 + .../proto/cosmos/feegrant/v1beta1/query.proto | 8 +- x/feegrant/query.pb.go | 70 +- x/feegrant/query.pb.gw.go | 3 - x/gov/proto/cosmos/gov/v1beta1/gov.proto | 2 +- x/gov/types/keys.go | 122 +- x/slashing/types/keys.go | 28 + x/staking/types/keys.go | 115 +- 22 files changed, 3089 insertions(+), 460 deletions(-) create mode 100644 x/feegrant/key_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index d8088de08468..d49559b70ffa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,8 @@ Ref: https://keepachangelog.com/en/1.0.0/ * [#11796](https://github.com/cosmos/cosmos-sdk/pull/11796) Handle EOF error case in `readLineFromBuf`, which allows successful reading of passphrases from STDIN. * [\#11772](https://github.com/cosmos/cosmos-sdk/pull/11772) Limit types.Dec length to avoid overflow. +* [\#10947](https://github.com/cosmos/cosmos-sdk/pull/10947) Add `AllowancesByGranter` query to the feegrant module +* [\#9639](https://github.com/cosmos/cosmos-sdk/pull/9639) Check store keys length before accessing them by making sure that `key` is of length `m+1` (for `key[n:m]`) ## Improvements @@ -279,18 +281,17 @@ Security Release. No breaking changes related to 0.44.x. * (crypto/ed25519) [\#8690] Adopt zip1215 ed2559 verification rules. * [\#8849](https://github.com/cosmos/cosmos-sdk/pull/8849) Upgrade module no longer supports time based upgrades. * [\#7477](https://github.com/cosmos/cosmos-sdk/pull/7477) Changed Bech32 Public Key serialization in the client facing functionality (CLI, MsgServer, QueryServer): - * updated the keyring display structure (it uses protobuf JSON serialization) - the output is more verbose. - * Renamed `MarshalAny` and `UnmarshalAny` to `MarshalInterface` and `UnmarshalInterface` respectively. These functions must take an interface as parameter (not a concrete type nor `Any` object). Underneath they use `Any` wrapping for correct protobuf serialization. - * CLI: removed `--text` flag from `show-node-id` command; the text format for public keys is not used any more - instead we use ProtoJSON. + * updated the keyring display structure (it uses protobuf JSON serialization) - the output is more verbose. + * Renamed `MarshalAny` and `UnmarshalAny` to `MarshalInterface` and `UnmarshalInterface` respectively. These functions must take an interface as parameter (not a concrete type nor `Any` object). Underneath they use `Any` wrapping for correct protobuf serialization. + * CLI: removed `--text` flag from `show-node-id` command; the text format for public keys is not used any more - instead we use ProtoJSON. * (store) [\#8790](https://github.com/cosmos/cosmos-sdk/pull/8790) Reduce gas costs by 10x for transient store operations. * [\#9139](https://github.com/cosmos/cosmos-sdk/pull/9139) Querying events: - * via `ServiceMsg` TypeURLs (e.g. `message.action='/cosmos.bank.v1beta1.Msg/Send'`) does not work anymore, - * via legacy `msg.Type()` (e.g. `message.action='send'`) is being deprecated, new `Msg`s won't emit these events. - * Please use concrete `Msg` TypeURLs instead (e.g. `message.action='/cosmos.bank.v1beta1.MsgSend'`). + * via `ServiceMsg` TypeURLs (e.g. `message.action='/cosmos.bank.v1beta1.Msg/Send'`) does not work anymore, + * via legacy `msg.Type()` (e.g. `message.action='send'`) is being deprecated, new `Msg`s won't emit these events. + * Please use concrete `Msg` TypeURLs instead (e.g. `message.action='/cosmos.bank.v1beta1.MsgSend'`). * [\#9859](https://github.com/cosmos/cosmos-sdk/pull/9859) The `default` pruning strategy now keeps the last 362880 blocks instead of 100. 362880 equates to roughly enough blocks to cover the entire unbonding period assuming a 21 day unbonding period and 5s block time. * [\#9785](https://github.com/cosmos/cosmos-sdk/issues/9785) Missing coin denomination in logs - ### API Breaking Changes * (keyring) [#\8662](https://github.com/cosmos/cosmos-sdk/pull/8662) `NewMnemonic` now receives an additional `passphrase` argument to secure the key generated by the bip39 mnemonic. @@ -309,11 +310,11 @@ Security Release. No breaking changes related to 0.44.x. * (baseapp) [\7487](https://github.com/cosmos/cosmos-sdk/pull/8897) BaseApp's fields appVersion and version were swapped to match Tendermint's fields. * [\#8682](https://github.com/cosmos/cosmos-sdk/pull/8682) `ante.NewAnteHandler` updated to receive all positional params as `ante.HandlerOptions` struct. If required fields aren't set, throws error accordingly. * (x/staking/types) [\#7447](https://github.com/cosmos/cosmos-sdk/issues/7447) Remove bech32 PubKey support: - * `ValidatorI` interface update: `GetConsPubKey` renamed to `TmConsPubKey` (this is to clarify the return type: consensus public key must be a tendermint key); `TmConsPubKey`, `GetConsAddr` methods return error. - * `Validator` updated according to the `ValidatorI` changes described above. - * `ToTmValidator` function: added `error` to return values. - * `Validator.ConsensusPubkey` type changed from `string` to `codectypes.Any`. - * `MsgCreateValidator.Pubkey` type changed from `string` to `codectypes.Any`. + * `ValidatorI` interface update: `GetConsPubKey` renamed to `TmConsPubKey` (this is to clarify the return type: consensus public key must be a tendermint key); `TmConsPubKey`, `GetConsAddr` methods return error. + * `Validator` updated according to the `ValidatorI` changes described above. + * `ToTmValidator` function: added `error` to return values. + * `Validator.ConsensusPubkey` type changed from `string` to `codectypes.Any`. + * `MsgCreateValidator.Pubkey` type changed from `string` to `codectypes.Any`. * (client) [\#8926](https://github.com/cosmos/cosmos-sdk/pull/8926) `client/tx.PrepareFactory` has been converted to a private function, as it's only used internally. * (auth/tx) [\#8926](https://github.com/cosmos/cosmos-sdk/pull/8926) The `ProtoTxProvider` interface used as a workaround for transaction simulation has been removed. * (x/bank) [\#8798](https://github.com/cosmos/cosmos-sdk/pull/8798) `GetTotalSupply` is removed in favour of `GetPaginatedTotalSupply` @@ -321,23 +322,21 @@ Security Release. No breaking changes related to 0.44.x. * (x/bank/types) [\#9061](https://github.com/cosmos/cosmos-sdk/pull/9061) `AddressFromBalancesStore` now returns an error for invalid key instead of panic. * (x/auth) [\#9144](https://github.com/cosmos/cosmos-sdk/pull/9144) The `NewTxTimeoutHeightDecorator` antehandler has been converted from a struct to a function. * (codec) [\#9226](https://github.com/cosmos/cosmos-sdk/pull/9226) Rename codec interfaces and methods, to follow a general Go interfaces: - * `codec.Marshaler` → `codec.Codec` (this defines objects which serialize other objects) - * `codec.BinaryMarshaler` → `codec.BinaryCodec` - * `codec.JSONMarshaler` → `codec.JSONCodec` - * Removed `BinaryBare` suffix from `BinaryCodec` methods (`MarshalBinaryBare`, `UnmarshalBinaryBare`, ...) - * Removed `Binary` infix from `BinaryCodec` methods (`MarshalBinaryLengthPrefixed`, `UnmarshalBinaryLengthPrefixed`, ...) + * `codec.Marshaler` → `codec.Codec` (this defines objects which serialize other objects) + * `codec.BinaryMarshaler` → `codec.BinaryCodec` + * `codec.JSONMarshaler` → `codec.JSONCodec` + * Removed `BinaryBare` suffix from `BinaryCodec` methods (`MarshalBinaryBare`, `UnmarshalBinaryBare`, ...) + * Removed `Binary` infix from `BinaryCodec` methods (`MarshalBinaryLengthPrefixed`, `UnmarshalBinaryLengthPrefixed`, ...) * [\#9139](https://github.com/cosmos/cosmos-sdk/pull/9139) `ServiceMsg` TypeURLs (e.g. `/cosmos.bank.v1beta1.Msg/Send`) have been removed, as they don't comply to the Probobuf `Any` spec. Please use `Msg` type TypeURLs (e.g. `/cosmos.bank.v1beta1.MsgSend`). This has multiple consequences: - * The `sdk.ServiceMsg` struct has been removed. - * `sdk.Msg` now only contains `ValidateBasic` and `GetSigners` methods. The remaining methods `GetSignBytes`, `Route` and `Type` are moved to `legacytx.LegacyMsg`. - * The `RegisterCustomTypeURL` function and the `cosmos.base.v1beta1.ServiceMsg` interface have been removed from the interface registry. + * The `sdk.ServiceMsg` struct has been removed. + * `sdk.Msg` now only contains `ValidateBasic` and `GetSigners` methods. The remaining methods `GetSignBytes`, `Route` and `Type` are moved to `legacytx.LegacyMsg`. + * The `RegisterCustomTypeURL` function and the `cosmos.base.v1beta1.ServiceMsg` interface have been removed from the interface registry. * (codec) [\#9251](https://github.com/cosmos/cosmos-sdk/pull/9251) Rename `clientCtx.JSONMarshaler` to `clientCtx.JSONCodec` as per #9226. * (x/bank) [\#9271](https://github.com/cosmos/cosmos-sdk/pull/9271) SendEnabledCoin(s) renamed to IsSendEnabledCoin(s) to better reflect its functionality. * (x/bank) [\#9550](https://github.com/cosmos/cosmos-sdk/pull/9550) `server.InterceptConfigsPreRunHandler` now takes 2 additional arguments: customAppConfigTemplate and customAppConfig. If you don't need to customize these, simply put `""` and `nil`. * [\#8245](https://github.com/cosmos/cosmos-sdk/pull/8245) Removed `simapp.MakeCodecs` and use `simapp.MakeTestEncodingConfig` instead. * (x/capability) [\#9836](https://github.com/cosmos/cosmos-sdk/pull/9836) Removed `InitializeAndSeal(ctx sdk.Context)` and replaced with `Seal()`. App must add x/capability module to the begin blockers which will assure that the x/capability keeper is properly initialized. The x/capability begin blocker must be run before any other module which uses x/capability. - - ### State Machine Breaking ### Features @@ -423,83 +422,6 @@ Security Release. No breaking changes related to 0.44.x. * [#19833](https://github.com/cosmos/cosmos-sdk/pull/19833) Fix some places in which we call Remove inside a Walk. * [#19851](https://github.com/cosmos/cosmos-sdk/pull/19851) Fix some places in which we call Remove inside a Walk (x/staking and x/gov). -### API Breaking Changes - -* (baseapp) [#16244](https://github.com/cosmos/cosmos-sdk/pull/16244) `SetProtocolVersion` has been renamed to `SetAppVersion`. It now updates the consensus params in baseapp's `ParamStore`. -* (types) [#16918](https://github.com/cosmos/cosmos-sdk/pull/16918) Remove `IntProto` and `DecProto`. Instead, `math.Int` and `math.LegacyDec` should be used respectively. Both types support `Marshal` and `Unmarshal` which should be used for binary marshaling. -* (client) [#17215](https://github.com/cosmos/cosmos-sdk/pull/17215) `server.StartCmd`,`server.ExportCmd`,`server.NewRollbackCmd`,`pruning.Cmd`,`genutilcli.InitCmd`,`genutilcli.GenTxCmd`,`genutilcli.CollectGenTxsCmd`,`genutilcli.AddGenesisAccountCmd`, do not take a home directory anymore. It is inferred from the root command. -* (client) [#17259](https://github.com/cosmos/cosmos-sdk/pull/17259) Remove deprecated `clientCtx.PrintObjectLegacy`. Use `clientCtx.PrintProto` or `clientCtx.PrintRaw` instead. -* (types) [#17348](https://github.com/cosmos/cosmos-sdk/pull/17348) Remove the `WrapServiceResult` function. - * The `*sdk.Result` returned by the msg server router will not contain the `.Data` field. -* (types) [#17426](https://github.com/cosmos/cosmos-sdk/pull/17426) `NewContext` does not take a `cmtproto.Header{}` any longer. - * `WithChainID` / `WithBlockHeight` / `WithBlockHeader` must be used to set values on the context -* (client/keys) [#17503](https://github.com/cosmos/cosmos-sdk/pull/17503) `clientkeys.NewKeyOutput`, `MkConsKeyOutput`, `MkValKeyOutput`, `MkAccKeyOutput`, `MkAccKeysOutput` now take their corresponding address codec instead of using the global SDK config. -* (types/simulation) [#17737](https://github.com/cosmos/cosmos-sdk/pull/17737) Remove unused parameter from `RandomFees` -* (types) [#17738](https://github.com/cosmos/cosmos-sdk/pull/17738) `WithBlockTime()` was removed & `BlockTime()` were deprecated in favor of `WithHeaderInfo()` & `HeaderInfo()`. `BlockTime` now gets data from `HeaderInfo()` instead of `BlockHeader()`. -* (client) [#17746](https://github.com/cosmos/cosmos-sdk/pull/17746) `txEncodeAmino` & `txDecodeAmino` txs via grpc and rest were removed -* (app) [#17838](https://github.com/cosmos/cosmos-sdk/pull/17838) Params module was removed from simapp and all imports of the params module removed throughout the repo. - * The Cosmos SDK has migrated away from using params, if your app still uses it, then you can leave it plugged into your app -* (x/bank/testutil) [#17868](https://github.com/cosmos/cosmos-sdk/pull/17868) `MsgSendExec` has been removed because of AutoCLI migration. -* (types) [#17885](https://github.com/cosmos/cosmos-sdk/pull/17885) `InitGenesis` & `ExportGenesis` now take `context.Context` instead of `sdk.Context` -* (x/gov/testutil) [#17986](https://github.com/cosmos/cosmos-sdk/pull/18036) `MsgDeposit` has been removed because of AutoCLI migration. -* (x/staking/testutil) [#17986](https://github.com/cosmos/cosmos-sdk/pull/17986) `MsgRedelegateExec`, `MsgUnbondExec` has been removed because of AutoCLI migration. -* (x/group) [#17937](https://github.com/cosmos/cosmos-sdk/pull/17937) Groups module was moved to its own go.mod `cosmossdk.io/x/group` -* (x/gov) [#18197](https://github.com/cosmos/cosmos-sdk/pull/18197) Gov module was moved to its own go.mod `cosmossdk.io/x/gov` -* (x/distribution) [#18199](https://github.com/cosmos/cosmos-sdk/pull/18199) Distribution module was moved to its own go.mod `cosmossdk.io/x/distribution` -* (x/slashing) [#18201](https://github.com/cosmos/cosmos-sdk/pull/18201) Slashing module was moved to its own go.mod `cosmossdk.io/x/slashing` -* (x/staking) [#18257](https://github.com/cosmos/cosmos-sdk/pull/18257) Staking module was moved to its own go.mod `cosmossdk.io/x/staking` -* (types) [#18268](https://github.com/cosmos/cosmos-sdk/pull/18268) Remove global setting of basedenom. Use the staking module parameter instead -* (x/authz) [#18265](https://github.com/cosmos/cosmos-sdk/pull/18265) Authz module was moved to its own go.mod `cosmossdk.io/x/authz` -* (x/mint) [#18283](https://github.com/cosmos/cosmos-sdk/pull/18283) Mint module was moved to its own go.mod `cosmossdk.io/x/mint` -* (server) [#18303](https://github.com/cosmos/cosmos-sdk/pull/18303) `x/genutil` now handles the application export. `server.AddCommands` does not take an `AppExporter` but instead `genutilcli.Commands` does. -* (types) [#18372](https://github.com/cosmos/cosmos-sdk/pull/18372) Removed global configuration for coin type and purpose. Setters and getters should be removed and access directly to defined types. -* (types) [#18607](https://github.com/cosmos/cosmos-sdk/pull/18607) Removed address verifier from global config, moved verifier function to bech32 codec. -* (types) [#18695](https://github.com/cosmos/cosmos-sdk/pull/18695) Removed global configuration for txEncoder. -* (server) [#18909](https://github.com/cosmos/cosmos-sdk/pull/18909) Remove configuration endpoint on grpc reflection endpoint in favour of auth module bech32prefix endpoint already exposed. -* (crypto) [#19541](https://github.com/cosmos/cosmos-sdk/pull/19541) The deprecated `FromTmProtoPublicKey`, `ToTmProtoPublicKey`, `FromTmPubKeyInterface` and `ToTmPubKeyInterface` functions have been removed. Use their replacements (`Cmt` instead of `Tm`) instead. -* (types) [#19512](https://github.com/cosmos/cosmos-sdk/pull/19512) Remove basic manager and all related functions (`module.BasicManager`, `module.NewBasicManager`, `module.NewBasicManagerFromManager`, `NewGenesisOnlyAppModule`). - * The module manager now can do everything that the basic manager was doing. - * When using runtime, just inject the module manager when needed using your app config. - * All `AppModuleBasic` structs have been removed. -* (types) [#19627](https://github.com/cosmos/cosmos-sdk/pull/19627) and [#19735](https://github.com/cosmos/cosmos-sdk/pull/19735) All genesis interfaces now don't take `codec.JsonCodec`: - * Every module has the codec already, passing it created an unneeded dependency. - * Additionally, to reflect this change, the module manager does not take a codec either. -* (types) [#19652](https://github.com/cosmos/cosmos-sdk/pull/19652) and [#19758](https://github.com/cosmos/cosmos-sdk/pull/19758) - * Moved`types/module.HasRegisterInterfaces` to `cosmossdk.io/core`. - * Moved `RegisterInterfaces` and `RegisterImplementations` from `InterfaceRegistry` to `cosmossdk.io/core/registry.InterfaceRegistrar` interface. -* (types) [#19742](https://github.com/cosmos/cosmos-sdk/pull/19742) Removes the use of `Accounts.String` - * `SimulationState` now has address and validator codecs as fields. -* (runtime) [#19747](https://github.com/cosmos/cosmos-sdk/pull/19747) `runtime.ValidatorAddressCodec` and `runtime.ConsensusAddressCodec` have been moved to `core`. -* (all) [#19726](https://github.com/cosmos/cosmos-sdk/pull/19726) Integrate comet v1 -* [#19833](https://github.com/cosmos/cosmos-sdk/pull/19833) Fix some places in which we call Remove inside a Walk. -* [#19839](https://github.com/cosmos/cosmos-sdk/pull/19839) `Tx.GetMsgsV2` has been replaced with `Tx.GetReflectMessages`, and `Codec.GetMsgV1Signers` and `Codec.GetMsgV2Signers` have been replaced with `GetMsgSigners` and `GetReflectMsgSigners` respectively. These API changes clear up confusion as to the use and purpose of these methods. -* [#19851](https://github.com/cosmos/cosmos-sdk/pull/19851) Fix some places in which we call Remove inside a Walk (x/staking and x/gov). -* (server) [#19854](https://github.com/cosmos/cosmos-sdk/pull/19854) Remove `servertypes.ModuleInitFlags` types and from `server.AddCommands` as `StartCmdOptions` already achieves the same goal. -* (x/genutil) [#19926](https://github.com/cosmos/cosmos-sdk/pull/19926) Removal of the `Address.String()` method and related changes: - * Added an address codec as an argument to `CollectTxs`, `GenAppStateFromConfig`, and `AddGenesisAccount`. - * Removed the `ValidatorAddressCodec` argument from `CollectGenTxsCmd`, now utilizing the context for this purpose. - * Changed `ValidateAccountInGenesis` to accept a string instead of an `AccAddress`. -* (baseapp) [#19993](https://github.com/cosmos/cosmos-sdk/pull/19993) Indicate pruning with error code "not found" rather than "invalid request". -* (x/consensus) [#20010](https://github.com/cosmos/cosmos-sdk/pull/20010) Move consensus module to be its own go.mod -* (x/crisis) [#20043](https://github.com/cosmos/cosmos-sdk/pull/20043) Changed `NewMsgVerifyInvariant` to accept a string as argument instead of an `AccAddress`. -* (x/simulation)[#20056](https://github.com/cosmos/cosmos-sdk/pull/20056) `SimulateFromSeed` now takes an address codec as argument. -* (server) [#20140](https://github.com/cosmos/cosmos-sdk/pull/20140) Remove embedded grpc-web proxy in favor of standalone grpc-web proxy. [Envoy Proxy](https://www.envoyproxy.io/docs/envoy/latest/start/start) -* (client) [#20255](https://github.com/cosmos/cosmos-sdk/pull/20255) Use comet proofOp proto type instead of sdk version to avoid needing to translate to later be proven in the merkle proof runtime. -* (types)[#20369](https://github.com/cosmos/cosmos-sdk/pull/20369) The signature of `HasAminoCodec` has changed to accept a `core/legacy.Amino` interface instead of `codec.LegacyAmino`. -* (server) [#20422](https://github.com/cosmos/cosmos-sdk/pull/20422) Deprecated `ServerContext`. To get `cmtcfg.Config` from cmd, use `client.GetCometConfigFromCmd(cmd)` instead of `server.GetServerContextFromCmd(cmd).Config` -* (x/genutil) [#20740](https://github.com/cosmos/cosmos-sdk/pull/20740) Update `genutilcli.Commands` and `genutilcli.CommandsWithCustomMigrationMap` to take the genesis module and abstract the module manager. -* (types/errors) [#20756](https://github.com/cosmos/cosmos-sdk/pull/20756) Remove `ResponseCheckTxWithEvents`, `ResponseExecTxResultWithEvents` & `QueryResult` from types/errors pkg. They have been moved to `baseapp/errors.go` and made private. -* (client) [#20976](https://github.com/cosmos/cosmos-sdk/pull/20976) Simplified command initialization by removing unnecessary parameters such as `txConfig` and `addressCodec`. - * Remove parameter `txConfig` from `genutilcli.Commands`,`genutilcli.CommandsWithCustomMigrationMap`,`genutilcli.GenTxCmd`. - * Remove parameter `addressCodec` from `genutilcli.GenTxCmd`,`genutilcli.AddGenesisAccountCmd`,`stakingcli.BuildCreateValidatorMsg`. -* (sims) [#21039](https://github.com/cosmos/cosmos-sdk/pull/21039): Remove Baseapp from sims by a new interface `simtypes.AppEntrypoint`. -* (x/genutil) [#21372](https://github.com/cosmos/cosmos-sdk/pull/21372) Remove `AddGenesisAccount` for `AddGenesisAccounts`. -* (baseapp) [#21413](https://github.com/cosmos/cosmos-sdk/pull/21413) Add `SelectBy` method to `Mempool` interface, which is thread-safe to use. - -### Client Breaking Changes - -* (runtime) [#19040](https://github.com/cosmos/cosmos-sdk/pull/19040) Simplify app config implementation and deprecate `/cosmos/app/v1alpha1/config` query. - ### CLI Breaking Changes * [\#8880](https://github.com/cosmos/cosmos-sdk/pull/8880) The CLI `simd migrate v0.40 ...` command has been renamed to `simd migrate v0.42`. @@ -539,7 +461,6 @@ Security Release. No breaking changes related to 0.44.x. * [\#8460](https://github.com/cosmos/cosmos-sdk/pull/8460) Ensure b.ReportAllocs() in all the benchmarks * [\#8461](https://github.com/cosmos/cosmos-sdk/pull/8461) Fix upgrade tx commands not showing up in CLI - ### Bug Fixes * (x/gov) [\#8813](https://github.com/cosmos/cosmos-sdk/pull/8813) fix `GET /cosmos/gov/v1beta1/proposals/{proposal_id}/deposits` to include initial deposit @@ -571,7 +492,6 @@ Security Release. No breaking changes related to 0.44.x. * (server) [#9704](https://github.com/cosmos/cosmos-sdk/pull/9704) Start GRPCWebServer in goroutine, avoid blocking other services from starting. * (bank) [\#9687](https://github.com/cosmos/cosmos-sdk/issues/9687) fixes [\#9159](https://github.com/cosmos/cosmos-sdk/issues/9159). Added migration to prune balances with zero coins. - ### Deprecated * (simapp) [#19146](https://github.com/cosmos/cosmos-sdk/pull/19146) Replace `--v` CLI option with `--validator-count`/`-n`. @@ -1128,9 +1048,6 @@ Security Release. No breaking changes related to 0.44.x. * (baseapp) [#20144](https://github.com/cosmos/cosmos-sdk/pull/20144) Remove txs from mempool when AnteHandler fails in recheck. * (testutil/sims) [#20151](https://github.com/cosmos/cosmos-sdk/pull/20151) Set all signatures and don't overwrite the previous one in `GenSignedMockTx`. -## [v0.47.11](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.11) - 2024-04-22 - - ### Bug Fixes * (x/feegrant,x/authz) [#20114](https://github.com/cosmos/cosmos-sdk/pull/20114) Follow up of [GHSA-4j93-fm92-rp4m](https://github.com/cosmos/cosmos-sdk/security/advisories/GHSA-4j93-fm92-rp4m). The same issue was found in `x/feegrant` and `x/authz` modules. @@ -1152,9 +1069,7 @@ Security Release. No breaking changes related to 0.44.x. * (x/auth/vesting) [GHSA-4j93-fm92-rp4m](#bug-fixes) Add `BlockedAddr` check in `CreatePeriodicVestingAccount`. * (baseapp) [#19177](https://github.com/cosmos/cosmos-sdk/pull/19177) Fix baseapp `DefaultProposalHandler` same-sender non-sequential sequence. -## [v0.47.8](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.8) - 2024-01-22 - -### Improvements +## [v0.40.0](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.40.0) - 2021-01-08 * (client/tx) [#18852](https://github.com/cosmos/cosmos-sdk/pull/18852) Add `WithFromName` to tx factory. * (types) [#18875](https://github.com/cosmos/cosmos-sdk/pull/18875) Speedup coins.Sort() if len(coins) <= 1. @@ -1163,30 +1078,381 @@ Security Release. No breaking changes related to 0.44.x. ### Bug Fixes -* [#19106](https://github.com/cosmos/cosmos-sdk/pull/19106) Allow empty public keys when setting signatures. Public keys aren't needed for every transaction. -* (server) [#18920](https://github.com/cosmos/cosmos-sdk/pull/18920) Fixes consensus failure while restart node with wrong `chainId` in genesis. +* **CLI** + * (client/keys) [\#5889](https://github.com/cosmos/cosmos-sdk/pull/5889) remove `keys update` command. + * (x/auth) [\#5844](https://github.com/cosmos/cosmos-sdk/pull/5844) `tx sign` command now returns an error when signing is attempted with offline/multisig keys. + * (x/auth) [\#6108](https://github.com/cosmos/cosmos-sdk/pull/6108) `tx sign` command's `--validate-signatures` flag is migrated into a `tx validate-signatures` standalone command. + * (x/auth) [#7788](https://github.com/cosmos/cosmos-sdk/pull/7788) Remove `tx auth` subcommands, all auth subcommands exist as `tx ` + * (x/genutil) [\#6651](https://github.com/cosmos/cosmos-sdk/pull/6651) The `gentx` command has been improved. No longer are `--from` and `--name` flags required. Instead, a single argument, `name`, is required which refers to the key pair in the Keyring. In addition, an optional + `--moniker` flag can be provided to override the moniker found in `config.toml`. + * (x/upgrade) [#7697](https://github.com/cosmos/cosmos-sdk/pull/7697) Rename flag name "--time" to "--upgrade-time", "--info" to "--upgrade-info", to keep it consistent with help message. +* **REST / Queriers** + * (api) [\#6426](https://github.com/cosmos/cosmos-sdk/pull/6426) The ability to start an out-of-process API REST server has now been removed. Instead, the API server is now started in-process along with the application and Tendermint. Configuration options have been added to `app.toml` to enable/disable the API server along with additional HTTP server options. + * (client) [\#7246](https://github.com/cosmos/cosmos-sdk/pull/7246) The rest server endpoint `/swagger-ui/` is replaced by `/swagger/`, and contains swagger documentation for gRPC Gateway routes in addition to legacy REST routes. Swagger API is exposed only if set in `app.toml`. + * (x/auth) [\#5702](https://github.com/cosmos/cosmos-sdk/pull/5702) The `x/auth` querier route has changed from `"acc"` to `"auth"`. + * (x/bank) [\#5572](https://github.com/cosmos/cosmos-sdk/pull/5572) The `/bank/balances/{address}` endpoint now returns all account balances or a single balance by denom when the `denom` query parameter is present. + * (x/evidence) [\#5952](https://github.com/cosmos/cosmos-sdk/pull/5952) Remove CLI and REST handlers for querying `x/evidence` parameters. + * (x/gov) [#6295](https://github.com/cosmos/cosmos-sdk/pull/6295) Fix typo in querying governance params. +* **General** + * (baseapp) [\#6384](https://github.com/cosmos/cosmos-sdk/pull/6384) The `Result.Data` is now a Protocol Buffer encoded binary blob of type `TxData`. The `TxData` contains `Data` which contains a list of Protocol Buffer encoded message data and the corresponding message type. + * (client) [\#5783](https://github.com/cosmos/cosmos-sdk/issues/5783) Unify all coins representations on JSON client requests for governance proposals. + * (crypto) [\#7419](https://github.com/cosmos/cosmos-sdk/pull/7419) The SDK doesn't use Tendermint's `crypto.PubKey` + interface anymore, and uses instead it's own `PubKey` interface, defined in `crypto/types`. Replace all instances of + `crypto.PubKey` by `cryptotypes.Pubkey`. + * (store/rootmulti) [\#6390](https://github.com/cosmos/cosmos-sdk/pull/6390) Proofs of empty stores are no longer supported. + * (store/types) [\#5730](https://github.com/cosmos/cosmos-sdk/pull/5730) store.types.Cp() is removed in favour of types.CopyBytes(). + * (x/auth) [\#6054](https://github.com/cosmos/cosmos-sdk/pull/6054) Remove custom JSON marshaling for base accounts as multsigs cannot be bech32 decoded. + * (x/auth/vesting) [\#6859](https://github.com/cosmos/cosmos-sdk/pull/6859) Custom JSON marshaling of vesting accounts was removed. Vesting accounts are now marshaled using their default proto or amino JSON representation. + * (x/bank) [\#5785](https://github.com/cosmos/cosmos-sdk/issues/5785) In x/bank errors, JSON strings coerced to valid UTF-8 bytes at JSON marshalling time + are now replaced by human-readable expressions. This change can potentially break compatibility with all those client side tools + that parse log messages. + * (x/evidence) [\#7538](https://github.com/cosmos/cosmos-sdk/pull/7538) The ABCI's `Result.Data` field for + `MsgSubmitEvidence` responses does not contain the raw evidence's hash, but the protobuf encoded + `MsgSubmitEvidenceResponse` struct. + * (x/gov) [\#7533](https://github.com/cosmos/cosmos-sdk/pull/7533) The ABCI's `Result.Data` field for + `MsgSubmitProposal` responses does not contain a raw binary encoding of the `proposalID`, but the protobuf encoded + `MsgSubmitSubmitProposalResponse` struct. + * (x/gov) [\#6859](https://github.com/cosmos/cosmos-sdk/pull/6859) `ProposalStatus` and `VoteOption` are now JSON serialized using its protobuf name, so expect names like `PROPOSAL_STATUS_DEPOSIT_PERIOD` as opposed to `DepositPeriod`. + * (x/staking) [\#7499](https://github.com/cosmos/cosmos-sdk/pull/7499) `BondStatus` is now a protobuf `enum` instead + of an `int32`, and JSON serialized using its protobuf name, so expect names like `BOND_STATUS_UNBONDING` as opposed + to `Unbonding`. + * (x/staking) [\#7556](https://github.com/cosmos/cosmos-sdk/pull/7556) The ABCI's `Result.Data` field for + `MsgBeginRedelegate` and `MsgUndelegate` responses does not contain custom binary marshaled `completionTime`, but the + protobuf encoded `MsgBeginRedelegateResponse` and `MsgUndelegateResponse` structs respectively ## [v0.47.7](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.7) - 2023-12-20 -### Improvements - -* (x/gov) [#18707](https://github.com/cosmos/cosmos-sdk/pull/18707) Improve genesis validation. -* (server) [#18478](https://github.com/cosmos/cosmos-sdk/pull/18478) Add command flag to disable colored logs. +* **Baseapp / Client** + * (AppModule) [\#7518](https://github.com/cosmos/cosmos-sdk/pull/7518) [\#7584](https://github.com/cosmos/cosmos-sdk/pull/7584) Rename `AppModule.RegisterQueryServices` to `AppModule.RegisterServices`, as this method now registers multiple services (the gRPC query service and the protobuf Msg service). A `Configurator` struct is used to hold the different services. + * (baseapp) [\#5865](https://github.com/cosmos/cosmos-sdk/pull/5865) The `SimulationResponse` returned from tx simulation is now JSON encoded instead of Amino binary. + * (client) [\#6290](https://github.com/cosmos/cosmos-sdk/pull/6290) `CLIContext` is renamed to `Context`. `Context` and all related methods have been moved from package context to client. + * (client) [\#6525](https://github.com/cosmos/cosmos-sdk/pull/6525) Removed support for `indent` in JSON responses. Clients should consider piping to an external tool such as `jq`. + * (client) [\#8107](https://github.com/cosmos/cosmos-sdk/pull/8107) Renamed `PrintOutput` and `PrintOutputLegacy` + methods of the `context.Client` object to `PrintProto` and `PrintObjectLegacy`. + * (client/flags) [\#6632](https://github.com/cosmos/cosmos-sdk/pull/6632) Remove NewCompletionCmd(), the function is now available in tendermint. + * (client/input) [\#5904](https://github.com/cosmos/cosmos-sdk/pull/5904) Removal of unnecessary `GetCheckPassword`, `PrintPrefixed` functions. + * (client/keys) [\#5889](https://github.com/cosmos/cosmos-sdk/pull/5889) Rename `NewKeyBaseFromDir()` -> `NewLegacyKeyBaseFromDir()`. + * (client/keys) [\#5820](https://github.com/cosmos/cosmos-sdk/pull/5820/) Removed method CloseDB from Keybase interface. + * (client/rpc) [\#6290](https://github.com/cosmos/cosmos-sdk/pull/6290) `client` package and subdirs reorganization. + * (client/lcd) [\#6290](https://github.com/cosmos/cosmos-sdk/pull/6290) `CliCtx` of struct `RestServer` in package client/lcd has been renamed to `ClientCtx`. + * (codec) [\#6330](https://github.com/cosmos/cosmos-sdk/pull/6330) `codec.RegisterCrypto` has been moved to the `crypto/codec` package and the global `codec.Cdc` Amino instance has been deprecated and moved to the `codec/legacy_global` package. + * (codec) [\#8080](https://github.com/cosmos/cosmos-sdk/pull/8080) Updated the `codec.Marshaler` interface + * Moved `MarshalAny` and `UnmarshalAny` helper functions to `codec.Marshaler` and renamed to `MarshalInterface` and + `UnmarshalInterface` respectively. These functions must take interface as a parameter (not a concrete type nor `Any` + object). Underneath they use `Any` wrapping for correct protobuf serialization. + * (crypto) [\#6780](https://github.com/cosmos/cosmos-sdk/issues/6780) Move ledger code to its own package. + * (crypto/types/multisig) [\#6373](https://github.com/cosmos/cosmos-sdk/pull/6373) `multisig.Multisignature` has been renamed to `AminoMultisignature` + * (codec) `*codec.LegacyAmino` is now a wrapper around Amino which provides backwards compatibility with protobuf `Any`. ALL legacy code should use `*codec.LegacyAmino` instead of `*amino.Codec` directly + * (crypto) [\#5880](https://github.com/cosmos/cosmos-sdk/pull/5880) Merge `crypto/keys/mintkey` into `crypto`. + * (crypto/hd) [\#5904](https://github.com/cosmos/cosmos-sdk/pull/5904) `crypto/keys/hd` moved to `crypto/hd`. + * (crypto/keyring): + * [\#5866](https://github.com/cosmos/cosmos-sdk/pull/5866) Rename `crypto/keys/` to `crypto/keyring/`. + * [\#5904](https://github.com/cosmos/cosmos-sdk/pull/5904) `Keybase` -> `Keyring` interfaces migration. `LegacyKeybase` interface is added in order + to guarantee limited backward compatibility with the old Keybase interface for the sole purpose of migrating keys across the new keyring backends. `NewLegacy` + constructor is provided [\#5889](https://github.com/cosmos/cosmos-sdk/pull/5889) to allow for smooth migration of keys from the legacy LevelDB based implementation + to new keyring backends. Plus, the package and the new keyring no longer depends on the sdk.Config singleton. Please consult the [package documentation](https://github.com/cosmos/cosmos-sdk/tree/master/crypto/keyring/doc.go) for more + information on how to implement the new `Keyring` interface. + * [\#5858](https://github.com/cosmos/cosmos-sdk/pull/5858) Make Keyring store keys by name and address's hexbytes representation. + * (export) [\#5952](https://github.com/cosmos/cosmos-sdk/pull/5952) `AppExporter` now returns ABCI consensus parameters to be included in marshaled exported state. These parameters must be returned from the application via the `BaseApp`. + * (simapp) Deprecating and renaming `MakeEncodingConfig` to `MakeTestEncodingConfig` (both in `simapp` and `simapp/params` packages). + * (store) [\#5803](https://github.com/cosmos/cosmos-sdk/pull/5803) The `store.CommitMultiStore` interface now includes the new `snapshots.Snapshotter` interface as well. + * (types) [\#5579](https://github.com/cosmos/cosmos-sdk/pull/5579) The `keepRecent` field has been removed from the `PruningOptions` type. + The `PruningOptions` type now only includes fields `KeepEvery` and `SnapshotEvery`, where `KeepEvery` + determines which committed heights are flushed to disk and `SnapshotEvery` determines which of these + heights are kept after pruning. The `IsValid` method should be called whenever using these options. Methods + `SnapshotVersion` and `FlushVersion` accept a version arugment and determine if the version should be + flushed to disk or kept as a snapshot. Note, `KeepRecent` is automatically inferred from the options + and provided directly the IAVL store. + * (types) [\#5533](https://github.com/cosmos/cosmos-sdk/pull/5533) Refactored `AppModuleBasic` and `AppModuleGenesis` + to now accept a `codec.JSONMarshaler` for modular serialization of genesis state. + * (types/rest) [\#5779](https://github.com/cosmos/cosmos-sdk/pull/5779) Drop unused Parse{Int64OrReturnBadRequest,QueryParamBool}() functions. +* **Modules** + * (modules) [\#7243](https://github.com/cosmos/cosmos-sdk/pull/7243) Rename `RegisterCodec` to `RegisterLegacyAminoCodec` and `codec.New()` is now renamed to `codec.NewLegacyAmino()` + * (modules) [\#6564](https://github.com/cosmos/cosmos-sdk/pull/6564) Constant `DefaultParamspace` is removed from all modules, use ModuleName instead. + * (modules) [\#5989](https://github.com/cosmos/cosmos-sdk/pull/5989) `AppModuleBasic.GetTxCmd` now takes a single `CLIContext` parameter. + * (modules) [\#5664](https://github.com/cosmos/cosmos-sdk/pull/5664) Remove amino `Codec` from simulation `StoreDecoder`, which now returns a function closure in order to unmarshal the key-value pairs. + * (modules) [\#5555](https://github.com/cosmos/cosmos-sdk/pull/5555) Move `x/auth/client/utils/` types and functions to `x/auth/client/`. + * (modules) [\#5572](https://github.com/cosmos/cosmos-sdk/pull/5572) Move account balance logic and APIs from `x/auth` to `x/bank`. + * (modules) [\#6326](https://github.com/cosmos/cosmos-sdk/pull/6326) `AppModuleBasic.GetQueryCmd` now takes a single `client.Context` parameter. + * (modules) [\#6336](https://github.com/cosmos/cosmos-sdk/pull/6336) `AppModuleBasic.RegisterQueryService` method was added to support gRPC queries, and `QuerierRoute` and `NewQuerierHandler` were deprecated. + * (modules) [\#6311](https://github.com/cosmos/cosmos-sdk/issues/6311) Remove `alias.go` usage + * (modules) [\#6447](https://github.com/cosmos/cosmos-sdk/issues/6447) Rename `blacklistedAddrs` to `blockedAddrs`. + * (modules) [\#6834](https://github.com/cosmos/cosmos-sdk/issues/6834) Add `RegisterInterfaces` method to `AppModuleBasic` to support registration of protobuf interface types. + * (modules) [\#6734](https://github.com/cosmos/cosmos-sdk/issues/6834) Add `TxEncodingConfig` parameter to `AppModuleBasic.ValidateGenesis` command to support JSON tx decoding in `genutil`. + * (modules) [#7764](https://github.com/cosmos/cosmos-sdk/pull/7764) Added module initialization options: + * `server/types.AppExporter` requires extra argument: `AppOptions`. + * `server.AddCommands` requires extra argument: `addStartFlags types.ModuleInitFlags` + * `x/crisis.NewAppModule` has a new attribute: `skipGenesisInvariants`. [PR](https://github.com/cosmos/cosmos-sdk/pull/7764) + * (types) [\#6327](https://github.com/cosmos/cosmos-sdk/pull/6327) `sdk.Msg` now inherits `proto.Message`, as a result all `sdk.Msg` types now use pointer semantics. + * (types) [\#7032](https://github.com/cosmos/cosmos-sdk/pull/7032) All types ending with `ID` (e.g. `ProposalID`) now end with `Id` (e.g. `ProposalId`), to match default Protobuf generated format. Also see [\#7033](https://github.com/cosmos/cosmos-sdk/pull/7033) for more details. + * (x/auth) [\#6029](https://github.com/cosmos/cosmos-sdk/pull/6029) Module accounts have been moved from `x/supply` to `x/auth`. + * (x/auth) [\#6443](https://github.com/cosmos/cosmos-sdk/issues/6443) Move `FeeTx` and `TxWithMemo` interfaces from `x/auth/ante` to `types`. + * (x/auth) [\#7006](https://github.com/cosmos/cosmos-sdk/pull/7006) All `AccountRetriever` methods now take `client.Context` as a parameter instead of as a struct member. + * (x/auth) [\#6270](https://github.com/cosmos/cosmos-sdk/pull/6270) The passphrase argument has been removed from the signature of the following functions and methods: `BuildAndSign`, `MakeSignature`, `SignStdTx`, `TxBuilder.BuildAndSign`, `TxBuilder.Sign`, `TxBuilder.SignStdTx` + * (x/auth) [\#6428](https://github.com/cosmos/cosmos-sdk/issues/6428): + * `NewAnteHandler` and `NewSigVerificationDecorator` both now take a `SignModeHandler` parameter. + * `SignatureVerificationGasConsumer` now has the signature: `func(meter sdk.GasMeter, sig signing.SignatureV2, params types.Params) error`. + * The `SigVerifiableTx` interface now has a `GetSignaturesV2() ([]signing.SignatureV2, error)` method and no longer has the `GetSignBytes` method. + * (x/auth/tx) [\#8106](https://github.com/cosmos/cosmos-sdk/pull/8106) change related to missing append functionality in + client transaction signing + + added `overwriteSig` argument to `x/auth/client.SignTx` and `client/tx.Sign` functions. + + removed `x/auth/tx.go:wrapper.GetSignatures`. The `wrapper` provides `TxBuilder` functionality, and it's a private + structure. That function was not used at all and it's not exposed through the `TxBuilder` interface. + * (x/bank) [\#7327](https://github.com/cosmos/cosmos-sdk/pull/7327) AddCoins and SubtractCoins no longer return a resultingValue and will only return an error. + * (x/capability) [#7918](https://github.com/cosmos/cosmos-sdk/pull/7918) Add x/capability safety checks: + * All outward facing APIs will now check that capability is not nil and name is not empty before performing any state-machine changes + * `SetIndex` has been renamed to `InitializeIndex` + * (x/evidence) [\#7251](https://github.com/cosmos/cosmos-sdk/pull/7251) New evidence types and light client evidence handling. The module function names changed. + * (x/evidence) [\#5952](https://github.com/cosmos/cosmos-sdk/pull/5952) Remove APIs for getting and setting `x/evidence` parameters. `BaseApp` now uses a `ParamStore` to manage Tendermint consensus parameters which is managed via the `x/params` `Substore` type. + * (x/gov) [\#6147](https://github.com/cosmos/cosmos-sdk/pull/6147) The `Content` field on `Proposal` and `MsgSubmitProposal` + is now `Any` in concordance with [ADR 019](docs/architecture/adr-019-protobuf-state-encoding.md) and `GetContent` should now + be used to retrieve the actual proposal `Content`. Also the `NewMsgSubmitProposal` constructor now may return an `error` + * (x/ibc) [\#6374](https://github.com/cosmos/cosmos-sdk/pull/6374) `VerifyMembership` and `VerifyNonMembership` now take a `specs []string` argument to specify the proof format used for verification. Most SDK chains can simply use `commitmenttypes.GetSDKSpecs()` for this argument. + * (x/params) [\#5619](https://github.com/cosmos/cosmos-sdk/pull/5619) The `x/params` keeper now accepts a `codec.Marshaller` instead of + a reference to an amino codec. Amino is still used for JSON serialization. + * (x/staking) [\#6451](https://github.com/cosmos/cosmos-sdk/pull/6451) `DefaultParamspace` and `ParamKeyTable` in staking module are moved from keeper to types to enforce consistency. + * (x/staking) [\#7419](https://github.com/cosmos/cosmos-sdk/pull/7419) The `TmConsPubKey` method on ValidatorI has been + removed and replaced instead by `ConsPubKey` (which returns a SDK `cryptotypes.PubKey`) and `TmConsPublicKey` (which + returns a Tendermint proto PublicKey). + * (x/staking/types) [\#7447](https://github.com/cosmos/cosmos-sdk/issues/7447) Remove bech32 PubKey support: + * `ValidatorI` interface update. `GetConsPubKey` renamed to `TmConsPubKey` (consensus public key must be a tendermint key). `TmConsPubKey`, `GetConsAddr` methods return error. + * `Validator` update. Methods changed in `ValidatorI` (as described above) and `ToTmValidator` return error. + * `Validator.ConsensusPubkey` type changed from `string` to `codectypes.Any`. + * `MsgCreateValidator.Pubkey` type changed from `string` to `codectypes.Any`. + * (x/supply) [\#6010](https://github.com/cosmos/cosmos-sdk/pull/6010) All `x/supply` types and APIs have been moved to `x/bank`. + * [\#6409](https://github.com/cosmos/cosmos-sdk/pull/6409) Rename all IsEmpty methods to Empty across the codebase and enforce consistency. + * [\#6231](https://github.com/cosmos/cosmos-sdk/pull/6231) Simplify `AppModule` interface, `Route` and `NewHandler` methods become only `Route` + and returns a new `Route` type. + * (x/slashing) [\#6212](https://github.com/cosmos/cosmos-sdk/pull/6212) Remove `Get*` prefixes from key construction functions + * (server) [\#6079](https://github.com/cosmos/cosmos-sdk/pull/6079) Remove `UpgradeOldPrivValFile` (deprecated in Tendermint Core v0.28). + * [\#5719](https://github.com/cosmos/cosmos-sdk/pull/5719) Bump Go requirement to 1.14+ ### Bug Fixes -* (baseapp) [#18609](https://github.com/cosmos/cosmos-sdk/issues/18609) Fixed accounting in the block gas meter after BeginBlock and before DeliverTx, ensuring transaction processing always starts with the expected zeroed out block gas meter. -* (server) [#18537](https://github.com/cosmos/cosmos-sdk/pull/18537) Fix panic when defining minimum gas config as `100stake;100uatom`. Use a `,` delimiter instead of `;`. Fixes the server config getter to use the correct delimiter. -* (client/tx) [#18472](https://github.com/cosmos/cosmos-sdk/pull/18472) Utilizes the correct Pubkey when simulating a transaction. +* **General** + * (client) [\#7268](https://github.com/cosmos/cosmos-sdk/pull/7268) / [\#7147](https://github.com/cosmos/cosmos-sdk/pull/7147) Introduce new protobuf based PubKeys, and migrate PubKey in BaseAccount to use this new protobuf based PubKey format -## [v0.47.6](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.6) - 2023-11-14 +* **Modules** + * (modules) [\#5572](https://github.com/cosmos/cosmos-sdk/pull/5572) Separate balance from accounts per ADR 004. + * Account balances are now persisted and retrieved via the `x/bank` module. + * Vesting account interface has been modified to account for changes. + * Callers to `NewBaseVestingAccount` are responsible for verifying account balance in relation to + the original vesting amount. + * The `SendKeeper` and `ViewKeeper` interfaces in `x/bank` have been modified to account for changes. + * (x/auth) [\#5533](https://github.com/cosmos/cosmos-sdk/pull/5533) Migrate the `x/auth` module to use Protocol Buffers for state + serialization instead of Amino. + * The `BaseAccount.PubKey` field is now represented as a Bech32 string instead of a `crypto.Pubkey`. + * `NewBaseAccountWithAddress` now returns a reference to a `BaseAccount`. + * The `x/auth` module now accepts a `Codec` interface which extends the `codec.Marshaler` interface by + requiring a concrete codec to know how to serialize accounts. + * The `AccountRetriever` type now accepts a `Codec` in its constructor in order to know how to + serialize accounts. + * (x/bank) [\#6518](https://github.com/cosmos/cosmos-sdk/pull/6518) Support for global and per-denomination send enabled flags. + * Existing send_enabled global flag has been moved into a Params structure as `default_send_enabled`. + * An array of: `{denom: string, enabled: bool}` is added to bank Params to support per-denomination override of global default value. + * (x/distribution) [\#5610](https://github.com/cosmos/cosmos-sdk/pull/5610) Migrate the `x/distribution` module to use Protocol Buffers for state + serialization instead of Amino. The exact codec used is `codec.HybridCodec` which utilizes Protobuf for binary encoding and Amino + for JSON encoding. + * `ValidatorHistoricalRewards.ReferenceCount` is now of types `uint32` instead of `uint16`. + * `ValidatorSlashEvents` is now a struct with `slashevents`. + * `ValidatorOutstandingRewards` is now a struct with `rewards`. + * `ValidatorAccumulatedCommission` is now a struct with `commission`. + * The `Keeper` constructor now takes a `codec.Marshaler` instead of a concrete Amino codec. This exact type + provided is specified by `ModuleCdc`. + * (x/evidence) [\#5634](https://github.com/cosmos/cosmos-sdk/pull/5634) Migrate the `x/evidence` module to use Protocol Buffers for state + serialization instead of Amino. + * The `internal` sub-package has been removed in order to expose the types proto file. + * The module now accepts a `Codec` interface which extends the `codec.Marshaler` interface by + requiring a concrete codec to know how to serialize `Evidence` types. + * The `MsgSubmitEvidence` message has been removed in favor of `MsgSubmitEvidenceBase`. The application-level + codec must now define the concrete `MsgSubmitEvidence` type which must implement the module's `MsgSubmitEvidence` + interface. + * (x/evidence) [\#5952](https://github.com/cosmos/cosmos-sdk/pull/5952) Remove parameters from `x/evidence` genesis and module state. The `x/evidence` module now solely uses Tendermint consensus parameters to determine of evidence is valid or not. + * (x/gov) [\#5737](https://github.com/cosmos/cosmos-sdk/pull/5737) Migrate the `x/gov` module to use Protocol + Buffers for state serialization instead of Amino. + * `MsgSubmitProposal` will be removed in favor of the application-level proto-defined `MsgSubmitProposal` which + implements the `MsgSubmitProposalI` interface. Applications should extend the `NewMsgSubmitProposalBase` type + to define their own concrete `MsgSubmitProposal` types. + * The module now accepts a `Codec` interface which extends the `codec.Marshaler` interface by + requiring a concrete codec to know how to serialize `Proposal` types. + * (x/mint) [\#5634](https://github.com/cosmos/cosmos-sdk/pull/5634) Migrate the `x/mint` module to use Protocol Buffers for state + serialization instead of Amino. + * The `internal` sub-package has been removed in order to expose the types proto file. + * (x/slashing) [\#5627](https://github.com/cosmos/cosmos-sdk/pull/5627) Migrate the `x/slashing` module to use Protocol Buffers for state + serialization instead of Amino. The exact codec used is `codec.HybridCodec` which utilizes Protobuf for binary encoding and Amino + for JSON encoding. + * The `Keeper` constructor now takes a `codec.Marshaler` instead of a concrete Amino codec. This exact type + provided is specified by `ModuleCdc`. + * (x/staking) [\#6844](https://github.com/cosmos/cosmos-sdk/pull/6844) Validators are now inserted into the unbonding queue based on their unbonding time and height. The relevant keeper APIs are modified to reflect these changes by now also requiring a height. + * (x/staking) [\#6061](https://github.com/cosmos/cosmos-sdk/pull/6061) Allow a validator to immediately unjail when no signing info is present due to + falling below their minimum self-delegation and never having been bonded. The validator may immediately unjail once they've met their minimum self-delegation. + * (x/staking) [\#5600](https://github.com/cosmos/cosmos-sdk/pull/5600) Migrate the `x/staking` module to use Protocol Buffers for state + serialization instead of Amino. The exact codec used is `codec.HybridCodec` which utilizes Protobuf for binary encoding and Amino + for JSON encoding. + * `BondStatus` is now of type `int32` instead of `byte`. + * Types of `int16` in the `Params` type are now of type `int32`. + * Every reference of `crypto.Pubkey` in context of a `Validator` is now of type string. `GetPubKeyFromBech32` must be used to get the `crypto.Pubkey`. + * The `Keeper` constructor now takes a `codec.Marshaler` instead of a concrete Amino codec. This exact type + provided is specified by `ModuleCdc`. + * (x/staking) [\#7979](https://github.com/cosmos/cosmos-sdk/pull/7979) keeper pubkey storage serialization migration + from bech32 to protobuf. + * (x/supply) [\#6010](https://github.com/cosmos/cosmos-sdk/pull/6010) Removed the `x/supply` module by merging the existing types and APIs into the `x/bank` module. + * (x/supply) [\#5533](https://github.com/cosmos/cosmos-sdk/pull/5533) Migrate the `x/supply` module to use Protocol Buffers for state + serialization instead of Amino. + * The `internal` sub-package has been removed in order to expose the types proto file. + * The `x/supply` module now accepts a `Codec` interface which extends the `codec.Marshaler` interface by + requiring a concrete codec to know how to serialize `SupplyI` types. + * The `SupplyI` interface has been modified to no longer return `SupplyI` on methods. Instead the + concrete type's receiver should modify the type. + * (x/upgrade) [\#5659](https://github.com/cosmos/cosmos-sdk/pull/5659) Migrate the `x/upgrade` module to use Protocol + Buffers for state serialization instead of Amino. + * The `internal` sub-package has been removed in order to expose the types proto file. + * The `x/upgrade` module now accepts a `codec.Marshaler` interface. ### Features -* (server) [#18110](https://github.com/cosmos/cosmos-sdk/pull/18110) Start gRPC & API server in standalone mode. +* **Baseapp / Client / REST** + * (x/auth) [\#6213](https://github.com/cosmos/cosmos-sdk/issues/6213) Introduce new protobuf based path for transaction signing, see [ADR020](https://github.com/cosmos/cosmos-sdk/blob/master/docs/architecture/adr-020-protobuf-transaction-encoding.md) for more details + * (x/auth) [\#6350](https://github.com/cosmos/cosmos-sdk/pull/6350) New sign-batch command to sign StdTx batch files. + * (baseapp) [\#5803](https://github.com/cosmos/cosmos-sdk/pull/5803) Added support for taking state snapshots at regular height intervals, via options `snapshot-interval` and `snapshot-keep-recent`. + * (baseapp) [\#7519](https://github.com/cosmos/cosmos-sdk/pull/7519) Add `ServiceMsgRouter` to BaseApp to handle routing of protobuf service `Msg`s. The two new types defined in ADR 031, `sdk.ServiceMsg` and `sdk.MsgRequest` are introduced with this router. + * (client) [\#5921](https://github.com/cosmos/cosmos-sdk/issues/5921) Introduce new gRPC and gRPC Gateway based APIs for querying app & module data. See [ADR021](https://github.com/cosmos/cosmos-sdk/blob/master/docs/architecture/adr-021-protobuf-query-encoding.md) for more details + * (cli) [\#7485](https://github.com/cosmos/cosmos-sdk/pull/7485) Introduce a new optional `--keyring-dir` flag that allows clients to specify a Keyring directory if it does not reside in the directory specified by `--home`. + * (cli) [\#7221](https://github.com/cosmos/cosmos-sdk/pull/7221) Add the option of emitting amino encoded json from the CLI + * (codec) [\#7519](https://github.com/cosmos/cosmos-sdk/pull/7519) `InterfaceRegistry` now inherits `jsonpb.AnyResolver`, and has a `RegisterCustomTypeURL` method to support ADR 031 packing of `Any`s. `AnyResolver` is now a required parameter to `RejectUnknownFields`. + * (coin) [\#6755](https://github.com/cosmos/cosmos-sdk/pull/6755) Add custom regex validation for `Coin` denom by overwriting `CoinDenomRegex` when using `/types/coin.go`. + * (config) [\#7265](https://github.com/cosmos/cosmos-sdk/pull/7265) Support Tendermint block pruning through a new `min-retain-blocks` configuration that can be set in either `app.toml` or via the CLI. This parameter is used in conjunction with other criteria to determine the height at which Tendermint should prune blocks. + * (events) [\#7121](https://github.com/cosmos/cosmos-sdk/pull/7121) The application now derives what events are indexed by Tendermint via the `index-events` configuration in `app.toml`, which is a list of events taking the form `{eventType}.{attributeKey}`. + * (tx) [\#6089](https://github.com/cosmos/cosmos-sdk/pull/6089) Transactions can now have a `TimeoutHeight` set which allows the transaction to be rejected if it's committed at a height greater than the timeout. + * (rest) [\#6167](https://github.com/cosmos/cosmos-sdk/pull/6167) Support `max-body-bytes` CLI flag for the REST service. + * (genesis) [\#7089](https://github.com/cosmos/cosmos-sdk/pull/7089) The `export` command now adds a `initial_height` field in the exported JSON. Baseapp's `CommitMultiStore` now also has a `SetInitialVersion` setter, so it can set the initial store version inside `InitChain` and start a new chain from a given height. +* **General** + * (crypto/multisig) [\#6241](https://github.com/cosmos/cosmos-sdk/pull/6241) Add Multisig type directly to the repo. Previously this was in tendermint. + * (codec/types) [\#8106](https://github.com/cosmos/cosmos-sdk/pull/8106) Adding `NewAnyWithCustomTypeURL` to correctly + marshal Messages in TxBuilder. + * (tests) [\#6489](https://github.com/cosmos/cosmos-sdk/pull/6489) Introduce package `testutil`, new in-process testing network framework for use in integration and unit tests. + * (tx) Add new auth/tx gRPC & gRPC-Gateway endpoints for basic querying & broadcasting support + * [\#7842](https://github.com/cosmos/cosmos-sdk/pull/7842) Add TxsByEvent gRPC endpoint + * [\#7852](https://github.com/cosmos/cosmos-sdk/pull/7852) Add tx broadcast gRPC endpoint + * (tx) [\#7688](https://github.com/cosmos/cosmos-sdk/pull/7688) Add a new Tx gRPC service with methods `Simulate` and `GetTx` (by hash). + * (store) [\#5803](https://github.com/cosmos/cosmos-sdk/pull/5803) Added `rootmulti.Store` methods for taking and restoring snapshots, based on `iavl.Store` export/import. + * (store) [\#6324](https://github.com/cosmos/cosmos-sdk/pull/6324) IAVL store query proofs now return CommitmentOp which wraps an ics23 CommitmentProof + * (store) [\#6390](https://github.com/cosmos/cosmos-sdk/pull/6390) `RootMulti` store query proofs now return `CommitmentOp` which wraps `CommitmentProofs` + * `store.Query` now only returns chained `ics23.CommitmentProof` wrapped in `merkle.Proof` + * `ProofRuntime` only decodes and verifies `ics23.CommitmentProof` +* **Modules** + * (modules) [\#5921](https://github.com/cosmos/cosmos-sdk/issues/5921) Introduction of Query gRPC service definitions along with REST annotations for gRPC Gateway for each module + * (modules) [\#7540](https://github.com/cosmos/cosmos-sdk/issues/7540) Protobuf service definitions can now be used for + packing `Msg`s in transactions as defined in [ADR 031](./docs/architecture/adr-031-msg-service.md). All modules now + define a `Msg` protobuf service. + * (x/auth/vesting) [\#7209](https://github.com/cosmos/cosmos-sdk/pull/7209) Create new `MsgCreateVestingAccount` message type along with CLI handler that allows for the creation of delayed and continuous vesting types. + * (x/capability) [\#5828](https://github.com/cosmos/cosmos-sdk/pull/5828) Capability module integration as outlined in [ADR 3 - Dynamic Capability Store](https://github.com/cosmos/tree/master/docs/architecture/adr-003-dynamic-capability-store.md). + * (x/crisis) `x/crisis` has a new function: `AddModuleInitFlags`, which will register optional crisis module flags for the start command. + * (x/ibc) [\#5277](https://github.com/cosmos/cosmos-sdk/pull/5277) `x/ibc` changes from IBC alpha. For more details check the the [`x/ibc/core/spec`](https://github.com/cosmos/cosmos-sdk/tree/master/x/ibc/core/spec) directory, or the ICS specs below: + * [ICS 002 - Client Semantics](https://github.com/cosmos/ics/tree/master/spec/ics-002-client-semantics) subpackage + * [ICS 003 - Connection Semantics](https://github.com/cosmos/ics/blob/master/spec/ics-003-connection-semantics) subpackage + * [ICS 004 - Channel and Packet Semantics](https://github.com/cosmos/ics/blob/master/spec/ics-004-channel-and-packet-semantics) subpackage + * [ICS 005 - Port Allocation](https://github.com/cosmos/ics/blob/master/spec/ics-005-port-allocation) subpackage + * [ICS 006 - Solo Machine Client](https://github.com/cosmos/ics/tree/master/spec/ics-006-solo-machine-client) subpackage + * [ICS 007 - Tendermint Client](https://github.com/cosmos/ics/blob/master/spec/ics-007-tendermint-client) subpackage + * [ICS 009 - Loopback Client](https://github.com/cosmos/ics/tree/master/spec/ics-009-loopback-client) subpackage + * [ICS 020 - Fungible Token Transfer](https://github.com/cosmos/ics/tree/master/spec/ics-020-fungible-token-transfer) subpackage + * [ICS 023 - Vector Commitments](https://github.com/cosmos/ics/tree/master/spec/ics-023-vector-commitments) subpackage + * [ICS 024 - Host State Machine Requirements](https://github.com/cosmos/ics/tree/master/spec/ics-024-host-requirements) subpackage + * (x/ibc) [\#6374](https://github.com/cosmos/cosmos-sdk/pull/6374) ICS-23 Verify functions will now accept and verify ics23 CommitmentProofs exclusively + * (x/params) [\#6005](https://github.com/cosmos/cosmos-sdk/pull/6005) Add new CLI command for querying raw x/params parameters by subspace and key. + +### Bug Fixes + +* **Baseapp / Client / REST** + * (client) [\#5964](https://github.com/cosmos/cosmos-sdk/issues/5964) `--trust-node` is now false by default - for real. Users must ensure it is set to true if they don't want to enable the verifier. + * (client) [\#6402](https://github.com/cosmos/cosmos-sdk/issues/6402) Fix `keys add` `--algo` flag which only worked for Tendermint's `secp256k1` default key signing algorithm. + * (client) [\#7699](https://github.com/cosmos/cosmos-sdk/pull/7699) Fix panic in context when setting invalid nodeURI. `WithNodeURI` does not set the `Client` in the context. + * (export) [\#6510](https://github.com/cosmos/cosmos-sdk/pull/6510/) Field TimeIotaMs now is included in genesis file while exporting. + * (rest) [\#5906](https://github.com/cosmos/cosmos-sdk/pull/5906) Fix an issue that make some REST calls panic when sending invalid or incomplete requests. + * (crypto) [\#7966](https://github.com/cosmos/cosmos-sdk/issues/7966) `Bip44Params` `String()` function now correctly + returns the absolute HD path by adding the `m/` prefix. + * (crypto/keyring) [\#5844](https://github.com/cosmos/cosmos-sdk/pull/5844) `Keyring.Sign()` methods no longer decode amino signatures when method receivers + are offline/multisig keys. + * (store) [\#7415](https://github.com/cosmos/cosmos-sdk/pull/7415) Allow new stores to be registered during on-chain upgrades. +* **Modules** + * (modules) [\#5569](https://github.com/cosmos/cosmos-sdk/issues/5569) `InitGenesis`, for the relevant modules, now ensures module accounts exist. + * (x/auth) [\#5892](https://github.com/cosmos/cosmos-sdk/pull/5892) Add `RegisterKeyTypeCodec` to register new + types (eg. keys) to the `auth` module internal amino codec. + * (x/bank) [\#6536](https://github.com/cosmos/cosmos-sdk/pull/6536) Fix bug in `WriteGeneratedTxResponse` function used by multiple + REST endpoints. Now it writes a Tx in StdTx format. + * (x/genutil) [\#5938](https://github.com/cosmos/cosmos-sdk/pull/5938) Fix `InitializeNodeValidatorFiles` error handling. + * (x/gentx) [\#8183](https://github.com/cosmos/cosmos-sdk/pull/8183) change gentx cmd amount to arg from flag + * (x/gov) [#7641](https://github.com/cosmos/cosmos-sdk/pull/7641) Fix tally calculation precision error. + * (x/staking) [\#6529](https://github.com/cosmos/cosmos-sdk/pull/6529) Export validator addresses (previously was empty). + * (x/staking) [\#5949](https://github.com/cosmos/cosmos-sdk/pull/5949) Skip staking `HistoricalInfoKey` in simulations as headers are not exported. + * (x/staking) [\#6061](https://github.com/cosmos/cosmos-sdk/pull/6061) Allow a validator to immediately unjail when no signing info is present due to +falling below their minimum self-delegation and never having been bonded. The validator may immediately unjail once they've met their minimum self-delegation. +* **General** + * (types) [\#7038](https://github.com/cosmos/cosmos-sdk/issues/7038) Fix infinite looping of `ApproxRoot` by including a hard-coded maximum iterations limit of 100. + * (types) [\#7084](https://github.com/cosmos/cosmos-sdk/pull/7084) Fix panic when calling `BigInt()` on an uninitialized `Int`. + * (simulation) [\#7129](https://github.com/cosmos/cosmos-sdk/issues/7129) Fix support for custom `Account` and key types on auth's simulation. ### Improvements +* **Baseapp / Client / REST** + * (baseapp) [\#6186](https://github.com/cosmos/cosmos-sdk/issues/6186) Support emitting events during `AnteHandler` execution. + * (baseapp) [\#6053](https://github.com/cosmos/cosmos-sdk/pull/6053) Customizable panic recovery handling added for `app.runTx()` method (as proposed in the [ADR 22](https://github.com/cosmos/cosmos-sdk/blob/master/docs/architecture/adr-022-custom-panic-handling.md)). Adds ability for developers to register custom panic handlers extending standard ones. + * (client) [\#5810](https://github.com/cosmos/cosmos-sdk/pull/5810) Added a new `--offline` flag that allows commands to be executed without an + internet connection. Previously, `--generate-only` served this purpose in addition to only allowing txs to be generated. Now, `--generate-only` solely + allows txs to be generated without being broadcasted and disallows Keybase use and `--offline` allows the use of Keybase but does not allow any + functionality that requires an online connection. + * (cli) [#7764](https://github.com/cosmos/cosmos-sdk/pull/7764) Update x/banking and x/crisis InitChain to improve node startup time + * (client) [\#5856](https://github.com/cosmos/cosmos-sdk/pull/5856) Added the possibility to set `--offline` flag with config command. + * (client) [\#5895](https://github.com/cosmos/cosmos-sdk/issues/5895) show config options in the config command's help screen. + * (client/keys) [\#8043](https://github.com/cosmos/cosmos-sdk/pull/8043) Add support for export of unarmored private key + * (client/tx) [\#7801](https://github.com/cosmos/cosmos-sdk/pull/7801) Update sign-batch multisig to work online + * (x/genutil) [\#8099](https://github.com/cosmos/cosmos-sdk/pull/8099) `init` now supports a `--recover` flag to recover + the private validator key from a given mnemonic +* **Modules** + * (x/auth) [\#5702](https://github.com/cosmos/cosmos-sdk/pull/5702) Add parameter querying support for `x/auth`. + * (x/auth/ante) [\#6040](https://github.com/cosmos/cosmos-sdk/pull/6040) `AccountKeeper` interface used for `NewAnteHandler` and handler's decorators to add support of using custom `AccountKeeper` implementations. + * (x/evidence) [\#5952](https://github.com/cosmos/cosmos-sdk/pull/5952) Tendermint Consensus parameters can now be changed via parameter change proposals through `x/gov`. + * (x/evidence) [\#5961](https://github.com/cosmos/cosmos-sdk/issues/5961) Add `StoreDecoder` simulation for evidence module. + * (x/ibc) [\#5948](https://github.com/cosmos/cosmos-sdk/issues/5948) Add `InitGenesis` and `ExportGenesis` functions for `ibc` module. + * (x/ibc-transfer) [\#6871](https://github.com/cosmos/cosmos-sdk/pull/6871) Implement [ADR 001 - Coin Source Tracing](./docs/architecture/adr-001-coin-source-tracing.md). + * (x/staking) [\#6059](https://github.com/cosmos/cosmos-sdk/pull/6059) Updated `HistoricalEntries` parameter default to 100. + * (x/staking) [\#5584](https://github.com/cosmos/cosmos-sdk/pull/5584) Add util function `ToTmValidator` that converts a `staking.Validator` type to `*tmtypes.Validator`. + * (x/staking) [\#6163](https://github.com/cosmos/cosmos-sdk/pull/6163) CLI and REST call to unbonding delegations and delegations now accept + pagination. + * (x/staking) [\#8178](https://github.com/cosmos/cosmos-sdk/pull/8178) Update default historical header number for stargate +* **General** + * (crypto) [\#7987](https://github.com/cosmos/cosmos-sdk/pull/7987) Fix the inconsistency of CryptoCdc, only use + `codec/legacy.Cdc`. + * (logging) [\#8072](https://github.com/cosmos/cosmos-sdk/pull/8072) Refactor logging: + * Use [zerolog](https://github.com/rs/zerolog) over Tendermint's go-kit logging wrapper. + * Introduce Tendermint's `--log_format=plain|json` flag. Using format `json` allows for emitting structured JSON + logs which can be consumed by an external logging facility (e.g. Loggly). Both formats log to STDERR. + * The existing `--log_level` flag and it's default value now solely relates to the global logging + level (e.g. `info`, `debug`, etc...) instead of `:`. + * (rest) [#7649](https://github.com/cosmos/cosmos-sdk/pull/7649) Return an unsigned tx in legacy GET /tx endpoint when signature conversion fails + * (simulation) [\#6002](https://github.com/cosmos/cosmos-sdk/pull/6002) Add randomized consensus params into simulation. + * (store) [\#6481](https://github.com/cosmos/cosmos-sdk/pull/6481) Move `SimpleProofsFromMap` from Tendermint into the SDK. + * (store) [\#6719](https://github.com/cosmos/cosmos-sdk/6754) Add validity checks to stores for nil and empty keys. + * (SDK) Updated dependencies + * Updated iavl dependency to v0.15.3 + * Update tendermint to v0.34.1 + * (types) [\#7027](https://github.com/cosmos/cosmos-sdk/pull/7027) `Coin(s)` and `DecCoin(s)` updates: + * Bump denomination max length to 128 + * Allow uppercase letters and numbers in denominations to support [ADR 001](./docs/architecture/adr-001-coin-source-tracing.md) + * Added `Validate` function that returns a descriptive error + * (types) [\#5581](https://github.com/cosmos/cosmos-sdk/pull/5581) Add convenience functions {,Must}Bech32ifyAddressBytes. + * (types/module) [\#5724](https://github.com/cosmos/cosmos-sdk/issues/5724) The `types/module` package does no longer depend on `x/simulation`. + * (types) [\#5585](https://github.com/cosmos/cosmos-sdk/pull/5585) IBC additions: + * `Coin` denomination max lenght has been increased to 32. + * Added `CapabilityKey` alias for `StoreKey` to match IBC spec. + * (types/rest) [\#5900](https://github.com/cosmos/cosmos-sdk/pull/5900) Add Check*Error function family to spare developers from replicating tons of boilerplate code. + * (types) [\#6128](https://github.com/cosmos/cosmos-sdk/pull/6137) Add `String()` method to `GasMeter`. + * (types) [\#6195](https://github.com/cosmos/cosmos-sdk/pull/6195) Add codespace to broadcast(sync/async) response. + * (types) \#6897 Add KV type from tendermint to `types` directory. + * (version) [\#7848](https://github.com/cosmos/cosmos-sdk/pull/7848) [\#7941](https://github.com/cosmos/cosmos-sdk/pull/7941) + `version --long` output now shows the list of build dependencies and replaced build dependencies. + * (baseapp) [#17954](https://github.com/cosmos/cosmos-sdk/issues/17954) Add `Mempool()` method on `BaseApp` to allow access to the mempool. * (x/gov) [#17780](https://github.com/cosmos/cosmos-sdk/pull/17780) Recover panics and turn them into errors when executing x/gov proposals. @@ -1213,11 +1479,11 @@ Security Release. No breaking changes related to 0.44.x. ### 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. - * In v0.46, v0.47 this function is additive to the `genesis migrate` command. However in v0.50+, adding custom migrations to the `genesis migrate` command is directly possible. +* (deps) Bump IAVL version to [v0.14.0](https://github.com/cosmos/iavl/releases/tag/v0.14.0) +* (client) [\#5585](https://github.com/cosmos/cosmos-sdk/pull/5585) `CLIContext` additions: + * Introduce `QueryABCI` that returns the full `abci.ResponseQuery` with inclusion Merkle proofs. + * Added `prove` flag for Merkle proof verification. +* (x/staking) [\#6791)](https://github.com/cosmos/cosmos-sdk/pull/6791) Close {UBDQueue,RedelegationQueu}Iterator once used. ### Bug Fixes @@ -1304,7 +1570,10 @@ Security Release. No breaking changes related to 0.44.x. ## [v0.47.1](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.1) - 2023-03-23 -### Features +* (rest) [\#5648](https://github.com/cosmos/cosmos-sdk/pull/5648) Enhance /txs usability: + * Add `tx.minheight` key to filter transaction with an inclusive minimum block height + * Add `tx.maxheight` key to filter transaction with an inclusive maximum block height +* (crypto/keys) [\#5739](https://github.com/cosmos/cosmos-sdk/pull/5739) Print an error message if the password input failed. * (x/bank) [#15265](https://github.com/cosmos/cosmos-sdk/pull/15265) Update keeper interface to include `GetAllDenomMetaData`. * (x/groups) [#14879](https://github.com/cosmos/cosmos-sdk/pull/14879) Add `Query/Groups` query to get all the groups. @@ -1460,65 +1729,62 @@ Security Release. No breaking changes related to 0.44.x. ### API Breaking Changes -* Migrate to CometBFT. Follow the migration instructions in the [upgrade guide](./UPGRADING.md#migration-to-cometbft-part-1). -* (simulation) [#14728](https://github.com/cosmos/cosmos-sdk/pull/14728) Rename the `ParamChanges` field to `LegacyParamChange` and `Contents` to `LegacyProposalContents` in `simulation.SimulationState`. Additionally it adds a `ProposalMsgs` field to `simulation.SimulationState`. -* (x/gov) [#14782](https://github.com/cosmos/cosmos-sdk/pull/14782) Move the `metadata` argument in `govv1.NewProposal` alongside `title` and `summary`. -* (x/upgrade) [#14216](https://github.com/cosmos/cosmos-sdk/pull/14216) Change upgrade keeper receiver to upgrade keeper pointers. -* (x/auth) [#13780](https://github.com/cosmos/cosmos-sdk/pull/13780) Querying with `id` (type of int64) in `AccountAddressByID` grpc query now throws error, use account-id(type of uint64) instead. -* (store) [#13516](https://github.com/cosmos/cosmos-sdk/pull/13516) Update State Streaming APIs: - * Add method `ListenCommit` to `ABCIListener` - * Move `ListeningEnabled` and `AddListener` methods to `CommitMultiStore` - * Remove `CacheWrapWithListeners` from `CacheWrap` and `CacheWrapper` interfaces - * Remove listening APIs from the caching layer (it should only listen to the `rootmulti.Store`) - * Add three new options to file streaming service constructor. - * Modify `ABCIListener` such that any error from any method will always halt the app via `panic` -* (x/auth) [#13877](https://github.com/cosmos/cosmos-sdk/pull/13877) Rename `AccountKeeper`'s `GetNextAccountNumber` to `NextAccountNumber`. -* (x/evidence) [#13740](https://github.com/cosmos/cosmos-sdk/pull/13740) The `NewQueryEvidenceRequest` function now takes `hash` as a HEX encoded `string`. -* (server) [#13485](https://github.com/cosmos/cosmos-sdk/pull/13485) The `Application` service now requires the `RegisterNodeService` method to be implemented. -* [#13437](https://github.com/cosmos/cosmos-sdk/pull/13437) Add a list of modules to export argument in `ExportAppStateAndValidators`. -* (simapp) [#13402](https://github.com/cosmos/cosmos-sdk/pull/13402) Move simulation flags to `x/simulation/client/cli`. -* (simapp) [#13402](https://github.com/cosmos/cosmos-sdk/pull/13402) Move simulation helpers functions (`SetupSimulation`, `SimulationOperations`, `CheckExportSimulation`, `PrintStats`, `GetSimulationLog`) to `testutil/sims`. -* (simapp) [#13402](https://github.com/cosmos/cosmos-sdk/pull/13402) Move `testutil/rest` package to `testutil`. -* (types) [#13380](https://github.com/cosmos/cosmos-sdk/pull/13380) Remove deprecated `sdk.NewLevelDB`. -* (simapp) [#13378](https://github.com/cosmos/cosmos-sdk/pull/13378) Move `simapp.App` to `runtime.AppI`. -* (tx) [#12659](https://github.com/cosmos/cosmos-sdk/pull/12659) Remove broadcast mode `block`. -* (simapp) [#12747](https://github.com/cosmos/cosmos-sdk/pull/12747) Remove `simapp.MakeTestEncodingConfig`. Please use `moduletestutil.MakeTestEncodingConfig` (`types/module/testutil`) in tests instead. -* (x/bank) [#12648](https://github.com/cosmos/cosmos-sdk/pull/12648) `NewSendAuthorization` takes a new argument of an optional list of addresses allowed to receive bank assests via authz MsgSend grant. You can pass `nil` for the same behavior as before, i.e. any recipient is allowed. -* (x/bank) [#12593](https://github.com/cosmos/cosmos-sdk/pull/12593) Add `SpendableCoin` method to `BaseViewKeeper` -* (x/slashing) [#12581](https://github.com/cosmos/cosmos-sdk/pull/12581) Remove `x/slashing` legacy querier. -* (types) [#12355](https://github.com/cosmos/cosmos-sdk/pull/12355) Remove the compile-time `types.DBbackend` variable. Removes usage of the same in server/util.go -* (x/gov) [#12368](https://github.com/cosmos/cosmos-sdk/pull/12369) Gov keeper is now passed by reference instead of copy to make post-construction mutation of Hooks and Proposal Handlers possible at a framework level. -* (simapp) [#12270](https://github.com/cosmos/cosmos-sdk/pull/12270) Remove `invCheckPeriod uint` attribute from `SimApp` struct as per migration of `x/crisis` to app wiring -* (simapp) [#12334](https://github.com/cosmos/cosmos-sdk/pull/12334) Move `simapp.ConvertAddrsToValAddrs` and `simapp.CreateTestPubKeys ` to respectively `simtestutil.ConvertAddrsToValAddrs` and `simtestutil.CreateTestPubKeys` (`testutil/sims`) -* (simapp) [#12312](https://github.com/cosmos/cosmos-sdk/pull/12312) Move `simapp.EmptyAppOptions` to `simtestutil.EmptyAppOptions` (`testutil/sims`) -* (simapp) [#12312](https://github.com/cosmos/cosmos-sdk/pull/12312) Remove `skipUpgradeHeights map[int64]bool` and `homePath string` from `NewSimApp` constructor as per migration of `x/upgrade` to app-wiring. -* (testutil) [#12278](https://github.com/cosmos/cosmos-sdk/pull/12278) Move all functions from `simapp/helpers` to `testutil/sims` -* (testutil) [#12233](https://github.com/cosmos/cosmos-sdk/pull/12233) Move `simapp.TestAddr` to `simtestutil.TestAddr` (`testutil/sims`) -* (x/staking) [#12102](https://github.com/cosmos/cosmos-sdk/pull/12102) Staking keeper now is passed by reference instead of copy. Keeper's SetHooks no longer returns keeper. It updates the keeper in place instead. -* (linting) [#12141](https://github.com/cosmos/cosmos-sdk/pull/12141) Fix usability related linting for database. This means removing the infix Prefix from `prefix.NewPrefixWriter` and such so that it is `prefix.NewWriter` and making `db.DBConnection` and such into `db.Connection` -* (x/distribution) [#12434](https://github.com/cosmos/cosmos-sdk/pull/12434) `x/distribution` module `SetParams` keeper method definition is now updated to return `error`. -* (x/staking) [#12409](https://github.com/cosmos/cosmos-sdk/pull/12409) `x/staking` module `SetParams` keeper method definition is now updated to return `error`. -* (x/crisis) [#12445](https://github.com/cosmos/cosmos-sdk/pull/12445) `x/crisis` module `SetConstantFee` keeper method definition is now updated to return `error`. -* (x/gov) [#12631](https://github.com/cosmos/cosmos-sdk/pull/12631) `x/gov` module refactored to use `Params` as single struct instead of `DepositParams`, `TallyParams` & `VotingParams`. -* (x/gov) [#12631](https://github.com/cosmos/cosmos-sdk/pull/12631) Migrate `x/gov` to self-managed parameters and deprecate it's usage of `x/params`. -* (x/bank) [#12630](https://github.com/cosmos/cosmos-sdk/pull/12630) `x/bank` module `SetParams` keeper method definition is now updated to return `error`. -* (x/bank) [#11859](https://github.com/cosmos/cosmos-sdk/pull/11859) Move the SendEnabled information out of the Params and into the state store directly. - The information can now be accessed using the BankKeeper. - Setting can be done using MsgSetSendEnabled as a governance proposal. - A SendEnabled query has been added to both GRPC and CLI. -* (appModule) Remove `Route`, `QuerierRoute` and `LegacyQuerierHandler` from AppModule Interface. -* (x/modules) Remove all LegacyQueries and related code from modules -* (store) [#11825](https://github.com/cosmos/cosmos-sdk/pull/11825) Make extension snapshotter interface safer to use, renamed the util function `WriteExtensionItem` to `WriteExtensionPayload`. -* (x/genutil)[#12956](https://github.com/cosmos/cosmos-sdk/pull/12956) `genutil.AppModuleBasic` has a new attribute: genesis transaction validation function. The existing validation logic is implemented in `genutiltypes.DefaultMessageValidator`. Use `genutil.NewAppModuleBasic` to create a new genutil Module Basic. -* (codec) [#12964](https://github.com/cosmos/cosmos-sdk/pull/12964) `ProtoCodec.MarshalInterface` now returns an error when serializing unregistered types and a subsequent `ProtoCodec.UnmarshalInterface` would fail. -* (x/staking) [#12973](https://github.com/cosmos/cosmos-sdk/pull/12973) Removed `stakingkeeper.RandomValidator`. Use `testutil.RandSliceElem(r, sk.GetAllValidators(ctx))` instead. -* (x/gov) [#13160](https://github.com/cosmos/cosmos-sdk/pull/13160) Remove custom marshaling of proposl and voteoption. -* (types) [#13430](https://github.com/cosmos/cosmos-sdk/pull/13430) Remove unused code `ResponseCheckTx` and `ResponseDeliverTx` -* (store) [#13529](https://github.com/cosmos/cosmos-sdk/pull/13529) Add method `LatestVersion` to `MultiStore` interface, add method `SetQueryMultiStore` to baesapp to support alternative `MultiStore` implementation for query service. -* (pruning) [#13609](https://github.com/cosmos/cosmos-sdk/pull/13609) Move pruning package to be under store package -* [#13794](https://github.com/cosmos/cosmos-sdk/pull/13794) Most methods on `types/module.AppModule` have been moved to -extension interfaces. `module.Manager.Modules` is now of type `map[string]interface{}` to support in parallel the new -`cosmossdk.io/core/appmodule.AppModule` API. +* (modules) [\#5506](https://github.com/cosmos/cosmos-sdk/pull/5506) Remove individual setters of `x/distribution` parameters. Instead, follow the module spec in getting parameters, setting new value(s) and finally calling `SetParams`. +* (types) [\#5495](https://github.com/cosmos/cosmos-sdk/pull/5495) Remove redundant `(Must)Bech32ify*` and `(Must)Get*KeyBech32` functions in favor of `(Must)Bech32ifyPubKey` and `(Must)GetPubKeyFromBech32` respectively, both of which take a `Bech32PubKeyType` (string). +* (types) [\#5430](https://github.com/cosmos/cosmos-sdk/pull/5430) `DecCoins#Add` parameter changed from `DecCoins` +to `...DecCoin`, `Coins#Add` parameter changed from `Coins` to `...Coin`. +* (baseapp/types) [\#5421](https://github.com/cosmos/cosmos-sdk/pull/5421) The `Error` interface (`types/errors.go`) +has been removed in favor of the concrete type defined in `types/errors/` which implements the standard `error` interface. + * As a result, the `Handler` and `Querier` implementations now return a standard `error`. + Within `BaseApp`, `runTx` now returns a `(GasInfo, *Result, error)` tuple and `runMsgs` returns a + `(*Result, error)` tuple. A reference to a `Result` is now used to indicate success whereas an error + signals an invalid message or failed message execution. As a result, the fields `Code`, `Codespace`, + `GasWanted`, and `GasUsed` have been removed the `Result` type. The latter two fields are now found + in the `GasInfo` type which is always returned regardless of execution outcome. + * Note to developers: Since all handlers and queriers must now return a standard `error`, the `types/errors/` + package contains all the relevant and pre-registered errors that you typically work with. A typical + error returned will look like `sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, "...")`. You can retrieve + relevant ABCI information from the error via `ABCIInfo`. +* (client) [\#5442](https://github.com/cosmos/cosmos-sdk/pull/5442) Remove client/alias.go as it's not necessary and +components can be imported directly from the packages. +* (store) [\#4748](https://github.com/cosmos/cosmos-sdk/pull/4748) The `CommitMultiStore` interface +now requires a `SetInterBlockCache` method. Applications that do not wish to support this can simply +have this method perform a no-op. +* (modules) [\#4665](https://github.com/cosmos/cosmos-sdk/issues/4665) Refactored `x/gov` module structure and dev-UX: + * Prepare for module spec integration + * Update gov keys to use big endian encoding instead of little endian +* (modules) [\#5017](https://github.com/cosmos/cosmos-sdk/pull/5017) The `x/genaccounts` module has been deprecated and all components removed except the `legacy/` package. +* [\#4486](https://github.com/cosmos/cosmos-sdk/issues/4486) Vesting account types decoupled from the `x/auth` module and now live under `x/auth/vesting`. Applications wishing to use vesting account types must be sure to register types via `RegisterCodec` under the new vesting package. +* [\#4486](https://github.com/cosmos/cosmos-sdk/issues/4486) The `NewBaseVestingAccount` constructor returns an error +if the provided arguments are invalid. +* (x/auth) [\#5006](https://github.com/cosmos/cosmos-sdk/pull/5006) Modular `AnteHandler` via composable decorators: + * The `AnteHandler` interface now returns `(newCtx Context, err error)` instead of `(newCtx Context, result sdk.Result, abort bool)` + * The `NewAnteHandler` function returns an `AnteHandler` function that returns the new `AnteHandler` + interface and has been moved into the `auth/ante` directory. + * `ValidateSigCount`, `ValidateMemo`, `ProcessPubKey`, `EnsureSufficientMempoolFee`, and `GetSignBytes` + have all been removed as public functions. + * Invalid Signatures may return `InvalidPubKey` instead of `Unauthorized` error, since the transaction + will first hit `SetPubKeyDecorator` before the `SigVerificationDecorator` runs. + * `StdTx#GetSignatures` will return an array of just signature byte slices `[][]byte` instead of + returning an array of `StdSignature` structs. To replicate the old behavior, use the public field + `StdTx.Signatures` to get back the array of StdSignatures `[]StdSignature`. +* (modules) [\#5299](https://github.com/cosmos/cosmos-sdk/pull/5299) `HandleDoubleSign` along with params `MaxEvidenceAge` and `DoubleSignJailEndTime` have moved from the `x/slashing` module to the `x/evidence` module. +* (keys) [\#4941](https://github.com/cosmos/cosmos-sdk/issues/4941) Keybase concrete types constructors such as `NewKeyBaseFromDir` and `NewInMemory` now accept optional parameters of type `KeybaseOption`. These +optional parameters are also added on the keys sub-commands functions, which are now public, and allows +these options to be set on the commands or ignored to default to previous behavior. +* [\#5547](https://github.com/cosmos/cosmos-sdk/pull/5547) `NewKeyBaseFromHomeFlag` constructor has been removed. +* [\#5439](https://github.com/cosmos/cosmos-sdk/pull/5439) Further modularization was done to the `keybase` +package to make it more suitable for use with different key formats and algorithms: + * The `WithKeygenFunc` function added as a `KeybaseOption` which allows a custom bytes to key + implementation to be defined when keys are created. + * The `WithDeriveFunc` function added as a `KeybaseOption` allows custom logic for deriving a key + from a mnemonic, bip39 password, and HD Path. + * BIP44 is no longer build into `keybase.CreateAccount()`. It is however the default when using + the `client/keys` add command. + * `SupportedAlgos` and `SupportedAlgosLedger` functions return a slice of `SigningAlgo`s that are + supported by the keybase and the ledger integration respectively. +* (simapp) [\#5419](https://github.com/cosmos/cosmos-sdk/pull/5419) The `helpers.GenTx()` now accepts a gas argument. +* (baseapp) [\#5455](https://github.com/cosmos/cosmos-sdk/issues/5455) A `sdk.Context` is now passed into the `router.Route()` function. ### CLI Breaking Changes @@ -1527,35 +1793,146 @@ extension interfaces. `module.Manager.Modules` is now of type `map[string]interf ### Bug Fixes -* (x/auth/vesting) [#15373](https://github.com/cosmos/cosmos-sdk/pull/15373) Add extra checks when creating a periodic vesting account. -* (x/auth) [#13838](https://github.com/cosmos/cosmos-sdk/pull/13838) Fix calling `String()` and `MarshalYAML` panics when pubkey is set on a `BaseAccount``. -* (x/evidence) [#13740](https://github.com/cosmos/cosmos-sdk/pull/13740) Fix evidence query API to decode the hash properly. -* (bank) [#13691](https://github.com/cosmos/cosmos-sdk/issues/13691) Fix unhandled error for vesting account transfers, when total vesting amount exceeds total balance. -* [#13553](https://github.com/cosmos/cosmos-sdk/pull/13553) Ensure all parameter validation for decimal types handles nil decimal values. -* [#13145](https://github.com/cosmos/cosmos-sdk/pull/13145) Fix panic when calling `String()` to a Record struct type. -* [#13116](https://github.com/cosmos/cosmos-sdk/pull/13116) Fix a dead-lock in the `Group-TotalWeight` `x/group` invariant. -* (types) [#12154](https://github.com/cosmos/cosmos-sdk/pull/12154) Add `baseAccountGetter` to avoid invalid account error when create vesting account. -* (x/staking) [#12303](https://github.com/cosmos/cosmos-sdk/pull/12303) Use bytes instead of string comparison in delete validator queue -* (store/rootmulti) [#12487](https://github.com/cosmos/cosmos-sdk/pull/12487) Fix non-deterministic map iteration. -* (sdk/dec_coins) [#12903](https://github.com/cosmos/cosmos-sdk/pull/12903) Fix nil `DecCoin` creation when converting `Coins` to `DecCoins` -* (store) [#12945](https://github.com/cosmos/cosmos-sdk/pull/12945) Fix nil end semantics in store/cachekv/iterator when iterating a dirty cache. -* (x/gov) [#13051](https://github.com/cosmos/cosmos-sdk/pull/13051) In SubmitPropsal, when a legacy msg fails it's handler call, wrap the error as ErrInvalidProposalContent (instead of ErrNoProposalHandlerExists). -* (snapshot) [#13400](https://github.com/cosmos/cosmos-sdk/pull/13400) Fix snapshot checksum issue in golang 1.19. -* (server) [#13778](https://github.com/cosmos/cosmos-sdk/pull/13778) Set Cosmos SDK default endpoints to localhost to avoid unknown exposure of endpoints. -* (x/auth) [#13877](https://github.com/cosmos/cosmos-sdk/pull/13877) Handle missing account numbers during `InitGenesis`. -* (x/gov) [#13918](https://github.com/cosmos/cosmos-sdk/pull/13918) Propagate message errors when executing a proposal. - -### Deprecated +* (store) [\#5435](https://github.com/cosmos/cosmos-sdk/pull/5435) New iterator for paginated requests. Iterator limits DB reads to the range of the requested page. +* (x/evidence) [\#5240](https://github.com/cosmos/cosmos-sdk/pull/5240) Initial implementation of the `x/evidence` module. +* (cli) [\#5212](https://github.com/cosmos/cosmos-sdk/issues/5212) The `q gov proposals` command now supports pagination. +* (store) [\#4724](https://github.com/cosmos/cosmos-sdk/issues/4724) Multistore supports substore migrations upon load. New `rootmulti.Store.LoadLatestVersionAndUpgrade` method in +`Baseapp` supports `StoreLoader` to enable various upgrade strategies. It no +longer panics if the store to load contains substores that we didn't explicitly mount. +* [\#4972](https://github.com/cosmos/cosmos-sdk/issues/4972) A `TxResponse` with a corresponding code +and tx hash will be returned for specific Tendermint errors: + * `CodeTxInMempoolCache` + * `CodeMempoolIsFull` + * `CodeTxTooLarge` +* [\#3872](https://github.com/cosmos/cosmos-sdk/issues/3872) Implement a RESTful endpoint and cli command to decode transactions. +* (keys) [\#4754](https://github.com/cosmos/cosmos-sdk/pull/4754) Introduce new Keybase implementation that can +leverage operating systems' built-in functionalities to securely store secrets. MacOS users may encounter +the following [issue](https://github.com/keybase/go-keychain/issues/47) with the `go-keychain` library. If +you encounter this issue, you must upgrade your xcode command line tools to version >= `10.2`. You can +upgrade via: `sudo rm -rf /Library/Developer/CommandLineTools; xcode-select --install`. Verify the +correct version via: `pkgutil --pkg-info=com.apple.pkg.CLTools_Executables`. +* [\#5355](https://github.com/cosmos/cosmos-sdk/pull/5355) Client commands accept a new `--keyring-backend` option through which users can specify which backend should be used +by the new key store: + * `os`: use OS default credentials storage (default). + * `file`: use encrypted file-based store. + * `kwallet`: use [KDE Wallet](https://utils.kde.org/projects/kwalletmanager/) service. + * `pass`: use the [pass](https://www.passwordstore.org/) command line password manager. + * `test`: use password-less key store. _For testing purposes only. Use it at your own risk._ +* (keys) [\#5097](https://github.com/cosmos/cosmos-sdk/pull/5097) New `keys migrate` command to assist users migrate their keys +to the new keyring. +* (keys) [\#5366](https://github.com/cosmos/cosmos-sdk/pull/5366) `keys list` now accepts a `--list-names` option to list key names only, whilst the `keys delete` +command can delete multiple keys by passing their names as arguments. The aforementioned commands can then be piped together, e.g. +`appcli keys list -n | xargs appcli keys delete` +* (modules) [\#4233](https://github.com/cosmos/cosmos-sdk/pull/4233) Add upgrade module that coordinates software upgrades of live chains. +* [\#4486](https://github.com/cosmos/cosmos-sdk/issues/4486) Introduce new `PeriodicVestingAccount` vesting account type +that allows for arbitrary vesting periods. +* (baseapp) [\#5196](https://github.com/cosmos/cosmos-sdk/pull/5196) Baseapp has a new `runTxModeReCheck` to allow applications to skip expensive and unnecessary re-checking of transactions. +* (types) [\#5196](https://github.com/cosmos/cosmos-sdk/pull/5196) Context has new `IsRecheckTx() bool` and `WithIsReCheckTx(bool) Context` methods to to be used in the `AnteHandler`. +* (x/auth/ante) [\#5196](https://github.com/cosmos/cosmos-sdk/pull/5196) AnteDecorators have been updated to avoid unnecessary checks when `ctx.IsReCheckTx() == true` +* (x/auth) [\#5006](https://github.com/cosmos/cosmos-sdk/pull/5006) Modular `AnteHandler` via composable decorators: + * The `AnteDecorator` interface has been introduced to allow users to implement modular `AnteHandler` + functionality that can be composed together to create a single `AnteHandler` rather than implementing + a custom `AnteHandler` completely from scratch, where each `AnteDecorator` allows for custom behavior in + tightly defined and logically isolated manner. These custom `AnteDecorator` can then be chained together + with default `AnteDecorator` or third-party `AnteDecorator` to create a modularized `AnteHandler` + which will run each `AnteDecorator` in the order specified in `ChainAnteDecorators`. For details + on the new architecture, refer to the [ADR](docs/architecture/adr-010-modular-antehandler.md). + * `ChainAnteDecorators` function has been introduced to take in a list of `AnteDecorators` and chain + them in sequence and return a single `AnteHandler`: + * `SetUpContextDecorator`: Sets `GasMeter` in context and creates defer clause to recover from any + `OutOfGas` panics in future AnteDecorators and return `OutOfGas` error to `BaseApp`. It MUST be the + first `AnteDecorator` in the chain for any application that uses gas (or another one that sets the gas meter). + * `ValidateBasicDecorator`: Calls tx.ValidateBasic and returns any non-nil error. + * `ValidateMemoDecorator`: Validates tx memo with application parameters and returns any non-nil error. + * `ConsumeGasTxSizeDecorator`: Consumes gas proportional to the tx size based on application parameters. + * `MempoolFeeDecorator`: Checks if fee is above local mempool `minFee` parameter during `CheckTx`. + * `DeductFeeDecorator`: Deducts the `FeeAmount` from first signer of the transaction. + * `SetPubKeyDecorator`: Sets pubkey of account in any account that does not already have pubkey saved in state machine. + * `SigGasConsumeDecorator`: Consume parameter-defined amount of gas for each signature. + * `SigVerificationDecorator`: Verify each signature is valid, return if there is an error. + * `ValidateSigCountDecorator`: Validate the number of signatures in tx based on app-parameters. + * `IncrementSequenceDecorator`: Increments the account sequence for each signer to prevent replay attacks. +* (cli) [\#5223](https://github.com/cosmos/cosmos-sdk/issues/5223) Cosmos Ledger App v2.0.0 is now supported. The changes are backwards compatible and App v1.5.x is still supported. +* (x/staking) [\#5380](https://github.com/cosmos/cosmos-sdk/pull/5380) Introduced ability to store historical info entries in staking keeper, allows applications to introspect specified number of past headers and validator sets + * Introduces new parameter `HistoricalEntries` which allows applications to determine how many recent historical info entries they want to persist in store. Default value is 0. + * Introduces cli commands and rest routes to query historical information at a given height +* (modules) [\#5249](https://github.com/cosmos/cosmos-sdk/pull/5249) Funds are now allowed to be directly sent to the community pool (via the distribution module account). +* (keys) [\#4941](https://github.com/cosmos/cosmos-sdk/issues/4941) Introduce keybase option to allow overriding the default private key implementation of a key generated through the `keys add` cli command. +* (keys) [\#5439](https://github.com/cosmos/cosmos-sdk/pull/5439) Flags `--algo` and `--hd-path` are added to + `keys add` command in order to make use of keybase modularized. By default, it uses (0, 0) bip44 + HD path and secp256k1 keys, so is non-breaking. +* (types) [\#5447](https://github.com/cosmos/cosmos-sdk/pull/5447) Added `ApproxRoot` function to sdk.Decimal type in order to get the nth root for a decimal number, where n is a positive integer. + * An `ApproxSqrt` function was also added for convenience around the common case of n=2. -* (x/evidence) [#13740](https://github.com/cosmos/cosmos-sdk/pull/13740) The `evidence_hash` field of `QueryEvidenceRequest` has been deprecated and now contains a new field `hash` with type `string`. -* (x/bank) [#11859](https://github.com/cosmos/cosmos-sdk/pull/11859) The Params.SendEnabled field is deprecated and unusable. - The information can now be accessed using the BankKeeper. - Setting can be done using MsgSetSendEnabled as a governance proposal. - A SendEnabled query has been added to both GRPC and CLI. +### Improvements -## [v0.46.16](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.46.16) - 2023-11-07 +* (iavl) [\#5538](https://github.com/cosmos/cosmos-sdk/pull/5538) Remove manual IAVL pruning in favor of IAVL's internal pruning strategy. +* (server) [\#4215](https://github.com/cosmos/cosmos-sdk/issues/4215) The `--pruning` flag +has been moved to the configuration file, to allow easier node configuration. +* (cli) [\#5116](https://github.com/cosmos/cosmos-sdk/issues/5116) The `CLIContext` now supports multiple verifiers +when connecting to multiple chains. The connecting chain's `CLIContext` will have to have the correct +chain ID and node URI or client set. To use a `CLIContext` with a verifier for another chain: + + ```go + // main or parent chain (chain as if you're running without IBC) + mainCtx := context.NewCLIContext() + + // connecting IBC chain + sideCtx := context.NewCLIContext(). + WithChainID(sideChainID). + WithNodeURI(sideChainNodeURI) // or .WithClient(...) + + sideCtx = sideCtx.WithVerifier( + context.CreateVerifier(sideCtx, context.DefaultVerifierCacheSize), + ) + ``` -EOL notice. This is the last release of the `v0.46.x` line. Per this version, the v0.46.x line reached its end-of-life. +* (modules) [\#5017](https://github.com/cosmos/cosmos-sdk/pull/5017) The `x/auth` package now supports +generalized genesis accounts through the `GenesisAccount` interface. +* (modules) [\#4762](https://github.com/cosmos/cosmos-sdk/issues/4762) Deprecate remove and add permissions in ModuleAccount. +* (modules) [\#4760](https://github.com/cosmos/cosmos-sdk/issues/4760) update `x/auth` to match module spec. +* (modules) [\#4814](https://github.com/cosmos/cosmos-sdk/issues/4814) Add security contact to Validator description. +* (modules) [\#4875](https://github.com/cosmos/cosmos-sdk/issues/4875) refactor integration tests to use SimApp and separate test package +* (sdk) [\#4566](https://github.com/cosmos/cosmos-sdk/issues/4566) Export simulation's parameters and app state to JSON in order to reproduce bugs and invariants. +* (sdk) [\#4640](https://github.com/cosmos/cosmos-sdk/issues/4640) improve import/export simulation errors by extending `DiffKVStores` to return an array of `KVPairs` that are then compared to check for inconsistencies. +* (sdk) [\#4717](https://github.com/cosmos/cosmos-sdk/issues/4717) refactor `x/slashing` to match the new module spec +* (sdk) [\#4758](https://github.com/cosmos/cosmos-sdk/issues/4758) update `x/genaccounts` to match module spec +* (simulation) [\#4824](https://github.com/cosmos/cosmos-sdk/issues/4824) `PrintAllInvariants` flag will print all failed invariants +* (simulation) [\#4490](https://github.com/cosmos/cosmos-sdk/issues/4490) add `InitialBlockHeight` flag to resume a simulation from a given block + + * Support exporting the simulation stats to a given JSON file +* (simulation) [\#4847](https://github.com/cosmos/cosmos-sdk/issues/4847), [\#4838](https://github.com/cosmos/cosmos-sdk/pull/4838) and [\#4869](https://github.com/cosmos/cosmos-sdk/pull/4869) `SimApp` and simulation refactors: + * Implement `SimulationManager` for executing modules' simulation functionalities in a modularized way + * Add `RegisterStoreDecoders` to the `SimulationManager` for decoding each module's types + * Add `GenerateGenesisStates` to the `SimulationManager` to generate a randomized `GenState` for each module + * Add `RandomizedParams` to the `SimulationManager` that registers each modules' parameters in order to + simulate `ParamChangeProposal`s' `Content`s + * Add `WeightedOperations` to the `SimulationManager` that define simulation operations (modules' `Msg`s) with their + respective weights (i.e chance of being simulated). + * Add `ProposalContents` to the `SimulationManager` to register each module's governance proposal `Content`s. +* (simulation) [\#4893](https://github.com/cosmos/cosmos-sdk/issues/4893) Change `SimApp` keepers to be public and add getter functions for keys and codec +* (simulation) [\#4906](https://github.com/cosmos/cosmos-sdk/issues/4906) Add simulation `Config` struct that wraps simulation flags +* (simulation) [\#4935](https://github.com/cosmos/cosmos-sdk/issues/4935) Update simulation to reflect a proper `ABCI` application without bypassing `BaseApp` semantics +* (simulation) [\#5378](https://github.com/cosmos/cosmos-sdk/pull/5378) Simulation tests refactor: + * Add `App` interface for general SDK-based app's methods. + * Refactor and cleanup simulation tests into util functions to simplify their implementation for other SDK apps. +* (store) [\#4792](https://github.com/cosmos/cosmos-sdk/issues/4792) panic on non-registered store +* (types) [\#4821](https://github.com/cosmos/cosmos-sdk/issues/4821) types/errors package added with support for stacktraces. It is meant as a more feature-rich replacement for sdk.Errors in the mid-term. +* (store) [\#1947](https://github.com/cosmos/cosmos-sdk/issues/1947) Implement inter-block (persistent) +caching through `CommitKVStoreCacheManager`. Any application wishing to utilize an inter-block cache +must set it in their app via a `BaseApp` option. The `BaseApp` docs have been drastically improved +to detail this new feature and how state transitions occur. +* (docs/spec) All module specs moved into their respective module dir in x/ (i.e. docs/spec/staking -->> x/staking/spec) +* (docs/) [\#5379](https://github.com/cosmos/cosmos-sdk/pull/5379) Major documentation refactor, including: + * (docs/intro/) Add and improve introduction material for newcomers. + * (docs/basics/) Add documentation about basic concepts of the cosmos sdk such as the anatomy of an SDK application, the transaction lifecycle or accounts. + * (docs/core/) Add documentation about core conepts of the cosmos sdk such as `baseapp`, `server`, `store`s, `context` and more. + * (docs/building-modules/) Add reference documentation on concepts relevant for module developers (`keeper`, `handler`, `messages`, `queries`,...). + * (docs/interfaces/) Add documentation on building interfaces for the Cosmos SDK. + * Redesigned user interface that features new dynamically generated sidebar, build-time code embedding from GitHub, new homepage as well as many other improvements. +* (types) [\#5428](https://github.com/cosmos/cosmos-sdk/pull/5428) Add `Mod` (modulo) method and `RelativePow` (exponentation) function for `Uint`. +* (modules) [\#5506](https://github.com/cosmos/cosmos-sdk/pull/5506) Remove redundancy in `x/distribution`s use of parameters. There + now exists a single `Params` type with a getter and setter along with a getter for each individual parameter. ### Bug Fixes @@ -1570,9 +1947,7 @@ EOL notice. This is the last release of the `v0.46.x` line. Per this version, th * (x/genutil) [#17296](https://github.com/cosmos/cosmos-sdk/pull/17296) Add `MigrateHandler` to allow reuse migrate genesis related function. * In v0.46, v0.47 this function is additive to the `genesis migrate` command. However in v0.50+, adding custom migrations to the `genesis migrate` command is directly possible. -## Bug Fixes - -* (server) [#17181](https://github.com/cosmos/cosmos-sdk/pull/17181) Fix `db_backend` lookup fallback from `config.toml`. +## [v0.37.13] - 2020-06-03 ## [v0.46.14](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.46.14) - 2023-07-17 @@ -1644,7 +2019,9 @@ EOL notice. This is the last release of the `v0.46.x` line. Per this version, th ### Improvements -* (cli) [#14953](https://github.com/cosmos/cosmos-sdk/pull/14953) Enable profiling block replay during abci handshake with `--cpu-profile`. +* (rest) [\#5648](https://github.com/cosmos/cosmos-sdk/pull/5648) Enhance /txs usability: + * Add `tx.minheight` key to filter transaction with an inclusive minimum block height + * Add `tx.maxheight` key to filter transaction with an inclusive maximum block height ## [v0.46.9](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.46.9) - 2023-02-07 @@ -1745,12 +2122,216 @@ EOL notice. This is the last release of the `v0.46.x` line. Per this version, th * (x/group) [#13876](https://github.com/cosmos/cosmos-sdk/pull/13876) Fix group MinExecutionPeriod that is checked on execution now, instead of voting period end. -### API Breaking Changes +* (cli) [\#4973](https://github.com/cosmos/cosmos-sdk/pull/4973) Enable application CPU profiling +via the `--cpu-profile` flag. +* [\#4979](https://github.com/cosmos/cosmos-sdk/issues/4979) Introduce a new `halt-time` config and +CLI option to the `start` command. When provided, an application will halt during `Commit` when the +block time is >= the `halt-time`. -* (x/group) [#13876](https://github.com/cosmos/cosmos-sdk/pull/13876) Add `GetMinExecutionPeriod` method on DecisionPolicy interface. +### Improvements + +* [\#4990](https://github.com/cosmos/cosmos-sdk/issues/4990) Add `Events` to the `ABCIMessageLog` to +provide context and grouping of events based on the messages they correspond to. The `Events` field +in `TxResponse` is deprecated and will be removed in the next major release. + +### Bug Fixes + +* [\#4979](https://github.com/cosmos/cosmos-sdk/issues/4979) Use `Signal(os.Interrupt)` over +`os.Exit(0)` during configured halting to allow any `defer` calls to be executed. +* [\#5034](https://github.com/cosmos/cosmos-sdk/issues/5034) Binary search in NFT Module wasn't working on larger sets. + +## [v0.37.0] - 2019-08-21 ### Bug Fixes +* (baseapp) [\#4903](https://github.com/cosmos/cosmos-sdk/issues/4903) Various height query fixes: + * Move height with proof check from `CLIContext` to `BaseApp` as the height + can automatically be injected there. + * Update `handleQueryStore` to resemble `handleQueryCustom` +* (simulation) [\#4912](https://github.com/cosmos/cosmos-sdk/issues/4912) Fix SimApp ModuleAccountAddrs +to properly return black listed addresses for bank keeper initialization. +* (cli) [\#4919](https://github.com/cosmos/cosmos-sdk/pull/4919) Don't crash CLI +if user doesn't answer y/n confirmation request. +* (cli) [\#4927](https://github.com/cosmos/cosmos-sdk/issues/4927) Fix the `q gov vote` +command to handle empty (pruned) votes correctly. + +### Improvements + +* (rest) [\#4924](https://github.com/cosmos/cosmos-sdk/pull/4924) Return response +height even upon error as it may be useful for the downstream caller and have +`/auth/accounts/{address}` return a 200 with an empty account upon error when +that error is that the account doesn't exist. + +## [v0.36.0] - 2019-08-13 + +### Breaking Changes + +* (rest) [\#4837](https://github.com/cosmos/cosmos-sdk/pull/4837) Remove /version and /node_version + endpoints in favor of refactoring /node_info to also include application version info. +* All REST responses now wrap the original resource/result. The response + will contain two fields: height and result. +* [\#3565](https://github.com/cosmos/cosmos-sdk/issues/3565) Updates to the governance module: + * Rename JSON field from `proposal_content` to `content` + * Rename JSON field from `proposal_id` to `id` + * Disable `ProposalTypeSoftwareUpgrade` temporarily +* [\#3775](https://github.com/cosmos/cosmos-sdk/issues/3775) unify sender transaction tag for ease of querying +* [\#4255](https://github.com/cosmos/cosmos-sdk/issues/4255) Add supply module that passively tracks the supplies of a chain + - Renamed `x/distribution` `ModuleName` + - Genesis JSON and CLI now use `distribution` instead of `distr` + - Introduce `ModuleAccount` type, which tracks the flow of coins held within a module + - Replaced `FeeCollectorKeeper` for a `ModuleAccount` + - Replaced the staking `Pool`, which coins are now held by the `BondedPool` and `NotBonded` module accounts + - The `NotBonded` module account now only keeps track of the not bonded tokens within staking, instead of the whole chain + - [\#3628](https://github.com/cosmos/cosmos-sdk/issues/3628) Replaced governance's burn and deposit accounts for a `ModuleAccount` + - Added a `ModuleAccount` for the distribution module + - Added a `ModuleAccount` for the mint module + [\#4472](https://github.com/cosmos/cosmos-sdk/issues/4472) validation for crisis genesis +* [\#3985](https://github.com/cosmos/cosmos-sdk/issues/3985) `ValidatorPowerRank` uses potential consensus power instead of tendermint power +* [\#4104](https://github.com/cosmos/cosmos-sdk/issues/4104) Gaia has been moved to its own repository: https://github.com/cosmos/gaia +* [\#4104](https://github.com/cosmos/cosmos-sdk/issues/4104) Rename gaiad.toml to app.toml. The internal contents of the application + config remain unchanged. +* [\#4159](https://github.com/cosmos/cosmos-sdk/issues/4159) create the default module patterns and module manager +* [\#4230](https://github.com/cosmos/cosmos-sdk/issues/4230) Change the type of ABCIMessageLog#MsgIndex to uint16 for proper serialization. +* [\#4250](https://github.com/cosmos/cosmos-sdk/issues/4250) BaseApp.Query() returns app's version string set via BaseApp.SetAppVersion() + when handling /app/version queries instead of the version string passed as build + flag at compile time. +* [\#4262](https://github.com/cosmos/cosmos-sdk/issues/4262) GoSumHash is no longer returned by the version command. +* [\#4263](https://github.com/cosmos/cosmos-sdk/issues/4263) RestServer#Start now takes read and write timeout arguments. +* [\#4305](https://github.com/cosmos/cosmos-sdk/issues/4305) `GenerateOrBroadcastMsgs` no longer takes an `offline` parameter. +* [\#4342](https://github.com/cosmos/cosmos-sdk/pull/4342) Upgrade go-amino to v0.15.0 +* [\#4351](https://github.com/cosmos/cosmos-sdk/issues/4351) InitCmd, AddGenesisAccountCmd, and CollectGenTxsCmd take node's and client's default home directories as arguments. +* [\#4387](https://github.com/cosmos/cosmos-sdk/issues/4387) Refactor the usage of tags (now called events) to reflect the + new ABCI events semantics: + - Move `x/{module}/tags/tags.go` => `x/{module}/types/events.go` + - Update `docs/specs` + - Refactor tags in favor of new `Event(s)` type(s) + - Update `Context` to use new `EventManager` + - (Begin|End)Blocker no longer return tags, but rather uses new `EventManager` + - Message handlers no longer return tags, but rather uses new `EventManager` + Any component (e.g. BeginBlocker, message handler, etc...) wishing to emit an event must do so + through `ctx.EventManger().EmitEvent(s)`. + To reset or wipe emitted events: `ctx = ctx.WithEventManager(sdk.NewEventManager())` + To get all emitted events: `events := ctx.EventManager().Events()` +* [\#4437](https://github.com/cosmos/cosmos-sdk/issues/4437) Replace governance module store keys to use `[]byte` instead of `string`. +* [\#4451](https://github.com/cosmos/cosmos-sdk/issues/4451) Improve modularization of clients and modules: + * Module directory structure improved and standardized + * Aliases autogenerated + * Auth and bank related commands are now mounted under the respective moduels + * Client initialization and mounting standardized +* [\#4479](https://github.com/cosmos/cosmos-sdk/issues/4479) Remove codec argument redundency in client usage where + the CLIContext's codec should be used instead. +* [\#4488](https://github.com/cosmos/cosmos-sdk/issues/4488) Decouple client tx, REST, and ultil packages from auth. These packages have + been restructured and retrofitted into the `x/auth` module. +* [\#4521](https://github.com/cosmos/cosmos-sdk/issues/4521) Flatten x/bank structure by hiding module internals. +* [\#4525](https://github.com/cosmos/cosmos-sdk/issues/4525) Remove --cors flag, the feature is long gone. +* [\#4536](https://github.com/cosmos/cosmos-sdk/issues/4536) The `/auth/accounts/{address}` now returns a `height` in the response. + The account is now nested under `account`. +* [\#4543](https://github.com/cosmos/cosmos-sdk/issues/4543) Account getters are no longer part of client.CLIContext() and have now moved + to reside in the auth-specific AccountRetriever. +* [\#4588](https://github.com/cosmos/cosmos-sdk/issues/4588) Context does not depend on x/auth anymore. client/context is stripped out of the following features: + - GetAccountDecoder() + - CLIContext.WithAccountDecoder() + - CLIContext.WithAccountStore() + x/auth.AccountDecoder is unnecessary and consequently removed. +* [\#4602](https://github.com/cosmos/cosmos-sdk/issues/4602) client/input.{Buffer,Override}Stdin() functions are removed. Thanks to cobra's new release they are now redundant. +* [\#4633](https://github.com/cosmos/cosmos-sdk/issues/4633) Update old Tx search by tags APIs to use new Events + nomenclature. +* [\#4649](https://github.com/cosmos/cosmos-sdk/issues/4649) Refactor x/crisis as per modules new specs. +* [\#3685](https://github.com/cosmos/cosmos-sdk/issues/3685) The default signature verification gas logic (`DefaultSigVerificationGasConsumer`) now specifies explicit key types rather than string pattern matching. This means that zones that depended on string matching to allow other keys will need to write a custom `SignatureVerificationGasConsumer` function. +* [\#4663](https://github.com/cosmos/cosmos-sdk/issues/4663) Refactor bank keeper by removing private functions + - `InputOutputCoins`, `SetCoins`, `SubtractCoins` and `AddCoins` are now part of the `SendKeeper` instead of the `Keeper` interface +* (tendermint) [\#4721](https://github.com/cosmos/cosmos-sdk/pull/4721) Upgrade Tendermint to v0.32.1 + +* (x/group) [#13876](https://github.com/cosmos/cosmos-sdk/pull/13876) Add `GetMinExecutionPeriod` method on DecisionPolicy interface. + +* [\#4843](https://github.com/cosmos/cosmos-sdk/issues/4843) Add RegisterEvidences function in the codec package to register + Tendermint evidence types with a given codec. +* (rest) [\#3867](https://github.com/cosmos/cosmos-sdk/issues/3867) Allow querying for genesis transaction when height query param is set to zero. +* [\#2020](https://github.com/cosmos/cosmos-sdk/issues/2020) New keys export/import command line utilities to export/import private keys in ASCII format + that rely on Keybase's new underlying ExportPrivKey()/ImportPrivKey() API calls. +* [\#3565](https://github.com/cosmos/cosmos-sdk/issues/3565) Implement parameter change proposal support. + Parameter change proposals can be submitted through the CLI + or a REST endpoint. See docs for further usage. +* [\#3850](https://github.com/cosmos/cosmos-sdk/issues/3850) Add `rewards` and `commission` to distribution tx tags. +* [\#3981](https://github.com/cosmos/cosmos-sdk/issues/3981) Add support to gracefully halt a node at a given height + via the node's `halt-height` config or CLI value. +* [\#4144](https://github.com/cosmos/cosmos-sdk/issues/4144) Allow for configurable BIP44 HD path and coin type. +* [\#4250](https://github.com/cosmos/cosmos-sdk/issues/4250) New BaseApp.{,Set}AppVersion() methods to get/set app's version string. +* [\#4263](https://github.com/cosmos/cosmos-sdk/issues/4263) Add `--read-timeout` and `--write-timeout` args to the `rest-server` command + to support custom RPC R/W timeouts. +* [\#4271](https://github.com/cosmos/cosmos-sdk/issues/4271) Implement Coins#IsAnyGT +* [\#4318](https://github.com/cosmos/cosmos-sdk/issues/4318) Support height queries. Queries against nodes that have the queried + height pruned will return an error. +* [\#4409](https://github.com/cosmos/cosmos-sdk/issues/4409) Implement a command that migrates exported state from one version to the next. + The `migrate` command currently supports migrating from v0.34 to v0.36 by implementing + necessary types for both versions. +* [\#4570](https://github.com/cosmos/cosmos-sdk/issues/4570) Move /bank/balances/{address} REST handler to x/bank/client/rest. The exposed interface is unchanged. +* Community pool spend proposal per Cosmos Hub governance proposal [\#7](https://github.com/cosmos/cosmos-sdk/issues/7) "Activate the Community Pool" + +### Improvements + +* (simulation) PrintAllInvariants flag will print all failed invariants +* (simulation) Add `InitialBlockHeight` flag to resume a simulation from a given block +* (simulation) [\#4670](https://github.com/cosmos/cosmos-sdk/issues/4670) Update simulation statistics to JSON format + + - Support exporting the simulation stats to a given JSON file +* [\#4775](https://github.com/cosmos/cosmos-sdk/issues/4775) Refactor CI config +* Upgrade IAVL to v0.12.4 +* (tendermint) Upgrade Tendermint to v0.32.2 +* (modules) [\#4751](https://github.com/cosmos/cosmos-sdk/issues/4751) update `x/genutils` to match module spec +* (keys) [\#4611](https://github.com/cosmos/cosmos-sdk/issues/4611) store keys in simapp now use a map instead of using individual literal keys +* [\#2286](https://github.com/cosmos/cosmos-sdk/issues/2286) Improve performance of CacheKVStore iterator. +* [\#3512](https://github.com/cosmos/cosmos-sdk/issues/3512) Implement Logger method on each module's keeper. +* [\#3655](https://github.com/cosmos/cosmos-sdk/issues/3655) Improve signature verification failure error message. +* [\#3774](https://github.com/cosmos/cosmos-sdk/issues/3774) add category tag to transactions for ease of filtering +* [\#3914](https://github.com/cosmos/cosmos-sdk/issues/3914) Implement invariant benchmarks and add target to makefile. +* [\#3928](https://github.com/cosmos/cosmos-sdk/issues/3928) remove staking references from types package +* [\#3978](https://github.com/cosmos/cosmos-sdk/issues/3978) Return ErrUnknownRequest in message handlers for unknown + or invalid routed messages. +* [\#4190](https://github.com/cosmos/cosmos-sdk/issues/4190) Client responses that return (re)delegation(s) now return balances + instead of shares. +* [\#4194](https://github.com/cosmos/cosmos-sdk/issues/4194) ValidatorSigningInfo now includes the validator's consensus address. +* [\#4235](https://github.com/cosmos/cosmos-sdk/issues/4235) Add parameter change proposal messages to simulation. +* [\#4235](https://github.com/cosmos/cosmos-sdk/issues/4235) Update the minting module params to implement params.ParamSet so + individual keys can be set via proposals instead of passing a struct. +* [\#4259](https://github.com/cosmos/cosmos-sdk/issues/4259) `Coins` that are `nil` are now JSON encoded as an empty array `[]`. + Decoding remains unchanged and behavior is left intact. +* [\#4305](https://github.com/cosmos/cosmos-sdk/issues/4305) The `--generate-only` CLI flag fully respects offline tx processing. +* [\#4379](https://github.com/cosmos/cosmos-sdk/issues/4379) close db write batch. +* [\#4384](https://github.com/cosmos/cosmos-sdk/issues/4384)- Allow splitting withdrawal transaction in several chunks +* [\#4403](https://github.com/cosmos/cosmos-sdk/issues/4403) Allow for parameter change proposals to supply only desired fields to be updated + in objects instead of the entire object (only applies to values that are objects). +* [\#4415](https://github.com/cosmos/cosmos-sdk/issues/4415) /client refactor, reduce genutil dependancy on staking +* [\#4439](https://github.com/cosmos/cosmos-sdk/issues/4439) Implement governance module iterators. +* [\#4465](https://github.com/cosmos/cosmos-sdk/issues/4465) Unknown subcommands print relevant error message +* [\#4466](https://github.com/cosmos/cosmos-sdk/issues/4466) Commission validation added to validate basic of MsgCreateValidator by changing CommissionMsg to CommissionRates +* [\#4501](https://github.com/cosmos/cosmos-sdk/issues/4501) Support height queriers in rest client +* [\#4535](https://github.com/cosmos/cosmos-sdk/issues/4535) Improve import-export simulation errors by decoding the `KVPair.Value` into its + respective type +* [\#4536](https://github.com/cosmos/cosmos-sdk/issues/4536) cli context queries return query height and accounts are returned with query height +* [\#4553](https://github.com/cosmos/cosmos-sdk/issues/4553) undelegate max entries check first +* [\#4556](https://github.com/cosmos/cosmos-sdk/issues/4556) Added IsValid function to Coin +* [\#4564](https://github.com/cosmos/cosmos-sdk/issues/4564) client/input.GetConfirmation()'s default is changed to No. +* [\#4573](https://github.com/cosmos/cosmos-sdk/issues/4573) Returns height in response for query endpoints. +* [\#4580](https://github.com/cosmos/cosmos-sdk/issues/4580) Update `Context#BlockHeight` to properly set the block height via `WithBlockHeader`. +* [\#4584](https://github.com/cosmos/cosmos-sdk/issues/4584) Update bank Keeper to use expected keeper interface of the AccountKeeper. +* [\#4584](https://github.com/cosmos/cosmos-sdk/issues/4584) Move `Account` and `VestingAccount` interface types to `x/auth/exported`. +* [\#4082](https://github.com/cosmos/cosmos-sdk/issues/4082) supply module queriers for CLI and REST endpoints +* [\#4601](https://github.com/cosmos/cosmos-sdk/issues/4601) Implement generic pangination helper function to be used in + REST handlers and queriers. +* [\#4629](https://github.com/cosmos/cosmos-sdk/issues/4629) Added warning event that gets emitted if validator misses a block. +* [\#4674](https://github.com/cosmos/cosmos-sdk/issues/4674) Export `Simapp` genState generators and util functions by making them public +* [\#4706](https://github.com/cosmos/cosmos-sdk/issues/4706) Simplify context + Replace complex Context construct with a simpler immutible struct. + Only breaking change is not to support `Value` and `GetValue` as first class calls. + We do embed ctx.Context() as a raw context.Context instead to be used as you see fit. + + Migration guide: + + ```go + ctx = ctx.WithValue(contextKeyBadProposal, false) + ``` + * (x/group) [#13869](https://github.com/cosmos/cosmos-sdk/pull/13869) Group members weight must be positive and a finite number. * (x/bank) [#13821](https://github.com/cosmos/cosmos-sdk/pull/13821) Fix bank store migration of coin metadata. * (x/group) [#13808](https://github.com/cosmos/cosmos-sdk/pull/13808) Fix propagation of message events to the current context in `EndBlocker`. @@ -1764,7 +2345,52 @@ EOL notice. This is the last release of the `v0.46.x` line. Per this version, th * (x/auth) [#13612](https://github.com/cosmos/cosmos-sdk/pull/13612) Add `Query/ModuleAccountByName` endpoint for accessing the module account info by module name. -### Improvements +* [\#4891](https://github.com/cosmos/cosmos-sdk/issues/4891) Disable querying with proofs enabled when the query height <= 1. +* (rest) [\#4858](https://github.com/cosmos/cosmos-sdk/issues/4858) Do not return an error in BroadcastTxCommit when the tx broadcasting + was successful. This allows the proper REST response to be returned for a + failed tx during `block` broadcasting mode. +* (store) [\#4880](https://github.com/cosmos/cosmos-sdk/pull/4880) Fix error check in + IAVL `Store#DeleteVersion`. +* (tendermint) [\#4879](https://github.com/cosmos/cosmos-sdk/issues/4879) Don't terminate the process immediately after startup when run in standalone mode. +* (simulation) [\#4861](https://github.com/cosmos/cosmos-sdk/pull/4861) Fix non-determinism simulation + by using CLI flags as input and updating Makefile target. +* [\#4868](https://github.com/cosmos/cosmos-sdk/issues/4868) Context#CacheContext now sets a new EventManager. This prevents unwanted events + from being emitted. +* (cli) [\#4870](https://github.com/cosmos/cosmos-sdk/issues/4870) Disable the `withdraw-all-rewards` command when `--generate-only` is supplied +* (modules) [\#4831](https://github.com/cosmos/cosmos-sdk/issues/4831) Prevent community spend proposal from transferring funds to a module account +* (keys) [\#4338](https://github.com/cosmos/cosmos-sdk/issues/4338) fix multisig key output for CLI +* (modules) [\#4795](https://github.com/cosmos/cosmos-sdk/issues/4795) restrict module accounts from receiving transactions. + Allowing this would cause an invariant on the module account coins. +* (modules) [\#4823](https://github.com/cosmos/cosmos-sdk/issues/4823) Update the `DefaultUnbondingTime` from 3 days to 3 weeks to be inline with documentation. +* (abci) [\#4639](https://github.com/cosmos/cosmos-sdk/issues/4639) Fix `CheckTx` by verifying the message route +* Return height in responses when querying against BaseApp +* [\#1351](https://github.com/cosmos/cosmos-sdk/issues/1351) Stable AppHash allows no_empty_blocks +* [\#3705](https://github.com/cosmos/cosmos-sdk/issues/3705) Return `[]` instead of `null` when querying delegator rewards. +* [\#3966](https://github.com/cosmos/cosmos-sdk/issues/3966) fixed multiple assigns to action tags + [\#3793](https://github.com/cosmos/cosmos-sdk/issues/3793) add delegator tag for MsgCreateValidator and deleted unused moniker and identity tags +* [\#4194](https://github.com/cosmos/cosmos-sdk/issues/4194) Fix pagination and results returned from /slashing/signing_infos +* [\#4230](https://github.com/cosmos/cosmos-sdk/issues/4230) Properly set and display the message index through the TxResponse. +* [\#4234](https://github.com/cosmos/cosmos-sdk/pull/4234) Allow `tx send --generate-only` to + actually work offline. +* [\#4271](https://github.com/cosmos/cosmos-sdk/issues/4271) Fix addGenesisAccount by using Coins#IsAnyGT for vesting amount validation. +* [\#4273](https://github.com/cosmos/cosmos-sdk/issues/4273) Fix usage of AppendTags in x/staking/handler.go +* [\#4303](https://github.com/cosmos/cosmos-sdk/issues/4303) Fix NewCoins() underlying function for duplicate coins detection. +* [\#4307](https://github.com/cosmos/cosmos-sdk/pull/4307) Don't pass height to RPC calls as + Tendermint will automatically use the latest height. +* [\#4362](https://github.com/cosmos/cosmos-sdk/issues/4362) simulation setup bugfix for multisim 7601778 +* [\#4383](https://github.com/cosmos/cosmos-sdk/issues/4383) - currentStakeRoundUp is now always atleast currentStake + smallest-decimal-precision +* [\#4394](https://github.com/cosmos/cosmos-sdk/issues/4394) Fix signature count check to use the TxSigLimit param instead of + a default. +* [\#4455](https://github.com/cosmos/cosmos-sdk/issues/4455) Use `QueryWithData()` to query unbonding delegations. +* [\#4493](https://github.com/cosmos/cosmos-sdk/issues/4493) Fix validator-outstanding-rewards command. It now takes as an argument + a validator address. +* [\#4598](https://github.com/cosmos/cosmos-sdk/issues/4598) Fix redelegation and undelegation txs that were not checking for the correct bond denomination. +* [\#4619](https://github.com/cosmos/cosmos-sdk/issues/4619) Close iterators in `GetAllMatureValidatorQueue` and `UnbondAllMatureValidatorQueue` + methods. +* [\#4654](https://github.com/cosmos/cosmos-sdk/issues/4654) validator slash event stored by period and height +* [\#4681](https://github.com/cosmos/cosmos-sdk/issues/4681) panic on invalid amount on `MintCoins` and `BurnCoins` + * skip minting if inflation is set to zero +* Sort state JSON during export and initialization * (deps) Bump IAVL version to [v0.19.4](https://github.com/cosmos/iavl/releases/tag/v0.19.4). @@ -2286,7 +2912,19 @@ replace github.com/confio/ics23/go => github.com/cosmos/cosmos-sdk/ics23/go v0.8 * For applying the patch please refer to the [RELEASE PROCESS](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.45.9) * (store) [#13459](https://github.com/cosmos/cosmos-sdk/pull/13459) Don't let state listener observe the uncommitted writes. -### Notes +* [\#3808](https://github.com/cosmos/cosmos-sdk/issues/3808) `gaiad` and `gaiacli` integration tests use ./build/ binaries. +* \[\#3819](https://github.com/cosmos/cosmos-sdk/issues/3819) Simulation refactor, log output now stored in ~/.gaiad/simulation/ + * Simulation moved to its own module (not a part of mock) + * Logger type instead of passing function variables everywhere + * Logger json output (for reloadable simulation running) + * Cleanup bank simulation messages / remove dup code in bank simulation + * Simulations saved in `~/.gaiad/simulations/` + * "Lean" simulation output option to exclude No-ops and !ok functions (`--SimulationLean` flag) +* [\#3893](https://github.com/cosmos/cosmos-sdk/issues/3893) Improve `gaiacli tx sign` command + * Add shorthand flags -a and -s for the account and sequence numbers respectively + * Mark the account and sequence numbers required during "offline" mode + * Always do an RPC query for account and sequence number during "online" mode +* [\#4018](https://github.com/cosmos/cosmos-sdk/issues/4018) create genesis port script for release v.0.34.0 Reverted #12437 due to API breaking changes. @@ -2294,10 +2932,23 @@ Reverted #12437 due to API breaking changes. ### Improvements -* [#12981](https://github.com/cosmos/cosmos-sdk/pull/12981) Return proper error when parsing telemetry configuration. -* [#12885](https://github.com/cosmos/cosmos-sdk/pull/12885) Amortize cost of processing cache KV store. -* [#12970](https://github.com/cosmos/cosmos-sdk/pull/12970) Bump Tendermint to `v0.34.21` and IAVL to `v0.19.1`. -* [#12693](https://github.com/cosmos/cosmos-sdk/pull/12693) Make sure the order of each node is consistent when emitting proto events. +* [\#3238](https://github.com/cosmos/cosmos-sdk/issues/3238) Add block time to tx responses when querying for + txs by tags or hash. +* \[\#3752](https://github.com/cosmos/cosmos-sdk/issues/3752) Explanatory docs for minting mechanism (`docs/spec/mint/01_concepts.md`) +* [\#3801](https://github.com/cosmos/cosmos-sdk/issues/3801) `baseapp` safety improvements +* [\#3820](https://github.com/cosmos/cosmos-sdk/issues/3820) Make Coins.IsAllGT() more robust and consistent. +* [\#3828](https://github.com/cosmos/cosmos-sdk/issues/3828) New sdkch tool to maintain changelogs +* [\#3864](https://github.com/cosmos/cosmos-sdk/issues/3864) Make Coins.IsAllGTE() more consistent. +* [\#3907](https://github.com/cosmos/cosmos-sdk/issues/3907): dep -> go mod migration + * Drop dep in favor of go modules. + * Upgrade to Go 1.12.1. +* [\#3917](https://github.com/cosmos/cosmos-sdk/issues/3917) Allow arbitrary decreases to validator commission rates. +* [\#3937](https://github.com/cosmos/cosmos-sdk/issues/3937) Implement community pool querier. +* [\#3940](https://github.com/cosmos/cosmos-sdk/issues/3940) Codespace should be lowercase. +* [\#3986](https://github.com/cosmos/cosmos-sdk/issues/3986) Update the Stringer implementation of the Proposal type. +* [\#926](https://github.com/cosmos/cosmos-sdk/issues/926) circuit breaker high level explanation +* [\#3896](https://github.com/cosmos/cosmos-sdk/issues/3896) Fixed various linters warnings in the context of the gometalinter -> golangci-lint migration +* [\#3916](https://github.com/cosmos/cosmos-sdk/issues/3916) Hex encode data in tx responses ### Bug Fixes @@ -2330,67 +2981,595 @@ empty coins slice before it is used to create `banktype.MsgSend`. ### Improvements -* (simapp) [#12314](https://github.com/cosmos/cosmos-sdk/pull/12314) Increase `DefaultGenTxGas` from `1000000` to `10000000` -* [#12371](https://github.com/cosmos/cosmos-sdk/pull/12371) Update min required Golang version to 1.18. +#### Tendermint -### Bug Fixes +* Upgrade Tendermint to `v0.31.0-dev0-fix0` which includes critical security fixes. -* [#12317](https://github.com/cosmos/cosmos-sdk/pull/12317) Rename `edit-validator` command's `--moniker` flag to `--new-moniker` -* (x/upgrade) [#12264](https://github.com/cosmos/cosmos-sdk/pull/12264) Fix `GetLastCompleteUpgrade` to properly return the latest upgrade. -* (x/crisis) [#12208](https://github.com/cosmos/cosmos-sdk/pull/12208) Fix progress index of crisis invariant assertion logs. - -### Features +## 0.33.1 -* (query) [#12253](https://github.com/cosmos/cosmos-sdk/pull/12253) Add `GenericFilteredPaginate` to the `query` package to improve UX. +### Bug Fixes -## [v0.45.5](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.45.5) - 2022-06-09 +#### Gaia + +* [\#3999](https://github.com/cosmos/cosmos-sdk/pull/3999) Fix distribution delegation for zero height export bug + +## 0.33.0 + +BREAKING CHANGES + +* Gaia REST API + * [\#3641](https://github.com/cosmos/cosmos-sdk/pull/3641) Remove the ability to use a Keybase from the REST API client: + * `password` and `generate_only` have been removed from the `base_req` object + * All txs that used to sign or use the Keybase now only generate the tx + * `keys` routes completely removed + * [\#3692](https://github.com/cosmos/cosmos-sdk/pull/3692) Update tx encoding and broadcasting endpoints: + * Remove duplicate broadcasting endpoints in favor of POST @ `/txs` + * The `Tx` field now accepts a `StdTx` and not raw tx bytes + * Move encoding endpoint to `/txs/encode` + +* Gaia + * [\#3787](https://github.com/cosmos/cosmos-sdk/pull/3787) Fork the `x/bank` module into the Gaia application with only a + modified message handler, where the modified message handler behaves the same as + the standard `x/bank` message handler except for `MsgMultiSend` that must burn + exactly 9 atoms and transfer 1 atom, and `MsgSend` is disabled. + * [\#3789](https://github.com/cosmos/cosmos-sdk/pull/3789) Update validator creation flow: + * Remove `NewMsgCreateValidatorOnBehalfOf` and corresponding business logic + * Ensure the validator address equals the delegator address during + `MsgCreateValidator#ValidateBasic` + +* SDK + * [\#3750](https://github.com/cosmos/cosmos-sdk/issues/3750) Track outstanding rewards per-validator instead of globally, + and fix the main simulation issue, which was that slashes of + re-delegations to a validator were not correctly accounted for + in fee distribution when the redelegation in question had itself + been slashed (from a fault committed by a different validator) + in the same BeginBlock. Outstanding rewards are now available + on a per-validator basis in REST. + * [\#3669](https://github.com/cosmos/cosmos-sdk/pull/3669) Ensure consistency in message naming, codec registration, and JSON + tags. + * [\#3788](https://github.com/cosmos/cosmos-sdk/pull/3788) Change order of operations for greater accuracy when calculating delegation share token value + * [\#3788](https://github.com/cosmos/cosmos-sdk/pull/3788) DecCoins.Cap -> DecCoins.Intersect + * [\#3666](https://github.com/cosmos/cosmos-sdk/pull/3666) Improve coins denom validation. + * [\#3751](https://github.com/cosmos/cosmos-sdk/pull/3751) Disable (temporarily) support for ED25519 account key pairs. + +* Tendermint + * [\#3804] Update to Tendermint `v0.31.0-dev0` + +FEATURES + +* SDK + * [\#3719](https://github.com/cosmos/cosmos-sdk/issues/3719) DBBackend can now be set at compile time. + Defaults: goleveldb. Supported: cleveldb. + +IMPROVEMENTS + +* Gaia REST API + * Update the `TxResponse` type allowing for the `Logs` result to be JSON decoded automatically. + +* Gaia CLI + * [\#3653](https://github.com/cosmos/cosmos-sdk/pull/3653) Prompt user confirmation prior to signing and broadcasting a transaction. + * [\#3670](https://github.com/cosmos/cosmos-sdk/pull/3670) CLI support for showing bech32 addresses in Ledger devices + * [\#3711](https://github.com/cosmos/cosmos-sdk/pull/3711) Update `tx sign` to use `--from` instead of the deprecated `--name` + CLI flag. + * [\#3738](https://github.com/cosmos/cosmos-sdk/pull/3738) Improve multisig UX: + * `gaiacli keys show -o json` now includes constituent pubkeys, respective weights and threshold + * `gaiacli keys show --show-multisig` now displays constituent pubkeys, respective weights and threshold + * `gaiacli tx sign --validate-signatures` now displays multisig signers with their respective weights + * [\#3730](https://github.com/cosmos/cosmos-sdk/issues/3730) Improve workflow for + `gaiad gentx` with offline public keys, by outputting stdtx file that needs to be signed. + * [\#3761](https://github.com/cosmos/cosmos-sdk/issues/3761) Querying account related information using custom querier in auth module + +* SDK + * [\#3753](https://github.com/cosmos/cosmos-sdk/issues/3753) Remove no-longer-used governance penalty parameter + * [\#3679](https://github.com/cosmos/cosmos-sdk/issues/3679) Consistent operators across Coins, DecCoins, Int, Dec + replaced: Minus->Sub Plus->Add Div->Quo + * [\#3665](https://github.com/cosmos/cosmos-sdk/pull/3665) Overhaul sdk.Uint type in preparation for Coins Int -> Uint migration. + * [\#3691](https://github.com/cosmos/cosmos-sdk/issues/3691) Cleanup error messages + * [\#3456](https://github.com/cosmos/cosmos-sdk/issues/3456) Integrate in the Int.ToDec() convenience function + * [\#3300](https://github.com/cosmos/cosmos-sdk/pull/3300) Update the spec-spec, spec file reorg, and TOC updates. + * [\#3694](https://github.com/cosmos/cosmos-sdk/pull/3694) Push tagged docker images on docker hub when tag is created. + * [\#3716](https://github.com/cosmos/cosmos-sdk/pull/3716) Update file permissions the client keys directory and contents to `0700`. + * [\#3681](https://github.com/cosmos/cosmos-sdk/issues/3681) Migrate ledger-cosmos-go from ZondaX to Cosmos organization + +* Tendermint + * [\#3699](https://github.com/cosmos/cosmos-sdk/pull/3699) Upgrade to Tendermint 0.30.1 + +BUG FIXES + +* Gaia CLI + * [\#3731](https://github.com/cosmos/cosmos-sdk/pull/3731) `keys add --interactive` bip32 passphrase regression fix + * [\#3714](https://github.com/cosmos/cosmos-sdk/issues/3714) Fix USB raw access issues with gaiacli when installed via snap + +* Gaia + * [\#3777](https://github.com/cosmso/cosmos-sdk/pull/3777) `gaiad export` no longer panics when the database is empty + * [\#3806](https://github.com/cosmos/cosmos-sdk/pull/3806) Properly return errors from a couple of struct Unmarshal functions + +* SDK + * [\#3728](https://github.com/cosmos/cosmos-sdk/issues/3728) Truncate decimal multiplication & division in distribution to ensure + no more than the collected fees / inflation are distributed + * [\#3727](https://github.com/cosmos/cosmos-sdk/issues/3727) Return on zero-length (including []byte{}) PrefixEndBytes() calls + * [\#3559](https://github.com/cosmos/cosmos-sdk/issues/3559) fix occasional failing due to non-determinism in lcd test TestBonding + where validator is unexpectedly slashed throwing off test calculations + * [\#3411](https://github.com/cosmos/cosmos-sdk/pull/3411) Include the `RequestInitChain.Time` in the block header init during + `InitChain`. + * [\#3717](https://github.com/cosmos/cosmos-sdk/pull/3717) Update the vesting specification and implementation to cap deduction from + `DelegatedVesting` by at most `DelegatedVesting`. This accounts for the case where + the undelegation amount may exceed the original delegation amount due to + truncation of undelegation tokens. + * [\#3717](https://github.com/cosmos/cosmos-sdk/pull/3717) Ignore unknown proposers in allocating rewards for proposers, in case + unbonding period was just 1 block and proposer was already deleted. + * [\#3726](https://github.com/cosmos/cosmos-sdk/pull/3724) Cap(clip) reward to remaining coins in AllocateTokens. + +## 0.32.0 + +BREAKING CHANGES + +* Gaia REST API + * [\#3642](https://github.com/cosmos/cosmos-sdk/pull/3642) `GET /tx/{hash}` now returns `404` instead of `500` if the transaction is not found + +* SDK +* [\#3580](https://github.com/cosmos/cosmos-sdk/issues/3580) Migrate HTTP request/response types and utilities to types/rest. +* [\#3592](https://github.com/cosmos/cosmos-sdk/issues/3592) Drop deprecated keybase implementation's New() constructor in + favor of a new crypto/keys.New(string, string) implementation that + returns a lazy keybase instance. Remove client.MockKeyBase, + superseded by crypto/keys.NewInMemory() +* [\#3621](https://github.com/cosmos/cosmos-sdk/issues/3621) staking.GenesisState.Bonds -> Delegations + +IMPROVEMENTS + +* SDK + * [\#3311](https://github.com/cosmos/cosmos-sdk/pull/3311) Reconcile the `DecCoin/s` API with the `Coin/s` API. + * [\#3614](https://github.com/cosmos/cosmos-sdk/pull/3614) Add coin denom length checks to the coins constructors. + * [\#3621](https://github.com/cosmos/cosmos-sdk/issues/3621) remove many inter-module dependancies + * [\#3601](https://github.com/cosmos/cosmos-sdk/pull/3601) JSON-stringify the ABCI log response which includes the log and message + index. + * [\#3604](https://github.com/cosmos/cosmos-sdk/pull/3604) Improve SDK funds related error messages and allow for unicode in + JSON ABCI log. + * [\#3620](https://github.com/cosmos/cosmos-sdk/pull/3620) Version command shows build tags + * [\#3638](https://github.com/cosmos/cosmos-sdk/pull/3638) Add Bcrypt benchmarks & justification of security parameter choice + * [\#3648](https://github.com/cosmos/cosmos-sdk/pull/3648) Add JSON struct tags to vesting accounts. + +* Tendermint + * [\#3618](https://github.com/cosmos/cosmos-sdk/pull/3618) Upgrade to Tendermint 0.30.03 + +BUG FIXES + +* SDK + * [\#3646](https://github.com/cosmos/cosmos-sdk/issues/3646) `x/mint` now uses total token supply instead of total bonded tokens to calculate inflation + +## 0.31.2 + +BREAKING CHANGES + +* SDK +* [\#3592](https://github.com/cosmos/cosmos-sdk/issues/3592) Drop deprecated keybase implementation's + New constructor in favor of a new + crypto/keys.New(string, string) implementation that + returns a lazy keybase instance. Remove client.MockKeyBase, + superseded by crypto/keys.NewInMemory() + +IMPROVEMENTS + +* SDK + * [\#3604](https://github.com/cosmos/cosmos-sdk/pulls/3604) Improve SDK funds related error messages and allow for unicode in + JSON ABCI log. + +* Tendermint + * [\#3563](https://github.com/cosmos/cosmos-sdk/3563) Update to Tendermint version `0.30.0-rc0` + +BUG FIXES + +* Gaia + * [\#3585] Fix setting the tx hash in `NewResponseFormatBroadcastTxCommit`. + * [\#3585] Return an empty `TxResponse` when Tendermint returns an empty + `ResultBroadcastTx`. + +* SDK + * [\#3582](https://github.com/cosmos/cosmos-sdk/pull/3582) Running `make test_unit` was failing due to a missing tag + * [\#3617](https://github.com/cosmos/cosmos-sdk/pull/3582) Fix fee comparison when the required fees does not contain any denom + present in the tx fees. + +## 0.31.0 + +BREAKING CHANGES + +* Gaia REST API (`gaiacli advanced rest-server`) + * [\#3284](https://github.com/cosmos/cosmos-sdk/issues/3284) Rename the `name` + field to `from` in the `base_req` body. + * [\#3485](https://github.com/cosmos/cosmos-sdk/pull/3485) Error responses are now JSON objects. + * [\#3477][distribution] endpoint changed "all_delegation_rewards" -> "delegator_total_rewards" + +* Gaia CLI (`gaiacli`) + - [#3399](https://github.com/cosmos/cosmos-sdk/pull/3399) Add `gaiad validate-genesis` command to facilitate checking of genesis files + - [\#1894](https://github.com/cosmos/cosmos-sdk/issues/1894) `version` prints out short info by default. Add `--long` flag. Proper handling of `--format` flag introduced. + - [\#3465](https://github.com/cosmos/cosmos-sdk/issues/3465) `gaiacli rest-server` switched back to insecure mode by default: + - `--insecure` flag is removed. + - `--tls` is now used to enable secure layer. + - [\#3451](https://github.com/cosmos/cosmos-sdk/pull/3451) `gaiacli` now returns transactions in plain text including tags. + - [\#3497](https://github.com/cosmos/cosmos-sdk/issues/3497) `gaiad init` now takes moniker as required arguments, not as parameter. + * [\#3501](https://github.com/cosmos/cosmos-sdk/issues/3501) Change validator + address Bech32 encoding to consensus address in `tendermint-validator-set`. + +* Gaia + * [\#3457](https://github.com/cosmos/cosmos-sdk/issues/3457) Changed governance tally validatorGovInfo to use sdk.Int power instead of sdk.Dec + * [\#3495](https://github.com/cosmos/cosmos-sdk/issues/3495) Added Validator Minimum Self Delegation + * Reintroduce OR semantics for tx fees + +* SDK + * [\#2513](https://github.com/cosmos/cosmos-sdk/issues/2513) Tendermint updates are adjusted by 10^-6 relative to staking tokens, + * [\#3487](https://github.com/cosmos/cosmos-sdk/pull/3487) Move HTTP/REST utilities out of client/utils into a new dedicated client/rest package. + * [\#3490](https://github.com/cosmos/cosmos-sdk/issues/3490) ReadRESTReq() returns bool to avoid callers to write error responses twice. + * [\#3502](https://github.com/cosmos/cosmos-sdk/pull/3502) Fixes issue when comparing genesis states + * [\#3514](https://github.com/cosmos/cosmos-sdk/pull/3514) Various clean ups: + - Replace all GetKeyBase\* functions family in favor of NewKeyBaseFromDir and NewKeyBaseFromHomeFlag. + - Remove Get prefix from all TxBuilder's getters. + * [\#3522](https://github.com/cosmos/cosmos-sdk/pull/3522) Get rid of double negatives: Coins.IsNotNegative() -> Coins.IsAnyNegative(). + * [\#3561](https://github.com/cosmos/cosmos-sdk/issues/3561) Don't unnecessarily store denominations in staking + +FEATURES + +* Gaia REST API + +* [\#2358](https://github.com/cosmos/cosmos-sdk/issues/2358) Add distribution module REST interface + +* Gaia CLI (`gaiacli`) + * [\#3429](https://github.com/cosmos/cosmos-sdk/issues/3429) Support querying + for all delegator distribution rewards. + * [\#3449](https://github.com/cosmos/cosmos-sdk/issues/3449) Proof verification now works with absence proofs + * [\#3484](https://github.com/cosmos/cosmos-sdk/issues/3484) Add support + vesting accounts to the add-genesis-account command. + +* Gaia + - [\#3397](https://github.com/cosmos/cosmos-sdk/pull/3397) Implement genesis file sanitization to avoid failures at chain init. + * [\#3428](https://github.com/cosmos/cosmos-sdk/issues/3428) Run the simulation from a particular genesis state loaded from a file + +* SDK + * [\#3270](https://github.com/cosmos/cosmos-sdk/issues/3270) [x/staking] limit number of ongoing unbonding delegations /redelegations per pair/trio + * [\#3477][distribution] new query endpoint "delegator_validators" + * [\#3514](https://github.com/cosmos/cosmos-sdk/pull/3514) Provided a lazy loading implementation of Keybase that locks the underlying + storage only for the time needed to perform the required operation. Also added Keybase reference to TxBuilder struct. + * [types] [\#2580](https://github.com/cosmos/cosmos-sdk/issues/2580) Addresses now Bech32 empty addresses to an empty string + +IMPROVEMENTS + +* Gaia REST API + * [\#3284](https://github.com/cosmos/cosmos-sdk/issues/3284) Update Gaia Lite + REST service to support the following: + * Automatic account number and sequence population when fields are omitted + * Generate only functionality no longer requires access to a local Keybase + * `from` field in the `base_req` body can be a Keybase name or account address + * [\#3423](https://github.com/cosmos/cosmos-sdk/issues/3423) Allow simulation + (auto gas) to work with generate only. + * [\#3514](https://github.com/cosmos/cosmos-sdk/pull/3514) REST server calls to keybase does not lock the underlying storage anymore. + * [\#3523](https://github.com/cosmos/cosmos-sdk/pull/3523) Added `/tx/encode` endpoint to serialize a JSON tx to base64-encoded Amino. + +* Gaia CLI (`gaiacli`) + * [\#3476](https://github.com/cosmos/cosmos-sdk/issues/3476) New `withdraw-all-rewards` command to withdraw all delegations rewards for delegators. + * [\#3497](https://github.com/cosmos/cosmos-sdk/issues/3497) `gaiad gentx` supports `--ip` and `--node-id` flags to override defaults. + * [\#3518](https://github.com/cosmos/cosmos-sdk/issues/3518) Fix flow in + `keys add` to show the mnemonic by default. + * [\#3517](https://github.com/cosmos/cosmos-sdk/pull/3517) Increased test coverage + * [\#3523](https://github.com/cosmos/cosmos-sdk/pull/3523) Added `tx encode` command to serialize a JSON tx to base64-encoded Amino. + +* Gaia + * [\#3418](https://github.com/cosmos/cosmos-sdk/issues/3418) Add vesting account + genesis validation checks to `GaiaValidateGenesisState`. + * [\#3420](https://github.com/cosmos/cosmos-sdk/issues/3420) Added maximum length to governance proposal descriptions and titles + * [\#3256](https://github.com/cosmos/cosmos-sdk/issues/3256) Add gas consumption + for tx size in the ante handler. + * [\#3454](https://github.com/cosmos/cosmos-sdk/pull/3454) Add `--jail-whitelist` to `gaiad export` to enable testing of complex exports + * [\#3424](https://github.com/cosmos/cosmos-sdk/issues/3424) Allow generation of gentxs with empty memo field. + * [\#3507](https://github.com/cosmos/cosmos-sdk/issues/3507) General cleanup, removal of unnecessary struct fields, undelegation bugfix, and comment clarification in x/staking and x/slashing + +* SDK + * [\#2605] x/params add subkey accessing + * [\#2986](https://github.com/cosmos/cosmos-sdk/pull/2986) Store Refactor + * [\#3435](https://github.com/cosmos/cosmos-sdk/issues/3435) Test that store implementations do not allow nil values + * [\#2509](https://github.com/cosmos/cosmos-sdk/issues/2509) Sanitize all usage of Dec.RoundInt64() + * [\#556](https://github.com/cosmos/cosmos-sdk/issues/556) Increase `BaseApp` + test coverage. + * [\#3357](https://github.com/cosmos/cosmos-sdk/issues/3357) develop state-transitions.md for staking spec, missing states added to `state.md` + * [\#3552](https://github.com/cosmos/cosmos-sdk/pull/3552) Validate bit length when + deserializing `Int` types. + +BUG FIXES + +* Gaia CLI (`gaiacli`) + - [\#3417](https://github.com/cosmos/cosmos-sdk/pull/3417) Fix `q slashing signing-info` panic by ensuring safety of user input and properly returning not found error + - [\#3345](https://github.com/cosmos/cosmos-sdk/issues/3345) Upgrade ledger-cosmos-go dependency to v0.9.3 to pull + https://github.com/ZondaX/ledger-cosmos-go/commit/ed9aa39ce8df31bad1448c72d3d226bf2cb1a8d1 in order to fix a derivation path issue that causes `gaiacli keys add --recover` + to malfunction. + - [\#3419](https://github.com/cosmos/cosmos-sdk/pull/3419) Fix `q distr slashes` panic + - [\#3453](https://github.com/cosmos/cosmos-sdk/pull/3453) The `rest-server` command didn't respect persistent flags such as `--chain-id` and `--trust-node` if they were + passed on the command line. + - [\#3441](https://github.com/cosmos/cosmos-sdk/pull/3431) Improved resource management and connection handling (ledger devices). Fixes issue with DER vs BER signatures. + +* Gaia + * [\#3486](https://github.com/cosmos/cosmos-sdk/pull/3486) Use AmountOf in + vesting accounts instead of zipping/aligning denominations. + +## 0.30.0 + +BREAKING CHANGES + +* Gaia REST API (`gaiacli advanced rest-server`) + * [gaia-lite] [\#2182] Renamed and merged all redelegations endpoints into `/staking/redelegations` + * [\#3176](https://github.com/cosmos/cosmos-sdk/issues/3176) `tx/sign` endpoint now expects `BaseReq` fields as nested object. + * [\#2222] all endpoints renamed from `/stake` -> `/staking` + * [\#1268] `LooseTokens` -> `NotBondedTokens` + * [\#3289] misc renames: + * `Validator.UnbondingMinTime` -> `Validator.UnbondingCompletionTime` + * `Delegation` -> `Value` in `MsgCreateValidator` and `MsgDelegate` + * `MsgBeginUnbonding` -> `MsgUndelegate` + +* Gaia CLI (`gaiacli`) + * [\#810](https://github.com/cosmos/cosmos-sdk/issues/810) Don't fallback to any default values for chain ID. + * Users need to supply chain ID either via config file or the `--chain-id` flag. + * Change `chain_id` and `trust_node` in `gaiacli` configuration to `chain-id` and `trust-node` respectively. + * [\#3069](https://github.com/cosmos/cosmos-sdk/pull/3069) `--fee` flag renamed to `--fees` to support multiple coins + * [\#3156](https://github.com/cosmos/cosmos-sdk/pull/3156) Remove unimplemented `gaiacli init` command + * [\#2222] `gaiacli tx stake` -> `gaiacli tx staking`, `gaiacli query stake` -> `gaiacli query staking` + * [\#1894](https://github.com/cosmos/cosmos-sdk/issues/1894) `version` command now shows latest commit, vendor dir hash, and build machine info. + * [\#3320](https://github.com/cosmos/cosmos-sdk/pull/3320) Ensure all `gaiacli query` commands respect the `--output` and `--indent` flags + +* Gaia + * https://github.com/cosmos/cosmos-sdk/issues/2838 - Move store keys to constants + * [\#3162](https://github.com/cosmos/cosmos-sdk/issues/3162) The `--gas` flag now takes `auto` instead of `simulate` + in order to trigger a simulation of the tx before the actual execution. + * [\#3285](https://github.com/cosmos/cosmos-sdk/pull/3285) New `gaiad tendermint version` to print libs versions + * [\#1894](https://github.com/cosmos/cosmos-sdk/pull/1894) `version` command now shows latest commit, vendor dir hash, and build machine info. + * [\#3249\(https://github.com/cosmos/cosmos-sdk/issues/3249) `tendermint`'s `show-validator` and `show-address` `--json` flags removed in favor of `--output-format=json`. + +* SDK + * [distribution] [\#3359](https://github.com/cosmos/cosmos-sdk/issues/3359) Always round down when calculating rewards-to-be-withdrawn in F1 fee distribution + * [#3336](https://github.com/cosmos/cosmos-sdk/issues/3336) Ensure all SDK + messages have their signature bytes contain canonical fields `value` and `type`. + * [\#3333](https://github.com/cosmos/cosmos-sdk/issues/3333) - F1 storage efficiency improvements - automatic withdrawals when unbonded, historical reward reference counting + * [staking] [\#2513](https://github.com/cosmos/cosmos-sdk/issues/2513) Validator power type from Dec -> Int + * [staking] [\#3233](https://github.com/cosmos/cosmos-sdk/issues/3233) key and value now contain duplicate fields to simplify code + * [\#3064](https://github.com/cosmos/cosmos-sdk/issues/3064) Sanitize `sdk.Coin` denom. Coins denoms are now case insensitive, i.e. 100fooToken equals to 100FOOTOKEN. + * [\#3195](https://github.com/cosmos/cosmos-sdk/issues/3195) Allows custom configuration for syncable strategy + * [\#3242](https://github.com/cosmos/cosmos-sdk/issues/3242) Fix infinite gas + meter utilization during aborted ante handler executions. + * [x/distribution] [\#3292](https://github.com/cosmos/cosmos-sdk/issues/3292) Enable or disable withdraw addresses with a parameter in the param store + * [staking] [\#2222](https://github.com/cosmos/cosmos-sdk/issues/2222) `/stake` -> `/staking` module rename + * [staking] [\#1268](https://github.com/cosmos/cosmos-sdk/issues/1268) `LooseTokens` -> `NotBondedTokens` + * [staking] [\#1402](https://github.com/cosmos/cosmos-sdk/issues/1402) Redelegation and unbonding-delegation structs changed to include multiple an array of entries + * [staking] [\#3289](https://github.com/cosmos/cosmos-sdk/issues/3289) misc renames: + * `Validator.UnbondingMinTime` -> `Validator.UnbondingCompletionTime` + * `Delegation` -> `Value` in `MsgCreateValidator` and `MsgDelegate` + * `MsgBeginUnbonding` -> `MsgUndelegate` + * [\#3315] Increase decimal precision to 18 + * [\#3323](https://github.com/cosmos/cosmos-sdk/issues/3323) Update to Tendermint 0.29.0 + * [\#3328](https://github.com/cosmos/cosmos-sdk/issues/3328) [x/gov] Remove redundant action tag + +* Tendermint + * [\#3298](https://github.com/cosmos/cosmos-sdk/issues/3298) Upgrade to Tendermint 0.28.0 + +FEATURES + +* Gaia REST API (`gaiacli advanced rest-server`) + * [\#3067](https://github.com/cosmos/cosmos-sdk/issues/3067) Add support for fees on transactions + * [\#3069](https://github.com/cosmos/cosmos-sdk/pull/3069) Add a custom memo on transactions + * [\#3027](https://github.com/cosmos/cosmos-sdk/issues/3027) Implement + `/gov/proposals/{proposalID}/proposer` to query for a proposal's proposer. + +* Gaia CLI (`gaiacli`) + * [\#2399](https://github.com/cosmos/cosmos-sdk/issues/2399) Implement `params` command to query slashing parameters. + * [\#2730](https://github.com/cosmos/cosmos-sdk/issues/2730) Add tx search pagination parameter + * [\#3027](https://github.com/cosmos/cosmos-sdk/issues/3027) Implement + `query gov proposer [proposal-id]` to query for a proposal's proposer. + * [\#3198](https://github.com/cosmos/cosmos-sdk/issues/3198) New `keys add --multisig` flag to store multisig keys locally. + * [\#3198](https://github.com/cosmos/cosmos-sdk/issues/3198) New `multisign` command to generate multisig signatures. + * [\#3198](https://github.com/cosmos/cosmos-sdk/issues/3198) New `sign --multisig` flag to enable multisig mode. + * [\#2715](https://github.com/cosmos/cosmos-sdk/issues/2715) Reintroduce gaia server's insecure mode. + * [\#3334](https://github.com/cosmos/cosmos-sdk/pull/3334) New `gaiad completion` and `gaiacli completion` to generate Bash/Zsh completion scripts. + * [\#2607](https://github.com/cosmos/cosmos-sdk/issues/2607) Make `gaiacli config` handle the boolean `indent` flag to beautify commands JSON output. + +* Gaia + * [\#2182] [x/staking] Added querier for querying a single redelegation + * [\#3305](https://github.com/cosmos/cosmos-sdk/issues/3305) Add support for + vesting accounts at genesis. + * [\#3198](https://github.com/cosmos/cosmos-sdk/issues/3198) [x/auth] Add multisig transactions support + * [\#3198](https://github.com/cosmos/cosmos-sdk/issues/3198) `add-genesis-account` can take both account addresses and key names + +* SDK + - [\#3099](https://github.com/cosmos/cosmos-sdk/issues/3099) Implement F1 fee distribution + - [\#2926](https://github.com/cosmos/cosmos-sdk/issues/2926) Add TxEncoder to client TxBuilder. + * [\#2694](https://github.com/cosmos/cosmos-sdk/issues/2694) Vesting account implementation. + * [\#2996](https://github.com/cosmos/cosmos-sdk/issues/2996) Update the `AccountKeeper` to contain params used in the context of + the ante handler. + * [\#3179](https://github.com/cosmos/cosmos-sdk/pull/3179) New CodeNoSignatures error code. + * [\#3319](https://github.com/cosmos/cosmos-sdk/issues/3319) [x/distribution] Queriers for all distribution state worth querying; distribution query commands + * [\#3356](https://github.com/cosmos/cosmos-sdk/issues/3356) [x/auth] bech32-ify accounts address in error message. + +IMPROVEMENTS + +* Gaia REST API + * [\#3176](https://github.com/cosmos/cosmos-sdk/issues/3176) Validate tx/sign endpoint POST body. + * [\#2948](https://github.com/cosmos/cosmos-sdk/issues/2948) Swagger UI now makes requests to light client node + +* Gaia CLI (`gaiacli`) + * [\#3224](https://github.com/cosmos/cosmos-sdk/pull/3224) Support adding offline public keys to the keystore + +* Gaia + * [\#2186](https://github.com/cosmos/cosmos-sdk/issues/2186) Add Address Interface + * [\#3158](https://github.com/cosmos/cosmos-sdk/pull/3158) Validate slashing genesis + * [\#3172](https://github.com/cosmos/cosmos-sdk/pull/3172) Support minimum fees in a local testnet. + * [\#3250](https://github.com/cosmos/cosmos-sdk/pull/3250) Refactor integration tests and increase coverage + * [\#3248](https://github.com/cosmos/cosmos-sdk/issues/3248) Refactor tx fee + model: + * Validators specify minimum gas prices instead of minimum fees + * Clients may provide either fees or gas prices directly + * The gas prices of a tx must meet a validator's minimum + * `gaiad start` and `gaia.toml` take --minimum-gas-prices flag and minimum-gas-price config key respectively. + * [\#2859](https://github.com/cosmos/cosmos-sdk/issues/2859) Rename `TallyResult` in gov proposals to `FinalTallyResult` + * [\#3286](https://github.com/cosmos/cosmos-sdk/pull/3286) Fix `gaiad gentx` printout of account's addresses, i.e. user bech32 instead of hex. + * [\#3249\(https://github.com/cosmos/cosmos-sdk/issues/3249) `--json` flag removed, users should use `--output=json` instead. + +* SDK + * [\#3137](https://github.com/cosmos/cosmos-sdk/pull/3137) Add tag documentation + for each module along with cleaning up a few existing tags in the governance, + slashing, and staking modules. + * [\#3093](https://github.com/cosmos/cosmos-sdk/issues/3093) Ante handler does no longer read all accounts in one go when processing signatures as signature + verification may fail before last signature is checked. + * [staking] [\#1402](https://github.com/cosmos/cosmos-sdk/issues/1402) Add for multiple simultaneous redelegations or unbonding-delegations within an unbonding period + * [staking] [\#1268](https://github.com/cosmos/cosmos-sdk/issues/1268) staking spec rewrite + +* CI + * [\#2498](https://github.com/cosmos/cosmos-sdk/issues/2498) Added macos CI job to CircleCI + * [#142](https://github.com/tendermint/devops/issues/142) Increased the number of blocks to be tested during multi-sim + * [#147](https://github.com/tendermint/devops/issues/142) Added docker image build to CI + +BUG FIXES + +* Gaia CLI (`gaiacli`) + * [\#3141](https://github.com/cosmos/cosmos-sdk/issues/3141) Fix the bug in GetAccount when `len(res) == 0` and `err == nil` + * [\#810](https://github.com/cosmos/cosmos-sdk/pull/3316) Fix regression in gaiacli config file handling + +* Gaia + * [\#3148](https://github.com/cosmos/cosmos-sdk/issues/3148) Fix `gaiad export` by adding a boolean to `NewGaiaApp` determining whether or not to load the latest version + * [\#3181](https://github.com/cosmos/cosmos-sdk/issues/3181) Correctly reset total accum update height and jailed-validator bond height / unbonding height on export-for-zero-height + * [\#3172](https://github.com/cosmos/cosmos-sdk/pull/3172) Fix parsing `gaiad.toml` + when it already exists. + * [\#3223](https://github.com/cosmos/cosmos-sdk/issues/3223) Fix unset governance proposal queues when importing state from old chain + * [#3187](https://github.com/cosmos/cosmos-sdk/issues/3187) Fix `gaiad export` + by resetting each validator's slashing period. + +## 0.29.1 + +BUG FIXES + +* SDK + * [\#3207](https://github.com/cosmos/cosmos-sdk/issues/3207) - Fix token printing bug + +## 0.29.0 + +BREAKING CHANGES + +* Gaia + * [\#3148](https://github.com/cosmos/cosmos-sdk/issues/3148) Fix `gaiad export` by adding a boolean to `NewGaiaApp` determining whether or not to load the latest version + +* SDK + * [\#3163](https://github.com/cosmos/cosmos-sdk/issues/3163) Withdraw commission on self bond removal + +## 0.28.1 + +BREAKING CHANGES + +* Gaia REST API (`gaiacli advanced rest-server`) + * [lcd] [\#3045](https://github.com/cosmos/cosmos-sdk/pull/3045) Fix quoted json return on GET /keys (keys list) + * [gaia-lite] [\#2191](https://github.com/cosmos/cosmos-sdk/issues/2191) Split `POST /stake/delegators/{delegatorAddr}/delegations` into `POST /stake/delegators/{delegatorAddr}/delegations`, `POST /stake/delegators/{delegatorAddr}/unbonding_delegations` and `POST /stake/delegators/{delegatorAddr}/redelegations` + * [gaia-lite] [\#3056](https://github.com/cosmos/cosmos-sdk/pull/3056) `generate_only` and `simulate` have moved from query arguments to POST requests body. +* Tendermint + * [tendermint] Now using Tendermint 0.27.3 + +FEATURES + +* Gaia REST API (`gaiacli advanced rest-server`) + * [slashing] [\#2399](https://github.com/cosmos/cosmos-sdk/issues/2399) Implement `/slashing/parameters` endpoint to query slashing parameters. +* Gaia CLI (`gaiacli`) + * [gaiacli] [\#2399](https://github.com/cosmos/cosmos-sdk/issues/2399) Implement `params` command to query slashing parameters. +* SDK + - [client] [\#2926](https://github.com/cosmos/cosmos-sdk/issues/2926) Add TxEncoder to client TxBuilder. +* Other + - Introduced the logjack tool for saving logs w/ rotation + +IMPROVEMENTS + +* Gaia REST API (`gaiacli advanced rest-server`) + * [\#2879](https://github.com/cosmos/cosmos-sdk/issues/2879), [\#2880](https://github.com/cosmos/cosmos-sdk/issues/2880) Update deposit and vote endpoints to perform a direct txs query + when a given proposal is inactive and thus having votes and deposits removed + from state. +* Gaia CLI (`gaiacli`) + * [\#2879](https://github.com/cosmos/cosmos-sdk/issues/2879), [\#2880](https://github.com/cosmos/cosmos-sdk/issues/2880) Update deposit and vote CLI commands to perform a direct txs query + when a given proposal is inactive and thus having votes and deposits removed + from state. +* Gaia + * [\#3021](https://github.com/cosmos/cosmos-sdk/pull/3021) Add `--gentx-dir` to `gaiad collect-gentxs` to specify a directory from which collect and load gentxs. Add `--output-document` to `gaiad init` to allow one to redirect output to file. + +## 0.28.0 + +BREAKING CHANGES + +* Gaia CLI (`gaiacli`) + * [cli] [\#2595](https://github.com/cosmos/cosmos-sdk/issues/2595) Remove `keys new` in favor of `keys add` incorporating existing functionality with addition of key recovery functionality. + * [cli] [\#2987](https://github.com/cosmos/cosmos-sdk/pull/2987) Add shorthand `-a` to `gaiacli keys show` and update docs + * [cli] [\#2971](https://github.com/cosmos/cosmos-sdk/pull/2971) Additional verification when running `gaiad gentx` + * [cli] [\#2734](https://github.com/cosmos/cosmos-sdk/issues/2734) Rewrite `gaiacli config`. It is now a non-interactive config utility. + +* Gaia + * [#128](https://github.com/tendermint/devops/issues/128) Updated CircleCI job to trigger website build on every push to master/develop. + * [\#2994](https://github.com/cosmos/cosmos-sdk/pull/2994) Change wrong-password error message. + * [\#3009](https://github.com/cosmos/cosmos-sdk/issues/3009) Added missing Gaia genesis verification + * [#128](https://github.com/tendermint/devops/issues/128) Updated CircleCI job to trigger website build on every push to master/develop. + * [\#2994](https://github.com/cosmos/cosmos-sdk/pull/2994) Change wrong-password error message. + * [\#3009](https://github.com/cosmos/cosmos-sdk/issues/3009) Added missing Gaia genesis verification + * [gas] [\#3052](https://github.com/cosmos/cosmos-sdk/issues/3052) Updated gas costs to more reasonable numbers + +* SDK + * [auth] [\#2952](https://github.com/cosmos/cosmos-sdk/issues/2952) Signatures are no longer serialized on chain with the account number and sequence number + * [auth] [\#2952](https://github.com/cosmos/cosmos-sdk/issues/2952) Signatures are no longer serialized on chain with the account number and sequence number + * [stake] [\#3055](https://github.com/cosmos/cosmos-sdk/issues/3055) Use address instead of bond height / intratxcounter for deduplication ### Improvements -* (x/feegrant) [#11813](https://github.com/cosmos/cosmos-sdk/pull/11813) Fix pagination total count in `AllowancesByGranter` query. -* (errors) [#12002](https://github.com/cosmos/cosmos-sdk/pull/12002) Removed 'redacted' error message from defaultErrEncoder. -* (ante) [#12017](https://github.com/cosmos/cosmos-sdk/pull/12017) Index ante events for failed tx (backport #12013). -* [#12153](https://github.com/cosmos/cosmos-sdk/pull/12153) Add a new `NewSimulationManagerFromAppModules` constructor, to simplify simulation wiring. +* Gaia CLI (`gaiacli`) + * [\#2961](https://github.com/cosmos/cosmos-sdk/issues/2961) Add --force flag to gaiacli keys delete command to skip passphrase check and force key deletion unconditionally. ### Bug Fixes -* [#11796](https://github.com/cosmos/cosmos-sdk/pull/11796) Handle EOF error case in `readLineFromBuf`, which allows successful reading of passphrases from STDIN. -* [#11772](https://github.com/cosmos/cosmos-sdk/pull/11772) Limit types.Dec length to avoid overflow. -* [#10947](https://github.com/cosmos/cosmos-sdk/pull/10947) Add `AllowancesByGranter` query to the feegrant module -* [#9639](https://github.com/cosmos/cosmos-sdk/pull/9639) Check store keys length before accessing them by making sure that `key` is of length `m+1` (for `key[n:m]`) -* [#11983](https://github.com/cosmos/cosmos-sdk/pull/11983) (x/feegrant, x/authz) rename grants query commands to `grants-by-grantee`, `grants-by-granter` cmds. - -## Improvements - -* [#11886](https://github.com/cosmos/cosmos-sdk/pull/11886) Improve error messages +* Gaia CLI (`gaiacli`) + * [\#2991](https://github.com/cosmos/cosmos-sdk/issues/2991) Fully validate transaction signatures during `gaiacli tx sign --validate-signatures` -## [v0.45.4](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.45.4) - 2022-04-25 +* SDK + * [\#1277](https://github.com/cosmos/cosmos-sdk/issues/1277) Complete bank module specification + * [\#2963](https://github.com/cosmos/cosmos-sdk/issues/2963) Complete auth module specification + * [\#2914](https://github.com/cosmos/cosmos-sdk/issues/2914) No longer withdraw validator rewards on bond/unbond, but rather move + the rewards to the respective validator's pools. -### Bug Fixes +BUG FIXES -* [#11624](https://github.com/cosmos/cosmos-sdk/pull/11624) Handle the error returned from `NewNode` in the `server` package. -* [#11724](https://github.com/cosmos/cosmos-sdk/pull/11724) Fix data race issues with `api.Server`. +* Gaia CLI (`gaiacli`) + * [\#2921](https://github.com/cosmos/cosmos-sdk/issues/2921) Fix `keys delete` inability to delete offline and ledger keys. -### Improvements +* Gaia + * [\#3003](https://github.com/cosmos/cosmos-sdk/issues/3003) CollectStdTxs() must validate DelegatorAddr against genesis accounts. -* (types) [#12201](https://github.com/cosmos/cosmos-sdk/pull/12201) Add `MustAccAddressFromBech32` util function -* [#11693](https://github.com/cosmos/cosmos-sdk/pull/11693) Add validation for gentx cmd. -* [#11686](https://github.com/cosmos/cosmos-sdk/pull/11686) Update the min required Golang version to `1.17`. -* (x/auth/vesting) [#11652](https://github.com/cosmos/cosmos-sdk/pull/11652) Add util functions for `Period(s)` +* SDK + * [\#2967](https://github.com/cosmos/cosmos-sdk/issues/2967) Change ordering of `mint.BeginBlocker` and `distr.BeginBlocker`, recalculate inflation each block + * [\#3068](https://github.com/cosmos/cosmos-sdk/issues/3068) check for uint64 gas overflow during `Std#ValidateBasic`. + * [\#3071](https://github.com/cosmos/cosmos-sdk/issues/3071) Catch overflow on block gas meter ## [v0.45.3](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.45.3) - 2022-04-12 ### Improvements -* [#11562](https://github.com/cosmos/cosmos-sdk/pull/11562) Updated Tendermint to v0.34.19; `unsafe-reset-all` command has been moved to the `tendermint` sub-command. +* Gaia REST API (`gaiacli advanced rest-server`) + * [gaia-lite] [\#2819](https://github.com/cosmos/cosmos-sdk/pull/2819) Txs query param format is now: `/txs?tag=value` (removed '' wrapping the query parameter `value`) -### Features +* Gaia CLI (`gaiacli`) + * [cli] [\#2728](https://github.com/cosmos/cosmos-sdk/pull/2728) Seperate `tx` and `query` subcommands by module + * [cli] [\#2727](https://github.com/cosmos/cosmos-sdk/pull/2727) Fix unbonding command flow + * [cli] [\#2786](https://github.com/cosmos/cosmos-sdk/pull/2786) Fix redelegation command flow + * [cli] [\#2829](https://github.com/cosmos/cosmos-sdk/pull/2829) add-genesis-account command now validates state when adding accounts + * [cli] [\#2804](https://github.com/cosmos/cosmos-sdk/issues/2804) Check whether key exists before passing it on to `tx create-validator`. + * [cli] [\#2874](https://github.com/cosmos/cosmos-sdk/pull/2874) `gaiacli tx sign` takes an optional `--output-document` flag to support output redirection. + * [cli] [\#2875](https://github.com/cosmos/cosmos-sdk/pull/2875) Refactor `gaiad gentx` and avoid redirection to `gaiacli tx sign` for tx signing. -* (x/upgrade) [#11551](https://github.com/cosmos/cosmos-sdk/pull/11551) Update `ScheduleUpgrade` for chains to schedule an automated upgrade on `BeginBlock` without having to go though governance. +* Gaia + * [mint] [\#2825] minting now occurs every block, inflation parameter updates still hourly -## [v0.45.2](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.45.2) - 2022-04-05 +* SDK + * [\#2752](https://github.com/cosmos/cosmos-sdk/pull/2752) Don't hardcode bondable denom. + * [\#2701](https://github.com/cosmos/cosmos-sdk/issues/2701) Account numbers and sequence numbers in `auth` are now `uint64` instead of `int64` + * [\#2019](https://github.com/cosmos/cosmos-sdk/issues/2019) Cap total number of signatures. Current per-transaction limit is 7, and if that is exceeded transaction is rejected. + * [\#2801](https://github.com/cosmos/cosmos-sdk/pull/2801) Remove AppInit structure. + * [\#2798](https://github.com/cosmos/cosmos-sdk/issues/2798) Governance API has miss-spelled English word in JSON response ('depositer' -> 'depositor') + * [\#2943](https://github.com/cosmos/cosmos-sdk/pull/2943) Transaction action tags equal the message type. Staking EndBlocker tags are included. -### Features +* Tendermint + * Update to Tendermint 0.27.0 * (tx) [#11533](https://github.com/cosmos/cosmos-sdk/pull/11533) Register [`EIP191`](https://eips.ethereum.org/EIPS/eip-191) as an available `SignMode` for chains to use. * [#11430](https://github.com/cosmos/cosmos-sdk/pull/11430) Introduce a new `grpc-only` flag, such that when enabled, will start the node in a query-only mode. Note, gRPC MUST be enabled with this flag. @@ -2402,69 +3581,849 @@ empty coins slice before it is used to create `banktype.MsgSend`. * (x/auth) [#10880](https://github.com/cosmos/cosmos-sdk/pull/10880) Added a new query to the tx query service that returns a block with transactions fully decoded. * [#11314](https://github.com/cosmos/cosmos-sdk/pull/11314) Add state rollback command. +* Gaia REST API (`gaiacli advanced rest-server`) + * [gov] [\#2479](https://github.com/cosmos/cosmos-sdk/issues/2479) Added governance parameter + query REST endpoints. + +* Gaia CLI (`gaiacli`) + * [gov][cli] [\#2479](https://github.com/cosmos/cosmos-sdk/issues/2479) Added governance + parameter query commands. + * [stake][cli] [\#2027] Add CLI query command for getting all delegations to a specific validator. + * [\#2840](https://github.com/cosmos/cosmos-sdk/pull/2840) Standardize CLI exports from modules + +* Gaia + * [app] [\#2791](https://github.com/cosmos/cosmos-sdk/issues/2791) Support export at a specific height, with `gaiad export --height=HEIGHT`. + * [x/gov] [#2479](https://github.com/cosmos/cosmos-sdk/issues/2479) Implemented querier + for getting governance parameters. + * [app] [\#2663](https://github.com/cosmos/cosmos-sdk/issues/2663) - Runtime-assertable invariants + * [app] [\#2791](https://github.com/cosmos/cosmos-sdk/issues/2791) Support export at a specific height, with `gaiad export --height=HEIGHT`. + * [app] [\#2812](https://github.com/cosmos/cosmos-sdk/issues/2812) Support export alterations to prepare for restarting at zero-height + +* SDK + * [simulator] [\#2682](https://github.com/cosmos/cosmos-sdk/issues/2682) MsgEditValidator now looks at the validator's max rate, thus it now succeeds a significant portion of the time + * [core] [\#2775](https://github.com/cosmos/cosmos-sdk/issues/2775) Add deliverTx maximum block gas limit + ### Bug Fixes -* [#11354](https://github.com/cosmos/cosmos-sdk/pull/11355) Added missing pagination flag for `bank q total` query. -* [#11197](https://github.com/cosmos/cosmos-sdk/pull/11197) Signing with multisig now works with multisig address which is not in the keyring. -* (client) [#11283](https://github.com/cosmos/cosmos-sdk/issues/11283) Support multiple keys for tx simulation and setting automatic gas for txs. -* (store) [#11177](https://github.com/cosmos/cosmos-sdk/pull/11177) Update the prune `everything` strategy to store the last two heights. -* (store) [#11117](https://github.com/cosmos/cosmos-sdk/pull/11117) Fix data race in store trace component -* (x/authz) [#11252](https://github.com/cosmos/cosmos-sdk/pull/11252) Allow insufficient funds error for authz simulation -* (crypto) [#11298](https://github.com/cosmos/cosmos-sdk/pull/11298) Fix cgo secp signature verification and update libscep256k1 library. -* (crypto) [#12122](https://github.com/cosmos/cosmos-sdk/pull/12122) Fix keyring migration issue. +* Gaia REST API (`gaiacli advanced rest-server`) + * [gaia-lite] [\#2819](https://github.com/cosmos/cosmos-sdk/pull/2819) Tx search now supports multiple tags as query parameters + * [\#2836](https://github.com/cosmos/cosmos-sdk/pull/2836) Expose LCD router to allow users to register routes there. + +* Gaia CLI (`gaiacli`) + * [\#2749](https://github.com/cosmos/cosmos-sdk/pull/2749) Add --chain-id flag to gaiad testnet + * [\#2819](https://github.com/cosmos/cosmos-sdk/pull/2819) Tx search now supports multiple tags as query parameters + +* Gaia + * [\#2772](https://github.com/cosmos/cosmos-sdk/issues/2772) Update BaseApp to not persist state when the ante handler fails on DeliverTx. + * [\#2773](https://github.com/cosmos/cosmos-sdk/issues/2773) Require moniker to be provided on `gaiad init`. + * [\#2672](https://github.com/cosmos/cosmos-sdk/issues/2672) [Makefile] Updated for better Windows compatibility and ledger support logic, get_tools was rewritten as a cross-compatible Makefile. + * [\#2766](https://github.com/cosmos/cosmos-sdk/issues/2766) [Makefile] Added goimports tool to get_tools. Get_tools now only builds new versions if binaries are missing. + * [#110](https://github.com/tendermint/devops/issues/110) Updated CircleCI job to trigger website build when cosmos docs are updated. + +* SDK + & [x/mock/simulation] [\#2720] major cleanup, introduction of helper objects, reorganization +* [\#2821](https://github.com/cosmos/cosmos-sdk/issues/2821) Codespaces are now strings +* [types] [\#2776](https://github.com/cosmos/cosmos-sdk/issues/2776) Improve safety of `Coin` and `Coins` types. Various functions + and methods will panic when a negative amount is discovered. +* [\#2815](https://github.com/cosmos/cosmos-sdk/issues/2815) Gas unit fields changed from `int64` to `uint64`. +* [\#2821](https://github.com/cosmos/cosmos-sdk/issues/2821) Codespaces are now strings +* [\#2779](https://github.com/cosmos/cosmos-sdk/issues/2779) Introduce `ValidateBasic` to the `Tx` interface and call it in the ante + handler. +* [\#2825](https://github.com/cosmos/cosmos-sdk/issues/2825) More staking and distribution invariants +* [\#2912](https://github.com/cosmos/cosmos-sdk/issues/2912) Print commit ID in hex when commit is synced. + +* Tendermint +* [\#2796](https://github.com/cosmos/cosmos-sdk/issues/2796) Update to go-amino 0.14.1 + +BUG FIXES + +* Gaia REST API (`gaiacli advanced rest-server`) + * [gaia-lite] [\#2868](https://github.com/cosmos/cosmos-sdk/issues/2868) Added handler for governance tally endpoint + * [\#2907](https://github.com/cosmos/cosmos-sdk/issues/2907) Refactor and fix the way Gaia Lite is started. + +* Gaia + * [\#2723] Use `cosmosvalcons` Bech32 prefix in `tendermint show-address` + * [\#2742](https://github.com/cosmos/cosmos-sdk/issues/2742) Fix time format of TimeoutCommit override + * [\#2898](https://github.com/cosmos/cosmos-sdk/issues/2898) Remove redundant '$' in docker-compose.yml + +* SDK + * [\#2733](https://github.com/cosmos/cosmos-sdk/issues/2733) [x/gov, x/mock/simulation] Fix governance simulation, update x/gov import/export + * [\#2854](https://github.com/cosmos/cosmos-sdk/issues/2854) [x/bank] Remove unused bank.MsgIssue, prevent possible panic + * [\#2884](https://github.com/cosmos/cosmos-sdk/issues/2884) [docs/examples] Fix `basecli version` panic + +* Tendermint + * [\#2797](https://github.com/tendermint/tendermint/pull/2797) AddressBook requires addresses to have IDs; Do not crap out immediately after sending pex addrs in seed mode + +## 0.26.0 + +BREAKING CHANGES + +* Gaia + * [gaiad init] [\#2602](https://github.com/cosmos/cosmos-sdk/issues/2602) New genesis workflow + +* SDK + * [simulation] [\#2665](https://github.com/cosmos/cosmos-sdk/issues/2665) only argument to sdk.Invariant is now app + +* Tendermint + * Upgrade to version 0.26.0 + +FEATURES + +* Gaia CLI (`gaiacli`) + * [cli] [\#2569](https://github.com/cosmos/cosmos-sdk/pull/2569) Add commands to query validator unbondings and redelegations + * [cli] [\#2569](https://github.com/cosmos/cosmos-sdk/pull/2569) Add commands to query validator unbondings and redelegations + * [cli] [\#2524](https://github.com/cosmos/cosmos-sdk/issues/2524) Add support offline mode to `gaiacli tx sign`. Lookups are not performed if the flag `--offline` is on. + * [cli] [\#2558](https://github.com/cosmos/cosmos-sdk/issues/2558) Rename --print-sigs to --validate-signatures. It now performs a complete set of sanity checks and reports to the user. Also added --print-signature-only to print the signature only, not the whole transaction. + * [cli] [\#2704](https://github.com/cosmos/cosmos-sdk/pull/2704) New add-genesis-account convenience command to populate genesis.json with genesis accounts. + +* SDK + * [\#1336](https://github.com/cosmos/cosmos-sdk/issues/1336) Mechanism for SDK Users to configure their own Bech32 prefixes instead of using the default cosmos prefixes. + +IMPROVEMENTS + +* Gaia +* [\#2637](https://github.com/cosmos/cosmos-sdk/issues/2637) [x/gov] Switched inactive and active proposal queues to an iterator based queue + +* SDK +* [\#2573](https://github.com/cosmos/cosmos-sdk/issues/2573) [x/distribution] add accum invariance +* [\#2556](https://github.com/cosmos/cosmos-sdk/issues/2556) [x/mock/simulation] Fix debugging output +* [\#2396](https://github.com/cosmos/cosmos-sdk/issues/2396) [x/mock/simulation] Change parameters to get more slashes +* [\#2617](https://github.com/cosmos/cosmos-sdk/issues/2617) [x/mock/simulation] Randomize all genesis parameters +* [\#2669](https://github.com/cosmos/cosmos-sdk/issues/2669) [x/stake] Added invarant check to make sure validator's power aligns with its spot in the power store. +* [\#1924](https://github.com/cosmos/cosmos-sdk/issues/1924) [x/mock/simulation] Use a transition matrix for block size +* [\#2660](https://github.com/cosmos/cosmos-sdk/issues/2660) [x/mock/simulation] Staking transactions get tested far more frequently +* [\#2610](https://github.com/cosmos/cosmos-sdk/issues/2610) [x/stake] Block redelegation to and from the same validator +* [\#2652](https://github.com/cosmos/cosmos-sdk/issues/2652) [x/auth] Add benchmark for get and set account +* [\#2685](https://github.com/cosmos/cosmos-sdk/issues/2685) [store] Add general merkle absence proof (also for empty substores) +* [\#2708](https://github.com/cosmos/cosmos-sdk/issues/2708) [store] Disallow setting nil values + +BUG FIXES + +* Gaia +* [\#2670](https://github.com/cosmos/cosmos-sdk/issues/2670) [x/stake] fixed incorrect `IterateBondedValidators` and split into two functions: `IterateBondedValidators` and `IterateLastBlockConsValidators` +* [\#2691](https://github.com/cosmos/cosmos-sdk/issues/2691) Fix local testnet creation by using a single canonical genesis time +* [\#2648](https://github.com/cosmos/cosmos-sdk/issues/2648) [gaiad] Fix `gaiad export` / `gaiad import` consistency, test in CI + +* SDK +* [\#2625](https://github.com/cosmos/cosmos-sdk/issues/2625) [x/gov] fix AppendTag function usage error +* [\#2677](https://github.com/cosmos/cosmos-sdk/issues/2677) [x/stake, x/distribution] various staking/distribution fixes as found by the simulator +* [\#2674](https://github.com/cosmos/cosmos-sdk/issues/2674) [types] Fix coin.IsLT() impl, coins.IsLT() impl, and renamed coins.Is\* to coins.IsAll\* (see [\#2686](https://github.com/cosmos/cosmos-sdk/issues/2686)) +* [\#2711](https://github.com/cosmos/cosmos-sdk/issues/2711) [x/stake] Add commission data to `MsgCreateValidator` signature bytes. +* Temporarily disable insecure mode for Gaia Lite + +## 0.25.0 + +_October 24th, 2018_ + +BREAKING CHANGES + +* Gaia REST API (`gaiacli advanced rest-server`) + * [x/stake] Validator.Owner renamed to Validator.Operator + * [\#595](https://github.com/cosmos/cosmos-sdk/issues/595) Connections to the REST server are now secured using Transport Layer Security by default. The --insecure flag is provided to switch back to insecure HTTP. + * [gaia-lite] [\#2258](https://github.com/cosmos/cosmos-sdk/issues/2258) Split `GET stake/delegators/{delegatorAddr}` into `GET stake/delegators/{delegatorAddr}/delegations`, `GET stake/delegators/{delegatorAddr}/unbonding_delegations` and `GET stake/delegators/{delegatorAddr}/redelegations` + +* Gaia CLI (`gaiacli`) + * [x/stake] Validator.Owner renamed to Validator.Operator + * [cli] unsafe_reset_all, show_validator, and show_node_id have been renamed to unsafe-reset-all, show-validator, and show-node-id + * [cli] [\#1983](https://github.com/cosmos/cosmos-sdk/issues/1983) --print-response now defaults to true in commands that create and send a transaction + * [cli] [\#1983](https://github.com/cosmos/cosmos-sdk/issues/1983) you can now pass --pubkey or --address to gaiacli keys show to return a plaintext representation of the key's address or public key for use with other commands + * [cli] [\#2061](https://github.com/cosmos/cosmos-sdk/issues/2061) changed proposalID in governance REST endpoints to proposal-id + * [cli] [\#2014](https://github.com/cosmos/cosmos-sdk/issues/2014) `gaiacli advanced` no longer exists - to access `ibc`, `rest-server`, and `validator-set` commands use `gaiacli ibc`, `gaiacli rest-server`, and `gaiacli tendermint`, respectively + * [makefile] `get_vendor_deps` no longer updates lock file it just updates vendor directory. Use `update_vendor_deps` to update the lock file. [#2152](https://github.com/cosmos/cosmos-sdk/pull/2152) + * [cli] [\#2221](https://github.com/cosmos/cosmos-sdk/issues/2221) All commands that + utilize a validator's operator address must now use the new Bech32 prefix, + `cosmosvaloper`. + * [cli] [\#2190](https://github.com/cosmos/cosmos-sdk/issues/2190) `gaiacli init --gen-txs` is now `gaiacli init --with-txs` to reduce confusion + * [cli] [\#2073](https://github.com/cosmos/cosmos-sdk/issues/2073) --from can now be either an address or a key name + * [cli] [\#1184](https://github.com/cosmos/cosmos-sdk/issues/1184) Subcommands reorganisation, see [\#2390](https://github.com/cosmos/cosmos-sdk/pull/2390) for a comprehensive list of changes. + * [cli] [\#2524](https://github.com/cosmos/cosmos-sdk/issues/2524) Add support offline mode to `gaiacli tx sign`. Lookups are not performed if the flag `--offline` is on. + * [cli] [\#2570](https://github.com/cosmos/cosmos-sdk/pull/2570) Add commands to query deposits on proposals + +* Gaia + * Make the transient store key use a distinct store key. [#2013](https://github.com/cosmos/cosmos-sdk/pull/2013) + * [x/stake] [\#1901](https://github.com/cosmos/cosmos-sdk/issues/1901) Validator type's Owner field renamed to Operator; Validator's GetOwner() renamed accordingly to comply with the SDK's Validator interface. + * [docs] [#2001](https://github.com/cosmos/cosmos-sdk/pull/2001) Update slashing spec for slashing period + * [x/stake, x/slashing] [#1305](https://github.com/cosmos/cosmos-sdk/issues/1305) - Rename "revoked" to "jailed" + * [x/stake] [#1676] Revoked and jailed validators put into the unbonding state + * [x/stake] [#1877] Redelegations/unbonding-delegation from unbonding validator have reduced time + * [x/slashing] [\#1789](https://github.com/cosmos/cosmos-sdk/issues/1789) Slashing changes for Tendermint validator set offset (NextValSet) + * [x/stake] [\#2040](https://github.com/cosmos/cosmos-sdk/issues/2040) Validator + operator type has now changed to `sdk.ValAddress` + * [x/stake] [\#2221](https://github.com/cosmos/cosmos-sdk/issues/2221) New + Bech32 prefixes have been introduced for a validator's consensus address and + public key: `cosmosvalcons` and `cosmosvalconspub` respectively. Also, existing Bech32 prefixes have been + renamed for accounts and validator operators: + * `cosmosaccaddr` / `cosmosaccpub` => `cosmos` / `cosmospub` + * `cosmosvaladdr` / `cosmosvalpub` => `cosmosvaloper` / `cosmosvaloperpub` + * [x/stake] [#1013] TendermintUpdates now uses transient store + * [x/stake] [\#2435](https://github.com/cosmos/cosmos-sdk/issues/2435) Remove empty bytes from the ValidatorPowerRank store key + * [x/gov] [\#2195](https://github.com/cosmos/cosmos-sdk/issues/2195) Governance uses BFT Time + * [x/gov] [\#2256](https://github.com/cosmos/cosmos-sdk/issues/2256) Removed slashing for governance non-voting validators + * [simulation] [\#2162](https://github.com/cosmos/cosmos-sdk/issues/2162) Added back correct supply invariants + * [x/slashing] [\#2430](https://github.com/cosmos/cosmos-sdk/issues/2430) Simulate more slashes, check if validator is jailed before jailing + * [x/stake] [\#2393](https://github.com/cosmos/cosmos-sdk/issues/2393) Removed `CompleteUnbonding` and `CompleteRedelegation` Msg types, and instead added unbonding/redelegation queues to endblocker + * [x/mock/simulation] [\#2501](https://github.com/cosmos/cosmos-sdk/issues/2501) Simulate transactions & invariants for fee distribution, and fix bugs discovered in the process + * [x/auth] Simulate random fee payments + * [cmd/gaia/app] Simulate non-zero inflation + * [x/stake] Call hooks correctly in several cases related to delegation/validator updates + * [x/stake] Check full supply invariants, including yet-to-be-withdrawn fees + * [x/stake] Remove no-longer-in-use store key + * [x/slashing] Call hooks correctly when a validator is slashed + * [x/slashing] Truncate withdrawals (unbonding, redelegation) and burn change + * [x/mock/simulation] Ensure the simulation cannot set a proposer address of nil + * [x/mock/simulation] Add more event logs on begin block / end block for clarity + * [x/mock/simulation] Correctly set validator power in abci.RequestBeginBlock + * [x/minting] Correctly call stake keeper to track inflated supply + * [x/distribution] Sanity check for nonexistent rewards + * [x/distribution] Truncate withdrawals and return change to the community pool + * [x/distribution] Add sanity checks for incorrect accum / total accum relations + * [x/distribution] Correctly calculate total power using Tendermint updates + * [x/distribution] Simulate withdrawal transactions + * [x/distribution] Fix a bug where the fee pool was not correctly tracked on WithdrawDelegatorRewardsAll + * [x/stake] [\#1673](https://github.com/cosmos/cosmos-sdk/issues/1673) Validators are no longer deleted until they can no longer possibly be slashed + * [\#1890](https://github.com/cosmos/cosmos-sdk/issues/1890) Start chain with initial state + sequence of transactions + * [cli] Rename `gaiad init gentx` to `gaiad gentx`. + * [cli] Add `--skip-genesis` flag to `gaiad init` to prevent `genesis.json` generation. + * Drop `GenesisTx` in favor of a signed `StdTx` with only one `MsgCreateValidator` message. + * [cli] Port `gaiad init` and `gaiad testnet` to work with `StdTx` genesis transactions. + * [cli] Add `--moniker` flag to `gaiad init` to override moniker when generating `genesis.json` - i.e. it takes effect when running with the `--with-txs` flag, it is ignored otherwise. + +* SDK + * [core] [\#2219](https://github.com/cosmos/cosmos-sdk/issues/2219) Update to Tendermint 0.24.0 + * Validator set updates delayed by one block + * BFT timestamp that can safely be used by applications + * Fixed maximum block size enforcement + * [core] [\#1807](https://github.com/cosmos/cosmos-sdk/issues/1807) Switch from use of rational to decimal + * [types] [\#1901](https://github.com/cosmos/cosmos-sdk/issues/1901) Validator interface's GetOwner() renamed to GetOperator() + * [x/slashing] [#2122](https://github.com/cosmos/cosmos-sdk/pull/2122) - Implement slashing period + * [types] [\#2119](https://github.com/cosmos/cosmos-sdk/issues/2119) Parsed error messages and ABCI log errors to make them more human readable. + * [types] [\#2407](https://github.com/cosmos/cosmos-sdk/issues/2407) MulInt method added to big decimal in order to improve efficiency of slashing + * [simulation] Rename TestAndRunTx to Operation [#2153](https://github.com/cosmos/cosmos-sdk/pull/2153) + * [simulation] Remove log and testing.TB from Operation and Invariants, in favor of using errors [\#2282](https://github.com/cosmos/cosmos-sdk/issues/2282) + * [simulation] Remove usage of keys and addrs in the types, in favor of simulation.Account [\#2384](https://github.com/cosmos/cosmos-sdk/issues/2384) + * [tools] Removed gocyclo [#2211](https://github.com/cosmos/cosmos-sdk/issues/2211) + * [baseapp] Remove `SetTxDecoder` in favor of requiring the decoder be set in baseapp initialization. [#1441](https://github.com/cosmos/cosmos-sdk/issues/1441) + * [baseapp] [\#1921](https://github.com/cosmos/cosmos-sdk/issues/1921) Add minimumFees field to BaseApp. + * [store] Change storeInfo within the root multistore to use tmhash instead of ripemd160 [\#2308](https://github.com/cosmos/cosmos-sdk/issues/2308) + * [codec] [\#2324](https://github.com/cosmos/cosmos-sdk/issues/2324) All referrences to wire have been renamed to codec. Additionally, wire.NewCodec is now codec.New(). + * [types] [\#2343](https://github.com/cosmos/cosmos-sdk/issues/2343) Make sdk.Msg have a names field, to facilitate automatic tagging. + * [baseapp] [\#2366](https://github.com/cosmos/cosmos-sdk/issues/2366) Automatically add action tags to all messages + * [x/auth] [\#2377](https://github.com/cosmos/cosmos-sdk/issues/2377) auth.StdSignMsg -> txbuilder.StdSignMsg + * [x/staking] [\#2244](https://github.com/cosmos/cosmos-sdk/issues/2244) staking now holds a consensus-address-index instead of a consensus-pubkey-index + * [x/staking] [\#2236](https://github.com/cosmos/cosmos-sdk/issues/2236) more distribution hooks for distribution + * [x/stake] [\#2394](https://github.com/cosmos/cosmos-sdk/issues/2394) Split up UpdateValidator into distinct state transitions applied only in EndBlock + * [x/slashing] [\#2480](https://github.com/cosmos/cosmos-sdk/issues/2480) Fix signing info handling bugs & faulty slashing + * [x/stake] [\#2412](https://github.com/cosmos/cosmos-sdk/issues/2412) Added an unbonding validator queue to EndBlock to automatically update validator.Status when finished Unbonding + * [x/stake] [\#2500](https://github.com/cosmos/cosmos-sdk/issues/2500) Block conflicting redelegations until we add an index + * [x/params] Global Paramstore refactored + * [types] [\#2506](https://github.com/cosmos/cosmos-sdk/issues/2506) sdk.Dec MarshalJSON now marshals as a normal Decimal, with 10 digits of decimal precision + * [x/stake] [\#2508](https://github.com/cosmos/cosmos-sdk/issues/2508) Utilize Tendermint power for validator power key + * [x/stake] [\#2531](https://github.com/cosmos/cosmos-sdk/issues/2531) Remove all inflation logic + * [x/mint] [\#2531](https://github.com/cosmos/cosmos-sdk/issues/2531) Add minting module and inflation logic + * [x/auth] [\#2540](https://github.com/cosmos/cosmos-sdk/issues/2540) Rename `AccountMapper` to `AccountKeeper`. + * [types] [\#2456](https://github.com/cosmos/cosmos-sdk/issues/2456) Renamed msg.Name() and msg.Type() to msg.Type() and msg.Route() respectively + +* Tendermint + * Update tendermint version from v0.23.0 to v0.25.0, notable changes + * Mempool now won't build too large blocks, or too computationally expensive blocks + * Maximum tx sizes and gas are now removed, and are implicitly the blocks maximums + * ABCI validators no longer send the pubkey. The pubkey is only sent in validator updates + * Validator set changes are now delayed by one block + * Block header now includes the next validator sets hash + * BFT time is implemented + * Secp256k1 signature format has changed + * There is now a threshold multisig format + * See the [tendermint changelog](https://github.com/tendermint/tendermint/blob/master/CHANGELOG.md) for other changes. + +FEATURES + +* Gaia REST API (`gaiacli advanced rest-server`) + * [gaia-lite] Endpoints to query staking pool and params + * [gaia-lite] [\#2110](https://github.com/cosmos/cosmos-sdk/issues/2110) Add support for `simulate=true` requests query argument to endpoints that send txs to run simulations of transactions + * [gaia-lite] [\#966](https://github.com/cosmos/cosmos-sdk/issues/966) Add support for `generate_only=true` query argument to generate offline unsigned transactions + * [gaia-lite] [\#1953](https://github.com/cosmos/cosmos-sdk/issues/1953) Add /sign endpoint to sign transactions generated with `generate_only=true`. + * [gaia-lite] [\#1954](https://github.com/cosmos/cosmos-sdk/issues/1954) Add /broadcast endpoint to broadcast transactions signed by the /sign endpoint. + * [gaia-lite] [\#2113](https://github.com/cosmos/cosmos-sdk/issues/2113) Rename `/accounts/{address}/send` to `/bank/accounts/{address}/transfers`, rename `/accounts/{address}` to `/auth/accounts/{address}`, replace `proposal-id` with `proposalId` in all gov endpoints + * [gaia-lite] [\#2478](https://github.com/cosmos/cosmos-sdk/issues/2478) Add query gov proposal's deposits endpoint + * [gaia-lite] [\#2477](https://github.com/cosmos/cosmos-sdk/issues/2477) Add query validator's outgoing redelegations and unbonding delegations endpoints + +* Gaia CLI (`gaiacli`) + * [cli] Cmds to query staking pool and params + * [gov][cli] [\#2062](https://github.com/cosmos/cosmos-sdk/issues/2062) added `--proposal` flag to `submit-proposal` that allows a JSON file containing a proposal to be passed in + * [\#2040](https://github.com/cosmos/cosmos-sdk/issues/2040) Add `--bech` to `gaiacli keys show` and respective REST endpoint to + provide desired Bech32 prefix encoding + * [cli] [\#2047](https://github.com/cosmos/cosmos-sdk/issues/2047) [\#2306](https://github.com/cosmos/cosmos-sdk/pull/2306) Passing --gas=simulate triggers a simulation of the tx before the actual execution. + The gas estimate obtained via the simulation will be used as gas limit in the actual execution. + * [cli] [\#2047](https://github.com/cosmos/cosmos-sdk/issues/2047) The --gas-adjustment flag can be used to adjust the estimate obtained via the simulation triggered by --gas=simulate. + * [cli] [\#2110](https://github.com/cosmos/cosmos-sdk/issues/2110) Add --dry-run flag to perform a simulation of a transaction without broadcasting it. The --gas flag is ignored as gas would be automatically estimated. + * [cli] [\#2204](https://github.com/cosmos/cosmos-sdk/issues/2204) Support generating and broadcasting messages with multiple signatures via command line: + * [\#966](https://github.com/cosmos/cosmos-sdk/issues/966) Add --generate-only flag to build an unsigned transaction and write it to STDOUT. + * [\#1953](https://github.com/cosmos/cosmos-sdk/issues/1953) New `sign` command to sign transactions generated with the --generate-only flag. + * [\#1954](https://github.com/cosmos/cosmos-sdk/issues/1954) New `broadcast` command to broadcast transactions generated offline and signed with the `sign` command. + * [cli] [\#2220](https://github.com/cosmos/cosmos-sdk/issues/2220) Add `gaiacli config` feature to interactively create CLI config files to reduce the number of required flags + * [stake][cli] [\#1672](https://github.com/cosmos/cosmos-sdk/issues/1672) Introduced + new commission flags for validator commands `create-validator` and `edit-validator`. + * [stake][cli] [\#1890](https://github.com/cosmos/cosmos-sdk/issues/1890) Add `--genesis-format` flag to `gaiacli tx create-validator` to produce transactions in genesis-friendly format. + * [cli][\#2554](https://github.com/cosmos/cosmos-sdk/issues/2554) Make `gaiacli keys show` multisig ready. + +* Gaia + * [cli] [\#2170](https://github.com/cosmos/cosmos-sdk/issues/2170) added ability to show the node's address via `gaiad tendermint show-address` + * [simulation] [\#2313](https://github.com/cosmos/cosmos-sdk/issues/2313) Reworked `make test_sim_gaia_slow` to `make test_sim_gaia_full`, now simulates from multiple starting seeds in parallel + * [cli] [\#1921] (https://github.com/cosmos/cosmos-sdk/issues/1921) + * New configuration file `gaiad.toml` is now created to host Gaia-specific configuration. + * New --minimum_fees/minimum_fees flag/config option to set a minimum fee. + +* SDK + * [querier] added custom querier functionality, so ABCI query requests can be handled by keepers + * [simulation] [\#1924](https://github.com/cosmos/cosmos-sdk/issues/1924) allow operations to specify future operations + * [simulation] [\#1924](https://github.com/cosmos/cosmos-sdk/issues/1924) Add benchmarking capabilities, with makefile commands "test_sim_gaia_benchmark, test_sim_gaia_profile" + * [simulation] [\#2349](https://github.com/cosmos/cosmos-sdk/issues/2349) Add time-based future scheduled operations to simulator + * [x/auth] [\#2376](https://github.com/cosmos/cosmos-sdk/issues/2376) Remove FeePayer() from StdTx + * [x/stake] [\#1672](https://github.com/cosmos/cosmos-sdk/issues/1672) Implement + basis for the validator commission model. + * [x/auth] Support account removal in the account mapper. + +IMPROVEMENTS + +* [tools] Improved terraform and ansible scripts for infrastructure deployment +* [tools] Added ansible script to enable process core dumps + +* Gaia REST API (`gaiacli advanced rest-server`) + * [x/stake] [\#2000](https://github.com/cosmos/cosmos-sdk/issues/2000) Added tests for new staking endpoints + * [gaia-lite] [\#2445](https://github.com/cosmos/cosmos-sdk/issues/2445) Standarized REST error responses + * [gaia-lite] Added example to Swagger specification for /keys/seed. + * [x/stake] Refactor REST utils + +* Gaia CLI (`gaiacli`) + * [cli] [\#2060](https://github.com/cosmos/cosmos-sdk/issues/2060) removed `--select` from `block` command + * [cli] [\#2128](https://github.com/cosmos/cosmos-sdk/issues/2128) fixed segfault when exporting directly after `gaiad init` + * [cli] [\#1255](https://github.com/cosmos/cosmos-sdk/issues/1255) open KeyBase in read-only mode + for query-purpose CLI commands + * [docs] Added commands for querying governance deposits, votes and tally + +* Gaia + * [x/stake] [#2023](https://github.com/cosmos/cosmos-sdk/pull/2023) Terminate iteration loop in `UpdateBondedValidators` and `UpdateBondedValidatorsFull` when the first revoked validator is encountered and perform a sanity check. + * [x/auth] Signature verification's gas cost now accounts for pubkey type. [#2046](https://github.com/tendermint/tendermint/pull/2046) + * [x/stake] [x/slashing] Ensure delegation invariants to jailed validators [#1883](https://github.com/cosmos/cosmos-sdk/issues/1883). + * [x/stake] Improve speed of GetValidator, which was shown to be a performance bottleneck. [#2046](https://github.com/tendermint/tendermint/pull/2200) + * [x/stake] [\#2435](https://github.com/cosmos/cosmos-sdk/issues/2435) Improve memory efficiency of getting the various store keys + * [genesis] [\#2229](https://github.com/cosmos/cosmos-sdk/issues/2229) Ensure that there are no duplicate accounts or validators in the genesis state. + * [genesis] [\#2450](https://github.com/cosmos/cosmos-sdk/issues/2450) Validate staking genesis parameters. + * Add SDK validation to `config.toml` (namely disabling `create_empty_blocks`) [\#1571](https://github.com/cosmos/cosmos-sdk/issues/1571) + * [\#1941](https://github.com/cosmos/cosmos-sdk/issues/1941)(https://github.com/cosmos/cosmos-sdk/issues/1941) Version is now inferred via `git describe --tags`. + * [x/distribution] [\#1671](https://github.com/cosmos/cosmos-sdk/issues/1671) add distribution types and tests + +* SDK + * [tools] Make get_vendor_deps deletes `.vendor-new` directories, in case scratch files are present. + * [spec] Added simple piggy bank distribution spec + * [cli] [\#1632](https://github.com/cosmos/cosmos-sdk/issues/1632) Add integration tests to ensure `basecoind init && basecoind` start sequences run successfully for both `democoin` and `basecoin` examples. + * [store] Speedup IAVL iteration, and consequently everything that requires IAVL iteration. [#2143](https://github.com/cosmos/cosmos-sdk/issues/2143) + * [store] [\#1952](https://github.com/cosmos/cosmos-sdk/issues/1952), [\#2281](https://github.com/cosmos/cosmos-sdk/issues/2281) Update IAVL dependency to v0.11.0 + * [simulation] Make timestamps randomized [#2153](https://github.com/cosmos/cosmos-sdk/pull/2153) + * [simulation] Make logs not just pure strings, speeding it up by a large factor at greater block heights [\#2282](https://github.com/cosmos/cosmos-sdk/issues/2282) + * [simulation] Add a concept of weighting the operations [\#2303](https://github.com/cosmos/cosmos-sdk/issues/2303) + * [simulation] Logs get written to file if large, and also get printed on panics [\#2285](https://github.com/cosmos/cosmos-sdk/issues/2285) + * [simulation] Bank simulations now makes testing auth configurable [\#2425](https://github.com/cosmos/cosmos-sdk/issues/2425) + * [gaiad] [\#1992](https://github.com/cosmos/cosmos-sdk/issues/1992) Add optional flag to `gaiad testnet` to make config directory of daemon (default `gaiad`) and cli (default `gaiacli`) configurable + * [x/stake] Add stake `Queriers` for Gaia-lite endpoints. This increases the staking endpoints performance by reusing the staking `keeper` logic for queries. [#2249](https://github.com/cosmos/cosmos-sdk/pull/2149) + * [store] [\#2017](https://github.com/cosmos/cosmos-sdk/issues/2017) Refactor + gas iterator gas consumption to only consume gas for iterator creation and `Next` + calls which includes dynamic consumption of value length. + * [types/decimal] [\#2378](https://github.com/cosmos/cosmos-sdk/issues/2378) - Added truncate functionality to decimal + * [client] [\#1184](https://github.com/cosmos/cosmos-sdk/issues/1184) Remove unused `client/tx/sign.go`. + * [tools] [\#2464](https://github.com/cosmos/cosmos-sdk/issues/2464) Lock binary dependencies to a specific version + * #2573 [x/distribution] add accum invariance + +BUG FIXES + +* Gaia CLI (`gaiacli`) + * [cli] [\#1997](https://github.com/cosmos/cosmos-sdk/issues/1997) Handle panics gracefully when `gaiacli stake {delegation,unbond}` fail to unmarshal delegation. + * [cli] [\#2265](https://github.com/cosmos/cosmos-sdk/issues/2265) Fix JSON formatting of the `gaiacli send` command. + * [cli] [\#2547](https://github.com/cosmos/cosmos-sdk/issues/2547) Mark --to and --amount as required flags for `gaiacli tx send`. + +* Gaia + * [x/stake] Return correct Tendermint validator update set on `EndBlocker` by not + including non previously bonded validators that have zero power. [#2189](https://github.com/cosmos/cosmos-sdk/issues/2189) + * [docs] Fixed light client section links + +* SDK + * [\#1988](https://github.com/cosmos/cosmos-sdk/issues/1988) Make us compile on OpenBSD (disable ledger) [#1988] (https://github.com/cosmos/cosmos-sdk/issues/1988) + * [\#2105](https://github.com/cosmos/cosmos-sdk/issues/2105) Fix DB Iterator leak, which may leak a go routine. + * [ledger] [\#2064](https://github.com/cosmos/cosmos-sdk/issues/2064) Fix inability to sign and send transactions via the LCD by + loading a Ledger device at runtime. + * [\#2158](https://github.com/cosmos/cosmos-sdk/issues/2158) Fix non-deterministic ordering of validator iteration when slashing in `gov EndBlocker` + * [simulation] [\#1924](https://github.com/cosmos/cosmos-sdk/issues/1924) Make simulation stop on SIGTERM + * [\#2388](https://github.com/cosmos/cosmos-sdk/issues/2388) Remove dependency on deprecated tendermint/tmlibs repository. + * [\#2416](https://github.com/cosmos/cosmos-sdk/issues/2416) Refactored `InitializeTestLCD` to properly include proposing validator in genesis state. + * #2573 [x/distribution] accum invariance bugfix + * #2573 [x/slashing] unbonding-delegation slashing invariance bugfix + +## 0.24.2 + +_August 22nd, 2018_ + +BUG FIXES + +* Tendermint + - Fix unbounded consensus WAL growth + +## 0.24.1 + +_August 21st, 2018_ + +BUG FIXES + +* Gaia + - [x/slashing] Evidence tracking now uses validator address instead of validator pubkey + +## 0.24.0 + +_August 13th, 2018_ + +BREAKING CHANGES + +* Gaia REST API (`gaiacli advanced rest-server`) + - [x/stake] [\#1880](https://github.com/cosmos/cosmos-sdk/issues/1880) More REST-ful endpoints (large refactor) + - [x/slashing] [\#1866](https://github.com/cosmos/cosmos-sdk/issues/1866) `/slashing/signing_info` takes cosmosvalpub instead of cosmosvaladdr + - use time.Time instead of int64 for time. See Tendermint v0.23.0 + - Signatures are no longer Amino encoded with prefixes (just encoded as raw + bytes) - see Tendermint v0.23.0 + +* Gaia CLI (`gaiacli`) + - [x/stake] change `--keybase-sig` to `--identity` + - [x/stake] [\#1828](https://github.com/cosmos/cosmos-sdk/issues/1828) Force user to specify amount on create-validator command by removing default + - [x/gov] Change `--proposalID` to `--proposal-id` + - [x/stake, x/gov] [\#1606](https://github.com/cosmos/cosmos-sdk/issues/1606) Use `--from` instead of adhoc flags like `--address-validator` + and `--proposer` to indicate the sender address. + - [\#1551](https://github.com/cosmos/cosmos-sdk/issues/1551) Remove `--name` completely + - Genesis/key creation (`gaiad init`) now supports user-provided key passwords + +* Gaia + - [x/stake] Inflation doesn't use rationals in calculation (performance boost) + - [x/stake] Persist a map from `addr->pubkey` in the state since BeginBlock + doesn't provide pubkeys. + - [x/gov] [\#1781](https://github.com/cosmos/cosmos-sdk/issues/1781) Added tags sub-package, changed tags to use dash-case + - [x/gov] [\#1688](https://github.com/cosmos/cosmos-sdk/issues/1688) Governance parameters are now stored in globalparams store + - [x/gov] [\#1859](https://github.com/cosmos/cosmos-sdk/issues/1859) Slash validators who do not vote on a proposal + - [x/gov] [\#1914](https://github.com/cosmos/cosmos-sdk/issues/1914) added TallyResult type that gets stored in Proposal after tallying is finished + +* SDK + - [baseapp] Msgs are no longer run on CheckTx, removed `ctx.IsCheckTx()` + - [baseapp] NewBaseApp constructor takes sdk.TxDecoder as argument instead of wire.Codec + - [types] sdk.NewCoin takes sdk.Int, sdk.NewInt64Coin takes int64 + - [x/auth] Default TxDecoder can be found in `x/auth` rather than baseapp + - [client] [\#1551](https://github.com/cosmos/cosmos-sdk/issues/1551): Refactored `CoreContext` to `TxContext` and `QueryContext` + - Removed all tx related fields and logic (building & signing) to separate + structure `TxContext` in `x/auth/client/context` + +* Tendermint + - v0.22.5 -> See [Tendermint PR](https://github.com/tendermint/tendermint/pull/1966) + - change all the cryptography imports. + - v0.23.0 -> See + [Changelog](https://github.com/tendermint/tendermint/blob/v0.23.0/CHANGELOG.md#0230) + and [SDK PR](https://github.com/cosmos/cosmos-sdk/pull/1927) + - BeginBlock no longer includes crypto.Pubkey + - use time.Time instead of int64 for time. + +FEATURES + +* Gaia REST API (`gaiacli advanced rest-server`) + - [x/gov] Can now query governance proposals by ProposalStatus + +* Gaia CLI (`gaiacli`) + - [x/gov] added `query-proposals` command. Can filter by `depositer`, `voter`, and `status` + - [x/stake] [\#2043](https://github.com/cosmos/cosmos-sdk/issues/2043) Added staking query cli cmds for unbonding-delegations and redelegations + +* Gaia + - [networks] Added ansible scripts to upgrade seed nodes on a network + +* SDK + - [x/mock/simulation] Randomized simulation framework + - Modules specify invariants and operations, preferably in an x/[module]/simulation package + - Modules can test random combinations of their own operations + - Applications can integrate operations and invariants from modules together for an integrated simulation + - Simulates Tendermint's algorithm for validator set updates + - Simulates validator signing/downtime with a Markov chain, and occaisional double-signatures + - Includes simulated operations & invariants for staking, slashing, governance, and bank modules + - [store] [\#1481](https://github.com/cosmos/cosmos-sdk/issues/1481) Add transient store + - [baseapp] Initialize validator set on ResponseInitChain + - [baseapp] added BaseApp.Seal - ability to seal baseapp parameters once they've been set + - [cosmos-sdk-cli] New `cosmos-sdk-cli` tool to quickly initialize a new + SDK-based project + - [scripts] added log output monitoring to DataDog using Ansible scripts -### Improvements +IMPROVEMENTS -* [#9576](https://github.com/cosmos/cosmos-sdk/pull/9576) Add debug error message to query result when enabled -* (types) [#11200](https://github.com/cosmos/cosmos-sdk/pull/11200) Added `Min()` and `Max()` operations on sdk.Coins. -* [#11267](https://github.com/cosmos/cosmos-sdk/pull/11267) Add hooks to allow app modules to add things to state-sync (backport #10961). +* Gaia + - [spec] [\#967](https://github.com/cosmos/cosmos-sdk/issues/967) Inflation and distribution specs drastically improved + - [x/gov] [\#1773](https://github.com/cosmos/cosmos-sdk/issues/1773) Votes on a proposal can now be queried + - [x/gov] Initial governance parameters can now be set in the genesis file + - [x/stake] [\#1815](https://github.com/cosmos/cosmos-sdk/issues/1815) Sped up the processing of `EditValidator` txs. + - [config] [\#1930](https://github.com/cosmos/cosmos-sdk/issues/1930) Transactions indexer indexes all tags by default. + - [ci] [#2057](https://github.com/cosmos/cosmos-sdk/pull/2057) Run `make localnet-start` on every commit and ensure network reaches at least 10 blocks -## [v0.45.1](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.45.1) - 2022-02-03 +* SDK + - [baseapp] [\#1587](https://github.com/cosmos/cosmos-sdk/issues/1587) Allow any alphanumeric character in route + - [baseapp] Allow any alphanumeric character in route + - [tools] Remove `rm -rf vendor/` from `make get_vendor_deps` + - [x/auth] Recover ErrorOutOfGas panic in order to set sdk.Result attributes correctly + - [x/auth] [\#2376](https://github.com/cosmos/cosmos-sdk/issues/2376) No longer runs any signature in a multi-msg, if any account/sequence number is wrong. + - [x/auth] [\#2376](https://github.com/cosmos/cosmos-sdk/issues/2376) No longer charge gas for subtracting fees + - [x/bank] Unit tests are now table-driven + - [tests] Add tests to example apps in docs + - [tests] Fixes ansible scripts to work with AWS too + - [tests] [\#1806](https://github.com/cosmos/cosmos-sdk/issues/1806) CLI tests are now behind the build flag 'cli_test', so go test works on a new repo -### Bug Fixes +BUG FIXES -* (grpc) [#10985](https://github.com/cosmos/cosmos-sdk/pull/10992) The `/cosmos/tx/v1beta1/txs/{hash}` endpoint returns a 404 when a tx does not exist. -* [#10990](https://github.com/cosmos/cosmos-sdk/pull/10990) Fixes missing `iavl-cache-size` config parsing in `GetConfig` method. -* [#11222](https://github.com/cosmos/cosmos-sdk/pull/11222) reject query with block height in the future +* Gaia CLI (`gaiacli`) + - [\#1766](https://github.com/cosmos/cosmos-sdk/issues/1766) Fixes bad example for keybase identity + - [x/stake] [\#2021](https://github.com/cosmos/cosmos-sdk/issues/2021) Fixed repeated CLI commands in staking -### Improvements +* Gaia + - [x/stake] [#2077](https://github.com/cosmos/cosmos-sdk/pull/2077) Fixed invalid cliff power comparison + - [\#1804](https://github.com/cosmos/cosmos-sdk/issues/1804) Fixes gen-tx genesis generation logic temporarily until upstream updates + - [\#1799](https://github.com/cosmos/cosmos-sdk/issues/1799) Fix `gaiad export` + - [\#1839](https://github.com/cosmos/cosmos-sdk/issues/1839) Fixed bug where intra-tx counter wasn't set correctly for genesis validators + - [x/stake] [\#1858](https://github.com/cosmos/cosmos-sdk/issues/1858) Fixed bug where the cliff validator was not updated correctly + - [tests] [\#1675](https://github.com/cosmos/cosmos-sdk/issues/1675) Fix non-deterministic `test_cover` + - [tests] [\#1551](https://github.com/cosmos/cosmos-sdk/issues/1551) Fixed invalid LCD test JSON payload in `doIBCTransfer` + - [basecoin] Fixes coin transaction failure and account query [discussion](https://forum.cosmos.network/t/unmarshalbinarybare-expected-to-read-prefix-bytes-75fbfab8-since-it-is-registered-concrete-but-got-0a141dfa/664/6) + - [x/gov] [\#1757](https://github.com/cosmos/cosmos-sdk/issues/1757) Fix VoteOption conversion to String + * [x/stake] [#2083] Fix broken invariant of bonded validator power decrease -* [#10407](https://github.com/cosmos/cosmos-sdk/pull/10407) Added validation to `x/upgrade` module's `BeginBlock` to check accidental binary downgrades -* [#10768](https://github.com/cosmos/cosmos-sdk/pull/10768) Extra logging in in-place store migrations. +## 0.23.1 -## [v0.45.0](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.45.0) - 2022-01-18 +_July 27th, 2018_ -### State Machine Breaking +BUG FIXES -* [#10833](https://github.com/cosmos/cosmos-sdk/pull/10833) fix reported tx gas used when block gas limit exceeded. -* (auth) [#10536](https://github.com/cosmos/cosmos-sdk/pull/10536]) Enable `SetSequence` for `ModuleAccount`. -* (store) [#10218](https://github.com/cosmos/cosmos-sdk/pull/10218) Charge gas even when there are no entries while seeking. -* (store) [#10247](https://github.com/cosmos/cosmos-sdk/pull/10247) Charge gas for the key length in gas meter. -* (x/gov) [#10740](https://github.com/cosmos/cosmos-sdk/pull/10740) Increase maximum proposal description size from 5k characters to 10k characters. -* [#10814](https://github.com/cosmos/cosmos-sdk/pull/10814) revert tx when block gas limit exceeded. +* [tendermint] Update to v0.22.8 + - [consensus, blockchain] Register the Evidence interface so it can be + marshalled/unmarshalled by the blockchain and consensus reactors -### API Breaking Changes +## 0.23.0 -* [#10561](https://github.com/cosmos/cosmos-sdk/pull/10561) The `CommitMultiStore` interface contains a new `SetIAVLCacheSize` method -* [#10922](https://github.com/cosmos/cosmos-sdk/pull/10922), [/#10956](https://github.com/cosmos/cosmos-sdk/pull/10956) Deprecate key `server.Generate*` functions and move them to `testutil` and support custom mnemonics in in-process testing network. Moved `TestMnemonic` from `testutil` package to `testdata`. -* [#11049](https://github.com/cosmos/cosmos-sdk/pull/11049) Add custom tendermint config variables into root command. Allows App developers to set config.toml variables. +_July 25th, 2018_ -### Features +BREAKING CHANGES -* [#10614](https://github.com/cosmos/cosmos-sdk/pull/10614) Support in-place migration ordering +* [x/stake] Fixed the period check for the inflation calculation -### Improvements +IMPROVEMENTS -* [#10486](https://github.com/cosmos/cosmos-sdk/pull/10486) store/cachekv's `Store.Write` conservatively - looks up keys, but also uses the [map clearing idiom](https://bencher.orijtech.com/perfclinic/mapclearing/) - to reduce the RAM usage, CPU time usage, and garbage collection pressure from clearing maps, - instead of allocating new maps. -* (module) [#10711](https://github.com/cosmos/cosmos-sdk/pull/10711) Panic at startup if the app developer forgot to add modules in the `SetOrder{BeginBlocker, EndBlocker, InitGenesis, ExportGenesis}` functions. This means that all modules, even those who have empty implementations for those methods, need to be added to `SetOrder*`. -* (types) [#10076](https://github.com/cosmos/cosmos-sdk/pull/10076) Significantly speedup and lower allocations for `Coins.String()`. -* (auth) [#10022](https://github.com/cosmos/cosmos-sdk/pull/10022) `AuthKeeper` interface in `x/auth` now includes a function `HasAccount`. -* [#10393](https://github.com/cosmos/cosmos-sdk/pull/10393) Add `HasSupply` method to bank keeper to ensure that input denom actually exists on chain. +* [cli] Improve error messages for all txs when the account doesn't exist +* [tendermint] Update to v0.22.6 + - Updates the crypto imports/API (#1966) +* [x/stake] Add revoked to human-readable validator + +BUG FIXES + +* [tendermint] Update to v0.22.6 + - Fixes some security vulnerabilities reported in the [Bug Bounty](https://hackerone.com/tendermint) +* [\#1797](https://github.com/cosmos/cosmos-sdk/issues/1797) Fix off-by-one error in slashing for downtime +* [\#1787](https://github.com/cosmos/cosmos-sdk/issues/1787) Fixed bug where Tally fails due to revoked/unbonding validator +* [\#1666](https://github.com/cosmos/cosmos-sdk/issues/1666) Add intra-tx counter to the genesis validators + +## 0.22.0 + +_July 16th, 2018_ + +BREAKING CHANGES + +* [x/gov] Increase VotingPeriod, DepositPeriod, and MinDeposit + +IMPROVEMENTS + +* [gaiad] Default config updates: + - `timeout_commit=5000` so blocks only made every 5s + - `prof_listen_addr=localhost:6060` so profile server is on by default + - `p2p.send_rate` and `p2p.recv_rate` increases 10x (~5MB/s) + +BUG FIXES + +* [server] Fix to actually overwrite default tendermint config + +## 0.21.1 + +_July 14th, 2018_ + +BUG FIXES + +* [build] Added Ledger build support via `LEDGER_ENABLED=true|false` + * True by default except when cross-compiling + +## 0.21.0 + +_July 13th, 2018_ + +BREAKING CHANGES + +* [x/stake] Specify DelegatorAddress in MsgCreateValidator +* [x/stake] Remove the use of global shares in the pool + * Remove the use of `PoolShares` type in `x/stake/validator` type - replace with `Status` `Tokens` fields +* [x/auth] NewAccountMapper takes a constructor instead of a prototype +* [keys] Keybase.Update function now takes in a function to get the newpass, rather than the password itself + +FEATURES + +* [baseapp] NewBaseApp now takes option functions as parameters + +IMPROVEMENTS + +* Updated docs folder to accommodate cosmos.network docs project +* [store] Added support for tracing multi-store operations via `--trace-store` +* [store] Pruning strategy configurable with pruning flag on gaiad start + +BUG FIXES + +* [\#1630](https://github.com/cosmos/cosmos-sdk/issues/1630) - redelegation nolonger removes tokens from the delegator liquid account +* [keys] [\#1629](https://github.com/cosmos/cosmos-sdk/issues/1629) - updating password no longer asks for a new password when the first entered password was incorrect +* [lcd] importing an account would create a random account +* [server] 'gaiad init' command family now writes provided name as the moniker in `config.toml` +* [build] Added Ledger build support via `LEDGER_ENABLED=true|false` + * True by default except when cross-compiling + +## 0.20.0 + +_July 10th, 2018_ + +BREAKING CHANGES + +* msg.GetSignBytes() returns sorted JSON (by key) +* msg.GetSignBytes() field changes + * `msg_bytes` -> `msgs` + * `fee_bytes` -> `fee` +* Update Tendermint to v0.22.2 + * Default ports changed from 466xx to 266xx + * Amino JSON uses type names instead of prefix bytes + * ED25519 addresses are the first 20-bytes of the SHA256 of the raw 32-byte + pubkey (Instead of RIPEMD160) + * go-crypto, abci, tmlibs have been merged into Tendermint + * The keys sub-module is now in the SDK + * Various other fixes +* [auth] Signers of a transaction now only sign over their own account and sequence number +* [auth] Removed MsgChangePubKey +* [auth] Removed SetPubKey from account mapper +* [auth] AltBytes renamed to Memo, now a string, max 100 characters, costs a bit of gas +* [types] `GetMsg()` -> `GetMsgs()` as txs wrap many messages +* [types] Removed GetMemo from Tx (it is still on StdTx) +* [types] renamed rational.Evaluate to rational.Round{Int64, Int} +* [types] Renamed `sdk.Address` to `sdk.AccAddress`/`sdk.ValAddress` +* [types] `sdk.AccAddress`/`sdk.ValAddress` natively marshals to Bech32 in String, Sprintf (when used with `%s`), and MarshalJSON +* [keys] Keybase and Ledger support from go-crypto merged into the SDK in the `crypto` folder +* [cli] Rearranged commands under subcommands +* [x/slashing] Update slashing for unbonding period + * Slash according to power at time of infraction instead of power at + time of discovery + * Iterate through unbonding delegations & redelegations which contributed + to an infraction, slash them proportional to their stake at the time + * Add REST endpoint to unrevoke a validator previously revoked for downtime + * Add REST endpoint to retrieve liveness signing information for a validator +* [x/stake] Remove Tick and add EndBlocker +* [x/stake] most index keys nolonger hold a value - inputs are rearranged to form the desired key +* [x/stake] store-value for delegation, validator, ubd, and red do not hold duplicate information contained store-key +* [x/stake] Introduce concept of unbonding for delegations and validators + * `gaiacli stake unbond` replaced with `gaiacli stake begin-unbonding` + * Introduced: + * `gaiacli stake complete-unbonding` + * `gaiacli stake begin-redelegation` + * `gaiacli stake complete-redelegation` +* [lcd] Switch key creation output to return bech32 +* [lcd] Removed shorthand CLI flags (`a`, `c`, `n`, `o`) +* [gaiad] genesis transactions now use bech32 addresses / pubkeys +* [gov] VoteStatus renamed to ProposalStatus +* [gov] VoteOption, ProposalType, and ProposalStatus all marshal to string form in JSON + +DEPRECATED + +* [cli] Deprecated `--name` flag in commands that send txs, in favor of `--from` + +FEATURES + +* [x/gov] Implemented MVP + * Supported proposal types: just binary (pass/fail) TextProposals for now + * Proposals need deposits to be votable; deposits are burned if proposal fails + * Delegators delegate votes to validator by default but can override (for their stake) +* [gaiacli] Ledger support added + - You can now use a Ledger with `gaiacli --ledger` for all key-related commands + - Ledger keys can be named and tracked locally in the key DB +* [gaiacli] You can now attach a simple text-only memo to any transaction, with the `--memo` flag +* [gaiacli] added the following flags for commands that post transactions to the chain: + * async -- send the tx without waiting for a tendermint response + * json -- return the output in json format for increased readability + * print-response -- return the tx response. (includes fields like gas cost) +* [lcd] Queried TXs now include the tx hash to identify each tx +* [mockapp] CompleteSetup() no longer takes a testing parameter +* [x/bank] Add benchmarks for signing and delivering a block with a single bank transaction + * Run with `cd x/bank && go test --bench=.` +* [tools] make get_tools installs tendermint's linter, and gometalinter +* [tools] Switch gometalinter to the stable version +* [tools] Add the following linters + * misspell + * gofmt + * go vet -composites=false + * unconvert + * ineffassign + * errcheck + * unparam + * gocyclo +* [tools] Added `make format` command to automate fixing misspell and gofmt errors. +* [server] Default config now creates a profiler at port 6060, and increase p2p send/recv rates +* [types] Switches internal representation of Int/Uint/Rat to use pointers +* [types] Added MinInt and MinUint functions +* [gaiad] `unsafe_reset_all` now resets addrbook.json +* [democoin] add x/oracle, x/assoc +* [tests] created a randomized testing framework. + - Currently bank has limited functionality in the framework + - Auth has its invariants checked within the framework +* [tests] Add WaitForNextNBlocksTM helper method +* [keys] New keys now have 24 word recovery keys, for heightened security + +- [keys] Add a temporary method for exporting the private key + +IMPROVEMENTS + +* [x/bank] Now uses go-wire codec instead of 'encoding/json' +* [x/auth] Now uses go-wire codec instead of 'encoding/json' +* revised use of endblock and beginblock +* [stake] module reorganized to include `types` and `keeper` package +* [stake] keeper always loads the store (instead passing around which doesn't really boost efficiency) +* [stake] edit-validator changes now can use the keyword [do-not-modify] to not modify unspecified `--flag` (aka won't set them to `""` value) +* [stake] offload more generic functionality from the handler into the keeper +* [stake] clearer staking logic +* [types] added common tag constants +* [keys] improve error message when deleting non-existent key +* [gaiacli] improve error messages on `send` and `account` commands +* added contributing guidelines +* [docs] Added commands for governance CLI on testnet README + +BUG FIXES + +* [x/slashing] [\#1510](https://github.com/cosmos/cosmos-sdk/issues/1510) Unrevoked validators cannot un-revoke themselves +* [x/stake] [\#1513](https://github.com/cosmos/cosmos-sdk/issues/1513) Validators slashed to zero power are unbonded and removed from the store +* [x/stake] [\#1567](https://github.com/cosmos/cosmos-sdk/issues/1567) Validators decreased in power but not unbonded are now updated in Tendermint +* [x/stake] error strings lower case +* [x/stake] pool loose tokens now accounts for unbonding and unbonding tokens not associated with any validator +* [x/stake] fix revoke bytes ordering (was putting revoked candidates at the top of the list) +* [x/stake] bond count was counting revoked validators as bonded, fixed +* [gaia] Added self delegation for validators in the genesis creation +* [lcd] tests now don't depend on raw json text +* Retry on HTTP request failure in CLI tests, add option to retry tests in Makefile +* Fixed bug where chain ID wasn't passed properly in x/bank REST handler, removed Viper hack from ante handler +* Fixed bug where `democli account` didn't decode the account data correctly +* [\#872](https://github.com/cosmos/cosmos-sdk/issues/872) - recovery phrases no longer all end in `abandon` +* [\#887](https://github.com/cosmos/cosmos-sdk/issues/887) - limit the size of rationals that can be passed in from user input +* [\#1052](https://github.com/cosmos/cosmos-sdk/issues/1052) - Make all now works +* [\#1258](https://github.com/cosmos/cosmos-sdk/issues/1258) - printing big.rat's can no longer overflow int64 +* [\#1259](https://github.com/cosmos/cosmos-sdk/issues/1259) - fix bug where certain tests that could have a nil pointer in defer +* [\#1343](https://github.com/cosmos/cosmos-sdk/issues/1343) - fixed unnecessary parallelism in CI +* [\#1353](https://github.com/cosmos/cosmos-sdk/issues/1353) - CLI: Show pool shares fractions in human-readable format +* [\#1367](https://github.com/cosmos/cosmos-sdk/issues/1367) - set ChainID in InitChain +* [\#1461](https://github.com/cosmos/cosmos-sdk/issues/1461) - CLI tests now no longer reset your local environment data +* [\#1505](https://github.com/cosmos/cosmos-sdk/issues/1505) - `gaiacli stake validator` no longer panics if validator doesn't exist +* [\#1565](https://github.com/cosmos/cosmos-sdk/issues/1565) - fix cliff validator persisting when validator set shrinks from max +* [\#1287](https://github.com/cosmos/cosmos-sdk/issues/1287) - prevent zero power validators at genesis +* [x/stake] fix bug when unbonding/redelegating using `--shares-percent` +* [\#1010](https://github.com/cosmos/cosmos-sdk/issues/1010) - two validators can't bond with the same pubkey anymore + +## 0.19.0 + +_June 13, 2018_ + +BREAKING CHANGES + +* msg.GetSignBytes() now returns bech32-encoded addresses in all cases +* [lcd] REST end-points now include gas +* sdk.Coin now uses sdk.Int, a big.Int wrapper with 256bit range cap + +FEATURES + +* [x/auth] Added AccountNumbers to BaseAccount and StdTxs to allow for replay protection with account pruning +* [lcd] added an endpoint to query for the SDK version of the connected node + +IMPROVEMENTS + +* export command now writes current validator set for Tendermint +* [tests] Application module tests now use a mock application +* [gaiacli] Fix error message when account isn't found when running gaiacli account +* [lcd] refactored to eliminate use of global variables, and interdependent tests +* [tests] Added testnet command to gaiad +* [tests] Added localnet targets to Makefile +* [x/stake] More stake tests added to test ByPower index + +FIXES + +* Fixes consensus fault on testnet - see postmortem [here](https://github.com/cosmos/cosmos-sdk/issues/1197#issuecomment-396823021) +* [x/stake] bonded inflation removed, non-bonded inflation partially implemented +* [lcd] Switch to bech32 for addresses on all human readable inputs and outputs +* [lcd] fixed tx indexing/querying +* [cli] Added `--gas` flag to specify transaction gas limit +* [gaia] Registered slashing message handler +* [x/slashing] Set signInfo.StartHeight correctly for newly bonded validators + +FEATURES + +* [docs] Reorganize documentation +* [docs] Update staking spec, create WIP spec for slashing, and fees + +## 0.18.0 + +_June 9, 2018_ + +BREAKING CHANGES + +* [stake] candidate -> validator throughout (details in refactor comment) +* [stake] delegate-bond -> delegation throughout +* [stake] `gaiacli query validator` takes and argument instead of using the `--address-candidate` flag +* [stake] introduce `gaiacli query delegations` +* [stake] staking refactor + * ValidatorsBonded store now take sorted pubKey-address instead of validator owner-address, + is sorted like Tendermint by pk's address + * store names more understandable + * removed temporary ToKick store, just needs a local map! + * removed distinction between candidates and validators + * everything is now a validator + * only validators with a status == bonded are actively validating/receiving rewards + * Introduction of Unbonding fields, lowlevel logic throughout (not fully implemented with queue) + * Introduction of PoolShares type within validators, + replaces three rational fields (BondedShares, UnbondingShares, UnbondedShares +* [x/auth] move stuff specific to auth anteHandler to the auth module rather than the types folder. This includes: + * StdTx (and its related stuff i.e. StdSignDoc, etc) + * StdFee + * StdSignature + * Account interface + * Related to this organization, I also: +* [x/auth] got rid of AccountMapper interface (in favor of the struct already in auth module) +* [x/auth] removed the FeeHandler function from the AnteHandler, Replaced with FeeKeeper +* [x/auth] Removed GetSignatures() from Tx interface (as different Tx styles might use something different than StdSignature) +* [store] Removed SubspaceIterator and ReverseSubspaceIterator from KVStore interface and replaced them with helper functions in /types +* [cli] rearranged commands under subcommands +* [stake] remove Tick and add EndBlocker +* Switch to bech32cosmos on all human readable inputs and outputs + +FEATURES + +* [x/auth] Added ability to change pubkey to auth module +* [baseapp] baseapp now has settable functions for filtering peers by address/port & public key +* [sdk] Gas consumption is now measured as transactions are executed + * Transactions which run out of gas stop execution and revert state changes + * A "simulate" query has been added to determine how much gas a transaction will need + * Modules can include their own gas costs for execution of particular message types +* [stake] Seperation of fee distribution to a new module +* [stake] Creation of a validator/delegation generics in `/types` +* [stake] Helper Description of the store in x/stake/store.md +* [stake] removed use of caches in the stake keeper +* [stake] Added REST API +* [Makefile] Added terraform/ansible playbooks to easily create remote testnets on Digital Ocean + +BUG FIXES -### Bug Fixes +* [#10614](https://github.com/cosmos/cosmos-sdk/pull/10614) Support in-place migration ordering + +## 0.17.5 + +_June 5, 2018_ * (std/codec) [/#10595](https://github.com/cosmos/cosmos-sdk/pull/10595) Add evidence to std/codec to be able to decode evidence in client interactions. * (types) [#9627](https://github.com/cosmos/cosmos-sdk/pull/9627) Fix nil pointer panic on `NewBigIntFromInt`. @@ -2474,35 +4433,32 @@ empty coins slice before it is used to create `banktype.MsgSend`. ## [v0.44.8](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.44.8) - 2022-04-12 -### Improvements +_May 31, 2018_ * [#11563](https://github.com/cosmos/cosmos-sdk/pull/11563) Updated Tendermint to v0.34.19; `unsafe-reset-all` command has been moved to the `tendermint` sub-command. ## [v0.44.7](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.44.7) - 2022-04-04 -### Features +_May 29, 2018_ * (x/bank) [#10771](https://github.com/cosmos/cosmos-sdk/pull/10771) Add safety check on bank module perms to allow module-specific mint restrictions (e.g. only minting a certain denom). * (x/bank) [#10771](https://github.com/cosmos/cosmos-sdk/pull/10771) Add `bank.BankKeeper.WithMintCoinsRestriction` function to restrict use of bank `MintCoins` usage. This function is not on the bank `Keeper` interface, so it's not API-breaking, but only additive on the keeper implementation. ### Bug Fixes -* [#11354](https://github.com/cosmos/cosmos-sdk/pull/11355) Added missing pagination flag for `bank q total` query. -* (store) [#11177](https://github.com/cosmos/cosmos-sdk/pull/11177) Update the prune `everything` strategy to store the last two heights. -* (store) [#11117](https://github.com/cosmos/cosmos-sdk/pull/11117) Fix data race in store trace component -* (x/authz) [#11252](https://github.com/cosmos/cosmos-sdk/pull/11252) Allow insufficient funds error for authz simulation +_June 5, 2018_ ### Improvements * [#9576](https://github.com/cosmos/cosmos-sdk/pull/9576) Add debug error message to query result when enabled -## [v0.44.6](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.44.6) - 2022-02-02 +_May 31, 2018_ ### Features * [#11124](https://github.com/cosmos/cosmos-sdk/pull/11124) Add `GetAllVersions` to application store -### Bug Fixes +_May 29, 2018_ * (grpc) [#10985](https://github.com/cosmos/cosmos-sdk/pull/10992) The `/cosmos/tx/v1beta1/txs/{hash}` endpoint returns a 404 when a tx does not exist. * (std/codec) [/#10595](https://github.com/cosmos/cosmos-sdk/pull/10595) Add evidence to std/codec to be able to decode evidence in client interactions. @@ -2540,23 +4496,35 @@ replace github.com/confio/ics23/go => github.com/cosmos/cosmos-sdk/ics23/go v0.8 ## [v0.44.4](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.44.4) - 2021-11-25 -### Improvements - -* (types) [#10630](https://github.com/cosmos/cosmos-sdk/pull/10630) Add an `Events` field to the `TxResponse` type that captures *all* events emitted by a transaction, unlike `Logs` which only contains events emitted during message execution. -* (x/upgrade) [#10532](https://github.com/cosmos/cosmos-sdk/pull/10532) Add `keeper.DumpUpgradeInfoWithInfoToDisk` to include `Plan.Info` in the upgrade-info file. -* (store) [#10544](https://github.com/cosmos/cosmos-sdk/pull/10544) Use the new IAVL iterator structure which significantly improves iterator performance. +## 0.16.0 (May 14th, 2018) ### Bug Fixes -* [#10827](https://github.com/cosmos/cosmos-sdk/pull/10827) Create query `Context` with requested block height -* [#10414](https://github.com/cosmos/cosmos-sdk/pull/10414) Use `sdk.GetConfig().GetFullBIP44Path()` instead `sdk.FullFundraiserPath` to generate key -* (bank) [#10394](https://github.com/cosmos/cosmos-sdk/pull/10394) Fix: query account balance by ibc denom. -* [\10608](https://github.com/cosmos/cosmos-sdk/pull/10608) Change the order of module migration by pushing x/auth to the end. Auth module depends on other modules and should be run last. We have updated the documentation to provide more details how to change module migration order. This is technically a breaking change, but only impacts updates between the upgrades with version change, hence migrating from the previous patch release doesn't cause new migration and doesn't break the state. -* [#10674](https://github.com/cosmos/cosmos-sdk/pull/10674) Fix issue with `Error.Wrap` and `Error.Wrapf` usage with `errors.Is`. +* Move module REST/CLI packages to x/[module]/client/rest and x/[module]/client/cli +* Gaia simple-staking bond and unbond functions replaced +* [stake] Delegator bonds now store the height at which they were updated +* All module keepers now require a codespace, see basecoin or democoin for usage +* Many changes to names throughout + * Type as a prefix naming convention applied (ex. BondMsg -> MsgBond) + * Removed redundancy in names (ex. stake.StakingKeeper -> stake.Keeper) +* Removed SealedAccountMapper +* gaiad init now requires use of `--name` flag +* Removed Get from Msg interface +* types/rational now extends big.Rat ## [v0.44.3](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.44.3) - 2021-10-21 -### Improvements +* Gaia stake commands include, CreateValidator, EditValidator, Delegate, Unbond +* MountStoreWithDB without providing a custom store works. +* Repo is now lint compliant / GoMetaLinter with tendermint-lint integrated into CI +* Better key output, pubkey go-amino hex bytes now output by default +* gaiad init overhaul + * Create genesis transactions with `gaiad init gen-tx` + * New genesis account keys are automatically added to the client keybase (introduce `--client-home` flag) + * Initialize with genesis txs using `--gen-txs` flag +* Context now has access to the application-configured logger +* Add (non-proof) subspace query helper functions +* Add more staking query functions: candidates, delegator-bonds * [#10768](https://github.com/cosmos/cosmos-sdk/pull/10768) Added extra logging for tracking in-place store migrations * [#10262](https://github.com/cosmos/cosmos-sdk/pull/10262) Remove unnecessary logging in `x/feegrant` simulation. @@ -2568,21 +4536,13 @@ replace github.com/confio/ics23/go => github.com/cosmos/cosmos-sdk/ics23/go v0.8 ### Bug Fixes -* (client) [#10226](https://github.com/cosmos/cosmos-sdk/pull/10226) Fix --home flag parsing. -* (rosetta) [#10340](https://github.com/cosmos/cosmos-sdk/pull/10340) Use `GenesisChunked(ctx)` instead `Genesis(ctx)` to get genesis block height - -## [v0.44.2](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.44.2) - 2021-10-12 +## 0.15.1 (April 29, 2018) Security Release. No breaking changes related to 0.44.x. ## [v0.44.1](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.44.1) - 2021-09-29 -### Improvements - -* (store) [#10040](https://github.com/cosmos/cosmos-sdk/pull/10040) Bump IAVL to v0.17.1 which includes performance improvements on a batch load. -* (types) [#10021](https://github.com/cosmos/cosmos-sdk/pull/10021) Speedup coins.AmountOf(), by removing many intermittent regex calls. -* [#10077](https://github.com/cosmos/cosmos-sdk/pull/10077) Remove telemetry on `GasKV` and `CacheKV` store Get/Set operations, significantly improving their performance. -* (store) [#10026](https://github.com/cosmos/cosmos-sdk/pull/10026) Improve CacheKVStore datastructures / algorithms, to no longer take O(N^2) time when interleaving iterators and insertions. +## 0.15.0 (April 29, 2018) ### Bug Fixes @@ -2909,14 +4869,29 @@ This release fixes a security vulnerability identified in x/bank. ### Improvements -* (grpc) [#8815](https://github.com/cosmos/cosmos-sdk/pull/8815) Add orderBy parameter to `TxsByEvents` endpoint. -* (cli) [#8826](https://github.com/cosmos/cosmos-sdk/pull/8826) Add trust to macOS Keychain for caller app by default. -* (store) [#8811](https://github.com/cosmos/cosmos-sdk/pull/8811) store/cachekv: use typed types/kv.List instead of container/list.List +* basecoin + * `basecoin start` supports all flags that `tendermint node` does, such as + `--rpc.laddr`, `--p2p.seeds`, and `--p2p.skip_upnp` + * fully supports `--log_level` and `--trace` for logger configuration + * merkleeyes no longers spams the logs... unless you want it + * Example: `basecoin start --log_level="merkleeyes:info,state:info,*:error"` + * Example: `basecoin start --log_level="merkleeyes:debug,state:info,*:error"` +* basecli + * `basecli init` is more intelligent and only complains if there really was + a connected chain, not just random files + * support `localhost:46657` or `http://localhost:46657` format for nodes, + not just `tcp://localhost:46657` + * Add `--genesis` to init to specify chain-id and validator hash + * Example: `basecli init --node=localhost:46657 --genesis=$HOME/.basecoin/genesis.json` + * `basecli rpc` has a number of methods to easily accept tendermint rpc, and verifies what it can ### Bug Fixes -* (crypto) [#8841](https://github.com/cosmos/cosmos-sdk/pull/8841) Fix legacy multisig amino marshaling, allowing migrations to work between v0.39 and v0.40+. -* (cli tx) [\8873](https://github.com/cosmos/cosmos-sdk/pull/8873) add missing `--output-document` option to `app tx multisign-batch`. +* basecli + * `basecli query account` accepts hex account address with or without `0x` + prefix + * gives error message when running commands on an unitialized chain, rather + than some unintelligable panic ## [v0.42.1](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.42.1) - 2021-03-10 @@ -2924,7 +4899,30 @@ This release fixes security vulnerability identified in the simapp. ## [v0.42.0](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.42.0) - 2021-03-08 -**IMPORTANT**: This release contains an important security fix for all non Cosmos Hub chains running Stargate version of the Cosmos SDK (>0.40). Non-hub chains should not be using any version of the SDK in the v0.40.x or v0.41.x release series. See [#8461](https://github.com/cosmos/cosmos-sdk/pull/8461) for more details. +* ./cmd/commands -> ./cmd/basecoin/commands +* basecli + * `basecli proof state get` -> `basecli query key` + * `basecli proof tx get` -> `basecli query tx` + * `basecli proof state get --app=account` -> `basecli query account` + * use `--chain-id` not `--chainid` for consistency + * update to use `--trace` not `--debug` for stack traces on errors + * complete overhaul on how tx and query subcommands are added. (see counter or trackomatron for examples) + * no longer supports counter app (see new countercli) +* basecoin + * `basecoin init` takes an argument, an address to allocate funds to in the genesis + * removed key2.json + * removed all client side functionality from it (use basecli now for proofs) + * no tx subcommand + * no query subcommand + * no account (query) subcommand + * a few other random ones... + * enhanced relay subcommand + * relay start did what relay used to do + * relay init registers both chains on one another (to set it up so relay start just works) +* docs + * removed `example-plugin`, put `counter` inside `docs/guide` +* app + * Implements ABCI handshake by proxying merkleeyes.Info() ### Improvements @@ -2963,7 +4961,20 @@ he Cosmos Hub) should not use this release or any release in the v0.41.x series. ### Bug Fixes -* [#8617](https://github.com/cosmos/cosmos-sdk/pull/8617) Fix build failures caused by a small API breakage introduced in tendermint v0.34.7. +* basecoin cli + * integrates tendermint 0.10.0 and unifies cli (init, unsafe_reset_all, ...) + * integrate viper, all command line flags can also be defined in environmental variables or config.toml +* genesis file + * you can define accounts with either address or pub_key + * sorts coins for you, so no silent errors if not in alphabetical order +* [light-client](https://github.com/tendermint/light-client) integration + * no longer must you trust the node you connect to, prove everything! + * new [basecli command](./cmd/basecli/README.md) + * integrated [key management](https://github.com/tendermint/go-crypto/blob/master/cmd/README.md), stored encrypted locally + * tracks validator set changes and proves everything from one initial validator seed + * `basecli proof state` gets complete proofs for any abci state + * `basecli proof tx` gets complete proof where a tx was stored in the chain + * `basecli proxy` exposes tendermint rpc, but only passes through results after doing complete verification ## [v0.41.2](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.41.2) - 2021-02-18 diff --git a/proto/cosmos/base/tendermint/v1beta1/query.proto b/proto/cosmos/base/tendermint/v1beta1/query.proto index 98fd8997982b..ca75e54f7fce 100644 --- a/proto/cosmos/base/tendermint/v1beta1/query.proto +++ b/proto/cosmos/base/tendermint/v1beta1/query.proto @@ -140,15 +140,15 @@ message GetNodeInfoResponse { // VersionInfo is the type for the GetNodeInfoResponse message. message VersionInfo { - string name = 1; - string app_name = 2; - string version = 3; - string git_commit = 4; - string build_tags = 5; - string go_version = 6; - repeated Module build_deps = 7; + string name = 1; + string app_name = 2; + string version = 3; + string git_commit = 4; + string build_tags = 5; + string go_version = 6; + repeated Module build_deps = 7; // Since: cosmos-sdk 0.43 - string cosmos_sdk_version = 8; + string cosmos_sdk_version = 8; } // Module is the type for VersionInfo diff --git a/proto/cosmos/store/snapshots/v1/snapshot.proto b/proto/cosmos/store/snapshots/v1/snapshot.proto index 387fc82e4d58..83d714603ed9 100644 --- a/proto/cosmos/store/snapshots/v1/snapshot.proto +++ b/proto/cosmos/store/snapshots/v1/snapshot.proto @@ -45,8 +45,7 @@ message SnapshotIAVLItem { // version is block height int64 version = 3; // height is depth of the tree. - int32 height = 4; - option (cosmos_proto.message_added_in) = "cosmos-sdk 0.46"; + int32 height = 4; } // SnapshotExtensionMeta contains metadata about an external snapshotter. diff --git a/proto/cosmos/tx/signing/v1beta1/signing.proto b/proto/cosmos/tx/signing/v1beta1/signing.proto index 9625234ce68f..584eff4e41fd 100644 --- a/proto/cosmos/tx/signing/v1beta1/signing.proto +++ b/proto/cosmos/tx/signing/v1beta1/signing.proto @@ -43,7 +43,7 @@ enum SignMode { // SIGN_MODE_EIP_191 specifies the sign mode for EIP 191 signing on the Cosmos // SDK. Ref: https://eips.ethereum.org/EIPS/eip-191 - // + // // Currently, SIGN_MODE_EIP_191 is registered as a SignMode enum variant, // but is not implemented on the SDK by default. To enable EIP-191, you need // to pass a custom `TxConfig` that has an implementation of diff --git a/proto/cosmos/tx/v1beta1/service.proto b/proto/cosmos/tx/v1beta1/service.proto index 72753a3c7765..2ca7efda8129 100644 --- a/proto/cosmos/tx/v1beta1/service.proto +++ b/proto/cosmos/tx/v1beta1/service.proto @@ -157,9 +157,9 @@ message GetBlockWithTxsRequest { // Since: cosmos-sdk 0.45.2 message GetBlockWithTxsResponse { // txs are the transactions in the block. - repeated cosmos.tx.v1beta1.Tx txs = 1; - .tendermint.types.BlockID block_id = 2; - .tendermint.types.Block block = 3; + repeated cosmos.tx.v1beta1.Tx txs = 1; + .tendermint.types.BlockID block_id = 2; + .tendermint.types.Block block = 3; // pagination defines a pagination for the response. cosmos.base.query.v1beta1.PageResponse pagination = 4; } \ No newline at end of file diff --git a/types/tx/signing/signing.pb.go b/types/tx/signing/signing.pb.go index 8e62fab6bf8c..31a434b2273e 100644 --- a/types/tx/signing/signing.pb.go +++ b/types/tx/signing/signing.pb.go @@ -59,7 +59,13 @@ const ( // SIGN_MODE_EIP_191 specifies the sign mode for EIP 191 signing on the Cosmos // SDK. Ref: https://eips.ethereum.org/EIPS/eip-191 // - // Since: cosmos-sdk 0.45 + // Currently, SIGN_MODE_EIP_191 is registered as a SignMode enum variant, + // but is not implemented on the SDK by default. To enable EIP-191, you need + // to pass a custom `TxConfig` that has an implementation of + // `SignModeHandler` for EIP-191. The SDK may decide to fully support + // EIP-191 in the future. + // + // Since: cosmos-sdk 0.45.2 SignMode_SIGN_MODE_EIP_191 SignMode = 191 ) @@ -416,43 +422,43 @@ func init() { } var fileDescriptor_9a54958ff3d0b1b9 = []byte{ - // 573 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0xc1, 0x6e, 0xd3, 0x4c, - 0x10, 0xc7, 0xed, 0x26, 0xad, 0xda, 0xe9, 0xa7, 0x4f, 0x66, 0x49, 0x51, 0x6a, 0x90, 0xa9, 0xca, - 0x81, 0x0a, 0xa9, 0x6b, 0xa5, 0x3d, 0xa0, 0x72, 0x73, 0x13, 0x93, 0x9a, 0x36, 0x69, 0xb1, 0x53, - 0xa9, 0x70, 0xb1, 0x6c, 0x67, 0x6b, 0xac, 0xc6, 0x5e, 0xe3, 0x5d, 0xa3, 0xfa, 0xc4, 0x2b, 0xf0, - 0x12, 0x1c, 0x78, 0x0a, 0x0e, 0x5c, 0x38, 0xf6, 0xc8, 0x11, 0x25, 0xcf, 0xc0, 0x1d, 0xc5, 0x8e, - 0x93, 0x80, 0x8a, 0x10, 0x39, 0x59, 0x33, 0xf3, 0xdf, 0xdf, 0xfc, 0x57, 0x33, 0x6b, 0x78, 0xec, - 0x51, 0x16, 0x52, 0xa6, 0xf2, 0x6b, 0x95, 0x05, 0x7e, 0x14, 0x44, 0xbe, 0xfa, 0xae, 0xe1, 0x12, - 0xee, 0x34, 0xca, 0x18, 0xc7, 0x09, 0xe5, 0x14, 0x6d, 0x16, 0x42, 0xcc, 0xaf, 0x71, 0x59, 0x98, - 0x08, 0xe5, 0xdd, 0x09, 0xc3, 0x4b, 0xb2, 0x98, 0x53, 0x35, 0x4c, 0x07, 0x3c, 0x60, 0xc1, 0x0c, - 0x54, 0x26, 0x0a, 0x92, 0xbc, 0xe9, 0x53, 0xea, 0x0f, 0x88, 0x9a, 0x47, 0x6e, 0x7a, 0xa9, 0x3a, - 0x51, 0x56, 0x94, 0xb6, 0x2f, 0xa1, 0x66, 0x05, 0x7e, 0xe4, 0xf0, 0x34, 0x21, 0x2d, 0xc2, 0xbc, - 0x24, 0x88, 0x39, 0x4d, 0x18, 0xea, 0x02, 0xb0, 0x32, 0xcf, 0xea, 0xe2, 0x56, 0x65, 0x67, 0x7d, - 0x0f, 0xe3, 0x3f, 0x3a, 0xc2, 0xb7, 0x40, 0xcc, 0x39, 0xc2, 0xf6, 0x8f, 0x2a, 0xdc, 0xbd, 0x45, - 0x83, 0xf6, 0x01, 0xe2, 0xd4, 0x1d, 0x04, 0x9e, 0x7d, 0x45, 0xb2, 0xba, 0xb8, 0x25, 0xee, 0xac, - 0xef, 0xd5, 0x70, 0xe1, 0x17, 0x97, 0x7e, 0xb1, 0x16, 0x65, 0xe6, 0x5a, 0xa1, 0x3b, 0x26, 0x19, - 0x6a, 0x43, 0xb5, 0xef, 0x70, 0xa7, 0xbe, 0x94, 0xcb, 0xf7, 0xff, 0xcd, 0x16, 0x6e, 0x39, 0xdc, - 0x31, 0x73, 0x00, 0x92, 0x61, 0x95, 0x91, 0xb7, 0x29, 0x89, 0x3c, 0x52, 0xaf, 0x6c, 0x89, 0x3b, - 0x55, 0x73, 0x1a, 0xcb, 0x5f, 0x2a, 0x50, 0x1d, 0x4b, 0x51, 0x0f, 0x56, 0x58, 0x10, 0xf9, 0x03, - 0x32, 0xb1, 0xf7, 0x6c, 0x81, 0x7e, 0xd8, 0xca, 0x09, 0x47, 0x82, 0x39, 0x61, 0xa1, 0x97, 0xb0, - 0x9c, 0x4f, 0x69, 0x72, 0x89, 0x83, 0x45, 0xa0, 0x9d, 0x31, 0xe0, 0x48, 0x30, 0x0b, 0x92, 0x6c, - 0xc3, 0x4a, 0xd1, 0x06, 0x3d, 0x85, 0x6a, 0x48, 0xfb, 0x85, 0xe1, 0xff, 0xf7, 0x1e, 0xfd, 0x85, - 0xdd, 0xa1, 0x7d, 0x62, 0xe6, 0x07, 0xd0, 0x03, 0x58, 0x9b, 0x0e, 0x2d, 0x77, 0xf6, 0x9f, 0x39, - 0x4b, 0xc8, 0x9f, 0x44, 0x58, 0xce, 0x7b, 0xa2, 0x63, 0x58, 0x75, 0x03, 0xee, 0x24, 0x89, 0x53, - 0x0e, 0x4d, 0x2d, 0x9b, 0x14, 0x3b, 0x89, 0xa7, 0x2b, 0x58, 0x76, 0x6a, 0xd2, 0x30, 0x76, 0x3c, - 0x7e, 0x18, 0x70, 0x6d, 0x7c, 0xcc, 0x9c, 0x02, 0x90, 0xf5, 0xcb, 0xae, 0x2d, 0xe5, 0xbb, 0xb6, - 0xd0, 0x50, 0xe7, 0x30, 0x87, 0xcb, 0x50, 0x61, 0x69, 0xf8, 0xe4, 0xa3, 0x08, 0xab, 0xe5, 0x1d, - 0xd1, 0x26, 0x6c, 0x58, 0x46, 0xbb, 0x6b, 0x77, 0x4e, 0x5b, 0xba, 0x7d, 0xde, 0xb5, 0xce, 0xf4, - 0xa6, 0xf1, 0xdc, 0xd0, 0x5b, 0x92, 0x80, 0x6a, 0x20, 0xcd, 0x4a, 0x2d, 0xc3, 0xd4, 0x9b, 0x3d, - 0x49, 0x44, 0x1b, 0x70, 0x67, 0x96, 0xed, 0xe9, 0x17, 0xbd, 0x73, 0xed, 0x44, 0x5a, 0x42, 0x75, - 0xa8, 0xfd, 0x2e, 0xb6, 0xb5, 0xf3, 0x0b, 0xa9, 0x82, 0x1e, 0xc2, 0xfd, 0x59, 0xe5, 0x44, 0x6f, - 0x6b, 0xcd, 0x57, 0xb6, 0xd6, 0x31, 0xba, 0xa7, 0xf6, 0x0b, 0xeb, 0xb4, 0x2b, 0xbd, 0x47, 0xf7, - 0xe6, 0x89, 0xba, 0x71, 0x66, 0x37, 0x0e, 0x1a, 0xd2, 0x67, 0xf1, 0xb0, 0xfd, 0x75, 0xa8, 0x88, - 0x37, 0x43, 0x45, 0xfc, 0x3e, 0x54, 0xc4, 0x0f, 0x23, 0x45, 0xb8, 0x19, 0x29, 0xc2, 0xb7, 0x91, - 0x22, 0xbc, 0xde, 0xf5, 0x03, 0xfe, 0x26, 0x75, 0xb1, 0x47, 0x43, 0xb5, 0x7c, 0xf6, 0xf9, 0x67, - 0x97, 0xf5, 0xaf, 0x54, 0x9e, 0xc5, 0x64, 0xfe, 0x5f, 0xe2, 0xae, 0xe4, 0x8f, 0x66, 0xff, 0x67, - 0x00, 0x00, 0x00, 0xff, 0xff, 0x02, 0x3d, 0xad, 0x03, 0x67, 0x04, 0x00, 0x00, + // 562 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0xcd, 0x6e, 0xd3, 0x4c, + 0x14, 0x86, 0xed, 0xe6, 0x47, 0xe9, 0xf4, 0xd3, 0x27, 0x33, 0xa4, 0x28, 0x31, 0xc8, 0x44, 0x65, + 0x41, 0x84, 0x94, 0xb1, 0x92, 0x2c, 0x50, 0xd9, 0xe5, 0xc7, 0xa4, 0xa6, 0x4d, 0x52, 0xec, 0x54, + 0x02, 0x36, 0x96, 0xed, 0x4c, 0x8d, 0xd5, 0xd8, 0x63, 0x3c, 0x63, 0x54, 0xaf, 0xb8, 0x00, 0x36, + 0xdc, 0x06, 0x57, 0xc1, 0x82, 0x0d, 0xcb, 0x2e, 0x59, 0xa2, 0xe4, 0x1a, 0xd8, 0xa3, 0xd8, 0x71, + 0x12, 0xa4, 0x22, 0x44, 0x56, 0xd6, 0x9c, 0xf3, 0x9e, 0xe7, 0xbc, 0xa3, 0x73, 0xc6, 0xe0, 0xb1, + 0x4d, 0xa8, 0x47, 0xa8, 0xcc, 0xae, 0x65, 0xea, 0x3a, 0xbe, 0xeb, 0x3b, 0xf2, 0xfb, 0xa6, 0x85, + 0x99, 0xd9, 0xcc, 0xce, 0x28, 0x08, 0x09, 0x23, 0xb0, 0x9a, 0x0a, 0x11, 0xbb, 0x46, 0x59, 0x62, + 0x25, 0x14, 0x1b, 0x2b, 0x86, 0x1d, 0xc6, 0x01, 0x23, 0xb2, 0x17, 0xcd, 0x98, 0x4b, 0xdd, 0x0d, + 0x28, 0x0b, 0xa4, 0x24, 0xb1, 0xea, 0x10, 0xe2, 0xcc, 0xb0, 0x9c, 0x9c, 0xac, 0xe8, 0x52, 0x36, + 0xfd, 0x38, 0x4d, 0x1d, 0x5d, 0x82, 0xb2, 0xee, 0x3a, 0xbe, 0xc9, 0xa2, 0x10, 0xf7, 0x31, 0xb5, + 0x43, 0x37, 0x60, 0x24, 0xa4, 0x70, 0x04, 0x00, 0xcd, 0xe2, 0xb4, 0xc2, 0xd7, 0x72, 0xf5, 0x83, + 0x16, 0x42, 0x7f, 0x74, 0x84, 0x6e, 0x81, 0x68, 0x5b, 0x84, 0xa3, 0x9f, 0x79, 0x70, 0xf7, 0x16, + 0x0d, 0x6c, 0x03, 0x10, 0x44, 0xd6, 0xcc, 0xb5, 0x8d, 0x2b, 0x1c, 0x57, 0xf8, 0x1a, 0x5f, 0x3f, + 0x68, 0x95, 0x51, 0xea, 0x17, 0x65, 0x7e, 0x51, 0xc7, 0x8f, 0xb5, 0xfd, 0x54, 0x77, 0x8a, 0x63, + 0x38, 0x00, 0xf9, 0xa9, 0xc9, 0xcc, 0xca, 0x5e, 0x22, 0x6f, 0xff, 0x9b, 0x2d, 0xd4, 0x37, 0x99, + 0xa9, 0x25, 0x00, 0x28, 0x82, 0x12, 0xc5, 0xef, 0x22, 0xec, 0xdb, 0xb8, 0x92, 0xab, 0xf1, 0xf5, + 0xbc, 0xb6, 0x3e, 0x8b, 0x5f, 0x73, 0x20, 0xbf, 0x94, 0xc2, 0x09, 0x28, 0x52, 0xd7, 0x77, 0x66, + 0x78, 0x65, 0xef, 0xd9, 0x0e, 0xfd, 0x90, 0x9e, 0x10, 0x4e, 0x38, 0x6d, 0xc5, 0x82, 0x2f, 0x41, + 0x21, 0x99, 0xd2, 0xea, 0x12, 0xc7, 0xbb, 0x40, 0x87, 0x4b, 0xc0, 0x09, 0xa7, 0xa5, 0x24, 0xd1, + 0x00, 0xc5, 0xb4, 0x0d, 0x7c, 0x0a, 0xf2, 0x1e, 0x99, 0xa6, 0x86, 0xff, 0x6f, 0x3d, 0xfa, 0x0b, + 0x7b, 0x48, 0xa6, 0x58, 0x4b, 0x0a, 0xe0, 0x03, 0xb0, 0xbf, 0x1e, 0x5a, 0xe2, 0xec, 0x3f, 0x6d, + 0x13, 0x10, 0x3f, 0xf3, 0xa0, 0x90, 0xf4, 0x84, 0xa7, 0xa0, 0x64, 0xb9, 0xcc, 0x0c, 0x43, 0x33, + 0x1b, 0x9a, 0x9c, 0x35, 0x49, 0x77, 0x12, 0xad, 0x57, 0x30, 0xeb, 0xd4, 0x23, 0x5e, 0x60, 0xda, + 0xac, 0xeb, 0xb2, 0xce, 0xb2, 0x4c, 0x5b, 0x03, 0xa0, 0xfe, 0xdb, 0xae, 0xed, 0x25, 0xbb, 0xb6, + 0xd3, 0x50, 0xb7, 0x30, 0xdd, 0x02, 0xc8, 0xd1, 0xc8, 0x7b, 0xf2, 0x91, 0x07, 0xa5, 0xec, 0x8e, + 0xb0, 0x0a, 0x0e, 0x75, 0x75, 0x30, 0x32, 0x86, 0xe3, 0xbe, 0x62, 0x5c, 0x8c, 0xf4, 0x73, 0xa5, + 0xa7, 0x3e, 0x57, 0x95, 0xbe, 0xc0, 0xc1, 0x32, 0x10, 0x36, 0xa9, 0xbe, 0xaa, 0x29, 0xbd, 0x89, + 0xc0, 0xc3, 0x43, 0x70, 0x67, 0x13, 0x9d, 0x28, 0xaf, 0x26, 0x17, 0x9d, 0x33, 0x61, 0x0f, 0x3e, + 0x04, 0xf7, 0x37, 0xe1, 0x33, 0x65, 0xd0, 0xe9, 0xbd, 0x36, 0x3a, 0x43, 0x75, 0x34, 0x36, 0x5e, + 0xe8, 0xe3, 0x91, 0xf0, 0x01, 0xde, 0xdb, 0xae, 0x53, 0xd4, 0x73, 0xa3, 0x79, 0xdc, 0x14, 0xbe, + 0xf0, 0xdd, 0xc1, 0xb7, 0xb9, 0xc4, 0xdf, 0xcc, 0x25, 0xfe, 0xc7, 0x5c, 0xe2, 0x3f, 0x2d, 0x24, + 0xee, 0x66, 0x21, 0x71, 0xdf, 0x17, 0x12, 0xf7, 0xa6, 0xe1, 0xb8, 0xec, 0x6d, 0x64, 0x21, 0x9b, + 0x78, 0x72, 0xf6, 0xb8, 0x93, 0x4f, 0x83, 0x4e, 0xaf, 0x64, 0x16, 0x07, 0x78, 0xfb, 0x8f, 0x61, + 0x15, 0x93, 0xa7, 0xd1, 0xfe, 0x15, 0x00, 0x00, 0xff, 0xff, 0x7a, 0x72, 0xd3, 0x58, 0x4d, 0x04, + 0x00, 0x00, } func (m *SignatureDescriptors) Marshal() (dAtA []byte, err error) { diff --git a/x/authz/authz.pb.go b/x/authz/authz.pb.go index e12361a7dda0..5fa26d2c7315 100644 --- a/x/authz/authz.pb.go +++ b/x/authz/authz.pb.go @@ -115,6 +115,8 @@ var xxx_messageInfo_Grant proto.InternalMessageInfo // GrantAuthorization extends a grant with both the addresses of the grantee and granter. // It is used in genesis.proto and query.proto +// +// Since: cosmos-sdk 0.45.2 type GrantAuthorization struct { Granter string `protobuf:"bytes,1,opt,name=granter,proto3" json:"granter,omitempty"` Grantee string `protobuf:"bytes,2,opt,name=grantee,proto3" json:"grantee,omitempty"` diff --git a/x/authz/keeper/keys.go b/x/authz/keeper/keys.go index a7f7e50bdadb..68750e493903 100644 --- a/x/authz/keeper/keys.go +++ b/x/authz/keeper/keys.go @@ -9,6 +9,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/address" "github.com/cosmos/cosmos-sdk/types/kv" + "github.com/cosmos/cosmos-sdk/x/authz" ) // Keys for store prefixes @@ -49,6 +50,13 @@ func granterStoreKey(granter sdk.AccAddress) []byte { func parseGrantStoreKey(key []byte) (granterAddr, granteeAddr sdk.AccAddress, msgType string) { // key is of format: // 0x01 + kv.AssertKeyAtLeastLength(key, 2) + granterAddrLen := key[1] // remove prefix key + kv.AssertKeyAtLeastLength(key, int(3+granterAddrLen)) + granterAddr = sdk.AccAddress(key[2 : 2+granterAddrLen]) + granteeAddrLen := int(key[2+granterAddrLen]) + kv.AssertKeyAtLeastLength(key, 4+int(granterAddrLen+byte(granteeAddrLen))) + granteeAddr = sdk.AccAddress(key[3+granterAddrLen : 3+granterAddrLen+byte(granteeAddrLen)]) granterAddrLen, granterAddrLenEndIndex := sdk.ParseLengthPrefixedBytes(key, 1, 1) // ignore key[0] since it is a prefix key granterAddr, granterAddrEndIndex := sdk.ParseLengthPrefixedBytes(key, granterAddrLenEndIndex+1, int(granterAddrLen[0])) diff --git a/x/authz/query.pb.go b/x/authz/query.pb.go index 00a23f13ceea..4f6a390c025b 100644 --- a/x/authz/query.pb.go +++ b/x/authz/query.pb.go @@ -436,11 +436,11 @@ type QueryClient interface { Grants(ctx context.Context, in *QueryGrantsRequest, opts ...grpc.CallOption) (*QueryGrantsResponse, error) // GranterGrants returns list of `GrantAuthorization`, granted by granter. // - // Since: cosmos-sdk 0.46 + // Since: cosmos-sdk 0.45.2 GranterGrants(ctx context.Context, in *QueryGranterGrantsRequest, opts ...grpc.CallOption) (*QueryGranterGrantsResponse, error) // GranteeGrants returns a list of `GrantAuthorization` by grantee. // - // Since: cosmos-sdk 0.46 + // Since: cosmos-sdk 0.45.2 GranteeGrants(ctx context.Context, in *QueryGranteeGrantsRequest, opts ...grpc.CallOption) (*QueryGranteeGrantsResponse, error) } @@ -485,11 +485,11 @@ type QueryServer interface { Grants(context.Context, *QueryGrantsRequest) (*QueryGrantsResponse, error) // GranterGrants returns list of `GrantAuthorization`, granted by granter. // - // Since: cosmos-sdk 0.46 + // Since: cosmos-sdk 0.45.2 GranterGrants(context.Context, *QueryGranterGrantsRequest) (*QueryGranterGrantsResponse, error) // GranteeGrants returns a list of `GrantAuthorization` by grantee. // - // Since: cosmos-sdk 0.46 + // Since: cosmos-sdk 0.45.2 GranteeGrants(context.Context, *QueryGranteeGrantsRequest) (*QueryGranteeGrantsResponse, error) } diff --git a/x/distribution/types/keys.go b/x/distribution/types/keys.go index cee527708b85..2040acf6cb67 100644 --- a/x/distribution/types/keys.go +++ b/x/distribution/types/keys.go @@ -65,10 +65,87 @@ var ( ParamsKey = collections.NewPrefix(9) // key for distribution module params ) -// Reserved prefixes -var ( - DeprecatedProposerKey = collections.NewPrefix(1) // key for the proposer operator address -) +// GetValidatorOutstandingRewardsAddress creates an address from a validator's outstanding rewards key. +func GetValidatorOutstandingRewardsAddress(key []byte) (valAddr sdk.ValAddress) { + // key is in the format: + // 0x02 + + // Remove prefix and address length. + kv.AssertKeyAtLeastLength(key, 3) + addr := key[2:] + kv.AssertKeyLength(addr, int(key[1])) + + return sdk.ValAddress(addr) +} + +// GetDelegatorWithdrawInfoAddress creates an address from a delegator's withdraw info key. +func GetDelegatorWithdrawInfoAddress(key []byte) (delAddr sdk.AccAddress) { + // key is in the format: + // 0x03 + + // Remove prefix and address length. + kv.AssertKeyAtLeastLength(key, 3) + addr := key[2:] + kv.AssertKeyLength(addr, int(key[1])) + + return sdk.AccAddress(addr) +} + +// GetDelegatorStartingInfoAddresses creates the addresses from a delegator starting info key. +func GetDelegatorStartingInfoAddresses(key []byte) (valAddr sdk.ValAddress, delAddr sdk.AccAddress) { + // key is in the format: + // 0x04 + kv.AssertKeyAtLeastLength(key, 2) + valAddrLen := int(key[1]) + kv.AssertKeyAtLeastLength(key, 3+valAddrLen) + valAddr = sdk.ValAddress(key[2 : 2+valAddrLen]) + delAddrLen := int(key[2+valAddrLen]) + kv.AssertKeyAtLeastLength(key, 4+valAddrLen) + delAddr = sdk.AccAddress(key[3+valAddrLen:]) + kv.AssertKeyLength(delAddr.Bytes(), delAddrLen) + + return +} + +// GetValidatorHistoricalRewardsAddressPeriod creates the address & period from a validator's historical rewards key. +func GetValidatorHistoricalRewardsAddressPeriod(key []byte) (valAddr sdk.ValAddress, period uint64) { + // key is in the format: + // 0x05 + kv.AssertKeyAtLeastLength(key, 2) + valAddrLen := int(key[1]) + kv.AssertKeyAtLeastLength(key, 3+valAddrLen) + valAddr = sdk.ValAddress(key[2 : 2+valAddrLen]) + b := key[2+valAddrLen:] + kv.AssertKeyLength(b, 8) + period = binary.LittleEndian.Uint64(b) + return +} + +// GetValidatorCurrentRewardsAddress creates the address from a validator's current rewards key. +func GetValidatorCurrentRewardsAddress(key []byte) (valAddr sdk.ValAddress) { + // key is in the format: + // 0x06: ValidatorCurrentRewards + + // Remove prefix and address length. + kv.AssertKeyAtLeastLength(key, 3) + addr := key[2:] + kv.AssertKeyLength(addr, int(key[1])) + + return sdk.ValAddress(addr) +} + +// GetValidatorAccumulatedCommissionAddress creates the address from a validator's accumulated commission key. +func GetValidatorAccumulatedCommissionAddress(key []byte) (valAddr sdk.ValAddress) { + // key is in the format: + // 0x07: ValidatorCurrentRewards + + // Remove prefix and address length. + kv.AssertKeyAtLeastLength(key, 3) + addr := key[2:] + kv.AssertKeyLength(addr, int(key[1])) + + return sdk.ValAddress(addr) +} // GetValidatorSlashEventAddressHeight creates the height from a validator's slash event key. func GetValidatorSlashEventAddressHeight(key []byte) (valAddr sdk.ValAddress, height uint64) { diff --git a/x/feegrant/client/cli/tx_test.go b/x/feegrant/client/cli/tx_test.go index cb75821c80cf..f905a0cef89c 100644 --- a/x/feegrant/client/cli/tx_test.go +++ b/x/feegrant/client/cli/tx_test.go @@ -127,9 +127,137 @@ func (s *CLITestSuite) createGrant(granter, grantee sdk.AccAddress, addressCodec out, err := clitestutil.ExecTestCLICmd(s.clientCtx, cmd, args) s.Require().NoError(err) - var resp sdk.TxResponse - s.Require().NoError(s.clientCtx.Codec.UnmarshalJSON(out.Bytes(), &resp), out.String()) - s.Require().Equal(resp.Code, uint32(0)) + if tc.expectErr { + s.Require().Error(err) + s.Require().Contains(err.Error(), tc.expectErrMsg) + } else { + s.Require().NoError(err) + s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) + s.Require().Equal(tc.respType.Grantee, tc.respType.Grantee) + s.Require().Equal(tc.respType.Granter, tc.respType.Granter) + grant, err := tc.respType.GetGrant() + s.Require().NoError(err) + grant1, err1 := tc.resp.GetGrant() + s.Require().NoError(err1) + s.Require().Equal( + grant.(*feegrant.BasicAllowance).SpendLimit, + grant1.(*feegrant.BasicAllowance).SpendLimit, + ) + } + }) + } +} + +func (s *IntegrationTestSuite) TestCmdGetFeeGrantsByGrantee() { + val := s.network.Validators[0] + grantee := s.addedGrantee + clientCtx := val.ClientCtx + + testCases := []struct { + name string + args []string + expectErr bool + resp *feegrant.QueryAllowancesResponse + expectLength int + }{ + { + "wrong grantee", + []string{ + "wrong_grantee", + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + }, + true, nil, 0, + }, + { + "non existent grantee", + []string{ + "cosmos1nph3cfzk6trsmfxkeu943nvach5qw4vwstnvkl", + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + }, + false, &feegrant.QueryAllowancesResponse{}, 0, + }, + { + "valid req", + []string{ + grantee.String(), + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + }, + false, &feegrant.QueryAllowancesResponse{}, 1, + }, + } + + for _, tc := range testCases { + tc := tc + + s.Run(tc.name, func() { + cmd := cli.GetCmdQueryFeeGrantsByGrantee() + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) + + if tc.expectErr { + s.Require().Error(err) + } else { + s.Require().NoError(err) + s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.resp), out.String()) + s.Require().Len(tc.resp.Allowances, tc.expectLength) + } + }) + } +} + +func (s *IntegrationTestSuite) TestCmdGetFeeGrantsByGranter() { + val := s.network.Validators[0] + granter := s.addedGranter + clientCtx := val.ClientCtx + + testCases := []struct { + name string + args []string + expectErr bool + resp *feegrant.QueryAllowancesByGranterResponse + expectLength int + }{ + { + "wrong grantee", + []string{ + "wrong_grantee", + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + }, + true, nil, 0, + }, + { + "non existent grantee", + []string{ + "cosmos1nph3cfzk6trsmfxkeu943nvach5qw4vwstnvkl", + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + }, + false, &feegrant.QueryAllowancesByGranterResponse{}, 0, + }, + { + "valid req", + []string{ + granter.String(), + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + }, + false, &feegrant.QueryAllowancesByGranterResponse{}, 1, + }, + } + + for _, tc := range testCases { + tc := tc + + s.Run(tc.name, func() { + cmd := cli.GetCmdQueryFeeGrantsByGranter() + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) + + if tc.expectErr { + s.Require().Error(err) + } else { + s.Require().NoError(err) + s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.resp), out.String()) + s.Require().Len(tc.resp.Allowances, tc.expectLength) + } + }) + } } func (s *CLITestSuite) TestNewCmdFeeGrant() { diff --git a/x/feegrant/keeper/grpc_query.go b/x/feegrant/keeper/grpc_query.go index f5ff7df04370..83d3ae38e1d0 100644 --- a/x/feegrant/keeper/grpc_query.go +++ b/x/feegrant/keeper/grpc_query.go @@ -116,3 +116,42 @@ func (q Keeper) AllowancesByGranter(c context.Context, req *feegrant.QueryAllowa return &feegrant.QueryAllowancesByGranterResponse{Allowances: grants, Pagination: pageRes}, nil } + +// AllowancesByGranter queries all the allowances granted by the given granter +func (q Keeper) AllowancesByGranter(c context.Context, req *feegrant.QueryAllowancesByGranterRequest) (*feegrant.QueryAllowancesByGranterResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + granterAddr, err := sdk.AccAddressFromBech32(req.Granter) + if err != nil { + return nil, err + } + + ctx := sdk.UnwrapSDKContext(c) + + var grants []*feegrant.Grant + + store := ctx.KVStore(q.storeKey) + pageRes, err := query.Paginate(store, req.Pagination, func(key []byte, value []byte) error { + var grant feegrant.Grant + + granter, _ := feegrant.ParseAddressesFromFeeAllowanceKey(key) + if !granter.Equals(granterAddr) { + return nil + } + + if err := q.cdc.Unmarshal(value, &grant); err != nil { + return err + } + + grants = append(grants, &grant) + return nil + }) + + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &feegrant.QueryAllowancesByGranterResponse{Allowances: grants, Pagination: pageRes}, nil +} diff --git a/x/feegrant/keeper/grpc_query_test.go b/x/feegrant/keeper/grpc_query_test.go index 7959a5f60440..9bb88c61ec15 100644 --- a/x/feegrant/keeper/grpc_query_test.go +++ b/x/feegrant/keeper/grpc_query_test.go @@ -233,9 +233,75 @@ func (suite *KeeperTestSuite) TestFeeAllowancesByGranter() { } } -func (suite *KeeperTestSuite) grantFeeAllowance(granter, grantee sdk.AccAddress) { - exp := suite.ctx.HeaderInfo().Time.AddDate(1, 0, 0) - err := suite.feegrantKeeper.GrantAllowance(suite.ctx, granter, grantee, &feegrant.BasicAllowance{ +func (suite *KeeperTestSuite) TestFeeAllowancesByGranter() { + testCases := []struct { + name string + req *feegrant.QueryAllowancesByGranterRequest + expectErr bool + preRun func() + postRun func(_ *feegrant.QueryAllowancesByGranterResponse) + }{ + { + "nil request", + nil, + true, + func() {}, + func(*feegrant.QueryAllowancesByGranterResponse) {}, + }, + { + "fail: invalid grantee", + &feegrant.QueryAllowancesByGranterRequest{ + Granter: "invalid_grantee", + }, + true, + func() {}, + func(*feegrant.QueryAllowancesByGranterResponse) {}, + }, + { + "no grants", + &feegrant.QueryAllowancesByGranterRequest{ + Granter: suite.addrs[0].String(), + }, + false, + func() {}, + func(resp *feegrant.QueryAllowancesByGranterResponse) { + suite.Require().Equal(len(resp.Allowances), 0) + }, + }, + { + "valid query: expect single grant", + &feegrant.QueryAllowancesByGranterRequest{ + Granter: suite.addrs[0].String(), + }, + false, + func() { + grantFeeAllowance(suite) + }, + func(resp *feegrant.QueryAllowancesByGranterResponse) { + suite.Require().Equal(len(resp.Allowances), 1) + suite.Require().Equal(resp.Allowances[0].Granter, suite.addrs[0].String()) + suite.Require().Equal(resp.Allowances[0].Grantee, suite.addrs[1].String()) + }, + }, + } + + for _, tc := range testCases { + suite.Run(tc.name, func() { + tc.preRun() + resp, err := suite.keeper.AllowancesByGranter(suite.ctx, tc.req) + if tc.expectErr { + suite.Require().Error(err) + } else { + suite.Require().NoError(err) + tc.postRun(resp) + } + }) + } +} + +func grantFeeAllowance(suite *KeeperTestSuite) { + exp := suite.sdkCtx.BlockTime().AddDate(1, 0, 0) + err := suite.app.FeeGrantKeeper.GrantAllowance(suite.sdkCtx, suite.addrs[0], suite.addrs[1], &feegrant.BasicAllowance{ SpendLimit: sdk.NewCoins(sdk.NewInt64Coin("atom", 555)), Expiration: &exp, }) diff --git a/x/feegrant/key.go b/x/feegrant/key.go index d44d7932f615..24c39dbfef00 100644 --- a/x/feegrant/key.go +++ b/x/feegrant/key.go @@ -1,7 +1,9 @@ package feegrant import ( - "cosmossdk.io/collections" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/address" + "github.com/cosmos/cosmos-sdk/types/kv" ) const ( @@ -17,7 +19,27 @@ var ( // - 0x00: allowance FeeAllowanceKeyPrefix = collections.NewPrefix(0) - // FeeAllowanceQueueKeyPrefix is the set of the kvstore for fee allowance keys data - // - 0x01: - FeeAllowanceQueueKeyPrefix = collections.NewPrefix(1) -) +// FeeAllowanceKey is the canonical key to store a grant from granter to grantee +// We store by grantee first to allow searching by everyone who granted to you +func FeeAllowanceKey(granter sdk.AccAddress, grantee sdk.AccAddress) []byte { + return append(FeeAllowancePrefixByGrantee(grantee), address.MustLengthPrefix(granter.Bytes())...) +} + +// FeeAllowancePrefixByGrantee returns a prefix to scan for all grants to this given address. +func FeeAllowancePrefixByGrantee(grantee sdk.AccAddress) []byte { + return append(FeeAllowanceKeyPrefix, address.MustLengthPrefix(grantee.Bytes())...) +} + +func ParseAddressesFromFeeAllowanceKey(key []byte) (granter, grantee sdk.AccAddress) { + // key is of format: + // 0x00 + kv.AssertKeyAtLeastLength(key, 2) + granteeAddrLen := key[1] // remove prefix key + kv.AssertKeyAtLeastLength(key, int(2+granteeAddrLen)) + grantee = sdk.AccAddress(key[2 : 2+granteeAddrLen]) + granterAddrLen := int(key[2+granteeAddrLen]) + kv.AssertKeyAtLeastLength(key, 3+int(granteeAddrLen+byte(granterAddrLen))) + granter = sdk.AccAddress(key[3+granterAddrLen : 3+granteeAddrLen+byte(granterAddrLen)]) + + return granter, grantee +} diff --git a/x/feegrant/key_test.go b/x/feegrant/key_test.go new file mode 100644 index 000000000000..75a7964bec32 --- /dev/null +++ b/x/feegrant/key_test.go @@ -0,0 +1,25 @@ +package feegrant_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/feegrant" +) + +func TestMarshalAndUnmarshalFeegrantKey(t *testing.T) { + grantee, err := sdk.AccAddressFromBech32("cosmos1qk93t4j0yyzgqgt6k5qf8deh8fq6smpn3ntu3x") + require.NoError(t, err) + granter, err := sdk.AccAddressFromBech32("cosmos1p9qh4ldfd6n0qehujsal4k7g0e37kel90rc4ts") + require.NoError(t, err) + + key := feegrant.FeeAllowanceKey(granter, grantee) + require.Len(t, key, len(grantee.Bytes())+len(granter.Bytes())+3) + require.Equal(t, feegrant.FeeAllowancePrefixByGrantee(grantee), key[:len(grantee.Bytes())+2]) + + g1, g2 := feegrant.ParseAddressesFromFeeAllowanceKey(key) + require.Equal(t, granter, g1) + require.Equal(t, grantee, g2) +} diff --git a/x/feegrant/proto/cosmos/feegrant/v1beta1/query.proto b/x/feegrant/proto/cosmos/feegrant/v1beta1/query.proto index 36305f87726c..cd4e3d2fca17 100644 --- a/x/feegrant/proto/cosmos/feegrant/v1beta1/query.proto +++ b/x/feegrant/proto/cosmos/feegrant/v1beta1/query.proto @@ -23,9 +23,9 @@ service Query { } // AllowancesByGranter returns all the grants given by an address + // Since v0.46 rpc AllowancesByGranter(QueryAllowancesByGranterRequest) returns (QueryAllowancesByGranterResponse) { - option (cosmos_proto.method_added_in) = "cosmos-sdk 0.46"; - option (google.api.http).get = "/cosmos/feegrant/v1beta1/issued/{granter}"; + option (google.api.http).get = "/cosmos/feegrant/v1beta1/issued/{granter}"; } } @@ -63,8 +63,7 @@ message QueryAllowancesResponse { // QueryAllowancesByGranterRequest is the request type for the Query/AllowancesByGranter RPC method. message QueryAllowancesByGranterRequest { - option (cosmos_proto.message_added_in) = "cosmos-sdk 0.46"; - string granter = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string granter = 1; // pagination defines an pagination for the request. cosmos.base.query.v1beta1.PageRequest pagination = 2; @@ -72,7 +71,6 @@ message QueryAllowancesByGranterRequest { // QueryAllowancesByGranterResponse is the response type for the Query/AllowancesByGranter RPC method. message QueryAllowancesByGranterResponse { - option (cosmos_proto.message_added_in) = "cosmos-sdk 0.46"; // allowances that have been issued by the granter. repeated cosmos.feegrant.v1beta1.Grant allowances = 1; diff --git a/x/feegrant/query.pb.go b/x/feegrant/query.pb.go index d46dde40d07e..6bf459ee255f 100644 --- a/x/feegrant/query.pb.go +++ b/x/feegrant/query.pb.go @@ -363,41 +363,38 @@ func init() { } var fileDescriptor_59efc303945de53f = []byte{ - // 543 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x95, 0x4f, 0x6b, 0x13, 0x4f, - 0x18, 0xc7, 0x33, 0xfd, 0xfd, 0x54, 0xf2, 0xf4, 0x20, 0x4c, 0xd5, 0xc6, 0x45, 0xd6, 0xb0, 0x42, - 0xfd, 0x47, 0x66, 0x9a, 0xa8, 0xa5, 0x8a, 0x14, 0x1a, 0xc4, 0x5c, 0x35, 0x82, 0x07, 0x2f, 0x32, - 0xe9, 0x3e, 0x2e, 0x4b, 0xe3, 0x4e, 0xba, 0xb3, 0x51, 0x8b, 0x14, 0xc1, 0x57, 0x20, 0xe8, 0x2b, - 0xf0, 0xe0, 0xc9, 0x53, 0xe9, 0x0b, 0xf0, 0x28, 0x9e, 0x42, 0xbd, 0x78, 0x94, 0xc4, 0x17, 0x22, - 0x99, 0x9d, 0xdd, 0x8d, 0x49, 0x96, 0x2e, 0xea, 0xc1, 0x5b, 0x26, 0xfb, 0xfd, 0x3e, 0xfb, 0xf9, - 0x3e, 0xcf, 0xcc, 0x2c, 0x5c, 0xd8, 0x92, 0xea, 0xa9, 0x54, 0xfc, 0x09, 0xa2, 0x17, 0x8a, 0x20, - 0xe2, 0xcf, 0xea, 0x1d, 0x8c, 0x44, 0x9d, 0xef, 0xf4, 0x31, 0xdc, 0x65, 0xbd, 0x50, 0x46, 0x92, - 0x2e, 0xc7, 0x22, 0x96, 0x88, 0x98, 0x11, 0x59, 0x2b, 0x79, 0xee, 0x54, 0xa9, 0x0b, 0x58, 0x57, - 0x8c, 0xae, 0x23, 0x14, 0xc6, 0x95, 0x53, 0x65, 0x4f, 0x78, 0x7e, 0x20, 0x22, 0x5f, 0x06, 0x46, - 0x7b, 0xce, 0x93, 0xd2, 0xeb, 0x22, 0x17, 0x3d, 0x9f, 0x8b, 0x20, 0x90, 0x91, 0x7e, 0xa8, 0xcc, - 0xd3, 0xb3, 0x71, 0xa5, 0xc7, 0x7a, 0xc5, 0x0d, 0x97, 0x5e, 0x38, 0xaf, 0xe0, 0xf4, 0xfd, 0x71, - 0xe9, 0xcd, 0x6e, 0x57, 0x3e, 0x17, 0xc1, 0x16, 0xb6, 0x71, 0xa7, 0x8f, 0x2a, 0xa2, 0x0d, 0x38, - 0xa1, 0x61, 0x30, 0xac, 0x90, 0x2a, 0xb9, 0x54, 0x6e, 0x56, 0x0e, 0x0f, 0x6a, 0xa7, 0x8c, 0x77, - 0xd3, 0x75, 0x43, 0x54, 0xea, 0x41, 0x14, 0xfa, 0x81, 0xd7, 0x4e, 0x84, 0x99, 0x07, 0x2b, 0x0b, - 0xc5, 0x3c, 0xe8, 0x3c, 0x84, 0x33, 0xd3, 0x00, 0xaa, 0x27, 0x03, 0x85, 0xf4, 0x36, 0x94, 0x45, - 0xf2, 0xa7, 0x66, 0x58, 0x6c, 0xd8, 0x2c, 0xa7, 0xa9, 0xac, 0x35, 0x5e, 0xb5, 0x33, 0x83, 0xf3, - 0x8e, 0x4c, 0x17, 0x56, 0x33, 0xd1, 0xb0, 0x68, 0x34, 0xa4, 0x77, 0x01, 0xb2, 0xa6, 0xeb, 0x74, - 0x8b, 0x8d, 0x95, 0x84, 0x66, 0x3c, 0x21, 0x16, 0xcf, 0x3e, 0xe1, 0xb9, 0x27, 0xbc, 0xa4, 0x95, - 0xed, 0x09, 0xa7, 0xf3, 0x9e, 0xc0, 0xf2, 0x0c, 0x96, 0x09, 0xbc, 0x01, 0x90, 0xf2, 0xab, 0x0a, - 0xa9, 0xfe, 0x57, 0x20, 0xf1, 0x84, 0x83, 0xb6, 0xe6, 0x30, 0x5e, 0x3c, 0x92, 0x31, 0x7e, 0xf9, - 0x2f, 0x90, 0xfb, 0x04, 0xce, 0x4f, 0x41, 0x36, 0x77, 0x5b, 0xf1, 0x90, 0xff, 0x64, 0x7f, 0xfc, - 0xa5, 0x26, 0xde, 0x5a, 0x3a, 0x3c, 0xa8, 0x9d, 0x8c, 0x6d, 0x35, 0xe5, 0x6e, 0x57, 0x57, 0xd9, - 0xf5, 0x35, 0xe7, 0x13, 0x81, 0x6a, 0x3e, 0xf4, 0x3f, 0xd6, 0xe2, 0xb9, 0x11, 0x1a, 0xfb, 0xff, - 0xc3, 0x31, 0x1d, 0x81, 0x7e, 0x24, 0x50, 0x4e, 0x73, 0x50, 0x96, 0x4b, 0x38, 0xf7, 0xec, 0x5a, - 0xbc, 0xb0, 0x3e, 0x26, 0x73, 0x36, 0x5e, 0x7f, 0xfd, 0xf1, 0x76, 0x61, 0x9d, 0xae, 0xf1, 0xbc, - 0xbb, 0x29, 0xed, 0x01, 0x7f, 0x69, 0xa6, 0xb9, 0x97, 0xfc, 0xc2, 0x3d, 0xfa, 0x81, 0x00, 0x64, - 0x6d, 0xa7, 0x45, 0xdf, 0x9f, 0x9c, 0x48, 0x6b, 0xb5, 0xb8, 0xc1, 0x10, 0xdf, 0xd0, 0xc4, 0x9c, - 0xd6, 0x8e, 0x26, 0x56, 0x13, 0xa0, 0x03, 0x02, 0x4b, 0x73, 0xf6, 0x07, 0x5d, 0x2f, 0x0a, 0x30, - 0x7d, 0x0e, 0xac, 0x9b, 0xbf, 0xe1, 0x34, 0x19, 0xee, 0x7c, 0x99, 0xdd, 0x03, 0x3a, 0xd6, 0x55, - 0x7a, 0x39, 0x37, 0x96, 0xaf, 0x54, 0x1f, 0xdd, 0x6c, 0x0a, 0xcd, 0xfa, 0xe7, 0xa1, 0x4d, 0x06, - 0x43, 0x9b, 0x7c, 0x1f, 0xda, 0xe4, 0xcd, 0xc8, 0x2e, 0x0d, 0x46, 0x76, 0xe9, 0xdb, 0xc8, 0x2e, - 0x3d, 0x32, 0x5f, 0x20, 0xe5, 0x6e, 0x33, 0x5f, 0xf2, 0x17, 0x69, 0xad, 0xce, 0x71, 0x7d, 0xf7, - 0x5f, 0xfb, 0x19, 0x00, 0x00, 0xff, 0xff, 0x84, 0x03, 0x50, 0xd8, 0xc8, 0x06, 0x00, 0x00, + // 495 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4e, 0xce, 0x2f, 0xce, + 0xcd, 0x2f, 0xd6, 0x4f, 0x4b, 0x4d, 0x4d, 0x2f, 0x4a, 0xcc, 0x2b, 0xd1, 0x2f, 0x33, 0x4c, 0x4a, + 0x2d, 0x49, 0x34, 0xd4, 0x2f, 0x2c, 0x4d, 0x2d, 0xaa, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, + 0x12, 0x87, 0x28, 0xd2, 0x83, 0x29, 0xd2, 0x83, 0x2a, 0x92, 0x52, 0xc3, 0xa5, 0x1b, 0xae, 0x12, + 0x6c, 0x80, 0x94, 0x16, 0x54, 0x5d, 0x52, 0x62, 0x71, 0x2a, 0xc4, 0x64, 0xb8, 0xca, 0x82, 0xc4, + 0xf4, 0xcc, 0xbc, 0xc4, 0x92, 0xcc, 0xfc, 0x3c, 0xa8, 0x5a, 0x99, 0xf4, 0xfc, 0xfc, 0xf4, 0x9c, + 0x54, 0xfd, 0xc4, 0x82, 0x4c, 0xfd, 0xc4, 0xbc, 0xbc, 0xfc, 0x12, 0xb0, 0x64, 0x31, 0x44, 0x56, + 0xc9, 0x9b, 0x4b, 0x34, 0x10, 0xa4, 0xdf, 0x31, 0x27, 0x27, 0xbf, 0x3c, 0x31, 0x2f, 0x39, 0x35, + 0x28, 0xb5, 0xb0, 0x34, 0xb5, 0xb8, 0x44, 0x48, 0x82, 0x8b, 0x1d, 0x6c, 0x63, 0x6a, 0x91, 0x04, + 0xa3, 0x02, 0xa3, 0x06, 0x67, 0x10, 0x8c, 0x8b, 0x90, 0x49, 0x95, 0x60, 0x42, 0x96, 0x49, 0x55, + 0x0a, 0xe3, 0x12, 0x43, 0x37, 0xac, 0xb8, 0x20, 0x3f, 0xaf, 0x38, 0x55, 0xc8, 0x86, 0x8b, 0x33, + 0x11, 0x26, 0x08, 0x36, 0x8f, 0xdb, 0x48, 0x4e, 0x0f, 0x47, 0x28, 0xe8, 0xb9, 0x83, 0x78, 0x41, + 0x08, 0x0d, 0x4a, 0x55, 0xe8, 0xe6, 0x16, 0x63, 0xb8, 0x32, 0x15, 0xd5, 0x95, 0xa9, 0x42, 0x6e, + 0x5c, 0x5c, 0x88, 0xa0, 0x00, 0x3b, 0x94, 0xdb, 0x48, 0x0d, 0x66, 0x25, 0x28, 0xdc, 0xf4, 0x20, + 0x31, 0x02, 0xb3, 0x34, 0x20, 0x31, 0x1d, 0xe6, 0xf7, 0x20, 0x24, 0x9d, 0x4a, 0x8b, 0x18, 0xb9, + 0xc4, 0x31, 0x2c, 0x87, 0xfa, 0xca, 0x8e, 0x8b, 0x0b, 0xee, 0xc8, 0x62, 0x09, 0x46, 0x05, 0x66, + 0x22, 0xbc, 0x85, 0xa4, 0x43, 0xc8, 0x1d, 0x8b, 0x1b, 0xd5, 0x09, 0xba, 0x11, 0x62, 0x39, 0x8a, + 0x23, 0x9b, 0x19, 0xb9, 0xe4, 0xd1, 0x1c, 0xe9, 0x54, 0xe9, 0x0e, 0x89, 0x2f, 0xc2, 0x11, 0x4a, + 0xad, 0xa0, 0x5a, 0xcd, 0xc8, 0xa5, 0x80, 0xdb, 0x15, 0x83, 0x2c, 0xcc, 0x8c, 0xe6, 0xb3, 0x70, + 0xb1, 0x82, 0x5d, 0x2b, 0xb4, 0x86, 0x91, 0x8b, 0x13, 0xee, 0x64, 0x21, 0x3d, 0x9c, 0x8e, 0xc1, + 0x9a, 0x51, 0xa4, 0xf4, 0x89, 0x56, 0x0f, 0x71, 0x84, 0x92, 0x5d, 0xd3, 0xe5, 0x27, 0x93, 0x99, + 0x2c, 0x84, 0xcc, 0xf4, 0x71, 0xe5, 0x76, 0xb8, 0x77, 0xf5, 0xab, 0xa1, 0x71, 0x54, 0x0b, 0x63, + 0xa5, 0xd6, 0x0a, 0x2d, 0x63, 0xe4, 0xe2, 0x42, 0x84, 0xb0, 0x10, 0xb1, 0xf6, 0xc3, 0xf2, 0x8c, + 0x94, 0x01, 0xf1, 0x1a, 0xa0, 0x2e, 0x36, 0x05, 0xbb, 0x58, 0x5f, 0x48, 0x97, 0xb0, 0x8b, 0x8b, + 0x91, 0x1c, 0xba, 0x97, 0x91, 0x4b, 0x18, 0x4b, 0x52, 0x10, 0xb2, 0x20, 0xd6, 0x01, 0xe8, 0x69, + 0x58, 0xca, 0x92, 0x0c, 0x9d, 0x50, 0x3f, 0x18, 0x82, 0xfd, 0xa0, 0x2d, 0xa4, 0x89, 0xd3, 0x0f, + 0x99, 0xc5, 0xc5, 0xa5, 0xa9, 0x29, 0x88, 0x20, 0x77, 0x72, 0x3c, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, + 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, + 0xc6, 0x63, 0x39, 0x86, 0x28, 0xf5, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, + 0x98, 0x71, 0x10, 0x4a, 0xb7, 0x38, 0x25, 0x5b, 0xbf, 0x02, 0x6e, 0x76, 0x12, 0x1b, 0xb8, 0x94, + 0x35, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x83, 0x57, 0xbe, 0x61, 0x17, 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -417,6 +414,7 @@ type QueryClient interface { // Allowances returns all the grants for the given grantee address. Allowances(ctx context.Context, in *QueryAllowancesRequest, opts ...grpc.CallOption) (*QueryAllowancesResponse, error) // AllowancesByGranter returns all the grants given by an address + // Since v0.46 AllowancesByGranter(ctx context.Context, in *QueryAllowancesByGranterRequest, opts ...grpc.CallOption) (*QueryAllowancesByGranterResponse, error) } @@ -462,6 +460,7 @@ type QueryServer interface { // Allowances returns all the grants for the given grantee address. Allowances(context.Context, *QueryAllowancesRequest) (*QueryAllowancesResponse, error) // AllowancesByGranter returns all the grants given by an address + // Since v0.46 AllowancesByGranter(context.Context, *QueryAllowancesByGranterRequest) (*QueryAllowancesByGranterResponse, error) } @@ -537,7 +536,6 @@ func _Query_AllowancesByGranter_Handler(srv interface{}, ctx context.Context, de return interceptor(ctx, in, info, handler) } -var Query_serviceDesc = _Query_serviceDesc var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "cosmos.feegrant.v1beta1.Query", HandlerType: (*QueryServer)(nil), diff --git a/x/feegrant/query.pb.gw.go b/x/feegrant/query.pb.gw.go index a34118fd88a5..e09b29109d25 100644 --- a/x/feegrant/query.pb.gw.go +++ b/x/feegrant/query.pb.gw.go @@ -308,8 +308,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_AllowancesByGranter_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -317,7 +315,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_AllowancesByGranter_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) diff --git a/x/gov/proto/cosmos/gov/v1beta1/gov.proto b/x/gov/proto/cosmos/gov/v1beta1/gov.proto index 6953d348d785..fd98fe4c34a9 100644 --- a/x/gov/proto/cosmos/gov/v1beta1/gov.proto +++ b/x/gov/proto/cosmos/gov/v1beta1/gov.proto @@ -192,7 +192,7 @@ message Vote { // Deprecated: Prefer to use `options` instead. This field is set in queries // if and only if `len(options) == 1` and that option has weight 1. In all // other cases, this field will default to VOTE_OPTION_UNSPECIFIED. - VoteOption option = 3 [deprecated = true]; + VoteOption option = 3 [deprecated = true]; // Since: cosmos-sdk 0.43 repeated WeightedVoteOption options = 4 [(gogoproto.nullable) = false]; } diff --git a/x/gov/types/keys.go b/x/gov/types/keys.go index f7ba01b059ae..916382e03ec9 100644 --- a/x/gov/types/keys.go +++ b/x/gov/types/keys.go @@ -1,7 +1,12 @@ package types import ( - "cosmossdk.io/collections" + "encoding/binary" + "time" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/address" + "github.com/cosmos/cosmos-sdk/types/kv" ) const ( @@ -28,7 +33,114 @@ var ( MessageBasedParamsKey = collections.NewPrefix(51) // MessageBasedParamsKey stores the message based gov params. ) -// Reserved kvstore keys -var ( - _ = collections.NewPrefix(4) -) +var lenTime = len(sdk.FormatTimeBytes(time.Now())) + +// GetProposalIDBytes returns the byte representation of the proposalID +func GetProposalIDBytes(proposalID uint64) (proposalIDBz []byte) { + proposalIDBz = make([]byte, 8) + binary.BigEndian.PutUint64(proposalIDBz, proposalID) + return +} + +// GetProposalIDFromBytes returns proposalID in uint64 format from a byte array +func GetProposalIDFromBytes(bz []byte) (proposalID uint64) { + return binary.BigEndian.Uint64(bz) +} + +// ProposalKey gets a specific proposal from the store +func ProposalKey(proposalID uint64) []byte { + return append(ProposalsKeyPrefix, GetProposalIDBytes(proposalID)...) +} + +// ActiveProposalByTimeKey gets the active proposal queue key by endTime +func ActiveProposalByTimeKey(endTime time.Time) []byte { + return append(ActiveProposalQueuePrefix, sdk.FormatTimeBytes(endTime)...) +} + +// ActiveProposalQueueKey returns the key for a proposalID in the activeProposalQueue +func ActiveProposalQueueKey(proposalID uint64, endTime time.Time) []byte { + return append(ActiveProposalByTimeKey(endTime), GetProposalIDBytes(proposalID)...) +} + +// InactiveProposalByTimeKey gets the inactive proposal queue key by endTime +func InactiveProposalByTimeKey(endTime time.Time) []byte { + return append(InactiveProposalQueuePrefix, sdk.FormatTimeBytes(endTime)...) +} + +// InactiveProposalQueueKey returns the key for a proposalID in the inactiveProposalQueue +func InactiveProposalQueueKey(proposalID uint64, endTime time.Time) []byte { + return append(InactiveProposalByTimeKey(endTime), GetProposalIDBytes(proposalID)...) +} + +// DepositsKey gets the first part of the deposits key based on the proposalID +func DepositsKey(proposalID uint64) []byte { + return append(DepositsKeyPrefix, GetProposalIDBytes(proposalID)...) +} + +// DepositKey key of a specific deposit from the store +func DepositKey(proposalID uint64, depositorAddr sdk.AccAddress) []byte { + return append(DepositsKey(proposalID), address.MustLengthPrefix(depositorAddr.Bytes())...) +} + +// VotesKey gets the first part of the votes key based on the proposalID +func VotesKey(proposalID uint64) []byte { + return append(VotesKeyPrefix, GetProposalIDBytes(proposalID)...) +} + +// VoteKey key of a specific vote from the store +func VoteKey(proposalID uint64, voterAddr sdk.AccAddress) []byte { + return append(VotesKey(proposalID), address.MustLengthPrefix(voterAddr.Bytes())...) +} + +// Split keys function; used for iterators + +// SplitProposalKey split the proposal key and returns the proposal id +func SplitProposalKey(key []byte) (proposalID uint64) { + kv.AssertKeyLength(key[1:], 8) + + return GetProposalIDFromBytes(key[1:]) +} + +// SplitActiveProposalQueueKey split the active proposal key and returns the proposal id and endTime +func SplitActiveProposalQueueKey(key []byte) (proposalID uint64, endTime time.Time) { + return splitKeyWithTime(key) +} + +// SplitInactiveProposalQueueKey split the inactive proposal key and returns the proposal id and endTime +func SplitInactiveProposalQueueKey(key []byte) (proposalID uint64, endTime time.Time) { + return splitKeyWithTime(key) +} + +// SplitKeyDeposit split the deposits key and returns the proposal id and depositor address +func SplitKeyDeposit(key []byte) (proposalID uint64, depositorAddr sdk.AccAddress) { + return splitKeyWithAddress(key) +} + +// SplitKeyVote split the votes key and returns the proposal id and voter address +func SplitKeyVote(key []byte) (proposalID uint64, voterAddr sdk.AccAddress) { + return splitKeyWithAddress(key) +} + +// private functions + +func splitKeyWithTime(key []byte) (proposalID uint64, endTime time.Time) { + kv.AssertKeyLength(key[1:], 8+lenTime) + + endTime, err := sdk.ParseTimeBytes(key[1 : 1+lenTime]) + if err != nil { + panic(err) + } + + proposalID = GetProposalIDFromBytes(key[1+lenTime:]) + return +} + +func splitKeyWithAddress(key []byte) (proposalID uint64, addr sdk.AccAddress) { + // Both Vote and Deposit store keys are of format: + // + kv.AssertKeyAtLeastLength(key, 10) + proposalID = GetProposalIDFromBytes(key[1:9]) + kv.AssertKeyAtLeastLength(key, 11) + addr = sdk.AccAddress(key[10:]) + return +} diff --git a/x/slashing/types/keys.go b/x/slashing/types/keys.go index 9bbaf26bcadb..7702ab63bd46 100644 --- a/x/slashing/types/keys.go +++ b/x/slashing/types/keys.go @@ -5,6 +5,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/address" + "github.com/cosmos/cosmos-sdk/types/kv" ) const ( @@ -62,3 +63,30 @@ var ( func ValidatorSigningInfoKey(v sdk.ConsAddress) []byte { return append(ValidatorSigningInfoKeyPrefix, address.MustLengthPrefix(v.Bytes())...) } + +// ValidatorSigningInfoAddress - extract the address from a validator signing info key +func ValidatorSigningInfoAddress(key []byte) (v sdk.ConsAddress) { + // Remove prefix and address length. + kv.AssertKeyAtLeastLength(key, 3) + addr := key[2:] + + return sdk.ConsAddress(addr) +} + +// ValidatorMissedBlockBitArrayPrefixKey - stored by *Consensus* address (not operator address) +func ValidatorMissedBlockBitArrayPrefixKey(v sdk.ConsAddress) []byte { + return append(ValidatorMissedBlockBitArrayKeyPrefix, address.MustLengthPrefix(v.Bytes())...) +} + +// ValidatorMissedBlockBitArrayKey - stored by *Consensus* address (not operator address) +func ValidatorMissedBlockBitArrayKey(v sdk.ConsAddress, i int64) []byte { + b := make([]byte, 8) + binary.LittleEndian.PutUint64(b, uint64(i)) + + return append(ValidatorMissedBlockBitArrayPrefixKey(v), b...) +} + +// AddrPubkeyRelationKey gets pubkey relation key used to get the pubkey from the address +func AddrPubkeyRelationKey(addr []byte) []byte { + return append(AddrPubkeyRelationKeyPrefix, address.MustLengthPrefix(addr)...) +} diff --git a/x/staking/types/keys.go b/x/staking/types/keys.go index 03335a9a8372..fd84495f28b5 100644 --- a/x/staking/types/keys.go +++ b/x/staking/types/keys.go @@ -156,7 +156,43 @@ func ParseValidatorPowerRankKey(key []byte) (operAddr []byte) { // GetUBDKey creates the key for an unbonding delegation by delegator and validator addr // VALUE: staking/UnbondingDelegation func GetUBDKey(delAddr sdk.AccAddress, valAddr sdk.ValAddress) []byte { - return append(append(UnbondingDelegationKey, address.MustLengthPrefix(delAddr)...), address.MustLengthPrefix(valAddr)...) + return append(GetUBDsKey(delAddr.Bytes()), address.MustLengthPrefix(valAddr)...) +} + +// GetUBDByValIndexKey creates the index-key for an unbonding delegation, stored by validator-index +// VALUE: none (key rearrangement used) +func GetUBDByValIndexKey(delAddr sdk.AccAddress, valAddr sdk.ValAddress) []byte { + return append(GetUBDsByValIndexKey(valAddr), address.MustLengthPrefix(delAddr)...) +} + +// GetUBDKeyFromValIndexKey rearranges the ValIndexKey to get the UBDKey +func GetUBDKeyFromValIndexKey(indexKey []byte) []byte { + kv.AssertKeyAtLeastLength(indexKey, 2) + addrs := indexKey[1:] // remove prefix bytes + + valAddrLen := addrs[0] + kv.AssertKeyAtLeastLength(addrs, 2+int(valAddrLen)) + valAddr := addrs[1 : 1+valAddrLen] + kv.AssertKeyAtLeastLength(addrs, 3+int(valAddrLen)) + delAddr := addrs[valAddrLen+2:] + + return GetUBDKey(delAddr, valAddr) +} + +// GetUBDsKey creates the prefix for all unbonding delegations from a delegator +func GetUBDsKey(delAddr sdk.AccAddress) []byte { + return append(UnbondingDelegationKey, address.MustLengthPrefix(delAddr)...) +} + +// GetUBDsByValIndexKey creates the prefix keyspace for the indexes of unbonding delegations for a validator +func GetUBDsByValIndexKey(valAddr sdk.ValAddress) []byte { + return append(UnbondingDelegationByValIndexKey, address.MustLengthPrefix(valAddr)...) +} + +// GetUnbondingDelegationTimeKey creates the prefix for all unbonding delegations from a delegator +func GetUnbondingDelegationTimeKey(timestamp time.Time) []byte { + bz := sdk.FormatTimeBytes(timestamp) + return append(UnbondingQueueKey, bz...) } // GetREDKey returns a key prefix for indexing a redelegation from a delegator @@ -174,6 +210,83 @@ func GetREDKey(delAddr sdk.AccAddress, valSrcAddr, valDstAddr sdk.ValAddress) [] return key } +// GetREDByValSrcIndexKey creates the index-key for a redelegation, stored by source-validator-index +// VALUE: none (key rearrangement used) +func GetREDByValSrcIndexKey(delAddr sdk.AccAddress, valSrcAddr, valDstAddr sdk.ValAddress) []byte { + REDSFromValsSrcKey := GetREDsFromValSrcIndexKey(valSrcAddr) + offset := len(REDSFromValsSrcKey) + + // key is of the form REDSFromValsSrcKey || delAddrLen (1 byte) || delAddr || valDstAddrLen (1 byte) || valDstAddr + key := make([]byte, offset+2+len(delAddr)+len(valDstAddr)) + copy(key[0:offset], REDSFromValsSrcKey) + key[offset] = byte(len(delAddr)) + copy(key[offset+1:offset+1+len(delAddr)], delAddr.Bytes()) + key[offset+1+len(delAddr)] = byte(len(valDstAddr)) + copy(key[offset+2+len(delAddr):], valDstAddr.Bytes()) + + return key +} + +// GetREDByValDstIndexKey creates the index-key for a redelegation, stored by destination-validator-index +// VALUE: none (key rearrangement used) +func GetREDByValDstIndexKey(delAddr sdk.AccAddress, valSrcAddr, valDstAddr sdk.ValAddress) []byte { + REDSToValsDstKey := GetREDsToValDstIndexKey(valDstAddr) + offset := len(REDSToValsDstKey) + + // key is of the form REDSToValsDstKey || delAddrLen (1 byte) || delAddr || valSrcAddrLen (1 byte) || valSrcAddr + key := make([]byte, offset+2+len(delAddr)+len(valSrcAddr)) + copy(key[0:offset], REDSToValsDstKey) + key[offset] = byte(len(delAddr)) + copy(key[offset+1:offset+1+len(delAddr)], delAddr.Bytes()) + key[offset+1+len(delAddr)] = byte(len(valSrcAddr)) + copy(key[offset+2+len(delAddr):], valSrcAddr.Bytes()) + + return key +} + +// GetREDKeyFromValSrcIndexKey rearranges the ValSrcIndexKey to get the REDKey +func GetREDKeyFromValSrcIndexKey(indexKey []byte) []byte { + // note that first byte is prefix byte, which we remove + kv.AssertKeyAtLeastLength(indexKey, 2) + addrs := indexKey[1:] + + valSrcAddrLen := addrs[0] + kv.AssertKeyAtLeastLength(addrs, int(valSrcAddrLen)+2) + valSrcAddr := addrs[1 : valSrcAddrLen+1] + delAddrLen := addrs[valSrcAddrLen+1] + kv.AssertKeyAtLeastLength(addrs, int(valSrcAddrLen)+int(delAddrLen)+2) + delAddr := addrs[valSrcAddrLen+2 : valSrcAddrLen+2+delAddrLen] + kv.AssertKeyAtLeastLength(addrs, int(valSrcAddrLen)+int(delAddrLen)+4) + valDstAddr := addrs[valSrcAddrLen+delAddrLen+3:] + + return GetREDKey(delAddr, valSrcAddr, valDstAddr) +} + +// GetREDKeyFromValDstIndexKey rearranges the ValDstIndexKey to get the REDKey +func GetREDKeyFromValDstIndexKey(indexKey []byte) []byte { + // note that first byte is prefix byte, which we remove + kv.AssertKeyAtLeastLength(indexKey, 2) + addrs := indexKey[1:] + + valDstAddrLen := addrs[0] + kv.AssertKeyAtLeastLength(addrs, int(valDstAddrLen)+2) + valDstAddr := addrs[1 : valDstAddrLen+1] + delAddrLen := addrs[valDstAddrLen+1] + kv.AssertKeyAtLeastLength(addrs, int(valDstAddrLen)+int(delAddrLen)+3) + delAddr := addrs[valDstAddrLen+2 : valDstAddrLen+2+delAddrLen] + kv.AssertKeyAtLeastLength(addrs, int(valDstAddrLen)+int(delAddrLen)+4) + valSrcAddr := addrs[valDstAddrLen+delAddrLen+3:] + + return GetREDKey(delAddr, valSrcAddr, valDstAddr) +} + +// GetRedelegationTimeKey returns a key prefix for indexing an unbonding +// redelegation based on a completion time. +func GetRedelegationTimeKey(timestamp time.Time) []byte { + bz := sdk.FormatTimeBytes(timestamp) + return append(RedelegationQueueKey, bz...) +} + // GetREDsKey returns a key prefix for indexing a redelegation from a delegator // address. func GetREDsKey(delAddr sdk.AccAddress) []byte {