Define bundle abandonment as - there is a pending bundle but after fee increases there are no longer any high enough paying UOs to increase the fees.
Modify sender state machine to funnel every bundle abandonment to the same state - "replacement underpriced." That is, when a bundle is abandoned clear the transaction tracker and start from scratch. On networks where the previous txn may still be in the mempool, we will get a "replacement underpriced." On other networks, starting from scratch allows us to continue.
Handle "replacement underpriced" errors with cancellations.
For the flashbots sender, use a "soft cancellation", which is just an API call and doesn't require polling
For all other senders, use a "hard cancellation", which requires a transaction to be sent to clear the mempool.
TODO (in follow up PRs):
[x] Consider splitting the monolith state machine function to make it easier to grok.
[ ] Consider delaying moving to the cancellation state by counting the number of "replacement underpriced" errors without landing a bundle. This will reduce the amount of wasted cancellation funds at the expense of being less reactive.
Closes #550
Proposed Changes
For all other senders, use a "hard cancellation", which requires a transaction to be sent to clear the mempool.
TODO (in follow up PRs):
bundle_sender