Skip to content

Commit

Permalink
Reduce diff
Browse files Browse the repository at this point in the history
  • Loading branch information
m-lord-renkse committed Apr 19, 2024
1 parent 660619b commit 235d0f9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
8 changes: 2 additions & 6 deletions crates/driver/src/tests/cases/internalization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ use crate::tests::{
async fn valid_internalization() {
let test = setup()
.pool(ab_pool())
.order(ab_order()
.internalize()
)
.order(ab_order().internalize())
// Marks "A" as trusted and hence OK to use for internalization.
.trust("A")
.solution(ab_solution())
Expand All @@ -31,9 +29,7 @@ async fn valid_internalization() {
async fn untrusted_internalization() {
let test = setup()
.pool(ab_pool())
.order(ab_order()
.internalize()
)
.order(ab_order().internalize())
.solution(ab_solution())
// Note: does not mark "A" as trusted, despite the order being internalized.
.done()
Expand Down
17 changes: 7 additions & 10 deletions crates/driver/src/tests/cases/order_prioritization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,21 @@ use crate::{
#[tokio::test]
#[ignore]
async fn sorting() {
let base_order = ab_order();
let test = setup()
.solvers(vec![
test_solver().fee_handler(FeeHandler::Driver)
])
.pool(ab_pool())
// Orders with better price ratios come first.
.order(base_order.clone())
.order(base_order.clone().reduce_amount("1e-3".ether().into_wei()).rename("second order"))
.order(ab_order())
.order(ab_order().reduce_amount("1e-3".ether().into_wei()).rename("second order"))
// Limit orders come after market orders.
.order(
base_order
.clone()
ab_order()
.rename("third order")
.limit()
)
.order(base_order.reduce_amount("1e-3".ether().into_wei()).rename("fourth order").limit())
.order(ab_order().reduce_amount("1e-3".ether().into_wei()).rename("fourth order").limit())
.solution(ab_solution())
.done()
.await;
Expand All @@ -44,15 +42,14 @@ async fn sorting() {
#[tokio::test]
#[ignore]
async fn filtering() {
let base_order = ab_order();
let test = setup()
.pool(ab_pool())
// Orders with better price ratios come first.
.order(base_order.clone())
.order(base_order.clone().reduce_amount("1e-3".ether().into_wei()).rename("second order"))
.order(ab_order())
.order(ab_order().reduce_amount("1e-3".ether().into_wei()).rename("second order"))
// Filter out the next order, because the trader doesn't have enough balance to cover it.
.order(
base_order
ab_order()
.rename("third order")
.multiply_amount("0.1".ether().into_wei())
.filtered()
Expand Down

0 comments on commit 235d0f9

Please sign in to comment.