Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
test(core-transaction-pool): increase coverage to 100% #3553
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.
Sender state was split into two classes
@@ 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
There is still quite a lot uncovered https://codecov.io/gh/ArkEcosystem/core/tree/test%2Fcore-transaction-pool/packages/core-transaction-pool/src.