-
Notifications
You must be signed in to change notification settings - Fork 461
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
Refactor broadcasting for a needs of 4844 #5485
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
a3ea4fe
send hash of added local blob tx in eth68 and nothing in older versions
marcindsobczak 2f9edf6
move tx size logic to extension
marcindsobczak 744e9d7
adjust broadcaster
marcindsobczak 3b23142
adjust handlers
marcindsobczak 9dbf58a
remove redundant check
marcindsobczak 1ddfd28
fix?
marcindsobczak 8a35cf5
add test for MaxSizeOfTxForBroadcast
marcindsobczak d15e6d4
cosmetic
marcindsobczak 00674e7
cosmetic
marcindsobczak 761a51e
Merge remote-tracking branch 'origin/master' into feature/networking_…
marcindsobczak File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,6 @@ | |
using Nethermind.Network.P2P.Subprotocols.Eth.V62; | ||
using Nethermind.Network.P2P.Subprotocols.Eth.V62.Messages; | ||
using Nethermind.Network.P2P.Subprotocols.Eth.V63.Messages; | ||
using Nethermind.Network.Rlpx; | ||
using Nethermind.Serialization.Rlp; | ||
using Nethermind.Stats; | ||
using Nethermind.Stats.Model; | ||
|
@@ -183,7 +182,18 @@ public virtual Task<byte[][]> GetNodeData(IReadOnlyList<Keccak> hashes, Cancella | |
|
||
public void SendNewTransaction(Transaction tx) | ||
{ | ||
SendMessage(new[] { tx }); | ||
if (tx.Hash != null && NotifiedTransactions.Set(tx.Hash)) | ||
{ | ||
SendNewTransactionCore(tx); | ||
} | ||
} | ||
|
||
protected virtual void SendNewTransactionCore(Transaction tx) | ||
{ | ||
if (tx.Type != TxType.Blob) //additional protection from sending full blob-type txs | ||
{ | ||
SendMessage(new[] { tx }); | ||
} | ||
} | ||
|
||
public void SendNewTransactions(IEnumerable<Transaction> txs, bool sendFullTx = false) | ||
|
@@ -209,7 +219,7 @@ protected virtual void SendNewTransactionsCore(IEnumerable<Transaction> txs, boo | |
|
||
foreach (Transaction tx in txs) | ||
{ | ||
int txSize = tx.GetLength(_txDecoder); | ||
int txSize = tx.GetLength(); | ||
|
||
if (txSize > packetSizeLeft && txsToSend.Count > 0) | ||
{ | ||
|
@@ -218,7 +228,7 @@ protected virtual void SendNewTransactionsCore(IEnumerable<Transaction> txs, boo | |
packetSizeLeft = TransactionsMessage.MaxPacketSize; | ||
} | ||
|
||
if (tx.Hash is not null) | ||
if (tx.Hash is not null && tx.Type != TxType.Blob) //additional protection from sending full blob-type txs | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't there |
||
{ | ||
txsToSend.Add(tx); | ||
packetSizeLeft -= txSize; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
QQ: we haven't had this if
tx.Hash != null && NotifiedTransactions.Set(tx.Hash)
before. Is it fixing some bug, but not related to 4844?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 recently added feature #5449
It was changed for
SendNewTransactions
:https://github.com/NethermindEth/nethermind/pull/5449/files#diff-e2801b05e4ee2fda5592da789a82f0e4c733c8b20c8688020cbb0de71e3db5e5
and
SendNewTransaction
was skipped. I just added it here too.It is a protection from sending the same tx few times to one peer - we are caching sent transactions. Not directly related to 4844
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.
Would move this to
ShouldNotifyTransaction
method for this condition in both places.