-
Notifications
You must be signed in to change notification settings - Fork 839
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 to avoid broadcasting full blob txs #6835
Conversation
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
c08ecc0
to
c3d96e8
Compare
Testing this PR, I see now consistant Geth peers
|
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
b584079
to
a51ce2e
Compare
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
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.
Comments are optional.
.../java/org/hyperledger/besu/tests/acceptance/jsonrpc/EthSendRawTransactionAcceptanceTest.java
Outdated
Show resolved
Hide resolved
public synchronized Set<Transaction> claimTransactionHashesToSendToPeer(final EthPeer peer) { | ||
final Set<Transaction> transactionHashesToSend = this.transactionHashesToSend.remove(peer); | ||
if (transactionHashesToSend != null) { | ||
markTransactionHashesAsSeen(peer, toHashList(transactionHashesToSend)); |
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.
should work, but i wonder if it would be more correct to mark them as seen after we know they've been sent to the peer. we could restore them to the cache in the exception handling of NewPooledTransactionHashesMessageSender:63
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.
good point, will review next
@@ -77,7 +102,7 @@ public void onTransactionsAdded(final Collection<Transaction> transactions) { | |||
return; | |||
} | |||
|
|||
final int numPeersToSendFullTransactions = (int) Math.ceil(Math.sqrt(currPeerCount)); | |||
final int numPeersToSendFullTransactions = (int) Math.round(Math.sqrt(currPeerCount)); |
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.
This allows for rounding down as well as up, instead of ceil which is up only. It still works, but I'm unclear why it is necessary or preferred?
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.
it is not necessary, just seems more appropriate to round instead of ceil, to avoid strange results when few peers are connected, for example with 2 peers, with round we have 1, otherwise is 2.
txBroadcaster = | ||
new TransactionBroadcaster( | ||
ethContext, | ||
transactionTracker, | ||
transactionsMessageSender, | ||
newPooledTransactionHashesMessageSender); | ||
newPooledTransactionHashesMessageSender, | ||
FIXED_RANDOM_SEED); |
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.
Excellent move. My list of "flaky tests to fix" thanks you!
* separate queue for tx hashes Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net> --------- Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com> Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net> Co-authored-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
* separate queue for tx hashes Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com> * Refinements Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net> * Update tests Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net> * Update CHANGELOG Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net> * Refinements Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net> --------- Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com> Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net> Co-authored-by: Gabriel Fukushima <gabrielfukushima@gmail.com> Signed-off-by: amsmota <antonio.mota@citi.com>
* separate queue for tx hashes Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com> * Refinements Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net> * Update tests Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net> * Update CHANGELOG Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net> * Refinements Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net> --------- Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com> Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net> Co-authored-by: Gabriel Fukushima <gabrielfukushima@gmail.com> Signed-off-by: amsmota <antonio.mota@citi.com>
* separate queue for tx hashes Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com> * Refinements Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net> * Update tests Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net> * Update CHANGELOG Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net> * Refinements Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net> --------- Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com> Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net> Co-authored-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
PR description
As @macfarla discovered, Besu is wrongly sending the full blob tx payload to a subset of peers, specifically the subset of peers that are selected for full tx broadcast ( sqrt(num of peers) ), and the problem was that there is a single queue for full tx and hash only broadcast, so for this subset of peers, actually it could happen that both kind of broadcasts are performed, and sending full blob tx is a breach of the protocol.
This PR finalize the work started by @gfukushima , that introduces 2 queues, one for full txs, and one for hashes only, so the specific broadcast methods do not incur in fetching a tx that is not meant for them.
Fixed Issue(s)
fixes #6777
Thanks for sending a pull request! Have you done the following?
doc-change-required
label to this PR if updates are required.Locally, you can run these tests to catch failures early:
./gradlew build
./gradlew acceptanceTest
./gradlew integrationTest
./gradlew ethereum:referenceTests:referenceTests