-
Notifications
You must be signed in to change notification settings - Fork 468
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
Add filter for max transaction size #7925
Conversation
Co-authored-by: Ruben Buniatyan <rubo@users.noreply.github.com>
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.
We could add similar logic in transaction gossip, before we even deserialise RLP. We could avoid deserialization and serialization later. Also NewPooledTransactionHashesMessage68
have size property that we could leverage and not request transactions over that size at all.
Do we want exception for local transactions? (probably not)
Good idea with not requesting txs with size above max limit! About skipping deserialization - we need to deserialise at least a part of tx to check tx type. But I think we can reject at the very beginning all txs with size exceeding maximally loaded blob tx (max number of blobs + max size of non-blob data). About exception for local txs - I don't think so. If user would need to send such tx, there is always an option to increase config value |
We can get the type without deserializing anything else, it is just first byte. |
src/Nethermind/Nethermind.Network/P2P/Subprotocols/Eth/PooledTxsRequestor.cs
Outdated
Show resolved
Hide resolved
src/Nethermind/Nethermind.Network/P2P/Subprotocols/Eth/PooledTxsRequestor.cs
Outdated
Show resolved
Hide resolved
# Conflicts: # src/Nethermind/Nethermind.Network/P2P/Subprotocols/Eth/PooledTxsRequestor.cs
There are some exceptions like legacy txs without tx type. For sure it's doable, but requires more insights, time, caution and extended testing, which I don't want to do in the scope of this PR. I added an issue for it: #7986 Here I added:
|
@@ -21,6 +21,7 @@ public class TxPoolConfig : ITxPoolConfig | |||
public int HashCacheSize { get; set; } = 512 * 1024; | |||
public long? GasLimit { get; set; } = null; | |||
public long? MaxTxSize { get; set; } = 128.KiB(); | |||
public long? MaxBlobTxSize { get; set; } = 1.MiB(); |
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.
why blopb tx's can be 8x bigger?
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.
Doesn't have sense to me, but I wanted to do it similar to Geth implementation
https://github.com/ethereum/go-ethereum/blob/master/core/txpool/blobpool/blobpool.go#L63-L68
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.
And it is not a big deal as blob txs are saved to disc. Memory is not affected as in case of non-blob txs
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.
We can also go with standard 128 KiB and it will simplify this PR, but we will then reject some txs accepted by Geth
Co-authored-by: Ruben Buniatyan <rubo@users.noreply.github.com> Co-authored-by: lukasz.rozmej <lukasz.rozmej@gmail.com>
Changes
PooledTxsRequestor
if tx size is exceeding configured max sizeTxType
comparisons (e.g.SupportsBlobs
) fromTransaction
toTxTypeExtensions
Types of changes
What types of changes does your code introduce?
Testing
Requires testing
If yes, did you write tests?