-
Notifications
You must be signed in to change notification settings - Fork 17
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
Refactor handler errors to try on next block watch tower pattern #87
Conversation
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
I have read the CLA Document and I hereby sign the CLA |
In general, I'd suggest to include all the watch-tower errors that are possible. I'd already done some work in composable-cow/src/interfaces/IConditionalOrder.sol Lines 17 to 25 in 24ce6fb
Instead of introducing this within |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general looks OK. I've left some comments about IwatchtowerCustomErrors
in the main PR comments. FYI, there is a error PollTryNextBlock(string reason)
that is supported by the watch-tower. This allows for simpler code as it was identified that trying at the very next block is a common pattern and alleviates a lot of block.number + 1
.
|
||
/** | ||
* @dev Reverts call execution with a custom error that indicates to the | ||
* watchtower to poll for new order when the next block is mined. | ||
*/ | ||
function revertPollAtNextBlock(string memory message) internal view { | ||
revert IWatchtowerCustomErrors.PollTryAtBlock( | ||
block.number + 1, | ||
message | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd generally discourage the use of revert utilities, such as this, to reduce the layers of indirection required when reviewing the logic within the smart contract to know where I can expect a revert (sure, it's in the name, but it's another function that I then need to drill into to triple check that it indeed does revert). Depending on the optimiser as well and how this gets compiled, this may also result in additional gas consumption.
Thanks for review @mfw78 . I refactor the contracts to address them. Let me know if we need more on the dev side. Also, once you think it's ready for deployment, let me know what should be the process (if we should do it or not). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…e PoolTryNextBlock error
@mfw78 since we're planning to launch the stop-loss app soon, I think that we should have this PR merged. Let me know if you need more things on our side. All the changed handlers contracts will need to be redeployed, I was assuming that you guys will do it since you have a wallet to do this process, right? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes look good to me with the exception of the comment below. Once clarified it's good for merging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
Description
Refactor Stop Loss, Trade Above Threshold, and Good After Time errors to watch tower try again pattern.
Changes
revertPollAtNextBlock
method onConditionalOrdersUtilsLib
How to test
0x410c267baf50b36475B30051Da2aE734f6726F01
Related Issues