Skip to content

Commit

Permalink
Fixed tests compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
mstrug committed Nov 23, 2024
1 parent 086e579 commit bca89ac
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 14 deletions.
5 changes: 0 additions & 5 deletions crates/orderbook/src/database/orders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1184,7 +1184,6 @@ mod tests {
database::clear_DANGER(&db.pool).await.unwrap();

let uid = OrderUid([0x42; 56]);
let call_data = vec![1];
let order = Order {
data: OrderData {
valid_to: u32::MAX,
Expand All @@ -1211,10 +1210,6 @@ mod tests {

let single_order_with_quote = db.single_order_with_quote(&uid).await.unwrap().unwrap();
assert_eq!(single_order_with_quote.order, order);
assert_eq!(
single_order_with_quote.quote.clone().unwrap().call_data,
Some(call_data)
);
assert!(single_order_with_quote.quote.unwrap().verified,);
}
}
2 changes: 1 addition & 1 deletion crates/shared/src/event_storing_helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pub fn create_quote_interactions_insert_data(
.enumerate()
.map(|(index, interaction)| DbQuoteInteraction {
id,
index: index as i64,
index: index.try_into().unwrap(),
target: ByteArray(interaction.target.0),
value: u256_to_big_decimal(&interaction.value),
call_data: interaction.call_data.clone(),
Expand Down
2 changes: 1 addition & 1 deletion crates/shared/src/price_estimation/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ mod tests {
gas: 0,
solver: H160([1; 20]),
verified: false,
call_data: None,
interactions: vec![],
})
}
.boxed()
Expand Down
14 changes: 7 additions & 7 deletions crates/shared/src/price_estimation/trade_verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ impl TradeVerifier {
"verified quote",
);

ensure_quote_accuracy(&self.quote_inaccuracy_limit, query, &trade, &summary)
ensure_quote_accuracy(&self.quote_inaccuracy_limit, query, trade, &summary)
}

/// Configures all the state overrides that are needed to mock the given
Expand Down Expand Up @@ -581,11 +581,11 @@ mod tests {
sell_tokens_lost: BigRational::from_integer(500.into()),
};

let estimate = ensure_quote_accuracy(&low_threshold, &query, H160::zero(), &sell_more);
let estimate = ensure_quote_accuracy(&low_threshold, &query, &Default::default(), &sell_more);
assert!(matches!(estimate, Err(Error::TooInaccurate)));

// passes with slightly higher tolerance
let estimate = ensure_quote_accuracy(&high_threshold, &query, H160::zero(), &sell_more);
let estimate = ensure_quote_accuracy(&high_threshold, &query, &Default::default(), &sell_more);
assert!(estimate.is_ok());

let pay_out_more = SettleOutput {
Expand All @@ -595,11 +595,11 @@ mod tests {
sell_tokens_lost: BigRational::from_integer(0.into()),
};

let estimate = ensure_quote_accuracy(&low_threshold, &query, H160::zero(), &pay_out_more);
let estimate = ensure_quote_accuracy(&low_threshold, &query, &Default::default(), &pay_out_more);
assert!(matches!(estimate, Err(Error::TooInaccurate)));

// passes with slightly higher tolerance
let estimate = ensure_quote_accuracy(&high_threshold, &query, H160::zero(), &pay_out_more);
let estimate = ensure_quote_accuracy(&high_threshold, &query, &Default::default(), &pay_out_more);
assert!(estimate.is_ok());

let sell_less = SettleOutput {
Expand All @@ -609,7 +609,7 @@ mod tests {
sell_tokens_lost: BigRational::from_integer((-500).into()),
};
// Ending up with surplus in the buffers is always fine
let estimate = ensure_quote_accuracy(&low_threshold, &query, H160::zero(), &sell_less);
let estimate = ensure_quote_accuracy(&low_threshold, &query, &Default::default(), &sell_less);
assert!(estimate.is_ok());

let pay_out_less = SettleOutput {
Expand All @@ -619,7 +619,7 @@ mod tests {
sell_tokens_lost: BigRational::from_integer(0.into()),
};
// Ending up with surplus in the buffers is always fine
let estimate = ensure_quote_accuracy(&low_threshold, &query, H160::zero(), &pay_out_less);
let estimate = ensure_quote_accuracy(&low_threshold, &query, &Default::default(), &pay_out_less);
assert!(estimate.is_ok());
}
}

0 comments on commit bca89ac

Please sign in to comment.