Skip to content

Commit 3bafecb

Browse files
committed
Add force presign order filtering flag (#3893)
# Description We want to disable order filtering for flash loans, but keep filtering for presign order that have not been presigned. For this I introduced a new flag that forces this filter even if filtering in general is disabled.
1 parent 1784fe7 commit 3bafecb

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

crates/autopilot/src/arguments.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,10 @@ pub struct Arguments {
260260
#[clap(long, env, default_value = "false", action = clap::ArgAction::Set)]
261261
pub disable_order_filtering: bool,
262262

263+
// Filter out orders that have not been presigned even if disable_order_filtering is turned on.
264+
#[clap(long, env, default_value = "false", action = clap::ArgAction::Set)]
265+
pub force_presign_order_filtering: bool,
266+
263267
/// Enables the usage of leader lock in the database
264268
/// The second instance of autopilot will act as a follower
265269
/// and not cut any auctions.
@@ -397,6 +401,7 @@ impl std::fmt::Display for Arguments {
397401
db_based_solver_participation_guard,
398402
disable_order_filtering,
399403
enable_leader_lock,
404+
force_presign_order_filtering,
400405
} = self;
401406

402407
write!(f, "{shared}")?;
@@ -472,6 +477,10 @@ impl std::fmt::Display for Arguments {
472477
"db_based_solver_participation_guard: {db_based_solver_participation_guard:?}"
473478
)?;
474479
writeln!(f, "disable_order_filtering: {disable_order_filtering}")?;
480+
writeln!(
481+
f,
482+
"force_presign_order_filtering: {force_presign_order_filtering}"
483+
)?;
475484
writeln!(f, "enable_leader_lock: {enable_leader_lock}")?;
476485
Ok(())
477486
}

crates/autopilot/src/run.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,7 @@ pub async fn run(args: Arguments, shutdown_controller: ShutdownController) {
543543
args.run_loop_native_price_timeout,
544544
eth.contracts().settlement().address().into_legacy(),
545545
args.disable_order_filtering,
546+
args.force_presign_order_filtering,
546547
);
547548

548549
let liveness = Arc::new(Liveness::new(args.max_auction_age));

crates/autopilot/src/solvable_orders.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ pub struct SolvableOrdersCache {
102102
native_price_timeout: Duration,
103103
settlement_contract: H160,
104104
disable_order_filters: bool,
105+
force_presign_order_filtering: bool,
105106
}
106107

107108
type Balances = HashMap<Query, U256>;
@@ -128,6 +129,7 @@ impl SolvableOrdersCache {
128129
native_price_timeout: Duration,
129130
settlement_contract: H160,
130131
disable_order_filters: bool,
132+
force_presign_order_filtering: bool,
131133
) -> Arc<Self> {
132134
Arc::new(Self {
133135
min_order_validity_period,
@@ -146,6 +148,7 @@ impl SolvableOrdersCache {
146148
native_price_timeout,
147149
settlement_contract,
148150
disable_order_filters,
151+
force_presign_order_filtering,
149152
})
150153
}
151154

@@ -390,7 +393,7 @@ impl SolvableOrdersCache {
390393
invalid_order_uids: &mut HashSet<OrderUid>,
391394
) -> Vec<Order> {
392395
let filter_invalid_signatures = async {
393-
if self.disable_order_filters {
396+
if self.disable_order_filters && !self.force_presign_order_filtering {
394397
return Default::default();
395398
}
396399
find_invalid_signature_orders(&orders, self.signature_validator.as_ref()).await

0 commit comments

Comments
 (0)