diff --git a/crates/autopilot/src/domain/auction/mod.rs b/crates/autopilot/src/domain/auction/mod.rs index 460c2dc344..a52e51c8ea 100644 --- a/crates/autopilot/src/domain/auction/mod.rs +++ b/crates/autopilot/src/domain/auction/mod.rs @@ -14,7 +14,7 @@ pub struct Auction { pub latest_settlement_block: u64, pub orders: Vec, pub prices: BTreeMap, - pub surplus_capturing_jit_order_owners: Vec, + pub surplus_capturing_jit_order_owners: Vec, } pub type Id = i64; diff --git a/crates/autopilot/src/infra/persistence/dto/auction.rs b/crates/autopilot/src/infra/persistence/dto/auction.rs index 5ac4c1494e..8ddfd3ff54 100644 --- a/crates/autopilot/src/infra/persistence/dto/auction.rs +++ b/crates/autopilot/src/infra/persistence/dto/auction.rs @@ -18,7 +18,11 @@ pub fn from_domain(auction: domain::Auction) -> Auction { .map(super::order::from_domain) .collect(), prices: auction.prices, - surplus_capturing_jit_order_owners: auction.surplus_capturing_jit_order_owners, + surplus_capturing_jit_order_owners: auction + .surplus_capturing_jit_order_owners + .into_iter() + .map(Into::into) + .collect(), } } @@ -32,7 +36,11 @@ pub fn to_domain(auction: Auction) -> domain::Auction { .map(super::order::to_domain) .collect(), prices: auction.prices, - surplus_capturing_jit_order_owners: auction.surplus_capturing_jit_order_owners, + surplus_capturing_jit_order_owners: auction + .surplus_capturing_jit_order_owners + .into_iter() + .map(Into::into) + .collect(), } } diff --git a/crates/autopilot/src/infra/persistence/mod.rs b/crates/autopilot/src/infra/persistence/mod.rs index f97f429300..23972c7619 100644 --- a/crates/autopilot/src/infra/persistence/mod.rs +++ b/crates/autopilot/src/infra/persistence/mod.rs @@ -7,7 +7,7 @@ use { }, anyhow::Context, chrono::Utc, - database::Address, + database::byte_array::ByteArray, primitive_types::H256, std::sync::Arc, tracing::Instrument, @@ -97,12 +97,15 @@ impl Persistence { pub async fn save_surplus_capturing_jit_orders_orders( &self, auction_id: AuctionId, - surplus_capturing_jit_order_owners: &[Address], + surplus_capturing_jit_order_owners: &[domain::eth::Address], ) -> Result<(), Error> { self.postgres .save_surplus_capturing_jit_orders_orders( auction_id, - surplus_capturing_jit_order_owners, + &surplus_capturing_jit_order_owners + .into_iter() + .map(|address| ByteArray(address.0.into())) + .collect::>(), ) .await .map_err(Error::DbError) diff --git a/crates/autopilot/src/run_loop.rs b/crates/autopilot/src/run_loop.rs index 0828e550a0..ab823ae072 100644 --- a/crates/autopilot/src/run_loop.rs +++ b/crates/autopilot/src/run_loop.rs @@ -22,7 +22,7 @@ use { }, ::observe::metrics, anyhow::Result, - database::{byte_array::ByteArray, order_events::OrderEventLabel}, + database::order_events::OrderEventLabel, model::solver_competition::{ CompetitionAuction, Order, @@ -280,8 +280,9 @@ impl RunLoop { auction_id, &surplus_capturing_jit_order_owners .into_iter() - .map(|address| ByteArray(address.0)) - .collect::>(), + .map(Into::into) + .collect::>() + .as_slice(), ) .await { @@ -327,16 +328,15 @@ impl RunLoop { id: domain::auction::Id, auction: &domain::Auction, ) -> Vec> { - let surplus_capturing_jit_order_owners = - self.surplus_capturing_jit_order_owners.list_all().await; let request = solve::Request::new( id, auction, &self.market_makable_token_list.all(), self.solve_deadline, - &surplus_capturing_jit_order_owners + &auction + .surplus_capturing_jit_order_owners .iter() - .cloned() + .map(|address| address.0) .collect::>(), ); let request = &request; diff --git a/crates/autopilot/src/shadow.rs b/crates/autopilot/src/shadow.rs index 1edf18234c..01fda9372e 100644 --- a/crates/autopilot/src/shadow.rs +++ b/crates/autopilot/src/shadow.rs @@ -192,7 +192,11 @@ impl RunLoop { auction, &self.trusted_tokens.all(), self.solve_deadline, - &auction.surplus_capturing_jit_order_owners, + &auction + .surplus_capturing_jit_order_owners + .iter() + .map(|address| address.0) + .collect::>(), ); let request = &request; diff --git a/crates/autopilot/src/solvable_orders.rs b/crates/autopilot/src/solvable_orders.rs index 9cd1641378..0e6930f8e3 100644 --- a/crates/autopilot/src/solvable_orders.rs +++ b/crates/autopilot/src/solvable_orders.rs @@ -265,7 +265,7 @@ impl SolvableOrdersCache { }) .collect(), prices, - surplus_capturing_jit_order_owners: cow_amms.iter().map(|cow_amm| cow_amm.address()).cloned().collect(), + surplus_capturing_jit_order_owners: cow_amms.iter().map(|cow_amm| cow_amm.address()).cloned().map(Into::into).collect(), }; *self.cache.lock().unwrap() = Inner { auction: Some(auction),