Skip to content

Add TransactionManager to handle stalled tx#767

Open
evgeny-stakewise wants to merge 8 commits into
masterfrom
tx-replace-pending
Open

Add TransactionManager to handle stalled tx#767
evgeny-stakewise wants to merge 8 commits into
masterfrom
tx-replace-pending

Conversation

@evgeny-stakewise

@evgeny-stakewise evgeny-stakewise commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Routes all wallet transactions through a single TransactionManager.transact(...) path and removes transaction_gas_wrapper. The manager owns submit + receipt-wait under a lock (one in-flight tx at a time), reuses the lowest unconfirmed nonce, and replaces a stuck pending tx with bumped fees instead of an in-call retry loop.

What changed

  • transact(tx_function, tx_params=None, high_priority=False) -> TxReceipt | None: serializes submit and the receipt wait so exactly one wallet tx is in flight at a time; returns the receipt (or None on revert).
  • Two gas strategies:
    • high_priority=True (e.g. validator registration) skips the default-gas attempts and submits high-priority fees straight away.
    • high_priority=False keeps the existing default-gas attempts loop, escalating to high-priority fees on FeeTooLow.
  • No in-call fee-bump loop. A run submits once; if it doesn't confirm within execution_transaction_timeout the task retries on its next run, where a pending tx is detected and its fees bumped (max(high_priority, bump(prev)), capped at max_fee_per_gas).
  • Deleted transaction_gas_wrapper; migrated every caller (validators register/fund/consolidate, withdrawals, exits, harvest, reward splitter, meta vault) plus the tx_aggregate / deposit_to_sub_vaults wrappers, which now return TxReceipt | None.

Behavior note

  • A receipt timeout is caught inside the manager: transact returns None and leaves the tx pending, so the next run detects and replaces it (previously TimeExhausted propagated out of the caller).
  • When the pending tx is at or near the max_fee_per_gas ceiling, the bump can't clear the node's +10% replacement threshold, so the manager skips the replacement, logs a warning, and returns None instead of broadcasting a doomed underpriced tx — it mines once the base fee drops or is retried on a later run.

@evgeny-stakewise evgeny-stakewise changed the title Integrate transaction_gas_wrapper into TransactionManager Add TransactionManager to handle stalled tx Jun 24, 2026
tsudmi
tsudmi previously approved these changes Jun 24, 2026
Comment thread src/common/transaction.py

# forget gas records for nonces that have already been mined (nonce
# `latest_nonce` itself may still be pending, so keep it)
self._nonce_to_tx_params = {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional: complicated one-liner, can be exracted into _update_nonce... func

Comment thread src/common/transaction.py Outdated
Comment thread src/common/transaction.py Outdated
Comment thread src/validators/execution.py Outdated
Comment thread src/common/transaction.py
Comment thread src/common/transaction.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants