Skip to content

Commit

Permalink
chore: multiply gas price for treasuretopaz too (#4999)
Browse files Browse the repository at this point in the history
### Description

<!--
What's included in this PR?
-->

### Drive-by changes

<!--
Are there any minor or drive-by changes also included?
-->

### Related issues

<!--
- Fixes #[issue number here]
-->

### Backward compatibility

<!--
Are these changes backward compatible? Are there any infrastructure
implications, e.g. changes that would prohibit deploying older commits
using this infra tooling?

Yes/No
-->

### Testing

<!--
What kind of testing have these changes undergone?

None/Manual/Unit Tests
-->
  • Loading branch information
daniel-savu authored Dec 13, 2024
1 parent ea75978 commit e6fdcc4
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions rust/main/chains/hyperlane-ethereum/src/tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,19 +235,23 @@ where
eip1559_default_estimator(base_fee_per_gas, fee_history.reward)
};

let mut gas_price_multiplier: u32 = 1;
// `treasure` chain gas estimation underestimates the actual gas price, so we add a multiplier to it
if domain.id() == 61166 {
gas_price_multiplier = 2;
}

let gas_price_multiplier = chain_specific_gas_price_multiplier(domain);
Ok((
base_fee_per_gas.mul(gas_price_multiplier),
max_fee_per_gas.mul(gas_price_multiplier),
max_priority_fee_per_gas.mul(gas_price_multiplier),
))
}

fn chain_specific_gas_price_multiplier(domain: &HyperlaneDomain) -> u32 {
match domain.id() {
// treasure (mainnet) and treasuretopaz (testnet) have a gas price multiplier of 2,
// as the gas estimation underestimates the actual gas price.
61166 | 978658 => 2,
_ => 1,
}
}

pub(crate) async fn call_with_reorg_period<M, T>(
call: ethers::contract::builders::ContractCall<M, T>,
provider: &M,
Expand Down

0 comments on commit e6fdcc4

Please sign in to comment.