feature: Handle cancellations: Reduce errors and logs #52
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR aims to handle cancelations of smart orders better.
Why
Currently, a big a mount of the errors in the logs comes from Smart Order cancelations
The error handling of
getTradeableOrderWithSignature
will try to guess if the issue with the CALL was because of the auth:composable-cow/actions/checkForAndPlaceOrder.ts
Line 420 in 81fc661
The problem is that sometimes (at least in Gnosis Chain), the EVM error will not give you this nice debug info, so basically you don't know why it failed.
The Problem
If we are not sure about the problem, we can't remove the order from the pending orders, so we will keep getting this error over and over for every block.
Additional problem
Debugging Smart Orders take a lot of time, and there are too many things that can be wrong. If we need to debug these situations manually, it will be very time consuming
This PR proposal
Before doing the
getTradeableOrderWithSignature
CALL, we check forsingleOrders
flow if the order is authorised or not.If its not authorised, we remove the order from the pending orders, and continue (we don't consider this an error, this is part of the normal flow on cancelations)
Example
This Order was failing over and over:
As you can see in the history:
https://app.safe.global/transactions/history?safe=gno:0xe60d513f367326c70f447875984940ccf9348b3c
This order was created in NONCE 0 (https://gnosisscan.io/tx/0xcf62a4ff38ae24015269c41dbf3b9f70e3b4ac711d7a08c4b001f412f48e3ba5/), and canceled in NONCE 1 (https://gnosisscan.io/tx/0xf494ac79b5f7cb4fce8e6298f6ac6c6c73295ffb90e105914a6402934812dff0/)