Skip to content

Drop message decode max length to 4_000_000#340

Merged
apoelstra merged 1 commit intorust-bitcoin:masterfrom
TheBlueMatt:2019-11-4m-limit
Nov 12, 2019
Merged

Drop message decode max length to 4_000_000#340
apoelstra merged 1 commit intorust-bitcoin:masterfrom
TheBlueMatt:2019-11-4m-limit

Conversation

@TheBlueMatt
Copy link
Copy Markdown
Member

It has been a long time since Bitcoin's maximum network message
length was 32MB, so we should follow suit. This is also an important
DoS limit, so we should limit it as much as possible.

It has been a long time since Bitcoin's maximum network message
length was 32MB, so we should follow suit. This is also an important
DoS limit, so we should limit it as much as possible.
@codecov-io
Copy link
Copy Markdown

Codecov Report

Merging #340 into master will decrease coverage by 0.25%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #340      +/-   ##
==========================================
- Coverage   81.89%   81.64%   -0.26%     
==========================================
  Files          38       38              
  Lines        7169     7032     -137     
==========================================
- Hits         5871     5741     -130     
+ Misses       1298     1291       -7
Impacted Files Coverage Δ
src/consensus/encode.rs 76.77% <ø> (ø) ⬆️
src/network/message_network.rs 25% <0%> (-10%) ⬇️
src/network/message.rs 61.23% <0%> (-7.36%) ⬇️
src/blockdata/block.rs 70.67% <0%> (-3.15%) ⬇️
src/network/stream_reader.rs 95.62% <0%> (-2.06%) ⬇️
src/util/misc.rs 96.77% <0%> (-0.37%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c8ac252...fe91776. Read the comment docs.

Copy link
Copy Markdown
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. Trusting you that this matches Core's behaviour.

@TheBlueMatt
Copy link
Copy Markdown
Member Author

Copy link
Copy Markdown

@Rjected Rjected left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked Core, LGTM

@tamasblummer tamasblummer self-requested a review November 11, 2019 08:11
@dongcarl
Copy link
Copy Markdown
Member

In the future we might want to decouple the limit for deserializing any Vecs from the limit for deserializing network messages... Or at least rename it to something less confusing... But we can do that after merge.

@apoelstra apoelstra merged commit 700ed54 into rust-bitcoin:master Nov 12, 2019
dagurval added a commit to dagurval/rust-bitcoin that referenced this pull request Jul 15, 2020
This adds the feature flag 'bump-decode-max-size' that when set, sets
maximum decode size to the limit it was before PR rust-bitcoin#340.
yancyribbens pushed a commit to yancyribbens/rust-bitcoin that referenced this pull request Mar 23, 2024
…tisfaction size

747876e Rectify `from_multi_a` max satisfaction size (Aman Rojjha)

Pull request description:

  Cost incurred for a single Schnorr signature in the witness stack := `<var_int><64-byte signature><sig_type>` = 1 + 64 + 1 (as clarified by @sanket1729 in rust-bitcoin#340 ).

ACKs for top commit:
  sanket1729:
    ACK 747876e

Tree-SHA512: f20652240f1daa7b33b1d525870114e0bd6412e82845e80a94c616dedcfb3d8ae2f7ef19d7c08760f79270e0d465c18b713eff2e3e599b45c65f2a64da36713b
PastaPastaPasta pushed a commit to PastaPastaPasta/rust-dashcore that referenced this pull request Feb 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants