88 reader:: { BlockNumber , RequestedWithCallbackEvent } ,
99 traced_client:: { RpcMetrics , TracedClient } ,
1010 } ,
11- config:: EthereumConfig ,
1211 config:: EscalationPolicyConfig ,
12+ config:: EthereumConfig ,
1313 } ,
1414 anyhow:: { anyhow, Result } ,
1515 backoff:: ExponentialBackoff ,
@@ -56,8 +56,6 @@ const UPDATE_COMMITMENTS_INTERVAL: Duration = Duration::from_secs(30);
5656const UPDATE_COMMITMENTS_THRESHOLD_FACTOR : f64 = 0.95 ;
5757/// Rety last N blocks
5858const RETRY_PREVIOUS_BLOCKS : u64 = 100 ;
59- /// By default, we scale the gas estimate by 25% when submitting the tx.
60- const DEFAULT_GAS_ESTIMATE_MULTIPLIER_PCT : u64 = 125 ;
6159
6260#[ derive( Clone , Debug , Hash , PartialEq , Eq , EncodeLabelSet ) ]
6361pub struct AccountLabel {
@@ -273,7 +271,7 @@ pub async fn run_keeper_threads(
273271 } ,
274272 contract. clone ( ) ,
275273 gas_limit,
276- chain_eth_config. escalation_policy ,
274+ chain_eth_config. escalation_policy . clone ( ) ,
277275 chain_state. clone ( ) ,
278276 metrics. clone ( ) ,
279277 fulfilled_requests_cache. clone ( ) ,
@@ -299,7 +297,7 @@ pub async fn run_keeper_threads(
299297 rx,
300298 Arc :: clone ( & contract) ,
301299 gas_limit,
302- chain_eth_config. escalation_policy ,
300+ chain_eth_config. escalation_policy . clone ( ) ,
303301 metrics. clone ( ) ,
304302 fulfilled_requests_cache. clone ( ) ,
305303 )
@@ -328,8 +326,8 @@ pub async fn run_keeper_threads(
328326 // However, the keeper will pad the gas limit for transactions (per the escalation policy) to ensure reliable submission.
329327 // Consequently, fees can be adjusted such that transactions are still unprofitable.
330328 // While we could scale up this value based on the padding, that ends up overcharging users as most transactions cost nowhere
331- // near the maximum gas limit.
332- // In the unlikely event that the keeper fees aren't sufficient, the solution to this is to configure the target
329+ // near the maximum gas limit.
330+ // In the unlikely event that the keeper fees aren't sufficient, the solution to this is to configure the target
333331 // fee percentage to be higher on that specific chain.
334332 chain_eth_config. gas_limit ,
335333 chain_eth_config. min_profit_pct ,
@@ -549,7 +547,6 @@ pub async fn process_event(
549547 // the padded gas estimate doesn't exceed the maximum amount of gas we are willing to use.
550548 let gas_estimate = gas_estimate. saturating_mul ( gas_estimate_multiplier_pct. into ( ) ) / 100 ;
551549
552-
553550 let contract_call = contract
554551 . reveal_with_callback (
555552 event. provider_address ,
@@ -572,7 +569,13 @@ pub async fn process_event(
572569
573570 // Apply the fee escalation policy. Note: the unwrap_or_default should never default as we have a gas oracle
574571 // in the client that sets the gas price.
575- transaction. set_gas_price ( transaction. gas_price ( ) . unwrap_or_default ( ) . saturating_mul ( fee_estimate_multiplier_pct. into ( ) ) / 100 ) ;
572+ transaction. set_gas_price (
573+ transaction
574+ . gas_price ( )
575+ . unwrap_or_default ( )
576+ . saturating_mul ( fee_estimate_multiplier_pct. into ( ) )
577+ / 100 ,
578+ ) ;
576579
577580 let pending_tx = client
578581 . send_transaction ( transaction. clone ( ) , None )
@@ -668,7 +671,7 @@ pub async fn process_block_range(
668671 block_range : BlockRange ,
669672 contract : Arc < InstrumentedSignablePythContract > ,
670673 gas_limit : U256 ,
671- backoff_gas_multiplier_pct : u64 ,
674+ escalation_policy : EscalationPolicyConfig ,
672675 chain_state : api:: BlockchainState ,
673676 metrics : Arc < KeeperMetrics > ,
674677 fulfilled_requests_cache : Arc < RwLock < HashSet < u64 > > > ,
@@ -692,7 +695,7 @@ pub async fn process_block_range(
692695 } ,
693696 contract. clone ( ) ,
694697 gas_limit,
695- backoff_gas_multiplier_pct ,
698+ escalation_policy . clone ( ) ,
696699 chain_state. clone ( ) ,
697700 metrics. clone ( ) ,
698701 fulfilled_requests_cache. clone ( ) ,
@@ -715,7 +718,7 @@ pub async fn process_single_block_batch(
715718 block_range : BlockRange ,
716719 contract : Arc < InstrumentedSignablePythContract > ,
717720 gas_limit : U256 ,
718- backoff_gas_multiplier_pct : u64 ,
721+ escalation_policy : EscalationPolicyConfig ,
719722 chain_state : api:: BlockchainState ,
720723 metrics : Arc < KeeperMetrics > ,
721724 fulfilled_requests_cache : Arc < RwLock < HashSet < u64 > > > ,
@@ -742,7 +745,7 @@ pub async fn process_single_block_batch(
742745 chain_state. clone ( ) ,
743746 contract. clone ( ) ,
744747 gas_limit,
745- backoff_gas_multiplier_pct ,
748+ escalation_policy . clone ( ) ,
746749 metrics. clone ( ) ,
747750 )
748751 . in_current_span ( ) ,
@@ -900,7 +903,7 @@ pub async fn process_new_blocks(
900903 block_range,
901904 Arc :: clone ( & contract) ,
902905 gas_limit,
903- escalation_policy,
906+ escalation_policy. clone ( ) ,
904907 chain_state. clone ( ) ,
905908 metrics. clone ( ) ,
906909 fulfilled_requests_cache. clone ( ) ,
0 commit comments