Skip to content

Commit 95b5017

Browse files
authored
Remove unused config options / features (#4156)
# Description This started out as an investigation into speeding up deny-listed token filtering in the auction building process but I realized that there is still some unfinished work of migrating away from the tracing based bad token detection. We already moved away from that bad token detection mechanism a while ago but I didn't fully delete all the related code yet in case the new mechanism doesn't work well enough. Since then we've been running the services without the feature for many months so it's time to remove that stuff now. We are deleting so much here because only the tracing detector was using all the logic to find owners of certain tokens onchain so that also went with it. Once that was done I also went ahead and tried to find any other args that are unused. # Changes - remove `tracing_url` parameter which made the tracing bad token detector unused - removed tracing detector which made token owner finding stuff unused - removed token owner finding stuff which made liquidity source configs unused - removed any other args that weren't used ## How to test compiler
1 parent d2d7e4f commit 95b5017

17 files changed

Lines changed: 8 additions & 2319 deletions

File tree

crates/autopilot/src/arguments.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use {
66
clap::ValueEnum,
77
shared::{
88
arguments::{FeeFactor, display_list, display_option, display_secret_option},
9-
bad_token::token_owner_finder,
109
http_client,
1110
price_estimation::{self, NativePriceEstimators},
1211
},
@@ -31,9 +30,6 @@ pub struct Arguments {
3130
#[clap(flatten)]
3231
pub http_client: http_client::Arguments,
3332

34-
#[clap(flatten)]
35-
pub token_owner_finder: token_owner_finder::Arguments,
36-
3733
#[clap(flatten)]
3834
pub price_estimation: price_estimation::Arguments,
3935

@@ -54,11 +50,6 @@ pub struct Arguments {
5450
#[clap(long, env)]
5551
pub ethflow_indexing_start: Option<u64>,
5652

57-
/// A tracing Ethereum node URL to connect to, allowing a separate node URL
58-
/// to be used exclusively for tracing calls.
59-
#[clap(long, env)]
60-
pub tracing_node_url: Option<Url>,
61-
6253
#[clap(long, env, default_value = "0.0.0.0:9589")]
6354
pub metrics_address: SocketAddr,
6455

@@ -293,10 +284,8 @@ impl std::fmt::Display for Arguments {
293284
shared,
294285
order_quoting,
295286
http_client,
296-
token_owner_finder,
297287
price_estimation,
298288
database_pool,
299-
tracing_node_url,
300289
ethflow_contracts,
301290
ethflow_indexing_start,
302291
metrics_address,
@@ -341,10 +330,8 @@ impl std::fmt::Display for Arguments {
341330
write!(f, "{shared}")?;
342331
write!(f, "{order_quoting}")?;
343332
write!(f, "{http_client}")?;
344-
write!(f, "{token_owner_finder}")?;
345333
write!(f, "{price_estimation}")?;
346334
write!(f, "{database_pool}")?;
347-
display_option(f, "tracing_node_url", tracing_node_url)?;
348335
writeln!(f, "ethflow_contracts: {ethflow_contracts:?}")?;
349336
writeln!(f, "ethflow_indexing_start: {ethflow_indexing_start:?}")?;
350337
writeln!(f, "metrics_address: {metrics_address}")?;

crates/autopilot/src/run.rs

Lines changed: 2 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,17 @@ use {
2727
alloy::{eips::BlockNumberOrTag, primitives::Address, providers::Provider},
2828
chain::Chain,
2929
clap::Parser,
30-
contracts::alloy::{BalancerV2Vault, GPv2Settlement, IUniswapV3Factory, WETH9},
30+
contracts::alloy::{BalancerV2Vault, GPv2Settlement, WETH9},
3131
ethrpc::{Web3, block_stream::block_number_to_block_number_hash},
32-
futures::StreamExt,
3332
model::DomainSeparator,
3433
num::ToPrimitive,
3534
observe::metrics::LivenessChecking,
3635
shared::{
3736
account_balances::{self, BalanceSimulator},
3837
arguments::tracing_config,
3938
bad_token::{
40-
cache::CachingDetector,
4139
instrumented::InstrumentedBadTokenDetectorExt,
4240
list_based::{ListBasedDetector, UnknownTokenStrategy},
43-
token_owner_finder,
44-
trace_call::TraceCallDetector,
4541
},
4642
baseline_solver::BaseTokens,
4743
code_fetching::CachedCodeFetcher,
@@ -51,7 +47,6 @@ use {
5147
factory::{self, PriceEstimatorFactory},
5248
native::NativePriceEstimating,
5349
},
54-
sources::{BaselineSource, uniswap_v2::UniV2BaselineSourceParameters},
5550
token_info::{CachedTokenInfoFetcher, TokenInfoFetcher},
5651
token_list::{AutoUpdatingTokenList, TokenListConfiguration},
5752
},
@@ -240,14 +235,6 @@ pub async fn run(args: Arguments, shutdown_controller: ShutdownController) {
240235
}
241236
addr
242237
});
243-
let vault =
244-
vault_address.map(|address| BalancerV2Vault::Instance::new(address, web3.provider.clone()));
245-
246-
let uniswapv3_factory = IUniswapV3Factory::Instance::deployed(&web3.provider)
247-
.instrument(info_span!("uniswapv3_deployed"))
248-
.await
249-
.inspect_err(|err| tracing::warn!(%err, "error while fetching IUniswapV3Factory instance"))
250-
.ok();
251238

252239
let chain = Chain::try_from(chain_id).expect("incorrect chain ID");
253240

@@ -275,27 +262,6 @@ pub async fn run(args: Arguments, shutdown_controller: ShutdownController) {
275262
.expect("failed to create gas price estimator"),
276263
);
277264

278-
let baseline_sources = args
279-
.shared
280-
.baseline_sources
281-
.clone()
282-
.unwrap_or_else(|| shared::sources::defaults_for_network(&chain));
283-
tracing::info!(?baseline_sources, "using baseline sources");
284-
let univ2_sources = baseline_sources
285-
.iter()
286-
.filter_map(|source: &BaselineSource| {
287-
UniV2BaselineSourceParameters::from_baseline_source(*source, &chain_id.to_string())
288-
})
289-
.chain(args.shared.custom_univ2_baseline_sources.iter().copied());
290-
let pair_providers: Vec<_> = futures::stream::iter(univ2_sources)
291-
.then(|source: UniV2BaselineSourceParameters| {
292-
let web3 = &web3;
293-
async move { source.into_source(web3).await.unwrap().pair_provider }
294-
})
295-
.collect()
296-
.instrument(info_span!("pair_providers"))
297-
.await;
298-
299265
let base_tokens = Arc::new(BaseTokens::new(
300266
*eth.contracts().weth().address(),
301267
&args.shared.base_tokens,
@@ -305,39 +271,11 @@ pub async fn run(args: Arguments, shutdown_controller: ShutdownController) {
305271
allowed_tokens.push(model::order::BUY_ETH_ADDRESS);
306272
let unsupported_tokens = args.unsupported_tokens.clone();
307273

308-
let finder = token_owner_finder::init(
309-
&args.token_owner_finder,
310-
web3.clone(),
311-
&chain,
312-
&http_factory,
313-
&pair_providers,
314-
vault.as_ref(),
315-
uniswapv3_factory.as_ref(),
316-
&base_tokens,
317-
*eth.contracts().settlement().address(),
318-
)
319-
.instrument(info_span!("token_owner_finder_init"))
320-
.await
321-
.expect("failed to initialize token owner finders");
322-
323-
let trace_call_detector = args.tracing_node_url.as_ref().map(|tracing_node_url| {
324-
CachingDetector::new(
325-
Box::new(TraceCallDetector::new(
326-
shared::ethrpc::web3(&args.shared.ethrpc, tracing_node_url, "trace"),
327-
*eth.contracts().settlement().address(),
328-
finder,
329-
)),
330-
args.shared.token_quality_cache_expiry,
331-
args.shared.token_quality_cache_prefetch_time,
332-
)
333-
});
334274
let bad_token_detector = Arc::new(
335275
ListBasedDetector::new(
336276
allowed_tokens,
337277
unsupported_tokens,
338-
trace_call_detector
339-
.map(|detector| UnknownTokenStrategy::Forward(detector))
340-
.unwrap_or(UnknownTokenStrategy::Allow),
278+
UnknownTokenStrategy::Allow,
341279
)
342280
.instrumented(),
343281
);

crates/e2e/src/setup/services.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,7 @@ impl<'a> Services<'a> {
157157

158158
fn api_autopilot_solver_arguments(&self) -> impl Iterator<Item = String> + use<> {
159159
[
160-
"--baseline-sources=None".to_string(),
161160
"--network-block-interval=1s".to_string(),
162-
"--solver-competition-auth=super_secret_key".to_string(),
163161
format!(
164162
"--settlement-contract-address={:?}",
165163
self.contracts.gp_settlement.address()

crates/orderbook/src/arguments.rs

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ use {
33
chrono::{DateTime, Utc},
44
reqwest::Url,
55
shared::{
6-
arguments::{FeeFactor, display_option, display_secret_option},
7-
bad_token::token_owner_finder,
6+
arguments::{FeeFactor, display_secret_option},
87
http_client,
98
price_estimation::{self, NativePriceEstimators},
109
},
@@ -22,20 +21,12 @@ pub struct Arguments {
2221
#[clap(flatten)]
2322
pub http_client: http_client::Arguments,
2423

25-
#[clap(flatten)]
26-
pub token_owner_finder: token_owner_finder::Arguments,
27-
2824
#[clap(flatten)]
2925
pub price_estimation: price_estimation::Arguments,
3026

3127
#[clap(flatten)]
3228
pub database_pool: shared::arguments::DatabasePoolConfig,
3329

34-
/// A tracing Ethereum node URL to connect to, allowing a separate node URL
35-
/// to be used exclusively for tracing calls.
36-
#[clap(long, env)]
37-
pub tracing_node_url: Option<Url>,
38-
3930
#[clap(long, env, default_value = "0.0.0.0:8080")]
4031
pub bind_address: SocketAddr,
4132

@@ -115,11 +106,6 @@ pub struct Arguments {
115106
#[clap(long, env, action = clap::ArgAction::Set, default_value = "false")]
116107
pub eip1271_skip_creation_validation: bool,
117108

118-
/// If solvable orders haven't been successfully updated in this many blocks
119-
/// attempting to get them errors and our liveness check fails.
120-
#[clap(long, env, default_value = "24")]
121-
pub solvable_orders_max_update_age_blocks: u64,
122-
123109
/// Max number of limit orders per user.
124110
#[clap(long, env, default_value = "10")]
125111
pub max_limit_orders_per_user: u64,
@@ -182,10 +168,8 @@ impl std::fmt::Display for Arguments {
182168
shared,
183169
order_quoting,
184170
http_client,
185-
token_owner_finder,
186171
price_estimation,
187172
database_pool,
188-
tracing_node_url,
189173
bind_address,
190174
min_order_validity_period,
191175
max_order_validity_period,
@@ -195,7 +179,6 @@ impl std::fmt::Display for Arguments {
195179
banned_users_max_cache_size,
196180
allowed_tokens,
197181
eip1271_skip_creation_validation,
198-
solvable_orders_max_update_age_blocks,
199182
native_price_estimators,
200183
fast_price_estimation_results_required,
201184
max_limit_orders_per_user,
@@ -213,10 +196,8 @@ impl std::fmt::Display for Arguments {
213196
write!(f, "{shared}")?;
214197
write!(f, "{order_quoting}")?;
215198
write!(f, "{http_client}")?;
216-
write!(f, "{token_owner_finder}")?;
217199
write!(f, "{price_estimation}")?;
218200
write!(f, "{database_pool}")?;
219-
display_option(f, "tracing_node_url", tracing_node_url)?;
220201
writeln!(f, "bind_address: {bind_address}")?;
221202
let _intentionally_ignored = db_url;
222203
writeln!(f, "db_url: SECRET")?;
@@ -244,10 +225,6 @@ impl std::fmt::Display for Arguments {
244225
f,
245226
"eip1271_skip_creation_validation: {eip1271_skip_creation_validation}"
246227
)?;
247-
writeln!(
248-
f,
249-
"solvable_orders_max_update_age_blocks: {solvable_orders_max_update_age_blocks}",
250-
)?;
251228
writeln!(f, "native_price_estimators: {native_price_estimators}")?;
252229
writeln!(
253230
f,

crates/orderbook/src/run.rs

Lines changed: 1 addition & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,9 @@ use {
1818
ChainalysisOracle,
1919
GPv2Settlement,
2020
HooksTrampoline,
21-
IUniswapV3Factory,
2221
WETH9,
2322
support::Balances,
2423
},
25-
futures::StreamExt,
2624
model::{DomainSeparator, order::BUY_ETH_ADDRESS},
2725
num::ToPrimitive,
2826
observe::metrics::{DEFAULT_METRICS_PORT, serve_metrics},
@@ -31,11 +29,8 @@ use {
3129
account_balances::{self, BalanceSimulator},
3230
arguments::tracing_config,
3331
bad_token::{
34-
cache::CachingDetector,
3532
instrumented::InstrumentedBadTokenDetectorExt,
3633
list_based::{ListBasedDetector, UnknownTokenStrategy},
37-
token_owner_finder,
38-
trace_call::TraceCallDetector,
3934
},
4035
baseline_solver::BaseTokens,
4136
code_fetching::CachedCodeFetcher,
@@ -50,7 +45,6 @@ use {
5045
native::NativePriceEstimating,
5146
},
5247
signature_validator,
53-
sources::{self, BaselineSource, uniswap_v2::UniV2BaselineSourceParameters},
5448
token_info::{CachedTokenInfoFetcher, TokenInfoFetcher},
5549
},
5650
std::{future::Future, net::SocketAddr, sync::Arc, time::Duration},
@@ -154,8 +148,6 @@ pub async fn run(args: Arguments) {
154148
}
155149
}
156150
});
157-
let vault =
158-
vault_address.map(|address| BalancerV2Vault::Instance::new(address, web3.provider.clone()));
159151

160152
let hooks_contract = match args.shared.hooks_contract_address {
161153
Some(address) => HooksTrampoline::Instance::new(address, web3.provider.clone()),
@@ -204,26 +196,6 @@ pub async fn run(args: Arguments) {
204196
.expect("failed to create gas price estimator"),
205197
));
206198

207-
let baseline_sources = args
208-
.shared
209-
.baseline_sources
210-
.clone()
211-
.unwrap_or_else(|| sources::defaults_for_network(&chain));
212-
tracing::info!(?baseline_sources, "using baseline sources");
213-
let univ2_sources = baseline_sources
214-
.iter()
215-
.filter_map(|source: &BaselineSource| {
216-
UniV2BaselineSourceParameters::from_baseline_source(*source, &chain_id.to_string())
217-
})
218-
.chain(args.shared.custom_univ2_baseline_sources.iter().copied());
219-
let pair_providers: Vec<_> = futures::stream::iter(univ2_sources)
220-
.then(|source: UniV2BaselineSourceParameters| {
221-
let web3 = &web3;
222-
async move { source.into_source(web3).await.unwrap().pair_provider }
223-
})
224-
.collect()
225-
.await;
226-
227199
let base_tokens = Arc::new(BaseTokens::new(
228200
*native_token.address(),
229201
&args.shared.base_tokens,
@@ -233,43 +205,11 @@ pub async fn run(args: Arguments) {
233205
allowed_tokens.push(BUY_ETH_ADDRESS);
234206
let unsupported_tokens = args.unsupported_tokens.clone();
235207

236-
let uniswapv3_factory = IUniswapV3Factory::Instance::deployed(&web3.provider)
237-
.await
238-
.inspect_err(|err| tracing::warn!(%err, "error while fetching IUniswapV3Factory instance"))
239-
.ok();
240-
241-
let finder = token_owner_finder::init(
242-
&args.token_owner_finder,
243-
web3.clone(),
244-
&chain,
245-
&http_factory,
246-
&pair_providers,
247-
vault.as_ref(),
248-
uniswapv3_factory.as_ref(),
249-
&base_tokens,
250-
*settlement_contract.address(),
251-
)
252-
.await
253-
.expect("failed to initialize token owner finders");
254-
255-
let trace_call_detector = args.tracing_node_url.as_ref().map(|tracing_node_url| {
256-
CachingDetector::new(
257-
Box::new(TraceCallDetector::new(
258-
shared::ethrpc::web3(&args.shared.ethrpc, tracing_node_url, "trace"),
259-
*settlement_contract.address(),
260-
finder,
261-
)),
262-
args.shared.token_quality_cache_expiry,
263-
args.shared.token_quality_cache_prefetch_time,
264-
)
265-
});
266208
let bad_token_detector = Arc::new(
267209
ListBasedDetector::new(
268210
allowed_tokens,
269211
unsupported_tokens,
270-
trace_call_detector
271-
.map(|detector| UnknownTokenStrategy::Forward(detector))
272-
.unwrap_or(UnknownTokenStrategy::Allow),
212+
UnknownTokenStrategy::Allow,
273213
)
274214
.instrumented(),
275215
);

0 commit comments

Comments
 (0)