Skip to content

Commit 1126b39

Browse files
committed
cleanup
1 parent b6dc863 commit 1126b39

File tree

4 files changed

+3
-34
lines changed

4 files changed

+3
-34
lines changed

apps/fortuna/src/eth_utils/utils.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@ use {
33
crate::eth_utils::nonce_manager::NonceManaged,
44
anyhow::{anyhow, Result},
55
backoff::ExponentialBackoff,
6-
ethers::{
7-
contract::ContractCall,
8-
middleware::Middleware,
9-
types::TransactionReceipt,
10-
},
6+
ethers::{contract::ContractCall, middleware::Middleware, types::TransactionReceipt},
117
std::sync::{atomic::AtomicU64, Arc},
128
tokio::time::{timeout, Duration},
139
tracing,
@@ -149,12 +145,7 @@ pub async fn submit_tx_with_backoff<T: Middleware + NonceManaged + 'static>(
149145
let num_retries = num_retries.load(std::sync::atomic::Ordering::Relaxed);
150146

151147
let fee_multiplier_pct = escalation_policy.get_fee_multiplier_pct(num_retries);
152-
submit_tx(
153-
middleware.clone(),
154-
&call,
155-
fee_multiplier_pct,
156-
)
157-
.await
148+
submit_tx(middleware.clone(), &call, fee_multiplier_pct).await
158149
},
159150
|e, dur| {
160151
let retry_number = num_retries.load(std::sync::atomic::Ordering::Relaxed);
@@ -190,7 +181,6 @@ pub async fn submit_tx<T: Middleware + NonceManaged + 'static>(
190181
// A value of 100 submits the tx with the same fee as the estimate.
191182
fee_estimate_multiplier_pct: u64,
192183
) -> Result<TransactionReceipt, backoff::Error<anyhow::Error>> {
193-
194184
let mut transaction = call.tx.clone();
195185

196186
// manually fill the tx with the gas info, so we can log the details in case of error

apps/fortuna/src/keeper.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,13 @@ pub async fn run_keeper_threads(
7979
let fulfilled_requests_cache = Arc::new(RwLock::new(HashSet::<u64>::new()));
8080

8181
// Spawn a thread to handle the events from last backlog_range blocks.
82-
let gas_limit: U256 = chain_eth_config.gas_limit.into();
8382
spawn(
8483
process_backlog(
8584
BlockRange {
8685
from: latest_safe_block.saturating_sub(chain_eth_config.backlog_range),
8786
to: latest_safe_block,
8887
},
8988
contract.clone(),
90-
gas_limit,
9189
chain_eth_config.escalation_policy.to_policy(),
9290
chain_state.clone(),
9391
metrics.clone(),
@@ -107,7 +105,6 @@ pub async fn run_keeper_threads(
107105
chain_state.clone(),
108106
rx,
109107
Arc::clone(&contract),
110-
gas_limit,
111108
chain_eth_config.escalation_policy.to_policy(),
112109
metrics.clone(),
113110
fulfilled_requests_cache.clone(),

apps/fortuna/src/keeper/block.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ use {
77
keeper::process_event::process_event_with_backoff,
88
},
99
anyhow::Result,
10-
ethers::types::U256,
1110
std::{collections::HashSet, sync::Arc},
1211
tokio::{
1312
spawn,
@@ -62,7 +61,6 @@ pub async fn get_latest_safe_block(chain_state: &BlockchainState) -> BlockNumber
6261
pub async fn process_block_range(
6362
block_range: BlockRange,
6463
contract: Arc<InstrumentedSignablePythContract>,
65-
gas_limit: U256,
6664
escalation_policy: EscalationPolicy,
6765
chain_state: api::BlockchainState,
6866
metrics: Arc<KeeperMetrics>,
@@ -86,7 +84,6 @@ pub async fn process_block_range(
8684
to: to_block,
8785
},
8886
contract.clone(),
89-
gas_limit,
9087
escalation_policy.clone(),
9188
chain_state.clone(),
9289
metrics.clone(),
@@ -109,7 +106,6 @@ pub async fn process_block_range(
109106
pub async fn process_single_block_batch(
110107
block_range: BlockRange,
111108
contract: Arc<InstrumentedSignablePythContract>,
112-
gas_limit: U256,
113109
escalation_policy: EscalationPolicy,
114110
chain_state: api::BlockchainState,
115111
metrics: Arc<KeeperMetrics>,
@@ -140,7 +136,6 @@ pub async fn process_single_block_batch(
140136
event.clone(),
141137
chain_state.clone(),
142138
contract.clone(),
143-
gas_limit,
144139
escalation_policy.clone(),
145140
metrics.clone(),
146141
)
@@ -251,7 +246,6 @@ pub async fn process_new_blocks(
251246
chain_state: BlockchainState,
252247
mut rx: mpsc::Receiver<BlockRange>,
253248
contract: Arc<InstrumentedSignablePythContract>,
254-
gas_limit: U256,
255249
escalation_policy: EscalationPolicy,
256250
metrics: Arc<KeeperMetrics>,
257251
fulfilled_requests_cache: Arc<RwLock<HashSet<u64>>>,
@@ -264,7 +258,6 @@ pub async fn process_new_blocks(
264258
process_block_range(
265259
block_range.clone(),
266260
Arc::clone(&contract),
267-
gas_limit,
268261
escalation_policy.clone(),
269262
chain_state.clone(),
270263
metrics.clone(),
@@ -282,7 +275,6 @@ pub async fn process_new_blocks(
282275
process_block_range(
283276
adjusted_range,
284277
Arc::clone(&contract),
285-
gas_limit,
286278
escalation_policy.clone(),
287279
chain_state.clone(),
288280
metrics.clone(),
@@ -302,7 +294,6 @@ pub async fn process_new_blocks(
302294
pub async fn process_backlog(
303295
backlog_range: BlockRange,
304296
contract: Arc<InstrumentedSignablePythContract>,
305-
gas_limit: U256,
306297
escalation_policy: EscalationPolicy,
307298
chain_state: BlockchainState,
308299
metrics: Arc<KeeperMetrics>,
@@ -314,7 +305,6 @@ pub async fn process_backlog(
314305
process_block_range(
315306
backlog_range.clone(),
316307
Arc::clone(&contract),
317-
gas_limit,
318308
escalation_policy.clone(),
319309
chain_state.clone(),
320310
metrics.clone(),
@@ -332,7 +322,6 @@ pub async fn process_backlog(
332322
process_block_range(
333323
adjusted_range,
334324
Arc::clone(&contract),
335-
gas_limit,
336325
escalation_policy.clone(),
337326
chain_state.clone(),
338327
metrics.clone(),

apps/fortuna/src/keeper/process_event.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use {
66
eth_utils::utils::{submit_tx_with_backoff, EscalationPolicy},
77
},
88
anyhow::{anyhow, Result},
9-
ethers::types::U256,
109
std::sync::Arc,
1110
tracing,
1211
};
@@ -19,7 +18,6 @@ pub async fn process_event_with_backoff(
1918
event: RequestedWithCallbackEvent,
2019
chain_state: BlockchainState,
2120
contract: Arc<InstrumentedSignablePythContract>,
22-
_gas_limit: U256,
2321
escalation_policy: EscalationPolicy,
2422
metrics: Arc<KeeperMetrics>,
2523
) -> Result<()> {
@@ -48,12 +46,7 @@ pub async fn process_event_with_backoff(
4846
provider_revelation,
4947
);
5048

51-
let success = submit_tx_with_backoff(
52-
contract.client(),
53-
contract_call,
54-
escalation_policy,
55-
)
56-
.await;
49+
let success = submit_tx_with_backoff(contract.client(), contract_call, escalation_policy).await;
5750

5851
metrics
5952
.requests_processed

0 commit comments

Comments
 (0)