Skip to content

Commit c27c7fc

Browse files
authored
Merge pull request #539 from terra-money/upgrade/v0.47.10
upgrade: v0.47.10
2 parents 361b96a + 24f2e72 commit c27c7fc

Some content is hidden

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

57 files changed

+1894
-706
lines changed

CHANGELOG.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,47 @@ Ref: https://keepachangelog.com/en/1.0.0/
3737

3838
## [Unreleased]
3939

40+
## [v0.47.10](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.10) - 2024-02-27
41+
42+
### Bug Fixes
43+
44+
* (x/staking) Fix a possible bypass of delagator slashing: [GHSA-86h5-xcpx-cfqc](https://github.com/cosmos/cosmos-sdk/security/advisories/GHSA-86h5-xcpx-cfqc)
45+
* (server) [#19573](https://github.com/cosmos/cosmos-sdk/pull/19573) Use proper `db_backend` type when reading chain-id
46+
47+
## [v0.47.9](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.9) - 2024-02-19
48+
49+
### Bug Fixes
50+
51+
* (x/auth/vesting) [GHSA-4j93-fm92-rp4m](#bug-fixes) Add `BlockedAddr` check in `CreatePeriodicVestingAccount`.
52+
* (baseapp) [#19177](https://github.com/cosmos/cosmos-sdk/pull/19177) Fix baseapp `DefaultProposalHandler` same-sender non-sequential sequence.
53+
54+
## [v0.47.8](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.8) - 2024-01-22
55+
56+
### Improvements
57+
58+
* (client/tx) [#18852](https://github.com/cosmos/cosmos-sdk/pull/18852) Add `WithFromName` to tx factory.
59+
* (types) [#18875](https://github.com/cosmos/cosmos-sdk/pull/18875) Speedup coins.Sort() if len(coins) <= 1.
60+
* (types) [#18888](https://github.com/cosmos/cosmos-sdk/pull/18888) Speedup DecCoin.Sort() if len(coins) <= 1
61+
* (testutil) [#18930](https://github.com/cosmos/cosmos-sdk/pull/18930) Add NodeURI for clientCtx.
62+
63+
### Bug Fixes
64+
65+
* [#19106](https://github.com/cosmos/cosmos-sdk/pull/19106) Allow empty public keys when setting signatures. Public keys aren't needed for every transaction.
66+
* (server) [#18920](https://github.com/cosmos/cosmos-sdk/pull/18920) Fixes consensus failure while restart node with wrong `chainId` in genesis.
67+
68+
## [v0.47.7](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.7) - 2023-12-20
69+
70+
### Improvements
71+
72+
* (x/gov) [#18707](https://github.com/cosmos/cosmos-sdk/pull/18707) Improve genesis validation.
73+
* (server) [#18478](https://github.com/cosmos/cosmos-sdk/pull/18478) Add command flag to disable colored logs.
74+
75+
### Bug Fixes
76+
77+
* (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.
78+
* (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.
79+
* (client/tx) [#18472](https://github.com/cosmos/cosmos-sdk/pull/18472) Utilizes the correct Pubkey when simulating a transaction.
80+
4081
## [v0.47.6](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.6) - 2023-11-14
4182

4283
### Features

RELEASE_NOTES.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
1-
# Cosmos SDK v0.47.6 Release Notes
1+
# Cosmos SDK v0.47.10 Release Notes
22

3-
💬 [**Release Discussion**](https://github.com/orgs/cosmos/discussions/categories/announcements)
3+
💬 [**Release Discussion**](https://github.com/orgs/cosmos/discussions/6)
44

55
## 🚀 Highlights
66

7-
v0.50 is there, the v0.47.x line is now supported for bug fixes only, as per our release policy.
8-
Start integrating with [Cosmos SDK Eden (v0.50)](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.50.1) and enjoy and the new features and performance improvements.
7+
This early monthly patch release fixes [GHSA-86h5-xcpx-cfqc](https://github.com/cosmos/cosmos-sdk/security/advisories/GHSA-86h5-xcpx-cfqc).
98

10-
For this 6th patch release of the `v0.47.x` line, some of the notable changes include:
9+
We recommended to upgrade to this patch release as soon as possible.
10+
When upgrading from <= v0.47.9, please ensure that 2/3 of the validator power upgrade to v0.47.10.
1111

12-
* The gRPC and API server are both started in standalone mode (CometBFT out of process)
13-
* Fix the default prepare proposal handler to better match CometBFT ABCI specification
12+
Curious? Check out the [changelog](https://github.com/cosmos/cosmos-sdk/blob/v0.47.10/CHANGELOG.md) for an exhaustive list of changes or [compare changes](https://github.com/cosmos/cosmos-sdk/compare/v0.47.9...v0.47.10) from last release.
1413

15-
Check out the [changelog](https://github.com/cosmos/cosmos-sdk/blob/v0.47.5/CHANGELOG.md) for an exhaustive list of changes or [compare changes](https://github.com/cosmos/cosmos-sdk/compare/v0.47.5...v0.47.6) from last release.
14+
Refer to the [upgrading guide](https://github.com/cosmos/cosmos-sdk/blob/release/v0.50.x/UPGRADING.md) when migrating from `v0.47.x` to `v0.50.x`.
1615

17-
Refer to the [upgrading guide](https://github.com/cosmos/cosmos-sdk/blob/release/v0.50.x/UPGRADING.md) when migrating from `v0.47.x` to `v0.50.1`.
16+
## Maintenance Policy
17+
18+
v0.50 has been released which means the v0.47.x line is now supported for bug fixes only, as per our release policy. Earlier versions are not maintained.
19+
20+
Start integrating with [Cosmos SDK Eden (v0.50)](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.50.5) and enjoy and the new features and performance improvements.

api/go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@ module cosmossdk.io/api
33
go 1.19
44

55
require (
6-
github.com/cosmos/cosmos-proto v1.0.0-beta.2
6+
github.com/cosmos/cosmos-proto v1.0.0-beta.4
77
github.com/cosmos/gogoproto v1.4.10
88
google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4
99
google.golang.org/grpc v1.55.0
10-
google.golang.org/protobuf v1.30.0
10+
google.golang.org/protobuf v1.32.0
1111
)
1212

1313
require (
1414
github.com/golang/protobuf v1.5.3 // indirect
15-
github.com/google/go-cmp v0.5.9 // indirect
15+
github.com/google/go-cmp v0.6.0 // indirect
1616
golang.org/x/exp v0.0.0-20230131160201-f062dba9d201 // indirect
1717
golang.org/x/net v0.9.0 // indirect
1818
golang.org/x/sys v0.7.0 // indirect

api/go.sum

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
github.com/cosmos/cosmos-proto v1.0.0-beta.2 h1:X3OKvWgK9Gsejo0F1qs5l8Qn6xJV/AzgIWR2wZ8Nua8=
2-
github.com/cosmos/cosmos-proto v1.0.0-beta.2/go.mod h1:+XRCLJ14pr5HFEHIUcn51IKXD1Fy3rkEQqt4WqmN4V0=
1+
github.com/cosmos/cosmos-proto v1.0.0-beta.4 h1:aEL7tU/rLOmxZQ9z4i7mzxcLbSCY48OdY7lIWTLG7oU=
2+
github.com/cosmos/cosmos-proto v1.0.0-beta.4/go.mod h1:oeB+FyVzG3XrQJbJng0EnV8Vljfk9XvTIpGILNU/9Co=
33
github.com/cosmos/gogoproto v1.4.10 h1:QH/yT8X+c0F4ZDacDv3z+xE3WU1P1Z3wQoLMBRJoKuI=
44
github.com/cosmos/gogoproto v1.4.10/go.mod h1:3aAZzeRWpAwr+SS/LLkICX2/kDFyaYVzckBDzygIxek=
55
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
66
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
77
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
88
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
9-
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
10-
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
9+
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
10+
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
1111
golang.org/x/exp v0.0.0-20230131160201-f062dba9d201 h1:BEABXpNXLEz0WxtA+6CQIz2xkg80e+1zrhWyMcq8VzE=
1212
golang.org/x/exp v0.0.0-20230131160201-f062dba9d201/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
1313
golang.org/x/net v0.9.0 h1:aWJ/m6xSmxWBx+V0XRHTlrYrPG56jKsLdTFmsSsCzOM=
@@ -23,5 +23,5 @@ google.golang.org/grpc v1.55.0 h1:3Oj82/tFSCeUrRTg/5E/7d/W5A1tj6Ky1ABAuZuv5ag=
2323
google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8=
2424
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
2525
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
26-
google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng=
27-
google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
26+
google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I=
27+
google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=

baseapp/abci.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,10 @@ func (app *BaseApp) BeginBlock(req abci.RequestBeginBlock) (res abci.ResponseBeg
206206
}
207207
}
208208

209+
// Reset the gas meter so that the AnteHandlers aren't required to
210+
gasMeter = app.getBlockGasMeter(app.deliverState.ctx)
211+
app.deliverState.ctx = app.deliverState.ctx.WithBlockGasMeter(gasMeter)
212+
209213
return res
210214
}
211215

baseapp/abci_utils.go

Lines changed: 62 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
package baseapp
22

33
import (
4+
"encoding/json"
5+
"fmt"
6+
47
"github.com/cockroachdb/errors"
58
abci "github.com/cometbft/cometbft/abci/types"
69

710
sdk "github.com/cosmos/cosmos-sdk/types"
811
"github.com/cosmos/cosmos-sdk/types/mempool"
12+
"github.com/cosmos/cosmos-sdk/x/auth/signing"
913
)
1014

1115
type (
@@ -93,8 +97,40 @@ func (h *DefaultProposalHandler) PrepareProposalHandler() sdk.PrepareProposalHan
9397
}
9498

9599
iterator := h.mempool.Select(ctx, req.Txs)
100+
selectedTxsSignersSeqs := make(map[string]uint64)
101+
var selectedTxsNums int
96102
for iterator != nil {
97103
memTx := iterator.Tx()
104+
sigs, err := memTx.(signing.SigVerifiableTx).GetSignaturesV2()
105+
if err != nil {
106+
panic(fmt.Errorf("failed to get signatures: %w", err))
107+
}
108+
109+
// If the signers aren't in selectedTxsSignersSeqs then we haven't seen them before
110+
// so we add them and continue given that we don't need to check the sequence.
111+
shouldAdd := true
112+
txSignersSeqs := make(map[string]uint64)
113+
for _, sig := range sigs {
114+
signer := sdk.AccAddress(sig.PubKey.Address()).String()
115+
seq, ok := selectedTxsSignersSeqs[signer]
116+
if !ok {
117+
txSignersSeqs[signer] = sig.Sequence
118+
continue
119+
}
120+
121+
// If we have seen this signer before in this block, we must make
122+
// sure that the current sequence is seq+1; otherwise is invalid
123+
// and we skip it.
124+
if seq+1 != sig.Sequence {
125+
shouldAdd = false
126+
break
127+
}
128+
txSignersSeqs[signer] = sig.Sequence
129+
}
130+
if !shouldAdd {
131+
iterator = iterator.Next()
132+
continue
133+
}
98134

99135
// NOTE: Since transaction verification was already executed in CheckTx,
100136
// which calls mempool.Insert, in theory everything in the pool should be
@@ -111,6 +147,23 @@ func (h *DefaultProposalHandler) PrepareProposalHandler() sdk.PrepareProposalHan
111147
if stop {
112148
break
113149
}
150+
151+
txsLen := len(h.txSelector.SelectedTxs())
152+
for sender, seq := range txSignersSeqs {
153+
// If txsLen != selectedTxsNums is true, it means that we've
154+
// added a new tx to the selected txs, so we need to update
155+
// the sequence of the sender.
156+
if txsLen != selectedTxsNums {
157+
selectedTxsSignersSeqs[sender] = seq
158+
} else if _, ok := selectedTxsSignersSeqs[sender]; !ok {
159+
// The transaction hasn't been added but it passed the
160+
// verification, so we know that the sequence is correct.
161+
// So we set this sender's sequence to seq-1, in order
162+
// to avoid unnecessary calls to PrepareProposalVerifyTx.
163+
selectedTxsSignersSeqs[sender] = seq - 1
164+
}
165+
}
166+
selectedTxsNums = txsLen
114167
}
115168

116169
iterator = iterator.Next()
@@ -147,10 +200,13 @@ func (h *DefaultProposalHandler) ProcessProposalHandler() sdk.ProcessProposalHan
147200
maxBlockGas = b.MaxGas
148201
}
149202

150-
for _, txBytes := range req.Txs {
203+
for i, txBytes := range req.Txs {
151204
tx, err := h.txVerifier.ProcessProposalVerifyTx(txBytes)
152205
if err != nil {
153-
ctx.Logger().Error("proposal failed on ProcessProposalVerifyTx", "error", err)
206+
proposal, err := json.Marshal(req)
207+
if err == nil {
208+
ctx.Logger().Error("proposal failed on ProcessProposalVerifyTx", "error", err, "proposal", string(proposal), "tx_index", i)
209+
}
154210
return abci.ResponseProcessProposal{Status: abci.ResponseProcessProposal_REJECT}
155211
}
156212

@@ -161,6 +217,10 @@ func (h *DefaultProposalHandler) ProcessProposalHandler() sdk.ProcessProposalHan
161217
}
162218

163219
if totalTxGas > uint64(maxBlockGas) {
220+
proposal, err := json.Marshal(req)
221+
if err == nil {
222+
ctx.Logger().Error("proposal failed on ProcessProposalVerifyTx", "error", err, "proposal", string(proposal), "tx_index", i)
223+
}
164224
ctx.Logger().Error("proposal failed on totalTxGas > maxBlockGas", "totalTxGas", totalTxGas, "maxBlockGas", maxBlockGas)
165225
return abci.ResponseProcessProposal{Status: abci.ResponseProcessProposal_REJECT}
166226
}

0 commit comments

Comments
 (0)