From dc8a4b4ddfaebf19ae942c3eaccf3ba4db3a8721 Mon Sep 17 00:00:00 2001 From: Trevor Porter Date: Wed, 29 Nov 2023 11:52:26 +0000 Subject: [PATCH] Use Polygon gas oracle (#2965) After investigating #2959, I found the following this is a known problem with Polygon, explanation here https://github.com/ethers-io/ethers.js/issues/2828#issuecomment-1283014250 Fun fact Asa looked into this once https://github.com/hyperlane-xyz/hyperlane-monorepo/issues/771 Here's a discussion it in Foundry, which I found hoping that ethers-rs folks had ran into this before https://github.com/foundry-rs/foundry/issues/1703 Foundry fixed this by using the Polygon gas station oracle which seems to be recommended path https://github.com/foundry-rs/foundry/pull/3368/files#diff-c89a4bbf7a90da118dcf00c5fe70eba78f8e5d95662bb5f039a353113e95042bR205 There's actually a polygon ethers middleware for this https://docs.rs/ethers/latest/ethers/middleware/gas_oracle/polygon/struct.Polygon.html So I (originally) borrowed this code from Foundry https://github.com/foundry-rs/foundry/blob/master/crates/common/src/provider.rs#L254-L290 Changed to use Middlewares This also means we can remove our existing janky Polygon logic --- rust/Cargo.lock | 20 ++++++++++---------- rust/Cargo.toml | 10 +++++----- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/rust/Cargo.lock b/rust/Cargo.lock index 2aed8d25d9..11de457001 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -2285,7 +2285,7 @@ dependencies = [ [[package]] name = "ethers" version = "1.0.2" -source = "git+https://github.com/hyperlane-xyz/ethers-rs?tag=2023-06-01#6c26645cc1707a3d9c987a603a513fb38a5edb3f" +source = "git+https://github.com/hyperlane-xyz/ethers-rs?tag=2023-11-29-01#882ea601bc8b037587642f8738fca684bdc6d69a" dependencies = [ "ethers-addressbook", "ethers-contract", @@ -2299,7 +2299,7 @@ dependencies = [ [[package]] name = "ethers-addressbook" version = "1.0.2" -source = "git+https://github.com/hyperlane-xyz/ethers-rs?tag=2023-06-01#6c26645cc1707a3d9c987a603a513fb38a5edb3f" +source = "git+https://github.com/hyperlane-xyz/ethers-rs?tag=2023-11-29-01#882ea601bc8b037587642f8738fca684bdc6d69a" dependencies = [ "ethers-core", "once_cell", @@ -2310,7 +2310,7 @@ dependencies = [ [[package]] name = "ethers-contract" version = "1.0.2" -source = "git+https://github.com/hyperlane-xyz/ethers-rs?tag=2023-06-01#6c26645cc1707a3d9c987a603a513fb38a5edb3f" +source = "git+https://github.com/hyperlane-xyz/ethers-rs?tag=2023-11-29-01#882ea601bc8b037587642f8738fca684bdc6d69a" dependencies = [ "ethers-contract-abigen", "ethers-contract-derive", @@ -2328,7 +2328,7 @@ dependencies = [ [[package]] name = "ethers-contract-abigen" version = "1.0.2" -source = "git+https://github.com/hyperlane-xyz/ethers-rs?tag=2023-06-01#6c26645cc1707a3d9c987a603a513fb38a5edb3f" +source = "git+https://github.com/hyperlane-xyz/ethers-rs?tag=2023-11-29-01#882ea601bc8b037587642f8738fca684bdc6d69a" dependencies = [ "Inflector", "cfg-if", @@ -2352,7 +2352,7 @@ dependencies = [ [[package]] name = "ethers-contract-derive" version = "1.0.2" -source = "git+https://github.com/hyperlane-xyz/ethers-rs?tag=2023-06-01#6c26645cc1707a3d9c987a603a513fb38a5edb3f" +source = "git+https://github.com/hyperlane-xyz/ethers-rs?tag=2023-11-29-01#882ea601bc8b037587642f8738fca684bdc6d69a" dependencies = [ "ethers-contract-abigen", "ethers-core", @@ -2366,7 +2366,7 @@ dependencies = [ [[package]] name = "ethers-core" version = "1.0.2" -source = "git+https://github.com/hyperlane-xyz/ethers-rs?tag=2023-06-01#6c26645cc1707a3d9c987a603a513fb38a5edb3f" +source = "git+https://github.com/hyperlane-xyz/ethers-rs?tag=2023-11-29-01#882ea601bc8b037587642f8738fca684bdc6d69a" dependencies = [ "arrayvec", "bytes", @@ -2396,7 +2396,7 @@ dependencies = [ [[package]] name = "ethers-etherscan" version = "1.0.2" -source = "git+https://github.com/hyperlane-xyz/ethers-rs?tag=2023-06-01#6c26645cc1707a3d9c987a603a513fb38a5edb3f" +source = "git+https://github.com/hyperlane-xyz/ethers-rs?tag=2023-11-29-01#882ea601bc8b037587642f8738fca684bdc6d69a" dependencies = [ "ethers-core", "getrandom 0.2.10", @@ -2412,7 +2412,7 @@ dependencies = [ [[package]] name = "ethers-middleware" version = "1.0.2" -source = "git+https://github.com/hyperlane-xyz/ethers-rs?tag=2023-06-01#6c26645cc1707a3d9c987a603a513fb38a5edb3f" +source = "git+https://github.com/hyperlane-xyz/ethers-rs?tag=2023-11-29-01#882ea601bc8b037587642f8738fca684bdc6d69a" dependencies = [ "async-trait", "auto_impl 0.5.0", @@ -2458,7 +2458,7 @@ dependencies = [ [[package]] name = "ethers-providers" version = "1.0.2" -source = "git+https://github.com/hyperlane-xyz/ethers-rs?tag=2023-06-01#6c26645cc1707a3d9c987a603a513fb38a5edb3f" +source = "git+https://github.com/hyperlane-xyz/ethers-rs?tag=2023-11-29-01#882ea601bc8b037587642f8738fca684bdc6d69a" dependencies = [ "async-trait", "auto_impl 1.1.0", @@ -2494,7 +2494,7 @@ dependencies = [ [[package]] name = "ethers-signers" version = "1.0.2" -source = "git+https://github.com/hyperlane-xyz/ethers-rs?tag=2023-06-01#6c26645cc1707a3d9c987a603a513fb38a5edb3f" +source = "git+https://github.com/hyperlane-xyz/ethers-rs?tag=2023-11-29-01#882ea601bc8b037587642f8738fca684bdc6d69a" dependencies = [ "async-trait", "coins-bip32", diff --git a/rust/Cargo.toml b/rust/Cargo.toml index b1400bbf87..d2488f7d69 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -148,28 +148,28 @@ which = "4.3" [workspace.dependencies.ethers] git = "https://github.com/hyperlane-xyz/ethers-rs" -tag = "2023-06-01" features = [] +tag = "2023-11-29-01" [workspace.dependencies.ethers-contract] git = "https://github.com/hyperlane-xyz/ethers-rs" -tag = "2023-06-01" features = ["legacy"] +tag = "2023-11-29-01" [workspace.dependencies.ethers-core] git = "https://github.com/hyperlane-xyz/ethers-rs" -tag = "2023-06-01" features = [] +tag = "2023-11-29-01" [workspace.dependencies.ethers-providers] git = "https://github.com/hyperlane-xyz/ethers-rs" -tag = "2023-06-01" features = [] +tag = "2023-11-29-01" [workspace.dependencies.ethers-signers] git = "https://github.com/hyperlane-xyz/ethers-rs" -tag = "2023-06-01" features = ["aws"] +tag = "2023-11-29-01" [patch.crates-io.curve25519-dalek] version = "3.2.2"