-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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: track full_transactions propagation when packet size limited #3993
fix: track full_transactions propagation when packet size limited #3993
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think perhaps a better way to do this is to have push
return a boolean to denote whether or not it was added - so it would return false
if it was limited. Then, when inserting hashes, it would be something like:
if full_transactions.push(tx) {
hashes.push(tx);
}
This current form has some duplicate/semi-dead code, e.g. new_pooled_hashes
is only used for the empty check on L258, and in the first branch of the if statement on L260 (which suffers from the same issue you described I think?)
That doesn't feel like the right approach? The way I understand it is basically we're splitting up peers and deciding to send either full tx objects or hashes. And within each of those we'd like to send the most tx data up to the defined network limits. Using your suggestion we would unnecessarily limit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you're absoultely right, they can diverge and this is a very nice find, tysm
only a smol nit
Codecov Report
... and 50 files with indirect coverage changes
Flags with carried forward coverage won't be shown. Click here to find out more.
|
New to the reth codebase and rust, so feel free to correct any misunderstandings or bad patterns.
In
transactions.rs
whenfull_transactions
is being built:reth/crates/net/network/src/transactions.rs
Lines 249 to 254 in f41386d
hashes
andfull_transactions
can diverge when a.push()
to the latter is limited byMAX_FULL_TRANSACTIONS_PACKET_SIZE
reth/crates/net/network/src/transactions.rs
Lines 636 to 640 in f41386d
so when
PropagatedTransactions
is being updated in the snippet below, it sends the limited setfull_transactions
to peers but then updates the tracking with the full tx hash list ofnew_pooled_hashes
reth/crates/net/network/src/transactions.rs
Lines 271 to 275 in f41386d