Skip to content

Commit f54b162

Browse files
committed
cleanup another thing
1 parent 1126b39 commit f54b162

File tree

2 files changed

+3
-13
lines changed

2 files changed

+3
-13
lines changed

apps/fortuna/src/keeper.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,6 @@ pub async fn run_keeper_threads(
132132
chain_state.provider_address,
133133
ADJUST_FEE_INTERVAL,
134134
chain_eth_config.legacy_tx,
135-
// NOTE: we are adjusting the fees based on the maximum configured gas for user transactions.
136-
// However, the keeper will pad the gas limit for transactions (per the escalation policy) to ensure reliable submission.
137-
// Consequently, fees can be adjusted such that transactions are still unprofitable.
138-
// While we could scale up this value based on the padding, that ends up overcharging users as most transactions cost nowhere
139-
// near the maximum gas limit.
140-
// In the unlikely event that the keeper fees aren't sufficient, the solution to this is to configure the target
141-
// fee percentage to be higher on that specific chain.
142-
chain_eth_config.gas_limit.into(),
143135
// NOTE: unwrap() here so we panic early if someone configures these values below -100.
144136
u64::try_from(100 + chain_eth_config.min_profit_pct)
145137
.expect("min_profit_pct must be >= -100"),

apps/fortuna/src/keeper/fee.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ pub async fn adjust_fee_wrapper(
7979
provider_address: Address,
8080
poll_interval: Duration,
8181
legacy_tx: bool,
82-
gas_limit: u64,
8382
min_profit_pct: u64,
8483
target_profit_pct: u64,
8584
max_profit_pct: u64,
@@ -96,7 +95,6 @@ pub async fn adjust_fee_wrapper(
9695
chain_state.id.clone(),
9796
provider_address,
9897
legacy_tx,
99-
gas_limit,
10098
min_profit_pct,
10199
target_profit_pct,
102100
max_profit_pct,
@@ -133,7 +131,6 @@ pub async fn adjust_fee_if_necessary(
133131
chain_id: ChainId,
134132
provider_address: Address,
135133
legacy_tx: bool,
136-
gas_limit: u64,
137134
min_profit_pct: u64,
138135
target_profit_pct: u64,
139136
max_profit_pct: u64,
@@ -154,7 +151,8 @@ pub async fn adjust_fee_if_necessary(
154151

155152
// Calculate target window for the on-chain fee.
156153
let middleware = contract.client();
157-
let max_callback_cost: u128 = estimate_tx_cost(middleware, legacy_tx, gas_limit.into())
154+
let gas_limit: u128 = u128::from(provider_info.default_gas_limit);
155+
let max_callback_cost: u128 = estimate_tx_cost(middleware, legacy_tx, gas_limit)
158156
.await
159157
.map_err(|e| anyhow!("Could not estimate transaction cost. error {:?}", e))?;
160158

@@ -166,7 +164,7 @@ pub async fn adjust_fee_if_necessary(
166164
metrics
167165
.gas_price_estimate
168166
.get_or_create(&account_label)
169-
.set((max_callback_cost / u128::from(gas_limit)) as f64 / 1e9);
167+
.set((max_callback_cost / gas_limit) as f64 / 1e9);
170168

171169
let target_fee_min = std::cmp::max(
172170
(max_callback_cost * u128::from(min_profit_pct)) / 100,

0 commit comments

Comments
 (0)