Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: check payload length and consumed buf for pooled tx #5153

Merged
merged 6 commits into from
Nov 2, 2023

Conversation

Rjected
Copy link
Member

@Rjected Rjected commented Oct 24, 2023

This is one of the bugs found by #5125, we were previously allowing decoding of legacy transactions that were shorter than their payload length, as well as legacy transactions that were longer than their payload length. We will need to similarly check header lengths in other manual decodings.

Tests are added that contain RLP strings generated by the fuzzer.

@Rjected Rjected added C-bug An unexpected or incorrect behavior A-devp2p Related to the Ethereum P2P protocol labels Oct 24, 2023
@Rjected Rjected requested a review from mattsse October 24, 2023 03:33
@codecov
Copy link

codecov bot commented Oct 24, 2023

Codecov Report

Merging #5153 (e0f2a02) into main (4dc15c3) will decrease coverage by 9.05%.
Report is 70 commits behind head on main.
The diff coverage is 12.50%.

❗ Current head e0f2a02 differs from pull request most recent head 5bffcc6. Consider uploading reports for the commit 5bffcc6 to get more accurate results

Impacted file tree graph

Files Coverage Δ
crates/primitives/src/transaction/tx_value.rs 26.43% <0.00%> (-42.49%) ⬇️
crates/primitives/src/transaction/pooled.rs 49.68% <15.25%> (-8.79%) ⬇️

... and 220 files with indirect coverage changes

Flag Coverage Δ
integration-tests 17.03% <12.50%> (-9.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
reth binary 6.18% <ø> (-19.61%) ⬇️
blockchain tree 0.00% <ø> (-28.47%) ⬇️
pipeline 0.00% <ø> (-5.05%) ⬇️
storage (db) 16.66% <ø> (-13.32%) ⬇️
trie 0.00% <ø> (-22.54%) ⬇️
txpool 32.20% <ø> (-9.18%) ⬇️
networking 28.84% <ø> (-2.06%) ⬇️
rpc 23.65% <ø> (-2.83%) ⬇️
consensus 0.88% <ø> (-24.19%) ⬇️
revm 1.33% <ø> (-8.52%) ⬇️
payload builder 7.95% <ø> (-6.21%) ⬇️
primitives 20.98% <12.50%> (-8.20%) ⬇️

mattsse
mattsse previously approved these changes Oct 24, 2023
Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

nice!

only naming nits

crates/primitives/src/transaction/pooled.rs Outdated Show resolved Hide resolved
crates/primitives/src/transaction/pooled.rs Outdated Show resolved Hide resolved
crates/primitives/src/transaction/pooled.rs Outdated Show resolved Hide resolved
@mattsse mattsse dismissed their stale review October 24, 2023 13:01

fat fingered approval

@Rjected Rjected marked this pull request as ready for review October 26, 2023 20:19
@Rjected Rjected requested a review from gakonst as a code owner October 26, 2023 20:19
@Rjected Rjected requested a review from mattsse October 26, 2023 20:22
Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

rlp 👍

there's another thing we should do (separately):

currently, we're always consuming the &mut & however ideally we only advance this when decoding is successful.

see Decode derive macro template for example

@mattsse
Copy link
Collaborator

mattsse commented Nov 2, 2023

good to merge @Rjected ?

@Rjected Rjected added this pull request to the merge queue Nov 2, 2023
@mattsse
Copy link
Collaborator

mattsse commented Nov 2, 2023

needs rebase @Rjected

@Rjected Rjected removed this pull request from the merge queue due to a manual request Nov 2, 2023
@Rjected Rjected force-pushed the dan/fix-pooled-txs-length-check branch from c9227f9 to b041ef1 Compare November 2, 2023 14:43
@Rjected Rjected force-pushed the dan/fix-pooled-txs-length-check branch from b041ef1 to 5bffcc6 Compare November 2, 2023 14:44
@Rjected Rjected added this pull request to the merge queue Nov 2, 2023
Merged via the queue into main with commit 3fc776e Nov 2, 2023
22 checks passed
@Rjected Rjected deleted the dan/fix-pooled-txs-length-check branch November 2, 2023 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-devp2p Related to the Ethereum P2P protocol C-bug An unexpected or incorrect behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants