Skip to content
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 TooExpensiveTxFilter #3497

Merged
merged 5 commits into from
Oct 8, 2021
Merged

Fix TooExpensiveTxFilter #3497

merged 5 commits into from
Oct 8, 2021

Conversation

marcindsobczak
Copy link
Contributor

Changes:

  • Stop including stale transactions when calculating cumulative cost in TooExpensiveTxFilter

Types of changes

What types of changes does your code introduce?
Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Other (please describe):

Testing

Requires testing

  • Yes
  • No

In case you checked yes, did you write tests??

  • Yes
  • No

@@ -55,6 +55,11 @@ public TooExpensiveTxFilter(IChainHeadInfoProvider headInfo, IAccountStateProvid

for (int i = 0; i < transactions.Length; i++)
{
if (transactions[i].Nonce < account.Nonce)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it feels like this should be a separate filter -> why the nonce check is added to the TooExpensiveTxFilter?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a check of currently added transaction.

Due to this issue:
#3173

we started checking that the account balance is sufficient to process not only the currently added transaction, but the cumulative cost of all pending transactions of the sender's address. This introduced a bug - if we have some stale transactions for this address in TxPool, we count them when calculating cumulative cost and they block adding new transactions. This PR solves it.
I can't move it to a separate filter, because change is connected with calculating the cumulative cost, which is right here.

@LukaszRozmej LukaszRozmej merged commit 33ff7cd into master Oct 8, 2021
@LukaszRozmej LukaszRozmej deleted the fix_TooExpensiveTxFilter branch October 8, 2021 13:37
marcindsobczak added a commit that referenced this pull request Oct 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants