Skip to content
Cosmopediaby Unity Nodes

v0.38.0

cosmos/cosmos-sdkv0.38.023-01-2020

Release Notes

State Machine Breaking

• (genesis) #5506 The `x/distribution` genesis state

now includes `params` instead of individual parameters.

• (genesis) #5017 The `x/genaccounts` module has been

deprecated and all components removed except the `legacy/` package. This requires changes to the

genesis state. Namely, `accounts` now exist under `app_state.auth.accounts`. The corresponding migration

logic has been implemented for v0.38 target version. Applications can migrate via:

`$ {appd} migrate v0.38 genesis.json`.

• (modules) #5299 Handling of `ABCIEvidenceTypeDuplicateVote`

during `BeginBlock` along with the corresponding parameters (`MaxEvidenceAge`) have moved from the

`x/slashing` module to the `x/evidence` module.

API Breaking Changes

• (modules) #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 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 `DecCoins#Add` parameter changed from `DecCoins`

to `...DecCoin`, `Coins#Add` parameter changed from `Coins` to `...Coin`.

• (baseapp/types) #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 Remove client/alias.go as it's not necessary and

components can be imported directly from the packages.

• (store) #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 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 The `x/genaccounts` module has been deprecated and all components removed except the `legacy/` package.

• #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 The `NewBaseVestingAccount` constructor returns an error

if the provided arguments are invalid.

• (x/auth) #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 `HandleDoubleSign` along with params `MaxEvidenceAge` and `DoubleSignJailEndTime` have moved from the `x/slashing` module to the `x/evidence` module.

• (keys) #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 `NewKeyBaseFromHomeFlag` constructor has been removed.

• #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 The `helpers.GenTx()` now accepts a gas argument.

• (baseapp) #5455 A `sdk.Context` is now passed into the `router.Route()` function.

Client Breaking Changes

• (rest) #5270 All account types now implement custom JSON serialization.

• (rest) #4783 The balance field in the DelegationResponse type is now sdk.Coin instead of sdk.Int

• (x/auth) #5006 The gas required to pass the `AnteHandler` has

increased significantly due to modular `AnteHandler` support. Increase GasLimit accordingly.

• (rest) #5336 `MsgEditValidator` uses `description` instead of `Description` as a JSON key.

• (keys) #5097 Due to the keybase -> keyring transition, keys need to be migrated. See `keys migrate` command for more info.

• (x/auth) #5424 Drop `decode-tx` command from x/auth/client/cli, duplicate of the `decode` command.

Features

• (store) #5435 New iterator for paginated requests. Iterator limits DB reads to the range of the requested page.

• (x/evidence) #5240 Initial implementation of the `x/evidence` module.

• (cli) #5212 The `q gov proposals` command now supports pagination.

• (store) #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 A `TxResponse` with a corresponding code

and tx hash will be returned for specific Tendermint errors: • `CodeTxInMempoolCache`

• `CodeMempoolIsFull`

• `CodeTxTooLarge`

• #3872 Implement a RESTful endpoint and cli command to decode transactions.

• (keys) #4754 Introduce new Keybase implementation that can

leverage operating systems' built-in functionalities to securely store secrets. MacOS users may encounter

the following issue 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 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 service.

• `pass`: use the pass command line password manager.

• `test`: use password-less key store. For testing purposes only. Use it at your own risk.

• (keys) #5097 New `keys migrate` command to assist users migrate their keys

to the new keyring.

• (keys) #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 Add upgrade module that coordinates software upgrades of live chains.

• #4486 Introduce new `PeriodicVestingAccount` vesting account type

that allows for arbitrary vesting periods.

• (baseapp) #5196 Baseapp has a new `runTxModeReCheck` to allow applications to skip expensive and unnecessary re-checking of transactions.

• (types) #5196 Context has new `IsRecheckTx() bool` and `WithIsReCheckTx(bool) Context` methods to to be used in the `AnteHandler`.

• (x/auth/ante) #5196 AnteDecorators have been updated to avoid unnecessary checks when `ctx.IsReCheckTx() == true`

• (x/auth) #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 .

• `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 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 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 Funds are now allowed to be directly sent to the community pool (via the distribution module account).

• (keys) #4941 Introduce keybase option to allow overriding the default private key implementation of a key generated through the `keys add` cli command.

• (keys) #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 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.

Improvements

• (iavl) #5538 Remove manual IAVL pruning in favor of IAVL's internal pruning strategy.

• (server) #4215 The `--pruning` flag

has been moved to the configuration file, to allow easier node configuration.

• (cli) #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:

``` // 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), ) ```

• (modules) #5017 The `x/auth` package now supports

generalized genesis accounts through the `GenesisAccount` interface.

• (modules) #4762 Deprecate remove and add permissions in ModuleAccount.

• (modules) #4760 update `x/auth` to match module spec.

• (modules) #4814 Add security contact to Validator description.

• (modules) #4875 refactor integration tests to use SimApp and separate test package

• (sdk) #4566 Export simulation's parameters and app state to JSON in order to reproduce bugs and invariants.

• (sdk) #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 refactor `x/slashing` to match the new module spec

• (sdk) #4758 update `x/genaccounts` to match module spec

• (simulation) #4824 `PrintAllInvariants` flag will print all failed invariants

• (simulation) #4490 add `InitialBlockHeight` flag to resume a simulation from a given block • Support exporting the simulation stats to a given JSON file

• (simulation) #4847 , #4838 and #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 Change `SimApp` keepers to be public and add getter functions for keys and codec

• (simulation) #4906 Add simulation `Config` struct that wraps simulation flags

• (simulation) #4935 Update simulation to reflect a proper `ABCI` application without bypassing `BaseApp` semantics

• (simulation) #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 panic on non-registered store

• (types) #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 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 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 Add `Mod` (modulo) method and `RelativePow` (exponentation) function for `Uint`.

• (modules) #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

• (rest) #5508 Fix `x/distribution` endpoints to properly return height in the response.

• (x/genutil) #5499 Ensure `DefaultGenesis` returns valid and non-nil default genesis state.

• (client) #5303 Fix ignored error in tx generate only mode.

• (cli) #4763 Fix flag `--min-self-delegation` for staking `EditValidator`

• (keys) Fix ledger custom coin type support bug.

• (x/gov) #5107 Sum validator operator's all voting power when tally votes

• (rest) #5212 Fix pagination in the `/gov/proposals` handler.

← Back to Releases