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

Prevent orders with excessive valid to from being created #224

Merged
merged 3 commits into from
May 24, 2022

Conversation

nlordell
Copy link
Contributor

Supersedes #200

This PR adds new restrictions for orders, they have a maximum valid validTo value. The default is for 3 hours in the future (the same maximum as we have in the CowSwap FE).

This new restriction does not apply to liquidity orders (since they don't have the same issue with gas price quotes being WAY off). We also don't apply the restriction to pre-sign orders, since they are, arguably much riskier to abuse (because of the required transaction).

Test Plan

Added test cases testing new conditions for the order validity restrictions.

@nlordell nlordell requested a review from a team as a code owner May 23, 2022 16:32
@fleupold
Copy link
Contributor

Just a random thought. For specific "knowingly good" use cases of long standing orders (e.g. yearn), we could create another allow list until we have a better mechanism.

Copy link
Contributor

@MartinquaXD MartinquaXD left a comment

Choose a reason for hiding this comment

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

LGTM. Nice test coverage.

Copy link
Contributor

@sunce86 sunce86 left a comment

Choose a reason for hiding this comment

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

Lgtm

@nlordell nlordell merged commit 56ae162 into main May 24, 2022
@nlordell nlordell deleted the deny-super-long-orders branch May 24, 2022 10:35
@github-actions github-actions bot locked and limited conversation to collaborators May 24, 2022
@nlordell
Copy link
Contributor Author

Just a random thought. For specific "knowingly good" use cases of long standing orders (e.g. yearn), we could create another allow list until we have a better mechanism.

This is a good suggestion. If we have the need to add more accounts that we want to let place long-standing orders, we can remove the signing_scheme == Presign check in favour of an allow list 😄.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants