feat: adopt reth pool maintenance and persist the txpool across restarts - #121
feat: adopt reth pool maintenance and persist the txpool across restarts#121bronxyz wants to merge 2 commits into
Conversation
1824513 to
3ec3e6b
Compare
| return 0; | ||
| } | ||
|
|
||
| let write_result = write_atomically(path, |writer| { |
There was a problem hiding this comment.
do we need to persist queued/pending txs upon graceful restarts - if we delay the start up of the stopped validator could this lead to double spending problem because the user erroneously retried with a new nonce? - also in the case of being an observer its snapshot may be used for spinning a new one inheriting the persisted txs - could this lead to an issue?
There was a problem hiding this comment.
The txpool and evm won't allow for double spending to occur.
- When we restart - we are going to enter the
CvvInactivestate, which doesn't produce any batches. Any tx that has been part of a block will be dropped by the pool maintenance. All remaining ones are still eligible to be included in batches when they become pending. - The pool snapshot must be used for local purposes only, so snapshots must not include this local pool backup for restoring purposes.
- replace the hand-rolled canonical-state pool update (OwnedCanonicalStateUpdate, update_canonical_state, process_canon_state_update, the canonical txn pool task) with reth's maintain_transaction_pool_future - hold locally submitted txs to the same fee and eviction rules as external ones via no_local_exemptions - release in-flight marks on a dedicated canonical-stream task, and drive the TTL sweep plus membership reconcile from the 30s engine gap-check tick so a stuck seal mark ages out and a burst cannot starve release - delete the bypass validator and orphan-batch re-introduction: sealed-but-uncommitted txs now stay pending and marked in flight, so nothing is re-collected from NodeBatchesCache and bypass-validated back in - drop the now-unused rayon dependency from the orchestrator
- snapshot every worker pool (pending + queued txs and their in-flight marks) to disk once the engine has drained on a graceful shutdown, and reload it on the next boot so sealed-but-uncommitted txs survive the restart - a safety-net snapshot also runs BEFORE the deliberately unbounded drain await: a genuinely hung engine would otherwise reach the supervisor's SIGKILL with no backup at all, losing exactly the txs no peer can re-supply; both writes are idempotent tmp-then-rename so the post-drain snapshot wins on the healthy path, and a tx executed during the drain is rejected nonce-too-low on reload with its mark reconciled away - the serialize and file writes are blocking work kept off the async workers; a panic in one pool must not abort the shutdown flush
3ec3e6b to
c8d71b8
Compare
|
Claude finished @bronxyz's task in 2m 52s —— View job PR Review Update:
|
- the post-drain twin logs; the pre-drain snapshot swallowed the `JoinError`, leaving no trace when the node entered the drain with no backup - note at `max_tx_lifetime` that reth applies it to the queued sub-pool only - addresses the PR #121 (feature/txpool-reth-pool-maintenance) review: swallowed `JoinError`; the `max_tx_lifetime` note answers the same review's eviction concern, which misread the knob
Summary
maintain_transaction_pool_future, and hold locally submitted transactions to the same fee and eviction rules as external ones (no_local_exemptions). In-flight marks release on a dedicated canonical-stream task, with the TTL sweep and membership reconcile driven from the 30s engine gap-check tick so a burst cannot starve release.NodeBatchesCacheand bypass-validated back in.Stack 2/9 of the txpool in-flight tracker and observer-forwarder series.
Surface areas touched
eth_*,rayls_*, faucet)rayls-contracts/)etc/, scripts, Docker, compose).github/workflows/,Makefile)doc/, in-crate READMEs, root docs)Breaking / compatibility
None on the wire. Behavior change: local transactions lose their fee/eviction exemption, and a node now writes a txpool backup file under its datadir on graceful shutdown. A transaction executed during the drain is rejected nonce-too-low on reload and its mark reconciled away.
Test plan
atomic_write_replaces_existing_file,streaming_reader_accepts_legacy_json_arrayintxn_pool/backup.rs.tests/it/build_batches.rs) pass against the reth maintenance task.make checkon the stack tip; CI on this branch.