Skip to content

Commit 0c45d5c

Browse files
committed
Merge tag 'v0.38.10' into cometbft-0.38.9
Release v0.38.10
2 parents b47eda4 + 5f59b42 commit 0c45d5c

38 files changed

+674
-167
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
- `[rpc]` Fix an issue where a legacy ABCI response, created on `v0.37` or before, is not returned properly in `v0.38` and up
2+
on the `/block_results` RPC endpoint.
3+
([\#3002](https://github.com/cometbft/cometbft/issues/3002))
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
- `[blocksync]` Do not stay in blocksync if the node's validator voting power
2+
is high enough to block the chain while it is not online
3+
([\#3406](https://github.com/cometbft/cometbft/pull/3406))
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
- `[p2p]` Node respects configured `max_num_outbound_peers` limit when dialing
2+
peers provided by a seed node
3+
([\#486](https://github.com/cometbft/cometbft/issues/486))
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- `[p2p/conn]` Update send monitor, used for sending rate limiting, once per batch of packets sent
2+
([\#3382](https://github.com/cometbft/cometbft/pull/3382))
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- `[libs/pubsub]` Allow dash (`-`) in event tags
2+
([\#3401](https://github.com/cometbft/cometbft/issues/3401))
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- `[p2p/conn]` Remove the usage of a synchronous pool of buffers in secret connection, storing instead the buffer in the connection struct. This reduces the synchronization primitive usage, speeding up the code.
2+
([\#3403](https://github.com/cometbft/cometbft/issues/3403))

.changelog/v0.38.10/summary.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
*July 16, 2024*
2+
3+
This release fixes a bug in `v0.38.x` that prevented ABCI responses from being
4+
correctly read when upgrading from `v0.37.x` or below. It also includes a few other
5+
bug fixes and performance improvements.

.github/workflows/cometbft-docker.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
platforms: all
4242

4343
- name: Set up Docker Build
44-
uses: docker/setup-buildx-action@v3.3.0
44+
uses: docker/setup-buildx-action@v3.4.0
4545

4646
- name: Login to DockerHub
4747
if: ${{ github.event_name != 'pull_request' }}
@@ -51,7 +51,7 @@ jobs:
5151
password: ${{ secrets.DOCKERHUB_TOKEN }}
5252

5353
- name: Publish to Docker Hub
54-
uses: docker/build-push-action@v6.2.0
54+
uses: docker/build-push-action@v6.3.0
5555
with:
5656
context: .
5757
file: ./DOCKER/Dockerfile

.github/workflows/testapp-docker.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
platforms: all
4242

4343
- name: Set up Docker Build
44-
uses: docker/setup-buildx-action@v3.3.0
44+
uses: docker/setup-buildx-action@v3.4.0
4545

4646
- name: Login to DockerHub
4747
if: ${{ github.event_name != 'pull_request' }}
@@ -51,7 +51,7 @@ jobs:
5151
password: ${{ secrets.DOCKERHUB_TOKEN }}
5252

5353
- name: Publish to Docker Hub
54-
uses: docker/build-push-action@v6.2.0
54+
uses: docker/build-push-action@v6.3.0
5555
with:
5656
context: .
5757
file: ./test/e2e/docker/Dockerfile

CHANGELOG.md

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,34 @@
11
# CHANGELOG
22

3+
## v0.38.10
4+
5+
*July 16, 2024*
6+
7+
This release fixes a bug in `v0.38.x` that prevented ABCI responses from being
8+
correctly read when upgrading from `v0.37.x` or below. It also includes a few other
9+
bug fixes and performance improvements.
10+
11+
### BUG FIXES
12+
13+
- `[p2p]` Node respects configured `max_num_outbound_peers` limit when dialing
14+
peers provided by a seed node
15+
([\#486](https://github.com/cometbft/cometbft/issues/486))
16+
- `[rpc]` Fix an issue where a legacy ABCI response, created on `v0.37` or before, is not returned properly in `v0.38` and up
17+
on the `/block_results` RPC endpoint.
18+
([\#3002](https://github.com/cometbft/cometbft/issues/3002))
19+
- `[blocksync]` Do not stay in blocksync if the node's validator voting power
20+
is high enough to block the chain while it is not online
21+
([\#3406](https://github.com/cometbft/cometbft/pull/3406))
22+
23+
### IMPROVEMENTS
24+
25+
- `[p2p/conn]` Update send monitor, used for sending rate limiting, once per batch of packets sent
26+
([\#3382](https://github.com/cometbft/cometbft/pull/3382))
27+
- `[libs/pubsub]` Allow dash (`-`) in event tags
28+
([\#3401](https://github.com/cometbft/cometbft/issues/3401))
29+
- `[p2p/conn]` Remove the usage of a synchronous pool of buffers in secret connection, storing instead the buffer in the connection struct. This reduces the synchronization primitive usage, speeding up the code.
30+
([\#3403](https://github.com/cometbft/cometbft/issues/3403))
31+
332
## v0.38.9
433

534
*July 1, 2024*
@@ -35,6 +64,10 @@ This release contains a few bug fixes and performance improvements.
3564

3665
### BUG FIXES
3766

67+
- `[blockstore]` Added peer banning in blockstore
68+
([\#ABC-0013](https://github.com/cometbft/cometbft/security/advisories/GHSA-hg58-rf2h-6rr7))
69+
- `[blockstore]` Send correct error message when vote extensions do not align with received packet
70+
([\#ABC-0014](https://github.com/cometbft/cometbft/security/advisories/GHSA-hg58-rf2h-6rr7))
3871
- [`mempool`] Fix data race when rechecking with async ABCI client
3972
([\#1827](https://github.com/cometbft/cometbft/issues/1827))
4073
- `[consensus]` Fix a race condition in the consensus timeout ticker. Race is caused by two timeouts being scheduled at the same time.
@@ -44,10 +77,6 @@ This release contains a few bug fixes and performance improvements.
4477

4578
### IMPROVEMENTS
4679

47-
- `[blockstore]` Added peer banning in blockstore
48-
([\#ABC-0013](https://github.com/cometbft/cometbft/security/advisories/GHSA-hg58-rf2h-6rr7))
49-
- `[blockstore]` Send correct error message when vote extensions do not align with received packet
50-
([\#ABC-0014](https://github.com/cometbft/cometbft/security/advisories/GHSA-hg58-rf2h-6rr7))
5180
- `[config]` Added `recheck_timeout` mempool parameter to set how much time to wait for recheck
5281
responses from the app (only applies to non-local ABCI clients).
5382
([\#1827](https://github.com/cometbft/cometbft/issues/1827/))

blocksync/reactor.go

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"sync"
77
"time"
88

9+
"github.com/cometbft/cometbft/crypto"
910
"github.com/cometbft/cometbft/libs/log"
1011
"github.com/cometbft/cometbft/p2p"
1112
bcproto "github.com/cometbft/cometbft/proto/tendermint/blocksync"
@@ -56,6 +57,7 @@ type Reactor struct {
5657
store sm.BlockStore
5758
pool *BlockPool
5859
blockSync bool
60+
localAddr crypto.Address
5961
poolRoutineWg sync.WaitGroup
6062

6163
requestsCh <-chan BlockRequest
@@ -70,6 +72,13 @@ type Reactor struct {
7072
func NewReactor(state sm.State, blockExec *sm.BlockExecutor, store *store.BlockStore,
7173
blockSync bool, metrics *Metrics, offlineStateSyncHeight int64,
7274
) *Reactor {
75+
return NewReactorWithAddr(state, blockExec, store, blockSync, nil, metrics, offlineStateSyncHeight)
76+
}
77+
78+
// Function added to keep existing API.
79+
func NewReactorWithAddr(state sm.State, blockExec *sm.BlockExecutor, store *store.BlockStore,
80+
blockSync bool, localAddr crypto.Address, metrics *Metrics, offlineStateSyncHeight int64,
81+
) *Reactor {
7382

7483
storeHeight := store.Height()
7584
if storeHeight == 0 {
@@ -105,6 +114,7 @@ func NewReactor(state sm.State, blockExec *sm.BlockExecutor, store *store.BlockS
105114
store: store,
106115
pool: pool,
107116
blockSync: blockSync,
117+
localAddr: localAddr,
108118
requestsCh: requestsCh,
109119
errorsCh: errorsCh,
110120
metrics: metrics,
@@ -294,6 +304,15 @@ func (bcR *Reactor) Receive(e p2p.Envelope) { //nolint: dupl // recreated in a t
294304
}
295305
}
296306

307+
func (bcR *Reactor) localNodeBlocksTheChain(state sm.State) bool {
308+
_, val := state.Validators.GetByAddress(bcR.localAddr)
309+
if val == nil {
310+
return false
311+
}
312+
total := state.Validators.TotalVotingPower()
313+
return val.VotingPower >= total/3
314+
}
315+
297316
// Handle messages from the poolReactor telling the reactor what to do.
298317
// NOTE: Don't sleep in the FOR_LOOP or otherwise slow it down!
299318
func (bcR *Reactor) poolRoutine(stateSynced bool) {
@@ -402,7 +421,7 @@ FOR_LOOP:
402421
)
403422
continue FOR_LOOP
404423
}
405-
if bcR.pool.IsCaughtUp() {
424+
if bcR.pool.IsCaughtUp() || bcR.localNodeBlocksTheChain(state) {
406425
bcR.Logger.Info("Time to switch to consensus reactor!", "height", height)
407426
if err := bcR.pool.Stop(); err != nil {
408427
bcR.Logger.Error("Error stopping pool", "err", err)

blocksync/reactor_test.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ func newReactor(
111111
// Make the Reactor itself.
112112
// NOTE we have to create and commit the blocks first because
113113
// pool.height is determined from the store.
114-
fastSync := true
114+
blockSync := true
115115
db := dbm.NewMemDB()
116116
stateStore = sm.NewStore(db, sm.StoreOptions{
117117
DiscardABCIResponses: false,
@@ -125,6 +125,13 @@ func newReactor(
125125
// The commit we are building for the current height.
126126
seenExtCommit := &types.ExtendedCommit{}
127127

128+
pubKey, err := privVals[0].GetPubKey()
129+
if err != nil {
130+
panic(err)
131+
}
132+
addr := pubKey.Address()
133+
idx, _ := state.Validators.GetByAddress(addr)
134+
128135
// let's add some blocks in
129136
for blockHeight := int64(1); blockHeight <= maxBlockHeight; blockHeight++ {
130137
voteExtensionIsEnabled := genDoc.ConsensusParams.ABCI.VoteExtensionsEnabled(blockHeight)
@@ -138,12 +145,6 @@ func newReactor(
138145
blockID := types.BlockID{Hash: thisBlock.Hash(), PartSetHeader: thisParts.Header()}
139146

140147
// Simulate a commit for the current height
141-
pubKey, err := privVals[0].GetPubKey()
142-
if err != nil {
143-
panic(err)
144-
}
145-
addr := pubKey.Address()
146-
idx, _ := state.Validators.GetByAddress(addr)
147148
vote, err := types.MakeVote(
148149
privVals[0],
149150
thisBlock.Header.ChainID,
@@ -177,7 +178,7 @@ func newReactor(
177178
}
178179
}
179180

180-
bcReactor := NewByzantineReactor(incorrectBlock, NewReactor(state.Copy(), blockExec, blockStore, fastSync, NopMetrics(), 0))
181+
bcReactor := NewByzantineReactor(incorrectBlock, NewReactor(state.Copy(), blockExec, blockStore, blockSync, NopMetrics(), 0))
181182
bcReactor.SetLogger(logger.With("module", "blocksync"))
182183

183184
return ReactorPair{bcReactor, proxyApp}

docs/app-dev/indexing-transactions.md

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -262,26 +262,44 @@ You can query for a paginated set of blocks by their events by calling the
262262
`/block_search` RPC endpoint:
263263

264264
```bash
265-
curl "localhost:26657/block_search?query=\"block.height > 10 AND val_set.num_changed > 0\""
265+
curl "localhost:26657/block_search?query=\"block.height > 10\""
266266
```
267267

268268

269-
Storing the event sequence was introduced in CometBFT 0.34.26. Before that, up until Tendermint Core 0.34.26,
270-
the event sequence was not stored in the kvstore and events were stored only by height. That means that queries
271-
returned blocks and transactions whose event attributes match within the height but can match across different
272-
events on that height.
273-
This behavior was fixed with CometBFT 0.34.26+. However, if the data was indexed with earlier versions of
274-
Tendermint Core and not re-indexed, that data will be queried as if all the attributes within a height
275-
occurred within the same event.
269+
Storing the event sequence was introduced in CometBFT 0.34.26. Before that, up
270+
until Tendermint Core 0.34.26, the event sequence was not stored in the kvstore
271+
and events were stored only by height. That means that queries returned blocks
272+
and transactions whose event attributes match within the height but can match
273+
across different events on that height.
274+
275+
This behavior was fixed with CometBFT 0.34.26+. However, if the data was
276+
indexed with earlier versions of Tendermint Core and not re-indexed, that data
277+
will be queried as if all the attributes within a height occurred within the
278+
same event.
276279

277280
## Event attribute value types
278281

279-
Users can use anything as an event value. However, if the event attribute value is a number, the following needs to be taken into account:
282+
Users can use anything as an event value. However, if the event attribute value
283+
is a number, the following needs to be taken into account:
280284

281285
- Negative numbers will not be properly retrieved when querying the indexer.
282-
- Event values are converted to big floats (from the `big/math` package). The precision of the floating point number is set to the bit length
283-
of the integer it is supposed to represent, so that there is no loss of information due to insufficient precision. This was not present before CometBFT v0.38.x and all float values were ignored.
286+
- Event values are converted to big floats (from the `big/math` package). The
287+
precision of the floating point number is set to the bit length of the
288+
integer it is supposed to represent, so that there is no loss of information
289+
due to insufficient precision. This was not present before CometBFT v0.38.x
290+
and all float values were ignored.
284291
- As of CometBFT v0.38.x, queries can contain floating point numbers as well.
285292
- Note that comparing to floats can be imprecise with a high number of decimals.
286293

294+
## Event type and attribute key format
295+
296+
An event type/attribute key is a string that can contain any Unicode letter or
297+
digit, as well as the following characters: `.` (dot), `-` (dash), `_`
298+
(underscore). The event type/attribute key must not start with `-` (dash) or
299+
`.` (dot).
300+
301+
```
302+
^[\w]+[\.-\w]?$
303+
```
304+
287305
[abci-events]: ../spec/abci/abci++_basic_concepts.md#events

go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ require (
1616
github.com/gorilla/websocket v1.5.0
1717
github.com/informalsystems/tm-load-test v1.3.0
1818
github.com/lib/pq v1.10.7
19-
github.com/libp2p/go-buffer-pool v0.1.0
2019
github.com/minio/highwayhash v1.0.2
2120
github.com/ory/dockertest v3.3.5+incompatible
2221
github.com/pkg/errors v0.9.1

go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -562,8 +562,6 @@ github.com/leonklingele/grouper v1.1.1 h1:suWXRU57D4/Enn6pXR0QVqqWWrnJ9Osrz+5rjt
562562
github.com/leonklingele/grouper v1.1.1/go.mod h1:uk3I3uDfi9B6PeUjsCKi6ndcf63Uy7snXgR4yDYQVDY=
563563
github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw=
564564
github.com/lib/pq v1.10.7/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
565-
github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8=
566-
github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg=
567565
github.com/lufeee/execinquery v1.2.1 h1:hf0Ems4SHcUGBxpGN7Jz78z1ppVkP/837ZlETPCEtOM=
568566
github.com/lufeee/execinquery v1.2.1/go.mod h1:EC7DrEKView09ocscGHC+apXMIaorh4xqSxS/dy8SbM=
569567
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=

libs/pubsub/query/syntax/doc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
// The lexical terms are defined here using RE2 regular expression notation:
1818
//
1919
// // The name of an event attribute (type.value)
20-
// tag = #'\w+(\.\w+)*'
20+
// tag = #`^[\w]+[\.-\w]?$`
2121
//
2222
// // A datestamp (YYYY-MM-DD)
2323
// date = #'DATE \d{4}-\d{2}-\d{2}'

libs/pubsub/query/syntax/scanner.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ func (s *Scanner) Next() error {
9999
}
100100
if '0' <= ch && ch <= '9' {
101101
return s.scanNumber(ch)
102-
} else if isTagRune(ch) {
102+
} else if isFirstTagRune(ch) {
103103
return s.scanTagLike(ch)
104104
}
105105
switch ch {
@@ -302,7 +302,11 @@ func (s *Scanner) invalid(ch rune) error {
302302
func isDigit(r rune) bool { return '0' <= r && r <= '9' }
303303

304304
func isTagRune(r rune) bool {
305-
return r == '.' || r == '_' || unicode.IsLetter(r) || unicode.IsDigit(r)
305+
return r == '.' || r == '_' || r == '-' || unicode.IsLetter(r) || unicode.IsDigit(r)
306+
}
307+
308+
func isFirstTagRune(r rune) bool {
309+
return r == '_' || unicode.IsLetter(r) || unicode.IsDigit(r)
306310
}
307311

308312
func isTimeRune(r rune) bool {

libs/pubsub/query/syntax/syntax_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ func TestScanner(t *testing.T) {
2525

2626
// Tags
2727
{`foo foo.bar`, []syntax.Token{syntax.TTag, syntax.TTag}},
28+
{`foo foo-foo.bar`, []syntax.Token{syntax.TTag, syntax.TTag}},
29+
{`foo foo._bar_bar`, []syntax.Token{syntax.TTag, syntax.TTag}},
2830

2931
// Strings (values)
3032
{` '' x 'x' 'x y'`, []syntax.Token{syntax.TString, syntax.TTag, syntax.TString, syntax.TString}},
@@ -167,6 +169,8 @@ func TestParseValid(t *testing.T) {
167169

168170
{"hash='136E18F7E4C348B780CF873A0BF43922E5BAFA63'", true},
169171
{"hash=136E18F7E4C348B780CF873A0BF43922E5BAFA63", false},
172+
173+
{"cosm-wasm.transfer_amount=100", true},
170174
}
171175

172176
for _, test := range tests {

node/node.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -344,9 +344,10 @@ func NewNodeWithContext(ctx context.Context,
344344
if err != nil {
345345
return nil, fmt.Errorf("can't get pubkey: %w", err)
346346
}
347+
localAddr := pubKey.Address()
347348

348349
// Determine whether we should attempt state sync.
349-
stateSync := config.StateSync.Enable && !onlyValidatorIsUs(state, pubKey)
350+
stateSync := config.StateSync.Enable && !onlyValidatorIsUs(state, localAddr)
350351
if stateSync && state.LastBlockHeight > 0 {
351352
logger.Info("Found local state with non-zero height, skipping state sync")
352353
stateSync = false
@@ -371,7 +372,7 @@ func NewNodeWithContext(ctx context.Context,
371372

372373
// Determine whether we should do block sync. This must happen after the handshake, since the
373374
// app may modify the validator set, specifying ourself as the only validator.
374-
blockSync := !onlyValidatorIsUs(state, pubKey)
375+
blockSync := !onlyValidatorIsUs(state, localAddr)
375376

376377
logNodeStartupInfo(state, pubKey, logger, consensusLogger)
377378

@@ -401,7 +402,7 @@ func NewNodeWithContext(ctx context.Context,
401402
}
402403
}
403404
// Don't start block sync if we're doing a state sync first.
404-
bcReactor, err := createBlocksyncReactor(config, state, blockExec, blockStore, blockSync && !stateSync, logger, bsMetrics, offlineStateSyncHeight)
405+
bcReactor, err := createBlocksyncReactor(config, state, blockExec, blockStore, blockSync && !stateSync, localAddr, logger, bsMetrics, offlineStateSyncHeight)
405406
if err != nil {
406407
return nil, fmt.Errorf("could not create blocksync reactor: %w", err)
407408
}
@@ -591,10 +592,11 @@ func (n *Node) OnStop() {
591592
if err := n.eventBus.Stop(); err != nil {
592593
n.Logger.Error("Error closing eventBus", "err", err)
593594
}
594-
if err := n.indexerService.Stop(); err != nil {
595-
n.Logger.Error("Error closing indexerService", "err", err)
595+
if n.indexerService != nil {
596+
if err := n.indexerService.Stop(); err != nil {
597+
n.Logger.Error("Error closing indexerService", "err", err)
598+
}
596599
}
597-
598600
// now stop the reactors
599601
if err := n.sw.Stop(); err != nil {
600602
n.Logger.Error("Error closing switch", "err", err)

0 commit comments

Comments
 (0)