Skip to content
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

feat: bin/cancel-all-pending-txs.js #1

Merged
merged 15 commits into from
Sep 20, 2024
Merged

feat: bin/cancel-all-pending-txs.js #1

merged 15 commits into from
Sep 20, 2024

Conversation

bajtos
Copy link
Member

@bajtos bajtos commented Sep 20, 2024

WIP

Signed-off-by: Miroslav Bajtoš <[email protected]>
@bajtos bajtos requested a review from juliangruber September 20, 2024 08:28
@bajtos bajtos marked this pull request as ready for review September 20, 2024 13:36
@bajtos
Copy link
Member Author

bajtos commented Sep 20, 2024

@juliangruber ready for your review.

I managed to cancel the oldest TX.

The second run failed with "transaction execution reverted", but it still cancelled the transaction 🤔

Error: transaction execution reverted (action="sendTransaction", data=null, reason=null, invocation=null, revert=null, transaction={ "data": "", "from": "0x4EcdC893Beb09121E4F5cBba469D33F5fF618442", "to": "0x4EcdC893Beb09121E4F5cBba469D33F5fF618442" }, receipt={ "_type": "TransactionReceipt", "blobGasPrice": null, "blobGasUsed": null, "blockHash": "0x71503ee0ecffdddfe45de3a4014ccd731774ec96390d50b7e8335e3c8b19802b", "blockNumber": 4284431, "contractAddress": null, "cumulativeGasUsed": "0", "from": "0x4EcdC893Beb09121E4F5cBba469D33F5fF618442", "gasPrice": "590849", "gasUsed": "1298840", "hash": "0x0be03a6d746686a0179a89dbcb051d166f25b62c27513af6ddc62feab9b8eaeb", "index": 71, "logs": [  ], "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "root": "0x0000000000000000000000000000000000000000000000000000000000000000", "status": 0, "to": "0x4EcdC893Beb09121E4F5cBba469D33F5fF618442" }, code=CALL_EXCEPTION, version=6.13.2)

The third run failed with the same error, but cancelled the transaction anyways.

It makes me wonder what to do about this. Should I not wait for TX confirmations and cancel all of them in one go? Or maybe in batches of 10 TX?

@bajtos
Copy link
Member Author

bajtos commented Sep 20, 2024

Signed-off-by: Miroslav Bajtoš <[email protected]>
Signed-off-by: Miroslav Bajtoš <[email protected]>
Signed-off-by: Miroslav Bajtoš <[email protected]>
Signed-off-by: Miroslav Bajtoš <[email protected]>
@bajtos
Copy link
Member Author

bajtos commented Sep 20, 2024

An error we are not handling yet, I don't know what to do when this happens. Do you perhaps know, @juliangruber ?

failed to lookup Eth Txn 0x6533f4eb56d9857a1b28dfc99a645e8505987fb73ec6ee61bf2545b00f60ea48 as bafy2bzacec74uxibzyreox5uxlluzotk5fvwyn2evsvqavyugvkofjpkjinhi: 
found message with equal nonce as the one we are looking for that is NOT a valid replacement message (
  F:bafy2bzacec74uxibzyreox5uxlluzotk5fvwyn2evsvqavyugvkofjpkjinhi 
  n 99056, 
  TS: bafy2bzaceam7vdxb4oxa3vuhs4zicfiokuif6mxzdo6oukngah2ase6bkmj2c 
  n99056
)

Signed-off-by: Miroslav Bajtoš <[email protected]>
Signed-off-by: Miroslav Bajtoš <[email protected]>
Signed-off-by: Miroslav Bajtoš <[email protected]>
Signed-off-by: Miroslav Bajtoš <[email protected]>
value: 0,
nonce,
gasLimit: Math.ceil(gasUsed * 1.1),
maxFeePerGas: gasFeeCap,
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll fix that in a follow-up PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

#2

@juliangruber
Copy link
Member

I managed to cancel the oldest TX.
[...]
The second run failed with "transaction execution reverted", but it still cancelled the transaction 🤔
[...]
The third run failed with the same error, but cancelled the transaction anyways.

It makes me wonder what to do about this. Should I not wait for TX confirmations and cancel all of them in one go? Or maybe in batches of 10 TX?

If we don't wait for confirmations it will be hard to tell whether the script succeeded, and why. I think we need to see the errors in the logs, when there are some

@juliangruber
Copy link
Member

Idk though why this happens

@juliangruber
Copy link
Member

An error we are not handling yet, I don't know what to do when this happens. Do you perhaps know, @juliangruber ?

failed to lookup Eth Txn 0x6533f4eb56d9857a1b28dfc99a645e8505987fb73ec6ee61bf2545b00f60ea48 as bafy2bzacec74uxibzyreox5uxlluzotk5fvwyn2evsvqavyugvkofjpkjinhi: 
found message with equal nonce as the one we are looking for that is NOT a valid replacement message (
  F:bafy2bzacec74uxibzyreox5uxlluzotk5fvwyn2evsvqavyugvkofjpkjinhi 
  n 99056, 
  TS: bafy2bzaceam7vdxb4oxa3vuhs4zicfiokuif6mxzdo6oukngah2ase6bkmj2c 
  n99056
)

I have seen this in logs before, but don't understand it yet either

Copy link
Member

@juliangruber juliangruber left a comment

Choose a reason for hiding this comment

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

Are you able to completely clear up the mempool with this script?

@bajtos
Copy link
Member Author

bajtos commented Sep 20, 2024

Yes, the mempool was cleared.

@bajtos bajtos merged commit 2f09bf3 into main Sep 20, 2024
@bajtos bajtos deleted the cancel-stuck-tx branch September 20, 2024 15:06
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.

2 participants