Repository: gakonst/ethers-rs
Pull request #1989 (2022-12-30 09:42:15)

tests: use sepolia
<!--
Thank you for your Pull Request. Please provide a description above and review
the requirements below.

Bug fixes and new features should include tests.

Contributors guide: https://github.com/gakonst/ethers-rs/blob/master/CONTRIBUTING.md

The contributors guide includes instructions for running rustfmt and building the
documentation.
-->

## Motivation

goerli moment

<!--
Explain the context and why you're making that change. What is the problem
you're trying to solve? In some cases there is not a problem and this can be
thought of as being the motivation for your change.
-->

## Solution

add sepolia to test provider and use it

fauceted from  https://web.getlaika.app/faucets

<!--
Summarize the solution and provide any necessary context needed to understand
the code change.
-->

## PR Checklist

-   [ ] Added Tests
-   [ ] Added Documentation
-   [ ] Updated the changelog
-   [ ] Breaking changes



Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2a623363..c5a0d996 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -275,6 +275,7 @@
 
 - `eth-keystore-rs` crate updated. Allow an optional name for the to-be-generated
   keystore file [#910](https://github.com/gakonst/ethers-rs/pull/910)
+- [1983](https://github.com/gakonst/ethers-rs/pull/1983) Added a `from_bytes` function for the `Wallet` type.
 
 ### 0.6.0
 
diff --git a/Cargo.lock b/Cargo.lock
index bbb66218..f6f73319 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2721,9 +2721,9 @@ checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3"
 
 [[package]]
 name = "once_cell"
-version = "1.16.0"
+version = "1.17.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860"
+checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66"
 
 [[package]]
 name = "oorandom"
diff --git a/ethers-addressbook/Cargo.toml b/ethers-addressbook/Cargo.toml
index 17907527..3e491ffc 100644
--- a/ethers-addressbook/Cargo.toml
+++ b/ethers-addressbook/Cargo.toml
@@ -11,7 +11,7 @@ repository = "https://github.com/gakonst/ethers-rs"
 keywords = ["ethereum", "web3", "celo", "ethers"]
 
 [dependencies]
-once_cell = "1.16.0"
+once_cell = "1.17.0"
 serde = { version = "1.0", features = ["derive"] }
 serde_json = "1.0"
 
diff --git a/ethers-contract/Cargo.toml b/ethers-contract/Cargo.toml
index 821fe3bf..aa9cb7ca 100644
--- a/ethers-contract/Cargo.toml
+++ b/ethers-contract/Cargo.toml
@@ -20,7 +20,7 @@ ethers-derive-eip712 = { version = "^1.0.0", path = "../ethers-core/ethers-deriv
 serde = { version = "1.0.124", default-features = false }
 serde_json = { version = "1.0.64", default-features = false }
 thiserror = { version = "1.0", default-features = false }
-once_cell = { version = "1.16.0" }
+once_cell = { version = "1.17.0" }
 pin-project = { version = "1.0.11", default-features = false }
 futures-util = { version = "^0.3" }
 hex = { version = "0.4.3", default-features = false, features = ["std"] }
diff --git a/ethers-contract/ethers-contract-abigen/Cargo.toml b/ethers-contract/ethers-contract-abigen/Cargo.toml
index f69e2f69..164d8b9e 100644
--- a/ethers-contract/ethers-contract-abigen/Cargo.toml
+++ b/ethers-contract/ethers-contract-abigen/Cargo.toml
@@ -1,11 +1,12 @@
 [package]
 name = "ethers-contract-abigen"
 version = "1.0.2"
+edition = "2021"
+rust-version = "1.64"
 authors = [
     "Nicholas Rodrigues Lordello <nlordell@gmail.com>",
     "Georgios Konstantopoulos <me@gakonst.com>",
 ]
-edition = "2018"
 license = "MIT OR Apache-2.0"
 description = "Code generation for type-safe bindings to Ethereum smart contracts"
 homepage = "https://docs.rs/ethers"
diff --git a/ethers-contract/ethers-contract-derive/Cargo.toml b/ethers-contract/ethers-contract-derive/Cargo.toml
index 1c49c995..0191d2f5 100644
--- a/ethers-contract/ethers-contract-derive/Cargo.toml
+++ b/ethers-contract/ethers-contract-derive/Cargo.toml
@@ -1,11 +1,12 @@
 [package]
 name = "ethers-contract-derive"
 version = "1.0.2"
+edition = "2021"
+rust-version = "1.64"
 authors = [
     "Nicholas Rodrigues Lordello <nlordell@gmail.com>",
     "Georgios Konstantopoulos <me@gakonst.com>",
 ]
-edition = "2018"
 license = "MIT OR Apache-2.0"
 description = "Proc macro for type-safe bindings generation to Ethereum and Celo smart contracts"
 homepage = "https://docs.rs/ethers"
diff --git a/ethers-contract/src/multicall/mod.rs b/ethers-contract/src/multicall/mod.rs
index 56dca427..0b5bc56f 100644
--- a/ethers-contract/src/multicall/mod.rs
+++ b/ethers-contract/src/multicall/mod.rs
@@ -661,7 +661,7 @@ impl<M: Middleware> Multicall<M> {
     /// #
     /// # let multicall = Multicall::new(client, None).await?;
     /// // If the all Solidity function calls `returns (uint256)`:
-    /// let result: Vec<U256> = multicall.call().await?;
+    /// let result: Vec<U256> = multicall.call_array().await?;
     /// # Ok(())
     /// # }
     /// ```
diff --git a/ethers-core/Cargo.toml b/ethers-core/Cargo.toml
index fbf0e92d..8aa21a6f 100644
--- a/ethers-core/Cargo.toml
+++ b/ethers-core/Cargo.toml
@@ -1,10 +1,10 @@
 [package]
 name = "ethers-core"
-license = "MIT OR Apache-2.0"
 version = "1.0.2"
+edition = "2021"
 rust-version = "1.64"
 authors = ["Georgios Konstantopoulos <me@gakonst.com>"]
-edition = "2018"
+license = "MIT OR Apache-2.0"
 description = "Core structures for the ethers-rs crate"
 homepage = "https://docs.rs/ethers"
 repository = "https://github.com/gakonst/ethers-rs"
@@ -31,7 +31,7 @@ serde_json = { version = "1.0.64", default-features = false, features = ["arbitr
 thiserror = { version = "1.0", default-features = false }
 bytes = { version = "1.3.0", features = ["serde"] }
 hex = { version = "0.4.3", default-features = false, features = ["std"] }
-once_cell = { version = "1.16.0", optional = true }
+once_cell = { version = "1.17.0", optional = true }
 unicode-xid = "0.2.4"
 strum = { version = "0.24", features = ["derive"] }
 
@@ -48,7 +48,7 @@ num_enum = "0.5.7"
 tempfile = { version = "3.3.0", default-features = false }
 serde_json = { version = "1.0.64", default-features = false }
 bincode = { version = "1.3.3", default-features = false }
-once_cell = { version = "1.16.0" }
+once_cell = { version = "1.17.0" }
 hex-literal = "0.3.4"
 rand = "0.8.5"
 
diff --git a/ethers-core/ethers-derive-eip712/Cargo.toml b/ethers-core/ethers-derive-eip712/Cargo.toml
index 305bfcfd..61073774 100644
--- a/ethers-core/ethers-derive-eip712/Cargo.toml
+++ b/ethers-core/ethers-derive-eip712/Cargo.toml
@@ -1,7 +1,8 @@
 [package]
 name = "ethers-derive-eip712"
 version = "1.0.2"
-edition = "2018"
+edition = "2021"
+rust-version = "1.64"
 description = "Custom derive macro for EIP-712 typed data"
 license = "MIT OR Apache-2.0"
 
@@ -11,7 +12,10 @@ proc-macro = true
 [dependencies]
 quote = "1.0.9"
 syn = "1.0.77"
-ethers-core = { version = "^1.0.0", path = "../", default-features = false, features = ["eip712", "macros"] }
+ethers-core = { version = "^1.0.0", path = "../", default-features = false, features = [
+    "eip712",
+    "macros",
+] }
 hex = "0.4.3"
 serde_json = "1.0.68"
 
diff --git a/ethers-core/src/macros/ethers_crate.rs b/ethers-core/src/macros/ethers_crate.rs
index 78bc38d8..2c33eb5c 100644
--- a/ethers-core/src/macros/ethers_crate.rs
+++ b/ethers-core/src/macros/ethers_crate.rs
@@ -63,7 +63,7 @@ pub fn determine_ethers_crates() -> (&'static str, &'static str, &'static str) {
     let needs_lock_file_cleanup = !std::path::Path::new(&lock_file).exists();
 
     let res = MetadataCommand::new()
-        .manifest_path(&format!("{manifest_dir}/Cargo.toml"))
+        .manifest_path(format!("{manifest_dir}/Cargo.toml"))
         .exec()
         .ok()
         .and_then(|metadata| {
diff --git a/ethers-core/src/utils/mod.rs b/ethers-core/src/utils/mod.rs
index 5a2e1315..ff5ca22a 100644
--- a/ethers-core/src/utils/mod.rs
+++ b/ethers-core/src/utils/mod.rs
@@ -12,7 +12,7 @@ pub use geth::{Geth, GethInstance};
 
 /// Utilities for working with a `genesis.json` and other chain config structs.
 mod genesis;
-pub use genesis::{ChainConfig, Genesis};
+pub use genesis::{ChainConfig, CliqueConfig, EthashConfig, Genesis, GenesisAccount};
 
 /// Utilities for launching an anvil instance
 #[cfg(not(target_arch = "wasm32"))]
diff --git a/ethers-etherscan/Cargo.toml b/ethers-etherscan/Cargo.toml
index abea9a1e..8de6d5ac 100644
--- a/ethers-etherscan/Cargo.toml
+++ b/ethers-etherscan/Cargo.toml
@@ -1,13 +1,13 @@
 [package]
 name = "ethers-etherscan"
 version = "1.0.2"
+edition = "2021"
 rust-version = "1.64"
 authors = [
     "Matthias Seitz <matthias.seitz@outlook.de>",
     "Georgios Konstantopoulos <me@gakonst.com>",
 ]
 license = "MIT OR Apache-2.0"
-edition = "2018"
 readme = "../README.md"
 documentation = "https://docs.rs/ethers"
 repository = "https://github.com/gakonst/ethers-rs"
diff --git a/ethers-middleware/Cargo.toml b/ethers-middleware/Cargo.toml
index 2518a21d..08c79162 100644
--- a/ethers-middleware/Cargo.toml
+++ b/ethers-middleware/Cargo.toml
@@ -1,7 +1,7 @@
 [package]
 name = "ethers-middleware"
 version = "1.0.2"
-edition = "2018"
+edition = "2021"
 rust-version = "1.64"
 authors = ["Georgios Konstantopoulos <me@gakonst.com>"]
 license = "MIT OR Apache-2.0"
@@ -47,7 +47,7 @@ ethers-providers = { version = "^1.0.0", path = "../ethers-providers", default-f
     "ws",
     "rustls",
 ] }
-once_cell = "1.16.0"
+once_cell = "1.17.0"
 ethers-solc = { version = "^1.0.0", path = "../ethers-solc" }
 serial_test = "0.10.0"
 reqwest = { version = "0.11.13", default-features = false, features = ["json", "rustls"] }
diff --git a/ethers-middleware/src/gas_oracle/mod.rs b/ethers-middleware/src/gas_oracle/mod.rs
index 9be17750..40c1bf42 100644
--- a/ethers-middleware/src/gas_oracle/mod.rs
+++ b/ethers-middleware/src/gas_oracle/mod.rs
@@ -37,7 +37,7 @@ use std::{error::Error, fmt::Debug};
 use thiserror::Error;
 
 pub(crate) const GWEI_TO_WEI: u64 = 1_000_000_000;
-pub(crate) const GWEI_TO_WEI_U256: U256 = U256([0, 0, 0, GWEI_TO_WEI]);
+pub(crate) const GWEI_TO_WEI_U256: U256 = U256([GWEI_TO_WEI, 0, 0, 0]);
 
 pub type Result<T, E = GasOracleError> = std::result::Result<T, E>;
 
@@ -153,3 +153,15 @@ pub trait GasOracle: Send + Sync + Debug {
 pub(crate) fn from_gwei_f64(gwei: f64) -> U256 {
     ethers_core::types::u256_from_f64_saturating(gwei) * GWEI_TO_WEI_U256
 }
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+
+    #[test]
+    fn test_gwei_wei_constants() {
+        let as_u256: U256 = GWEI_TO_WEI.into();
+        assert_eq!(as_u256, GWEI_TO_WEI_U256);
+        assert_eq!(GWEI_TO_WEI_U256.as_u64(), GWEI_TO_WEI);
+    }
+}
diff --git a/ethers-middleware/src/gas_oracle/polygon.rs b/ethers-middleware/src/gas_oracle/polygon.rs
index 5fd63545..f7acf85a 100644
--- a/ethers-middleware/src/gas_oracle/polygon.rs
+++ b/ethers-middleware/src/gas_oracle/polygon.rs
@@ -20,7 +20,7 @@ pub struct Polygon {
 
 /// The response from the Polygon gas station API.
 ///
-/// Gas prices are in Gwei.
+/// Gas prices are in __Gwei__.
 #[derive(Debug, Deserialize, PartialEq)]
 #[serde(rename_all = "camelCase")]
 pub struct Response {
@@ -103,3 +103,14 @@ impl Polygon {
         Ok(response)
     }
 }
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+
+    #[test]
+    fn parse_polygon_gas_station_response() {
+        let s = r#"{"safeLow":{"maxPriorityFee":2.1267086610666666,"maxFee":2.1267086760666665},"standard":{"maxPriorityFee":2.3482958369333335,"maxFee":2.3482958519333335},"fast":{"maxPriorityFee":2.793454819,"maxFee":2.793454834},"estimatedBaseFee":1.5e-8,"blockTime":2,"blockNumber":30328888}"#;
+        let _resp: Response = serde_json::from_str(s).unwrap();
+    }
+}
diff --git a/ethers-providers/Cargo.toml b/ethers-providers/Cargo.toml
index d11f4f81..e3117d68 100644
--- a/ethers-providers/Cargo.toml
+++ b/ethers-providers/Cargo.toml
@@ -1,7 +1,7 @@
 [package]
 name = "ethers-providers"
 version = "1.0.2"
-edition = "2018"
+edition = "2021"
 rust-version = "1.64"
 authors = ["Georgios Konstantopoulos <me@gakonst.com>"]
 license = "MIT OR Apache-2.0"
@@ -43,7 +43,7 @@ tracing = { version = "0.1.37", default-features = false }
 tracing-futures = { version = "0.2.5", default-features = false, features = ["std-future"] }
 
 bytes = { version = "1.3.0", default-features = false, optional = true }
-once_cell = "1.16.0"
+once_cell = "1.17.0"
 hashers = "1.0.1"
 
 [target.'cfg(not(target_arch = "wasm32"))'.dependencies]
diff --git a/ethers-providers/src/lib.rs b/ethers-providers/src/lib.rs
index b7825682..31ef49fe 100644
--- a/ethers-providers/src/lib.rs
+++ b/ethers-providers/src/lib.rs
@@ -723,7 +723,8 @@ pub trait CeloMiddleware: Middleware {
     }
 }
 
-pub use test_provider::{GOERLI, MAINNET, ROPSTEN};
+#[allow(deprecated)]
+pub use test_provider::{GOERLI, MAINNET, ROPSTEN, SEPOLIA};
 
 /// Pre-instantiated Infura HTTP clients which rotate through multiple API keys
 /// to prevent rate limits
@@ -743,9 +744,13 @@ pub mod test_provider {
         "5c812e02193c4ba793f8c214317582bd",
     ];
 
-    pub static GOERLI: Lazy<TestProvider> = Lazy::new(|| TestProvider::new(INFURA_KEYS, "goerli"));
     pub static MAINNET: Lazy<TestProvider> =
         Lazy::new(|| TestProvider::new(INFURA_KEYS, "mainnet"));
+    pub static GOERLI: Lazy<TestProvider> = Lazy::new(|| TestProvider::new(INFURA_KEYS, "goerli"));
+    pub static SEPOLIA: Lazy<TestProvider> =
+        Lazy::new(|| TestProvider::new(INFURA_KEYS, "sepolia"));
+
+    #[deprecated = "Ropsten testnet has been deprecated in favor of Goerli or Sepolia."]
     pub static ROPSTEN: Lazy<TestProvider> =
         Lazy::new(|| TestProvider::new(INFURA_KEYS, "ropsten"));
 
@@ -756,16 +761,14 @@ pub mod test_provider {
     }
 
     impl TestProvider {
-        pub fn new(keys: &'static [&'static str], network: &str) -> Self {
-            Self { keys: Mutex::new(keys.iter().cycle()), network: network.to_owned() }
+        pub fn new(keys: &'static [&'static str], network: impl Into<String>) -> Self {
+            Self { keys: keys.iter().cycle().into(), network: network.into() }
         }
 
         pub fn url(&self) -> String {
-            format!(
-                "https://{}.infura.io/v3/{}",
-                self.network,
-                self.keys.lock().unwrap().next().unwrap()
-            )
+            let Self { network, keys } = self;
+            let key = keys.lock().unwrap().next().unwrap();
+            format!("https://{network}.infura.io/v3/{key}")
         }
 
         pub fn provider(&self) -> Provider<Http> {
diff --git a/ethers-signers/Cargo.toml b/ethers-signers/Cargo.toml
index 02c2bab1..8a25e34f 100644
--- a/ethers-signers/Cargo.toml
+++ b/ethers-signers/Cargo.toml
@@ -1,7 +1,7 @@
 [package]
 name = "ethers-signers"
 version = "1.0.2"
-edition = "2018"
+edition = "2021"
 rust-version = "1.64"
 authors = ["Georgios Konstantopoulos <me@gakonst.com>"]
 license = "MIT OR Apache-2.0"
diff --git a/ethers-signers/src/wallet/private_key.rs b/ethers-signers/src/wallet/private_key.rs
index cdddf00a..ed10949c 100644
--- a/ethers-signers/src/wallet/private_key.rs
+++ b/ethers-signers/src/wallet/private_key.rs
@@ -90,6 +90,13 @@ impl Wallet<SigningKey> {
         let address = secret_key_to_address(&signer);
         Self { signer, address, chain_id: 1 }
     }
+
+    /// Creates a new Wallet instance from a raw scalar value (big endian).
+    pub fn from_bytes(bytes: &[u8]) -> Result<Self, WalletError> {
+        let signer = SigningKey::from_bytes(bytes)?;
+        let address = secret_key_to_address(&signer);
+        Ok(Self { signer, address, chain_id: 1 })
+    }
 }
 
 impl PartialEq for Wallet<SigningKey> {
@@ -305,4 +312,17 @@ mod tests {
             Address::from_str("6813Eb9362372EEF6200f3b1dbC3f819671cBA69").expect("Decoding failed")
         );
     }
+
+    #[test]
+    fn key_from_bytes() {
+        let wallet: Wallet<SigningKey> =
+            "0000000000000000000000000000000000000000000000000000000000000001".parse().unwrap();
+
+        let key_as_bytes = wallet.signer.to_bytes();
+        let wallet_from_bytes = Wallet::from_bytes(&key_as_bytes).unwrap();
+
+        assert_eq!(wallet.address, wallet_from_bytes.address);
+        assert_eq!(wallet.chain_id, wallet_from_bytes.chain_id);
+        assert_eq!(wallet.signer, wallet_from_bytes.signer);
+    }
 }
diff --git a/ethers-solc/Cargo.toml b/ethers-solc/Cargo.toml
index 66002fd5..3555e1b4 100644
--- a/ethers-solc/Cargo.toml
+++ b/ethers-solc/Cargo.toml
@@ -1,7 +1,7 @@
 [package]
 name = "ethers-solc"
 version = "1.0.2"
-edition = "2018"
+edition = "2021"
 rust-version = "1.64"
 authors = [
     "Matthias Seitz <matthias.seitz@outlook.de>",
@@ -23,7 +23,7 @@ semver = { version = "1.0.16", features = ["serde"] }
 walkdir = "2.3.2"
 tokio = { version = "1.18", default-features = false, features = ["rt"] }
 futures-util = { version = "^0.3", optional = true }
-once_cell = "1.16.0"
+once_cell = "1.17.0"
 regex = "1.7.0"
 md-5 = "0.10.5"
 thiserror = "1.0"
diff --git a/ethers-solc/benches/compile_many.rs b/ethers-solc/benches/compile_many.rs
index b667a6b9..b0df3c7a 100644
--- a/ethers-solc/benches/compile_many.rs
+++ b/ethers-solc/benches/compile_many.rs
@@ -36,7 +36,6 @@ fn load_compiler_inputs() -> Vec<CompilerInput> {
     let mut inputs = Vec::new();
     for file in std::fs::read_dir(Path::new(&env!("CARGO_MANIFEST_DIR")).join("test-data/in"))
         .unwrap()
-        .into_iter()
         .take(5)
     {
         let file = file.unwrap();
diff --git a/ethers-solc/src/artifacts/ast/mod.rs b/ethers-solc/src/artifacts/ast/mod.rs
index 82e01a2b..be83cd00 100644
--- a/ethers-solc/src/artifacts/ast/mod.rs
+++ b/ethers-solc/src/artifacts/ast/mod.rs
@@ -1089,11 +1089,11 @@ mod tests {
                 let result: Result<SourceUnit, _> = serde_path_to_error::deserialize(deserializer);
                 match result {
                     Err(e) => {
-                        println!("... {} fail: {e}", path_str);
+                        println!("... {path_str} fail: {e}");
                         panic!();
                     }
                     Ok(_) => {
-                        println!("... {} ok", path_str);
+                        println!("... {path_str} ok");
                     }
                 }
             })
diff --git a/ethers-solc/src/compile/mod.rs b/ethers-solc/src/compile/mod.rs
index fe40cfb9..b34913fe 100644
--- a/ethers-solc/src/compile/mod.rs
+++ b/ethers-solc/src/compile/mod.rs
@@ -457,7 +457,7 @@ impl Solc {
 
         use sha2::Digest;
         let mut hasher = sha2::Sha256::new();
-        hasher.update(&content);
+        hasher.update(content);
         let checksum_calc = &hasher.finalize()[..];
 
         let checksum_found = &RELEASES.0.get_checksum(&version).expect("checksum not found");
diff --git a/ethers-solc/src/resolver/mod.rs b/ethers-solc/src/resolver/mod.rs
index eceba2e1..848713ad 100644
--- a/ethers-solc/src/resolver/mod.rs
+++ b/ethers-solc/src/resolver/mod.rs
@@ -649,7 +649,7 @@ impl Graph {
                 return Vec::new()
             }
 
-            let mut result = sets.pop().cloned().expect("not empty; qed.").clone();
+            let mut result = sets.pop().cloned().expect("not empty; qed.");
             if !sets.is_empty() {
                 result.retain(|item| sets.iter().all(|set| set.contains(item)));
             }
diff --git a/examples/ethers-wasm/Cargo.toml b/examples/ethers-wasm/Cargo.toml
index 181e0f81..6ca4f575 100644
--- a/examples/ethers-wasm/Cargo.toml
+++ b/examples/ethers-wasm/Cargo.toml
@@ -1,7 +1,7 @@
 [package]
 name = "ethers-wasm"
 version = "0.1.0"
-edition = "2018"
+edition = "2021"
 rust-version = "1.64"
 authors = ["Matthias Seitz <matthias.seitz@outlook.de>"]
 license = "MIT OR Apache-2.0"
diff --git a/examples/middleware/examples/builder.rs b/examples/middleware/examples/builder.rs
index f8c54ad4..c9fb058a 100644
--- a/examples/middleware/examples/builder.rs
+++ b/examples/middleware/examples/builder.rs
@@ -1,6 +1,10 @@
 use ethers::{
     core::types::BlockNumber,
-    middleware::{gas_escalator::*, gas_oracle::*, *},
+    middleware::{
+        gas_escalator::{Frequency, GasEscalatorMiddleware, GeometricGasPrice},
+        gas_oracle::{GasNow, GasOracleMiddleware},
+        MiddlewareBuilder, NonceManagerMiddleware, SignerMiddleware,
+    },
     providers::{Http, Middleware, Provider},
     signers::{LocalWallet, Signer},
 };
@@ -24,7 +28,7 @@ async fn builder_example() {
     let signer = SIGNING_KEY.parse::<LocalWallet>().unwrap();
     let address = signer.address();
     let escalator = GeometricGasPrice::new(1.125, 60_u64, None::<u64>);
-    let gas_oracle = EthGasStation::new(None);
+    let gas_oracle = GasNow::new();
 
     let provider = Provider::<Http>::try_from(RPC_URL)
         .unwrap()
@@ -48,7 +52,7 @@ async fn builder_example_raw_wrap() {
         .unwrap()
         .wrap_into(|p| GasEscalatorMiddleware::new(p, escalator, Frequency::PerBlock))
         .wrap_into(|p| SignerMiddleware::new(p, signer))
-        .wrap_into(|p| GasOracleMiddleware::new(p, EthGasStation::new(None)))
+        .wrap_into(|p| GasOracleMiddleware::new(p, GasNow::new()))
         .wrap_into(|p| NonceManagerMiddleware::new(p, address)); // Outermost layer
 
     match provider.get_block(BlockNumber::Latest).await {
diff --git a/examples/middleware/examples/create_custom_middleware.rs b/examples/middleware/examples/create_custom_middleware.rs
index 7e19ee3a..56a4a21d 100644
--- a/examples/middleware/examples/create_custom_middleware.rs
+++ b/examples/middleware/examples/create_custom_middleware.rs
@@ -92,7 +92,7 @@ where
         };
 
         println!("Original transaction gas: {curr_gas:?} wei");
-        let units: U256 = U256::exp10(CONTINGENCY_UNITS.into());
+        let units: U256 = U256::exp10(CONTINGENCY_UNITS);
         let raised_gas: U256 = (curr_gas * self.contingency) / units;
         tx.set_gas(raised_gas);
         println!("Raised transaction gas: {raised_gas:?} wei");


Test patch:
diff --git a/ethers-middleware/tests/gas_escalator.rs b/ethers-middleware/tests/gas_escalator.rs
index c2bfbad6..66d7d4ff 100644
--- a/ethers-middleware/tests/gas_escalator.rs
+++ b/ethers-middleware/tests/gas_escalator.rs
@@ -13,6 +13,7 @@ use std::time::Duration;
 #[ignore]
 async fn gas_escalator_live() {
     // connect to ropsten for getting bad block times
+    #[allow(deprecated)]
     let provider = ethers_providers::ROPSTEN.ws().await;
     let provider = provider.interval(Duration::from_millis(2000u64));
     let wallet = "fdb33e2105f08abe41a8ee3b758726a31abdd57b7a443f470f23efce853af169"
@@ -34,7 +35,7 @@ async fn gas_escalator_live() {
     provider.send_transaction(tx.clone().nonce(nonce + 2), None).await.unwrap();
 
     // Wait a bunch of seconds and refresh etherscan to see the transactions get bumped
-    tokio::time::sleep(std::time::Duration::from_secs(100)).await;
+    tokio::time::sleep(Duration::from_secs(100)).await;
 
     // TODO: Figure out how to test this behavior properly in a local network. If the gas price was
     // bumped then the tx hash will be different
diff --git a/ethers-middleware/tests/nonce_manager.rs b/ethers-middleware/tests/nonce_manager.rs
index a1c74915..1be27fec 100644
--- a/ethers-middleware/tests/nonce_manager.rs
+++ b/ethers-middleware/tests/nonce_manager.rs
@@ -8,7 +8,7 @@ use std::time::Duration;
 
 #[tokio::test]
 async fn nonce_manager() {
-    let provider = ethers_providers::GOERLI.provider().interval(Duration::from_millis(2000u64));
+    let provider = ethers_providers::GOERLI.provider().interval(Duration::from_millis(2000));
     let chain_id = provider.get_chainid().await.unwrap().as_u64();
 
     let wallet = std::env::var("GOERLI_PRIVATE_KEY")
@@ -44,12 +44,12 @@ async fn nonce_manager() {
     }
 
     // sleep a bit to ensure there's no flakiness in the test
-    std::thread::sleep(std::time::Duration::new(5, 0));
+    tokio::time::sleep(Duration::from_secs(10)).await;
 
     let mut nonces = Vec::with_capacity(num_tx);
     for tx_hash in tx_hashes {
         nonces.push(provider.get_transaction(tx_hash).await.unwrap().unwrap().nonce.as_u64());
     }
 
-    assert_eq!(nonces, (nonce..nonce + (num_tx as u64)).collect::<Vec<_>>())
+    assert_eq!(nonces, (nonce..nonce + num_tx as u64).collect::<Vec<_>>())
 }
diff --git a/ethers-middleware/tests/signer.rs b/ethers-middleware/tests/signer.rs
index 9c2176ed..eecd1e65 100644
--- a/ethers-middleware/tests/signer.rs
+++ b/ethers-middleware/tests/signer.rs
@@ -294,7 +294,7 @@ impl TestWallets {
     #[allow(unused)]
     pub async fn fund<T: JsonRpcClient, U: Into<u32>>(&self, provider: &Provider<T>, n: U) {
         let addrs = (0..n.into()).map(|i| self.get(i).address()).collect::<Vec<_>>();
-        // hardcoded funder address private key, goerli
+        // hardcoded funder address private key, GOERLI
         let signer = "39aa18eeb5d12c071e5f19d8e9375a872e90cb1f2fa640384ffd8800a2f3e8f1"
             .parse::<LocalWallet>()
             .unwrap()