Skip to content

Commit 86d61d6

Browse files
authored
chore: merge upstream gas escalator and run test (#14)
Fixes some issues @tkporter brought up in hyperlane-xyz/hyperlane-monorepo#3852 (review): 1. Holding mutex lock across gas escalations (fixed upstream, I just merged the changes) 2. Silently ignoring nonce related errors: added a `warn` log. These error are only expected to occur if the original tx landed onchain though 3. I ran the unit test that comes with this middleware, and similar to what Trevor pointed out, sending a tx returns a `PendingTransaction` whose tx hash will not reflect the hash of the tx that lands onchain. However I manually checked by polling anvil and emitting logs that the gas is escalated and the final tx is finalized
1 parent 950dd34 commit 86d61d6

File tree

7 files changed

+313
-195
lines changed

7 files changed

+313
-195
lines changed

Cargo.lock

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ethers-middleware/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ serde = { version = "1.0.124", default-features = false, features = ["derive"] }
2727
thiserror = { version = "1.0", default-features = false }
2828
futures-util = { version = "^0.3" }
2929
futures-locks = { version = "0.7", default-features = false }
30+
futures-channel.workspace = "0.3.28"
3031
tracing = { version = "0.1.37", default-features = false }
3132
tracing-futures = { version = "0.2.5", default-features = false }
3233

ethers-middleware/src/gas_escalator/linear.rs

-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ impl LinearGasPrice {
3333
impl GasEscalator for LinearGasPrice {
3434
fn get_gas_price(&self, initial_price: U256, time_elapsed: u64) -> U256 {
3535
let mut result = initial_price + self.increase_by * (time_elapsed / self.every_secs);
36-
dbg!(time_elapsed, self.every_secs);
3736
if let Some(max_price) = self.max_price {
3837
result = std::cmp::min(result, max_price);
3938
}

0 commit comments

Comments
 (0)