-
Notifications
You must be signed in to change notification settings - Fork 285
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
test(core-transaction-pool): increase coverage to 100% #3553
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #3553 +/- ##
========================================
Coverage 66.86% 66.86%
========================================
Files 448 448
Lines 10181 10181
Branches 1322 1322
========================================
Hits 6808 6808
Misses 3351 3351
Partials 22 22 Continue to review full report at Codecov.
|
There is still quite a lot uncovered https://codecov.io/gh/ArkEcosystem/core/tree/test%2Fcore-transaction-pool/packages/core-transaction-pool/src. |
…core into test/core-transaction-pool
…core into test/core-transaction-pool
…core into test/core-transaction-pool
Summary
In addition to tests there are changes that are fixing various issues that were discovered.
Transaction has expired error
Previously it reported how many blocks ago transaction expired. But when transaction is entering the pool its expiration is checked against next height. So when current height is 100 and transaction expiration is set to 101 it is considered expired and cannot enter. It's unclear how to report blocks ago in such case. I changed error message to report expiration height instead of how many blocks ago it expired.
Sender state race condition
Although hypothetical it was possible to cause races due to async nature of transaction handler. Now sener's transactions are acquiring lock while applying or manipulating stored transactions array.
Error during revert and in-flight transactions
If error was raised during revert (should not happen) transactions that were waiting for lock to release cannot be applied anymore. State is considered corrupted, there isn't much that can be done with it. Any transactions that were waiting for lock to release will raise an error.
Mempool
Sender state was split into two classes
SenderState
that has onlyapply
andrevert
functions and also performs transaction related checks andSenderMempool
that keeps list of applied transactions and performs sender related checks.Memory
was renamed intoMempool
.Fixes #3482
Checklist