Skip to content

Commit 89ceb62

Browse files
author
Alessio Treglia
authored
Merge pull request #6725 from cosmos/rc0/v0.39.0
Merge 0.39.0 RC0 to 0.39.0
2 parents 5f6e499 + 4bae3e8 commit 89ceb62

Some content is hidden

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

53 files changed

+1162
-633
lines changed

.github/workflows/lint.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ jobs:
99
- uses: golangci/golangci-lint-action@master
1010
with:
1111
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
12-
version: v1.27
12+
version: v1.28
1313
args: --timeout 10m
1414
github-token: ${{ secrets.github_token }}

CHANGELOG.md

+39-1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,45 @@ Ref: https://keepachangelog.com/en/1.0.0/
3535

3636
# Changelog
3737

38+
## [v0.39.0]
39+
40+
### Improvements
41+
42+
* (deps) Bump Tendermint version to [v0.33.6](https://github.com/tendermint/tendermint/releases/tag/v0.33.6)
43+
* (deps) Bump IAVL version to [v0.14.0](https://github.com/cosmos/iavl/releases/tag/v0.14.0)
44+
* (client) [\#5585](https://github.com/cosmos/cosmos-sdk/pull/5585) `CLIContext` additions:
45+
* Introduce `QueryABCI` that returns the full `abci.ResponseQuery` with inclusion Merkle proofs.
46+
* Added `prove` flag for Merkle proof verification.
47+
* (x/staking) [\#6791)](https://github.com/cosmos/cosmos-sdk/pull/6791) Close {UBDQueue,RedelegationQueu}Iterator once used.
48+
49+
### API Breaking Changes
50+
51+
* (baseapp) [\#5837](https://github.com/cosmos/cosmos-sdk/issues/5837) Transaction simulation now returns a `SimulationResponse` which contains the `GasInfo` and `Result` from the execution.
52+
53+
### Client Breaking Changes
54+
55+
* (x/auth) [\#6745](https://github.com/cosmos/cosmos-sdk/issues/6745) Remove BaseAccount's custom JSON {,un}marshalling.
56+
57+
### Bug Fixes
58+
59+
* (store) [\#6475](https://github.com/cosmos/cosmos-sdk/pull/6475) Revert IAVL pruning functionality introduced in
60+
[v0.13.0](https://github.com/cosmos/iavl/releases/tag/v0.13.0),
61+
where the IAVL no longer keeps states in-memory in which it flushes periodically. IAVL now commits and
62+
flushes every state to disk as it did pre-v0.13.0. The SDK's multi-store will track and ensure the proper
63+
heights are pruned. The operator can set the pruning options via a `pruning` config via the CLI or
64+
through `app.toml`. The `pruning` flag exposes `default|everything|nothing|custom` as options --
65+
see docs for further details. If the operator chooses `custom`, they may provide granular pruning
66+
options `pruning-keep-recent`, `pruning-keep-every`, and `pruning-interval`. The former two options
67+
dictate how many recent versions are kept on disk and the offset of what versions are kept after that
68+
respectively, and the latter defines the height interval in which versions are deleted in a batch.
69+
**Note, there are some client-facing API breaking changes with regard to IAVL, stores, and pruning settings.**
70+
* (x/distribution) [\#6210](https://github.com/cosmos/cosmos-sdk/pull/6210) Register `MsgFundCommunityPool` in distribution amino codec.
71+
* (types) [\#5741](https://github.com/cosmos/cosmos-sdk/issues/5741) Prevent `ChainAnteDecorators()` from panicking when empty `AnteDecorator` slice is supplied.
72+
* (baseapp) [\#6306](https://github.com/cosmos/cosmos-sdk/issues/6306) Prevent events emitted by the antehandler from being persisted between transactions.
73+
* (client/keys) [\#5091](https://github.com/cosmos/cosmos-sdk/issues/5091) `keys parse` does not honor client app's configuration.
74+
* (x/bank) [\#6674](https://github.com/cosmos/cosmos-sdk/pull/6674) Create account if recipient does not exist on handing `MsgMultiSend`.
75+
* (x/auth) [\#6287](https://github.com/cosmos/cosmos-sdk/pull/6287) Fix nonce stuck when sending multiple transactions from an account in a same block.
76+
3877
## [v0.38.5] - 2020-07-02
3978

4079
### Improvements
@@ -311,7 +350,6 @@ to detail this new feature and how state transitions occur.
311350
now exists a single `Params` type with a getter and setter along with a getter for each individual parameter.
312351

313352
### Bug Fixes
314-
315353
* (rest) [\#5508](https://github.com/cosmos/cosmos-sdk/pull/5508) Fix `x/distribution` endpoints to properly return height in the response.
316354
* (x/genutil) [\#5499](https://github.com/cosmos/cosmos-sdk/pull/) Ensure `DefaultGenesis` returns valid and non-nil default genesis state.
317355
* (client) [\#5303](https://github.com/cosmos/cosmos-sdk/issues/5303) Fix ignored error in tx generate only mode.

Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ update-swagger-docs: statik
3535

3636
mocks: $(MOCKS_DIR)
3737
mockgen -source=x/auth/types/account_retriever.go -package mocks -destination tests/mocks/account_retriever.go
38+
mockgen -source=types/handler.go -package mocks -destination tests/mocks/types_handler.go
3839
.PHONY: mocks
3940

4041
$(MOCKS_DIR):

RELEASE_NOTES.md

+131
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
# Cosmos SDK v0.39.0 Release Notes
2+
3+
This is the inaugural release of the **Cosmos SDK 0.39 «Launchpad»** release series.
4+
5+
See the [Cosmos SDK 0.39.0 milestone](https://github.com/cosmos/cosmos-sdk/milestone/27?closed=1) on our issue tracker for details.
6+
7+
## Changes to IAVL and store pruning
8+
9+
The pruning features introduced in the `0.38` release series are buggy and might lead to data loss,
10+
even after upgrading to `v0.39.0`. When upgrading from `0.38` it is important to follow the instructions
11+
below, to prevent data loss and database corruption.
12+
13+
**Note: there are are several breaking changes with regard to IAVL, stores, and pruning settings that affect command line clients, server configuration, and Golang API.**
14+
15+
### Migrate an application from 0.38.5 to 0.39.0
16+
17+
The IAVL's `v0.13.0` release introduced a pruning functionality that turned out to be buggy and flawed.
18+
IAVL's new `v0.14.0` release now commits and flushes every state to disk as it did in pre-`v0.13.0` release.
19+
The SDK's multi-store will track and ensure the proper heights are pruned. The operator can now set the pruning
20+
options by passing a `pruning` configuration via command line option or `app.toml`. The `pruning` flag supports the following
21+
options: `default`, `everything`, `nothing`, `custom` - see docs for further details. If the operator chooses `custom`, they
22+
may want to provide either of the granular pruning values:
23+
- `pruning-keep-recent`
24+
- `pruning-keep-every`
25+
- `pruning-interval`
26+
27+
The former two options dictate how many recent versions are kept on disk and the offset of what versions are kept after that
28+
respectively, and the latter defines the height interval in which versions are deleted in a batch. **Note: there are are some
29+
client application breaking changes with regard to IAVL, stores, and pruning settings.** An example patch follows:
30+
31+
```patch
32+
From 5884171ba73c3054e98564c39adc9cbbab8d4646 Mon Sep 17 00:00:00 2001
33+
From: Alessio Treglia <[email protected]>
34+
Date: Tue, 14 Jul 2020 14:54:19 +0100
35+
Subject: [PATCH 2/4] use new pruning options
36+
37+
---
38+
cmd/cnd/main.go | 8 ++++++--
39+
1 file changed, 6 insertions(+), 2 deletions(-)
40+
41+
diff --git a/cmd/cnd/main.go b/cmd/cnd/main.go
42+
index b0c86f4a..4a3a8518 100644
43+
--- a/cmd/cnd/main.go
44+
+++ b/cmd/cnd/main.go
45+
@@ -23,7 +23,6 @@ import (
46+
comgenutilcli "github.com/commercionetwork/commercionetwork/x/genutil/client/cli"
47+
"github.com/cosmos/cosmos-sdk/baseapp"
48+
"github.com/cosmos/cosmos-sdk/server"
49+
- "github.com/cosmos/cosmos-sdk/store"
50+
genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli"
51+
"github.com/cosmos/cosmos-sdk/x/staking"
52+
)
53+
@@ -87,9 +86,14 @@ func main() {
54+
}
55+
56+
func newApp(logger log.Logger, db dbm.DB, traceStore io.Writer) abci.Application {
57+
+ pruningOpts, err := server.GetPruningOptionsFromFlags()
58+
+ if err != nil {
59+
+ panic(err)
60+
+ }
61+
+
62+
return app.NewCommercioNetworkApp(
63+
logger, db, traceStore, true, invCheckPeriod,
64+
- baseapp.SetPruning(store.NewPruningOptionsFromString(viper.GetString("pruning"))),
65+
+ baseapp.SetPruning(pruningOpts),
66+
baseapp.SetMinGasPrices(viper.GetString(server.FlagMinGasPrices)),
67+
baseapp.SetHaltHeight(uint64(viper.GetInt(server.FlagHaltHeight))),
68+
)
69+
```
70+
71+
### Migrate a node from 0.38.5 to 0.39.0
72+
73+
Note: **do not modify pruning settings with any release prior to `v0.39.0` as that may cause data corruption**.
74+
75+
The following instructions assume that **pruning settings have not been modified since the node started using 0.38.x. Note: the default pruning setting `syncable` used `KeepEvery:100`.
76+
77+
#### Chain Hard Fork (also know as The Tested Upgrade Path)
78+
79+
This strategy entails performing a hard fork of your chain.
80+
It takes time, coordination and a few technical steps that the validators of the network must follow. Note: a software upgrade guide for `gaia`, the application that powers the Cosmos Hub, is [available too](https://hub.cosmos.network/master/gaia-tutorials/upgrade-node.html). It contains detailed instructions on how to upgrade network nodes that apply to the vast majority of Cosmos SDK applications.
81+
82+
In preparation of the upgrade, you need to export the current state. This operation should be be performed on one node:
83+
84+
* Stop the node and export the current state, e.g.: `appd export --for-zero-height > export_genesis.json`.
85+
* Manually replace the chain id and genesis time fields in `export_genesis.json` with the values that the network had agreed upon.
86+
87+
Follow these steps to perform the upgrade:
88+
89+
* Make a backup copy of the old `genesis.json` file in your server application's config directory (e.g. `$HOME/.appd/config/genesis.json`) and replace it with `export_genesis.json`. Note: do rename `export_genesis.json` to `genesis.json`.
90+
* Replace the old binary with the new one and restart the service using the new binary.
91+
92+
#### Alternative strategies
93+
94+
Alternatively, you can follow *one of* the following strategies:
95+
96+
* Replace the application server's binary and perform a full sync of the node from scratch.
97+
98+
* If your node had started with using `KeepEvery:1` (e.g. pruning settings `nothing` or `everything`), upgrading to `v0.39.0` should be simple and safe.
99+
100+
* Do halt block processing with `--halt-height` after committing a height divisible by `KeepEvery` - e.g. at block 147600 with `KeepEvery:100`. The **node must never have processed a height beyond that at any time in its past**. Upgrading to `v0.39.0` is then safe.
101+
102+
* Set the `KeepEvery` setting to the same as the previous `KeepEvery` setting (both `<=v0.38.5` and `v0.39.0` default to `KeepEvery:100`). Upgrade to `v0.39.0` is then safe as long as you wait one `KeepEvery` interval plus one `KeepRecent` interval **plus** one pruning `Interval` before changing pruning settings or deleting the last `<=v0.38.5` height (so wait *210* heights with the default configuration).
103+
104+
* Otherwise, make sure the last version persisted with `<=v0.38.5` is never deleted after upgrading to `v0.39.0`, as doing so may cause data loss and data corruption.
105+
106+
## Regression in the signature verification when multiple transactions in the same block are sent from the same account
107+
108+
When multiple transactions in the same block are sent (and correctly signed) by the same account, chances are that some of them could be rejected and the error `unauthorized: signature verification failed` would be returned due to the account's sequence (*nonce*) getting stuck and not being incremented by the ante handler. This behaviour was [a regression](https://github.com/cosmos/cosmos-sdk/issues/6287) introduced in the `v0.38` release series, it did not occur in the `v0.37` release series and is now fixed in this release.
109+
110+
## Changes to ABCI Query's "app/simulate" path
111+
112+
The `app/simulate` query path is used to simulate the execution transactions in order to obtain an estimate
113+
of the gas consumption that would be required to actually execute them. The response used to return only
114+
the amount of gas, it now returns the result of the transaction as well.
115+
116+
## bank.send event comes with sender information
117+
118+
The `bank.send` event used to carry only the recipient and amount. It was assumed that the sender of the funds was `message.sender`.
119+
This is often not true when a module call the bank keeper directly. This may be due to staking distribution, or via a cosmwasm contract that released funds (where I discovered the issue).
120+
121+
`bank.send` now contains the entire triple `(sender, recipient, amount)`.
122+
123+
## trace option is no longer ignored
124+
125+
The `--trace` option is reintroduced. It comes in very handy for debugging as it causes the full stack trace to be included in the ABCI error logs.
126+
127+
## appcli keys parse command didn't honor client application's bech32 prefixes
128+
129+
The `key parse` command ignored the application-specific address bech32
130+
prefixes and used to return `cosmos*1`-prefixed addresses regardless
131+
of the client application's configuration.

baseapp/abci.go

+14-6
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ func (app *BaseApp) EndBlock(req abci.RequestEndBlock) (res abci.ResponseEndBloc
163163
func (app *BaseApp) CheckTx(req abci.RequestCheckTx) abci.ResponseCheckTx {
164164
tx, err := app.txDecoder(req.Tx)
165165
if err != nil {
166-
return sdkerrors.ResponseCheckTx(err, 0, 0)
166+
return sdkerrors.ResponseCheckTx(err, 0, 0, app.trace)
167167
}
168168

169169
var mode runTxMode
@@ -181,7 +181,7 @@ func (app *BaseApp) CheckTx(req abci.RequestCheckTx) abci.ResponseCheckTx {
181181

182182
gInfo, result, err := app.runTx(mode, req.Tx, tx)
183183
if err != nil {
184-
return sdkerrors.ResponseCheckTx(err, gInfo.GasWanted, gInfo.GasUsed)
184+
return sdkerrors.ResponseCheckTx(err, gInfo.GasWanted, gInfo.GasUsed, app.trace)
185185
}
186186

187187
return abci.ResponseCheckTx{
@@ -201,12 +201,12 @@ func (app *BaseApp) CheckTx(req abci.RequestCheckTx) abci.ResponseCheckTx {
201201
func (app *BaseApp) DeliverTx(req abci.RequestDeliverTx) abci.ResponseDeliverTx {
202202
tx, err := app.txDecoder(req.Tx)
203203
if err != nil {
204-
return sdkerrors.ResponseDeliverTx(err, 0, 0)
204+
return sdkerrors.ResponseDeliverTx(err, 0, 0, app.trace)
205205
}
206206

207207
gInfo, result, err := app.runTx(runTxModeDeliver, req.Tx, tx)
208208
if err != nil {
209-
return sdkerrors.ResponseDeliverTx(err, gInfo.GasWanted, gInfo.GasUsed)
209+
return sdkerrors.ResponseDeliverTx(err, gInfo.GasWanted, gInfo.GasUsed, app.trace)
210210
}
211211

212212
return abci.ResponseDeliverTx{
@@ -326,12 +326,20 @@ func handleQueryApp(app *BaseApp, path []string, req abci.RequestQuery) abci.Res
326326
return sdkerrors.QueryResult(sdkerrors.Wrap(err, "failed to decode tx"))
327327
}
328328

329-
gInfo, _, _ := app.Simulate(txBytes, tx)
329+
gInfo, res, err := app.Simulate(txBytes, tx)
330+
if err != nil {
331+
return sdkerrors.QueryResult(sdkerrors.Wrap(err, "failed to simulate tx"))
332+
}
333+
334+
simRes := sdk.SimulationResponse{
335+
GasInfo: gInfo,
336+
Result: res,
337+
}
330338

331339
return abci.ResponseQuery{
332340
Codespace: sdkerrors.RootCodespace,
333341
Height: req.Height,
334-
Value: codec.Cdc.MustMarshalBinaryLengthPrefixed(gInfo.GasUsed),
342+
Value: codec.Cdc.MustMarshalBinaryBare(simRes),
335343
}
336344

337345
case "version":

baseapp/baseapp.go

+10-1
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ type BaseApp struct { // nolint: maligned
106106

107107
// application's version string
108108
appVersion string
109+
110+
// trace set will return full stack traces for errors in ABCI Log field
111+
trace bool
109112
}
110113

111114
// NewBaseApp returns a reference to an initialized BaseApp. It accepts a
@@ -127,6 +130,7 @@ func NewBaseApp(
127130
queryRouter: NewQueryRouter(),
128131
txDecoder: txDecoder,
129132
fauxMerkleMode: false,
133+
trace: false,
130134
}
131135
for _, option := range options {
132136
option(app)
@@ -354,6 +358,10 @@ func (app *BaseApp) setInterBlockCache(cache sdk.MultiStorePersistentCache) {
354358
app.interBlockCache = cache
355359
}
356360

361+
func (app *BaseApp) setTrace(trace bool) {
362+
app.trace = trace
363+
}
364+
357365
// Router returns the router of the BaseApp.
358366
func (app *BaseApp) Router() sdk.Router {
359367
if app.sealed {
@@ -596,8 +604,9 @@ func (app *BaseApp) runTx(mode runTxMode, txBytes []byte, tx sdk.Tx) (gInfo sdk.
596604
// writes do not happen if aborted/failed. This may have some
597605
// performance benefits, but it'll be more difficult to get right.
598606
anteCtx, msCache = app.cacheTxContext(ctx, txBytes)
599-
607+
anteCtx = anteCtx.WithEventManager(sdk.NewEventManager())
600608
newCtx, err := app.anteHandler(anteCtx, tx, mode == runTxModeSimulate)
609+
601610
if !newCtx.IsZero() {
602611
// At this point, newCtx.MultiStore() is cache-wrapped, or something else
603612
// replaced by the AnteHandler. We want the original multistore, not one

0 commit comments

Comments
 (0)