-
Notifications
You must be signed in to change notification settings - Fork 138
feat(mempool): add timeout for reorg #880
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
Conversation
| gascap uint64 // Gas limit of the highest spending transaction (reset only if exceeds block limit) | ||
| totalcost *uint256.Int // Total cost of all transactions in the list | ||
|
|
||
| lastCheckedHeight int64 // the height at which the list was last checked |
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.
No mutex required, as this is an internal structure and its access is already under a lock
| } else { | ||
| // set the last checked height for the list | ||
| // this is used to return only checked accounts in Pending method | ||
| list.setLastCheckedHeight(height) |
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.
@mattac21 @Eric-Warehime , so this is the place where we'd set the last checked height.
The drawback of this approach: now, to be included in pool.Pending() → mempool.SelectBy() results, tx should go through demoteUnexecutables, which is not the case for same-block-inclusion (imagine an addition to an empty mempool) eg:
[time_0: block(1), t1: add_tx(), t2: propose_block(2)]
Do you see any easy ways to handle this case?
|
Closing, might open a re-implementation later if needed. |
Description
mempool.Selectandmempool.SelectBycallsTimeout logic
LegacyPool.WaitForReorgHeight now also has a timeout parameter (hard-coded to
300msinmempool.Select)Inside this function, we call
reorgContextthat either setsctx.timeout = timeoutor lowers existing timeout by 100ms ~ctx.timeout -= 100ms.After ctx is timed out, is calls an atomic bool
reorgCancelRequestedthat is checked for every account duringpromoteExecutablesordemoteUnexecutablesNote: due to how EVM mempool works, it's challenging to properly propagate
ctxacross all goroutines as the mempool follows the actor model with lots of channels. This leads to a semi-forced context timeout, where we might still have some operations running after the timeout (ie, hard timeout if not guaranteed)Closes: STACK-1927
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
mainbranch