-
Notifications
You must be signed in to change notification settings - Fork 85
feat: adds LocalPendingTransactionStorage implementation #4408
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
base: feat/transaction-pool
Are you sure you want to change the base?
feat: adds LocalPendingTransactionStorage implementation #4408
Conversation
…tests Signed-off-by: Simeon Nakov <simeon.nakov@limechain.tech>
Codecov Report❌ Patch coverage is
@@ Coverage Diff @@
## feat/transaction-pool #4408 +/- ##
========================================================
Coverage ? 95.70%
========================================================
Files ? 123
Lines ? 20107
Branches ? 1756
========================================================
Hits ? 19244
Misses ? 838
Partials ? 25
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Signed-off-by: Simeon Nakov <simeon.nakov@limechain.tech>
Signed-off-by: Simeon Nakov <simeon.nakov@limechain.tech>
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.
LGTM just a couple of feedback
} | ||
|
||
// Also remove from transaction data map | ||
this.transactionData.delete(txHash); |
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.
When does this.transactionData have a record of txHash? I don't see the txHash got added to this.transactionData at any point, right?
* @param addr - The account address to query | ||
* @returns Promise resolving to the number of pending transactions | ||
*/ | ||
async getList(addr: string): Promise<number> { |
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 kinda misleading in a sense. getList() sounds like it's getting a list of the actual values, while this method is returning the size of the list. Should we rename it to some else more descriptive? Not a big deal and no need to address in this PR.
async addToList(addr: string, txHash: string, expectedPending: number): Promise<AddToListResult> { | ||
const currentCount = await this.getList(addr); | ||
|
||
// Check if the current count matches expectations (optimistic concurrency control) |
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.
Is the purpose of optimistic concurrency control
to prevent race conditioning? If so I think we should add more context for this. Can address in upcoming PRs
Description
This PR adds implementation for LocalPendingTransactionStorage following the PendingTransactionStorage + relevant tests
Related issue(s)
Closes #4391
Testing Guide
Changes from original design (optional)
The interface has been slightly modified to pass the txHash to addToList
Additional work needed (optional)
N/A
Checklist