-
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
Transaction pool improvements to avoid filling the pool with not executable transactions #4425
Conversation
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>
Signed-off-by: Justin Florentine <justin+github@florentine.us> Signed-off-by: Justin Florentine <justin+github@florentine.us>
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>
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>
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>
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.
Suggestions below are non-blocking, would rather have this out sooner than adopt them. I have been running this branch successfully and when a proposal is triggered the block is full.
traceLambda(LOG, "Added remote transaction {}", transaction::toTraceLog); | ||
addedTransactions.add(transaction); | ||
break; | ||
case ALREADY_KNOWN: |
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.
Does this mean the duplicate check at 145 is redundant with one the validateRemoteTransaction() method does? Optimization potential if we can avoid a full scan running twice.
} | ||
} | ||
|
||
public List<Transaction> signalInvalidTransaction(final Transaction transaction) { |
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.
The return value here is not intuitive based on the method name. We should probably either add javadoc describing it, or rename to something like transactionsRemovedAfter(Transaction invalidTransaction)
.filter(tx::equals) | ||
.isPresent()) | ||
.findFirst(); | ||
private static class LowestInvalidNonceCache { |
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 is pretty big for an inner class, maybe pull it out into its own class?
merged after burn in on mainnet (4417, 4423, 4425) on a variety of hw and CL configurations |
Thanks @jflo for the review, I will implement your suggestion in a future PR |
…utable transactions (hyperledger#4425) * Add more tracing logs to transaction pool * Prevent adding non executable transactions and evict based on age * Move sender account in TransactionsForSenderInfo * Implement a size expiration cache for lowest invalid nonce for sender Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net> Signed-off-by: Justin Florentine <justin+github@florentine.us> Co-authored-by: Justin Florentine <justin+github@florentine.us>
PR description
This PR is built on top of #4413 which was used to investigate the transaction pool, with the result that currently we keep many transactions that are not possible to include in a block, because a transaction with a lower nonce is missing or invalid.
To avoid that issues first we now remember (in a cache) that that sender has an invalid transaction, and we do not accept transactions with higher nonce from that sender, of course if a replacement for the invalid transaction is sent it is accepted.
The eviction when the pool is full has changed in order to pick the sender of the oldest transaction in the pool, and the evict the transaction with the higher nonce for that sender, so no gaps in the nonce list for that sender are created.
Fixed Issue(s)
fixes #4401
Documentation
doc-change-required
label to this PR ifupdates are required.
Changelog