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: watch tower / sdk friendly expanded interface #73

Closed
wants to merge 0 commits into from

Conversation

mfw78
Copy link
Contributor

@mfw78 mfw78 commented Sep 18, 2023

Description

Provides expanded IConditionalOrder interfaces with parameterized errors as these are required to standardise such that the conditional order is able to communicate it's indexing intent to a watch tower.

Changes

  • Add custom parameterized errors for watch tower indexing.
  • validateData external function for verifying a conditional order's data struct if granular verification has been implemented (recommended for order type developers).

How to test

The TWAP contract has been updated to implement the expanded interface. To test:

forge test

Related Issues

Fixes #72

@mfw78 mfw78 added enhancement New feature or request E:2023-composable-cow labels Sep 18, 2023
@mfw78 mfw78 self-assigned this Sep 18, 2023
@mfw78 mfw78 linked an issue Sep 18, 2023 that may be closed by this pull request
3 tasks
* @inheritdoc IConditionalOrder
*/
function validateData(bytes memory data) external override pure {
TWAPOrder.validate(abi.decode(data, (TWAPOrder.Data)));
Copy link
Contributor

Choose a reason for hiding this comment

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

Cool, you now expose this function, but shouldn't you use the new Errors in TWAP too?

Copy link
Contributor Author

@mfw78 mfw78 Sep 18, 2023

Choose a reason for hiding this comment

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

The intent was to not change existing contracts, however, as the interface enforces this, I'll add the changes to TWAP, but remove the deployment addresses in README.md as the changes are not reflective of what is deployed (and we need to be careful and ensure we don't merge these into main unless there is a clear intent to have the changes audited).

tl;dr I don't think it's reasonable to count on these changes being usable in production at the moment until such time in the future that there are additional order types / tweaks that necessitate a new audit / review. It's fine however for new conditional orders to use these tweaks straight up.

Copy link
Contributor

@fleupold fleupold left a comment

Choose a reason for hiding this comment

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

Nice addition. Any thoughts on how we can enforce/incentivise developers to care about choosing the most suitable hint (if I don't care about watchtower costs, I'd let it poll every block).

src/interfaces/IConditionalOrder.sol Outdated Show resolved Hide resolved
@mfw78
Copy link
Contributor Author

mfw78 commented Sep 25, 2023

Nice addition. Any thoughts on how we can enforce/incentivise developers to care about choosing the most suitable hint (if I don't care about watchtower costs, I'd let it poll every block).

Incentives research is tracked here.

@mfw78 mfw78 changed the base branch from docs-separate-twap to develop September 25, 2023 00:39
@mfw78 mfw78 closed this Sep 25, 2023
@mfw78 mfw78 force-pushed the feat-interface-learnings branch from 7420aa7 to bc089b2 Compare September 25, 2023 00:41
@github-actions github-actions bot locked and limited conversation to collaborators Sep 25, 2023
@cowprotocol cowprotocol unlocked this conversation Sep 25, 2023
@cowprotocol cowprotocol locked as resolved and limited conversation to collaborators Sep 25, 2023
@mfw78 mfw78 added E:1.2: Watch Tower Service https://github.com/cowprotocol/pm/issues/8 and removed enhancement New feature or request labels Oct 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
E:1.2: Watch Tower Service https://github.com/cowprotocol/pm/issues/8
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants