ethers-provider-flashbots-bundle icon indicating copy to clipboard operation
ethers-provider-flashbots-bundle copied to clipboard

`wait` function only looks back one block; reorgs have a high probability

Open Randall4 opened this issue 4 years ago • 4 comments
trafficstars

bombardier got frustrated in the Discord since his MEV transaction was uncled but his FlashbotsBundleResolution said that the tx was included.

Suggestion: specify an optional number of blocks to wait (= confirmations) until resolving the promise. By default I'd recommend 3 confirmations based on the current state of the network.

Randall4 avatar Jul 04 '21 14:07 Randall4

should the resolution really just say pending for n+3 blocks?

sambacha avatar Aug 07 '21 01:08 sambacha

should the resolution really just say pending for n+3 blocks?

No, to be more specific I think this would just be passing a new argument called "confirmations" to the wait function here: https://github.com/flashbots/ethers-provider-flashbots-bundle/blob/0d404bb041b82c12789bd62b18e218304a095b6f/src/index.ts#L307

Ideally you would just propagate the confirmations argument to this other wait function and wait for block "targetBlockNumber + confirmations" to be mined immediately before this line: https://github.com/flashbots/ethers-provider-flashbots-bundle/blob/0d404bb041b82c12789bd62b18e218304a095b6f/src/index.ts#L385

Randall4 avatar Nov 08 '21 05:11 Randall4

I would think using the term finality would be more apt, as this is the attribute that is actually being used (finalization of transaction meaning X amount of blocks have passed since it was mined on the canonical chain)

sambacha avatar Nov 08 '21 05:11 sambacha

Interesting that you mention that. I've personally only heard the term "confirmations" to refer to the number of blocks to wait before deciding that a transaction is truly on the chain. Ethers' argument name for it is "confirms": https://docs.ethers.io/v5/api/providers/types/#providers-TransactionResponse and Etherscan uses "block confirmations"

Randall4 avatar Dec 08 '21 05:12 Randall4