From bca89ac7e4caa16135e498b88c3537f96be65272 Mon Sep 17 00:00:00 2001 From: Michal Strug Date: Sat, 23 Nov 2024 01:29:32 +0100 Subject: [PATCH] Fixed tests compilation --- crates/orderbook/src/database/orders.rs | 5 ----- crates/shared/src/event_storing_helpers.rs | 2 +- crates/shared/src/price_estimation/native.rs | 2 +- .../shared/src/price_estimation/trade_verifier.rs | 14 +++++++------- 4 files changed, 9 insertions(+), 14 deletions(-) diff --git a/crates/orderbook/src/database/orders.rs b/crates/orderbook/src/database/orders.rs index 887cfab122..04825b43b7 100644 --- a/crates/orderbook/src/database/orders.rs +++ b/crates/orderbook/src/database/orders.rs @@ -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, @@ -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,); } } diff --git a/crates/shared/src/event_storing_helpers.rs b/crates/shared/src/event_storing_helpers.rs index 28f829391f..496d2f1732 100644 --- a/crates/shared/src/event_storing_helpers.rs +++ b/crates/shared/src/event_storing_helpers.rs @@ -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(), diff --git a/crates/shared/src/price_estimation/native.rs b/crates/shared/src/price_estimation/native.rs index 910d671cff..6901ce3072 100644 --- a/crates/shared/src/price_estimation/native.rs +++ b/crates/shared/src/price_estimation/native.rs @@ -130,7 +130,7 @@ mod tests { gas: 0, solver: H160([1; 20]), verified: false, - call_data: None, + interactions: vec![], }) } .boxed() diff --git a/crates/shared/src/price_estimation/trade_verifier.rs b/crates/shared/src/price_estimation/trade_verifier.rs index 44aae65816..609af16626 100644 --- a/crates/shared/src/price_estimation/trade_verifier.rs +++ b/crates/shared/src/price_estimation/trade_verifier.rs @@ -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 @@ -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 { @@ -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 { @@ -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 { @@ -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()); } }