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

chore: add validation for quotes with incorrect sell amount #6241

Merged
merged 2 commits into from
Feb 19, 2024

Conversation

woodenfurniture
Copy link
Member

@woodenfurniture woodenfurniture commented Feb 19, 2024

Description

Prevents a quote being marked as valid (and therefore executable) when the sell amount isn't exactly the same as the sell amount the user inputted.

Pull Request Type

  • 🐛 Bug fix (Non-breaking Change: Fixes an issue)
  • 🛠️ Chore (Non-breaking Change: Doc updates, pkg upgrades, typos, etc..)
  • 💅 New Feature (Breaking/Non-breaking Change)

Issue (if applicable)

closes #5723 specifically point create sanity check that we never ask a user to sign a transaction that is larger than what a user input

Risk

High Risk PRs Require 2 approvals

Low risk as this prevents invalid trades. This check failing or being incorrectly implemented could have 2 possible outcomes

What protocols, transaction types or contract interactions might be affected by this PR?

LiFi trades specifically, though theoretically any protocol used in trades

Testing

Check trades are working as normal.

Engineering

Worth monkey patching to ensure a quote with mismatching sell amount results in a generic quote error.

Operations

Screenshots (if applicable)

@woodenfurniture woodenfurniture requested a review from a team as a code owner February 19, 2024 09:43
@woodenfurniture
Copy link
Member Author

Current dependencies on/for this PR:

This stack of pull requests is managed by Graphite.

Copy link
Contributor

@gomesalexandre gomesalexandre left a comment

Choose a reason for hiding this comment

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

Tested locally:

  • Li.Fi quotes are still happy ✅
image image
  • Li.Fi quotes are sad when monkey-patching input sell asset amount to be different than the quote one ✅
image image

@gomesalexandre gomesalexandre enabled auto-merge (squash) February 19, 2024 14:46
@gomesalexandre gomesalexandre merged commit 99509e1 into develop Feb 19, 2024
4 checks passed
@gomesalexandre gomesalexandre deleted the prevent-wrong-sell-amounts branch February 19, 2024 14:51
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.

Swapper attempts to swap more than in wallet and fees beyond the input amount
2 participants