Skip to content

Commit 0d2b765

Browse files
committed
Merge branch 'develop' of https://github.com/stacks-network/stacks-core into chore/fix-flakey-tenure-occurs-test
2 parents d7c3d17 + d23c861 commit 0d2b765

File tree

6 files changed

+33
-7
lines changed

6 files changed

+33
-7
lines changed

.github/workflows/lock-threads.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
id: lock_threads
3030
uses: stacks-network/actions/lock-threads@main
3131
with:
32-
github-token: ${{ secrets.GH_TOKEN }}
32+
github-token: ${{ secrets.GITHUB_TOKEN }}
3333
issue-inactive-days: 7
3434
pr-inactive-days: 7
3535
discussion-inactive-days: 7

.github/workflows/workflow-cleanup.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,19 @@ on:
1212
workflow-ttl:
1313
description: "How many days to keep a successful workflow (default: 30)"
1414
required: false
15-
default: "30"
15+
default: "60"
1616
failed-workflow-ttl:
1717
description: "How many days to keep failed workflows (default: 15)"
1818
required: false
19-
default: "15"
19+
default: "60"
2020
schedule:
2121
## Run every day at 00:00:00
2222
- cron: "0 0 * * *"
2323

24+
permissions:
25+
actions: write # to delete workflow runs and caches
26+
contents: read # to access repo contents
27+
2428
## env vars are transferred to composite action steps
2529
env:
2630
CACHE_TTL: 7 ## number of days to keep a cache
@@ -41,7 +45,7 @@ jobs:
4145
id: cleanup
4246
uses: stacks-network/actions/cleanup/workflows@main
4347
with:
44-
token: ${{ secrets.GH_TOKEN }}
48+
token: ${{ secrets.GITHUB_TOKEN }}
4549
cache-ttl: ${{ inputs.cache-ttl || env.CACHE_TTL}}
4650
workflow-ttl: ${{ inputs.workflow-ttl || env.WORKFLOW_TTL}}
4751
failed-workflow-ttl: ${{ inputs.failed-workflow-ttl || env.FAILED_WORKFLOW_TTL }}

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to the versioning scheme outlined in the [README.md](README.md).
77

8+
## [3.1.0.0.11]
9+
10+
- Hotfix for p2p stack misbehavior in mempool syncing conditions
11+
812
## [3.1.0.0.10]
913

1014
### Added

stackslib/src/net/api/postmempoolquery.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ pub struct StacksMemPoolStream {
9797
pub corked: bool,
9898
/// Did we run out of transactions to send?
9999
pub finished: bool,
100+
num_bytes: u64,
100101
/// link to the mempool DB
101102
mempool_db: DBConn,
102103
}
@@ -118,6 +119,7 @@ impl StacksMemPoolStream {
118119
tx_query,
119120
last_randomized_txid,
120121
num_txs: 0,
122+
num_bytes: 0,
121123
max_txs,
122124
coinbase_height,
123125
corked: false,
@@ -178,6 +180,14 @@ impl HttpChunkGenerator for StacksMemPoolStream {
178180
if !next_txs.is_empty() {
179181
// have another tx to send
180182
let chunk = next_txs[0].serialize_to_vec();
183+
if u64::try_from(chunk.len())
184+
.unwrap()
185+
.saturating_add(self.num_bytes)
186+
>= u64::from(MAX_MESSAGE_LEN) / 2
187+
{
188+
self.corked = true;
189+
return Ok(self.last_randomized_txid.serialize_to_vec());
190+
}
181191
if let Some(next_last_randomized_txid) = next_last_randomized_txid_opt {
182192
// we have more after this
183193
self.last_randomized_txid = next_last_randomized_txid;
@@ -187,6 +197,9 @@ impl HttpChunkGenerator for StacksMemPoolStream {
187197
self.finished = true;
188198
}
189199
self.num_txs += next_txs.len() as u64;
200+
self.num_bytes = self
201+
.num_bytes
202+
.saturating_add(u64::try_from(chunk.len()).unwrap());
190203
return Ok(chunk);
191204
} else if let Some(next_txid) = next_last_randomized_txid_opt {
192205
// no more txs to send

stackslib/src/net/connection.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -937,7 +937,12 @@ impl<P: ProtocolFamily> ConnectionInbox<P> {
937937
);
938938
self.inbox.push_back(message);
939939
consumed_message = true;
940-
};
940+
} else {
941+
if bytes_consumed == 0 {
942+
warn!("0 bytes consumed, but no message parsed");
943+
return Err(net_error::ConnectionBroken);
944+
}
945+
}
941946

942947
bytes_consumed
943948
} else {

versions.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Update these values when a new release is created.
22
# `stacks-common/build.rs` will automatically update `versions.rs` with these values.
3-
stacks_node_version = "3.1.0.0.10"
4-
stacks_signer_version = "3.1.0.0.10.0"
3+
stacks_node_version = "3.1.0.0.11"
4+
stacks_signer_version = "3.1.0.0.11.0"

0 commit comments

Comments
 (0)