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

Support JIT orders in the trade verifier #3085

Merged
merged 44 commits into from
Dec 2, 2024

Conversation

squadgazzz
Copy link
Contributor

@squadgazzz squadgazzz commented Oct 25, 2024

Description

Closes task n2 from #3082 by implementing support of the quotes with JIT orders in the trade verifier. For a gradual migration, it has to support both quote versions.

Changes

  • Added a new version of the trade with JIT orders.
  • Utilized the clearing prices to calculate the out amount.
  • Altered the Solver.sol helper contract to fetch all token balances as was proposed in one of the comments, which reduces the overall code complexity.
  • Bumped into an issue while converting floats into BigRational. Implemented a workaround with converting float's string representation into BigRational. Used BigDecimal in the config instead.

How to test

Unit tests. e2e would be possible only once the driver support is implemented(see #3103).

Base automatically changed from 3082/jit-orders-quote-api to main October 28, 2024 14:46
crates/shared/src/trade_finding.rs Outdated Show resolved Hide resolved
crates/shared/src/trade_finding.rs Outdated Show resolved Hide resolved
crates/shared/src/trade_finding.rs Outdated Show resolved Hide resolved
crates/shared/src/trade_finding.rs Outdated Show resolved Hide resolved
crates/shared/src/trade_finding.rs Outdated Show resolved Hide resolved
@squadgazzz squadgazzz force-pushed the 3082/trade-verifier-jit-orders-support branch from 5b2374c to f676a96 Compare October 30, 2024 17:23
@squadgazzz squadgazzz marked this pull request as ready for review October 30, 2024 19:51
@squadgazzz squadgazzz requested a review from a team as a code owner October 30, 2024 19:51
@squadgazzz squadgazzz changed the title Support JIT orders in trade verifier Support JIT orders in the trade verifier Oct 30, 2024
@squadgazzz squadgazzz force-pushed the 3082/trade-verifier-jit-orders-support branch from 88ee77b to e051528 Compare November 7, 2024 10:04
@squadgazzz squadgazzz marked this pull request as ready for review November 7, 2024 12:39
@squadgazzz squadgazzz force-pushed the 3082/trade-verifier-jit-orders-support branch from a1bc459 to bea5183 Compare November 7, 2024 12:39
Copy link

This pull request has been marked as stale because it has been inactive a while. Please update this pull request or it will be automatically closed.

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.

Still need to double check the value for the unit tests but the logic changes look correct to me.

crates/shared/src/price_estimation/trade_verifier.rs Outdated Show resolved Hide resolved
crates/shared/src/trade_finding.rs Outdated Show resolved Hide resolved
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.

Test values make sense to me. Just change to the signature of ensure_quote_accuracy() should be reverted to make the test setup easier. ATM it sets up a bunch of JIT orders which are actually no longer used with the latest approach.

crates/shared/src/price_estimation/trade_verifier.rs Outdated Show resolved Hide resolved
crates/shared/src/price_estimation/trade_verifier.rs Outdated Show resolved Hide resolved
# Conflicts:
#	crates/shared/src/trade_finding/mod.rs
@squadgazzz squadgazzz merged commit eb98aaf into main Dec 2, 2024
11 checks passed
@squadgazzz squadgazzz deleted the 3082/trade-verifier-jit-orders-support branch December 2, 2024 13:18
@github-actions github-actions bot locked and limited conversation to collaborators Dec 2, 2024
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