State Machine Breaking
- (genesis) #5506 The
x/distribution
genesis state
now includesparams
instead of individual parameters. - (genesis) #5017 The
x/genaccounts
module has been
deprecated and all components removed except thelegacy/
package. This requires changes to the
genesis state. Namely,accounts
now exist underapp_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
duringBeginBlock
along with the corresponding parameters (MaxEvidenceAge
) have moved from the
x/slashing
module to thex/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 callingSetParams
. - (types) #5495 Remove redundant
(Must)Bech32ify*
and(Must)Get*KeyBech32
functions in favor of(Must)Bech32ifyPubKey
and(Must)GetPubKeyFromBech32
respectively, both of which take aBech32PubKeyType
(string). - (types) #5430
DecCoins#Add
parameter changed fromDecCoins
to...DecCoin
,Coins#Add
parameter changed fromCoins
to...Coin
. - (baseapp/types) #5421 The
Error
interface (types/errors.go
)
has been removed in favor of the concrete type defined intypes/errors/
which implements the standarderror
interface.- As a result, the
Handler
andQuerier
implementations now return a standarderror
.
WithinBaseApp
,runTx
now returns a(GasInfo, *Result, error)
tuple andrunMsgs
returns a
(*Result, error)
tuple. A reference to aResult
is now used to indicate success whereas an error
signals an invalid message or failed message execution. As a result, the fieldsCode
,Codespace
,
GasWanted
, andGasUsed
have been removed theResult
type. The latter two fields are now found
in theGasInfo
type which is always returned regardless of execution outcome. - Note to developers: Since all handlers and queriers must now return a standard
error
, thetypes/errors/
package contains all the relevant and pre-registered errors that you typically work with. A typical
error returned will look likesdkerrors.Wrap(sdkerrors.ErrUnknownRequest, "...")
. You can retrieve
relevant ABCI information from the error viaABCIInfo
.
- As a result, the
- (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 aSetInterBlockCache
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 thelegacy/
package. - #4486 Vesting account types decoupled from the
x/auth
module and now live underx/auth/vesting
. Applications wishing to use vesting account types must be sure to register types viaRegisterCodec
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 anAnteHandler
function that returns the newAnteHandler
interface and has been moved into theauth/ante
directory. ValidateSigCount
,ValidateMemo
,ProcessPubKey
,EnsureSufficientMempoolFee
, andGetSignBytes
have all been removed as public functions.- Invalid Signatures may return
InvalidPubKey
instead ofUnauthorized
error, since the transaction
will first hitSetPubKeyDecorator
before theSigVerificationDecorator
runs. StdTx#GetSignatures
will return an array of just signature byte slices[][]byte
instead of
returning an array ofStdSignature
structs. To replicate the old behavior, use the public field
StdTx.Signatures
to get back the array of StdSignatures[]StdSignature
.
- The
- (modules) #5299
HandleDoubleSign
along with paramsMaxEvidenceAge
andDoubleSignJailEndTime
have moved from thex/slashing
module to thex/evidence
module. - (keys) #4941 Keybase concrete types constructors such as
NewKeyBaseFromDir
andNewInMemory
now accept optional parameters of typeKeybaseOption
. 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 aKeybaseOption
which allows a custom bytes to key
implementation to be defined when keys are created. - The
WithDeriveFunc
function added as aKeybaseOption
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
theclient/keys
add command. SupportedAlgos
andSupportedAlgosLedger
functions return a slice ofSigningAlgo
s that are
supported by the keybase and the ledger integration respectively.
- The
- (simapp) #5419 The
helpers.GenTx()
now accepts a gas argument. - (baseapp) #5455 A
sdk.Context
is now passed into therouter.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 modularAnteHandler
support. Increase GasLimit accordingly. - (rest) #5336
MsgEditValidator
usesdescription
instead ofDescription
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 thedecode
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
supportsStoreLoader
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 thego-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 thekeys 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
andWithIsReCheckTx(bool) Context
methods to to be used in theAnteHandler
. - (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 modularAnteHandler
functionality that can be composed together to create a singleAnteHandler
rather than implementing
a customAnteHandler
completely from scratch, where eachAnteDecorator
allows for custom behavior in
tightly defined and logically isolated manner. These customAnteDecorator
can then be chained together
with defaultAnteDecorator
or third-partyAnteDecorator
to create a modularizedAnteHandler
which will run eachAnteDecorator
in the order specified inChainAnteDecorators
. For details
on the new architecture, refer to the ADR. ChainAnteDecorators
function has been introduced to take in a list ofAnteDecorators
and chain
them in sequence and return a singleAnteHandler
:SetUpContextDecorator
: SetsGasMeter
in context and creates defer clause to recover from any
OutOfGas
panics in future AnteDecorators and returnOutOfGas
error toBaseApp
. It MUST be the
firstAnteDecorator
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 mempoolminFee
parameter duringCheckTx
.DeductFeeDecorator
: Deducts theFeeAmount
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.
- The
- (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
- Introduces new parameter
- (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.
- An
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'sCLIContext
will have to have the correct
chain ID and node URI or client set. To use aCLIContext
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 theGenesisAccount
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 ofKVPairs
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 theSimulationManager
for decoding each module's types - Add
GenerateGenesisStates
to theSimulationManager
to generate a randomizedGenState
for each module - Add
RandomizedParams
to theSimulationManager
that registers each modules' parameters in order to
simulateParamChangeProposal
s'Content
s - Add
WeightedOperations
to theSimulationManager
that define simulation operations (modules'Msg
s) with their
respective weights (i.e chance of being simulated). - Add
ProposalContents
to theSimulationManager
to register each module's governance proposalContent
s.
- Implement
- (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 bypassingBaseApp
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.
- Add
- (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 throughCommitKVStoreCacheManager
. Any application wishing to utilize an inter-block cache
must set it in their app via aBaseApp
option. TheBaseApp
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 andRelativePow
(exponentation) function forUint
. - (modules) #5506 Remove redundancy in
x/distribution
s use of parameters. There
now exists a singleParams
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 stakingEditValidator
- (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.