From 783a32c49eb0f0938b1852233b37430fd7dcb649 Mon Sep 17 00:00:00 2001 From: ManojJiSharma Date: Fri, 20 Sep 2024 14:31:30 +0530 Subject: [PATCH 1/7] remove repeated code --- Cargo.lock | 10 ++++++ Cargo.toml | 1 + chains/avalanche/Cargo.toml | 1 + chains/avalanche/src/lib.rs | 33 +------------------ chains/binance/Cargo.toml | 1 + chains/binance/src/lib.rs | 33 +------------------ .../rosetta-testing-polygon/Cargo.toml | 1 + .../rosetta-testing-polygon/src/lib.rs | 33 +------------------ chains/utils/Cargo.toml | 10 ++++++ chains/utils/src/lib.rs | 33 +++++++++++++++++++ 10 files changed, 60 insertions(+), 96 deletions(-) create mode 100644 chains/utils/Cargo.toml create mode 100644 chains/utils/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index 87868a51..791d7acf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5907,6 +5907,7 @@ dependencies = [ "tokio", "tracing", "url", + "utils", ] [[package]] @@ -5924,6 +5925,7 @@ dependencies = [ "rosetta-server-ethereum", "sha3", "tokio", + "utils", ] [[package]] @@ -5941,6 +5943,7 @@ dependencies = [ "rosetta-server-ethereum", "sha3", "tokio", + "utils", ] [[package]] @@ -8642,6 +8645,13 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" +[[package]] +name = "utils" +version = "0.1.0" +dependencies = [ + "tokio", +] + [[package]] name = "uuid" version = "0.8.2" diff --git a/Cargo.toml b/Cargo.toml index df91943a..19fc81c0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,6 +21,7 @@ members = [ "chains/polygon/rosetta-testing-polygon", "chains/binance", "chains/avalanche", + "chains/utils", ] resolver = "2" diff --git a/chains/avalanche/Cargo.toml b/chains/avalanche/Cargo.toml index 74a282a7..232f13cf 100644 --- a/chains/avalanche/Cargo.toml +++ b/chains/avalanche/Cargo.toml @@ -22,6 +22,7 @@ sha3 = "0.10" tokio = { workspace = true, features = ["rt-multi-thread", "macros"] } tracing = "0.1.40" url = "2.4" +utils = { path = "../utils" } [dev-dependencies] serial_test = "3.1.1" diff --git a/chains/avalanche/src/lib.rs b/chains/avalanche/src/lib.rs index e50c9790..24faff4d 100644 --- a/chains/avalanche/src/lib.rs +++ b/chains/avalanche/src/lib.rs @@ -51,6 +51,7 @@ mod tests { use serial_test::serial; use sha3::Digest; use std::{collections::BTreeMap, future::Future, path::Path}; + use utils::run_test; /// Account used to fund other testing accounts. const FUNDING_ACCOUNT_PRIVATE_KEY: [u8; 32] = @@ -68,38 +69,6 @@ mod tests { } } - /// Run the test in another thread while sending txs to force binance to mine new blocks - /// # Panic - /// Panics if the future panics - async fn run_test + Send + 'static>(future: Fut) { - // Guarantee that only one test is incrementing blocks at a time - static LOCK: tokio::sync::Mutex<()> = tokio::sync::Mutex::const_new(()); - - // Run the test in another thread - let test_handler = tokio::spawn(future); - - // Acquire Lock - let guard = LOCK.lock().await; - - // Check if the test is finished after acquiring the lock - if test_handler.is_finished() { - // Release lock - drop(guard); - - // Now is safe to panic - if let Err(err) = test_handler.await { - std::panic::resume_unwind(err.into_panic()); - } - return; - } - - // Now is safe to panic - if let Err(err) = test_handler.await { - // Resume the panic on the main task - std::panic::resume_unwind(err.into_panic()); - } - } - #[tokio::test] #[serial] async fn network_status() { diff --git a/chains/binance/Cargo.toml b/chains/binance/Cargo.toml index f8a34ded..b2f58f87 100644 --- a/chains/binance/Cargo.toml +++ b/chains/binance/Cargo.toml @@ -18,3 +18,4 @@ rosetta-core.workspace = true rosetta-server-ethereum.workspace = true sha3 = "0.10" tokio = { workspace = true, features = ["rt-multi-thread", "macros"] } +utils = { path = "../utils" } diff --git a/chains/binance/src/lib.rs b/chains/binance/src/lib.rs index 19a630a7..04448446 100644 --- a/chains/binance/src/lib.rs +++ b/chains/binance/src/lib.rs @@ -49,6 +49,7 @@ mod tests { use rosetta_server_ethereum::MaybeWsEthereumClient; use sha3::Digest; use std::{collections::BTreeMap, future::Future, path::Path}; + use utils::run_test; /// Binance rpc url const BINANCE_RPC_WS_URL: &str = "ws://127.0.0.1:8546"; @@ -62,38 +63,6 @@ mod tests { } } - /// Run the test in another thread while sending txs to force binance to mine new blocks - /// # Panic - /// Panics if the future panics - async fn run_test + Send + 'static>(future: Fut) { - // Guarantee that only one test is incrementing blocks at a time - static LOCK: tokio::sync::Mutex<()> = tokio::sync::Mutex::const_new(()); - - // Run the test in another thread - let test_handler: tokio::task::JoinHandle<()> = tokio::spawn(future); - - // Acquire Lock - let guard = LOCK.lock().await; - - // Check if the test is finished after acquiring the lock - if test_handler.is_finished() { - // Release lock - drop(guard); - - // Now is safe to panic - if let Err(err) = test_handler.await { - std::panic::resume_unwind(err.into_panic()); - } - return; - } - - // Now is safe to panic - if let Err(err) = test_handler.await { - // Resume the panic on the main task - std::panic::resume_unwind(err.into_panic()); - } - } - #[tokio::test] async fn network_status() { run_test(async move { diff --git a/chains/polygon/rosetta-testing-polygon/Cargo.toml b/chains/polygon/rosetta-testing-polygon/Cargo.toml index 69bd46d2..84847779 100644 --- a/chains/polygon/rosetta-testing-polygon/Cargo.toml +++ b/chains/polygon/rosetta-testing-polygon/Cargo.toml @@ -18,3 +18,4 @@ rosetta-core.workspace = true rosetta-server-ethereum.workspace = true sha3 = "0.10" tokio = { workspace = true, features = ["rt-multi-thread", "macros"] } +utils = { path = "../../utils" } diff --git a/chains/polygon/rosetta-testing-polygon/src/lib.rs b/chains/polygon/rosetta-testing-polygon/src/lib.rs index 513692c1..210bc64f 100644 --- a/chains/polygon/rosetta-testing-polygon/src/lib.rs +++ b/chains/polygon/rosetta-testing-polygon/src/lib.rs @@ -49,6 +49,7 @@ mod tests { use rosetta_server_ethereum::MaybeWsEthereumClient; use sha3::Digest; use std::{collections::BTreeMap, future::Future, path::Path}; + use utils::run_test; /// Polygon rpc url const POLYGON_RPC_WS_URL: &str = "ws://127.0.0.1:8546"; @@ -62,38 +63,6 @@ mod tests { } } - /// Run the test in another thread while sending txs to force polygon to mine new blocks - /// # Panic - /// Panics if the future panics - async fn run_test + Send + 'static>(future: Fut) { - // Guarantee that only one test is incrementing blocks at a time - static LOCK: tokio::sync::Mutex<()> = tokio::sync::Mutex::const_new(()); - - // Run the test in another thread - let test_handler: tokio::task::JoinHandle<()> = tokio::spawn(future); - - // Acquire Lock - let guard = LOCK.lock().await; - - // Check if the test is finished after acquiring the lock - if test_handler.is_finished() { - // Release lock - drop(guard); - - // Now is safe to panic - if let Err(err) = test_handler.await { - std::panic::resume_unwind(err.into_panic()); - } - return; - } - - // Now is safe to panic - if let Err(err) = test_handler.await { - // Resume the panic on the main task - std::panic::resume_unwind(err.into_panic()); - } - } - #[ignore = "No Polygon CI"] #[tokio::test] async fn network_status() { diff --git a/chains/utils/Cargo.toml b/chains/utils/Cargo.toml new file mode 100644 index 00000000..84fa5a04 --- /dev/null +++ b/chains/utils/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "utils" +version = "0.1.0" +edition = "2021" +license = "MIT" +repository = "https://github.com/analog-labs/chain-connectors" +description = "utils for rosetta test." + +[dependencies] +tokio = { workspace = true, features = ["rt-multi-thread", "macros"] } diff --git a/chains/utils/src/lib.rs b/chains/utils/src/lib.rs new file mode 100644 index 00000000..ab03aaba --- /dev/null +++ b/chains/utils/src/lib.rs @@ -0,0 +1,33 @@ +use std::future::Future; + +/// Run the test in another thread while sending txs to force binance to mine new blocks +/// # Panic +/// Panics if the future panics +pub async fn run_test + Send + 'static>(future: Fut) { + // Guarantee that only one test is incrementing blocks at a time + static LOCK: tokio::sync::Mutex<()> = tokio::sync::Mutex::const_new(()); + + // Run the test in another thread + let test_handler = tokio::spawn(future); + + // Acquire Lock + let guard = LOCK.lock().await; + + // Check if the test is finished after acquiring the lock + if test_handler.is_finished() { + // Release lock + drop(guard); + + // Now is safe to panic + if let Err(err) = test_handler.await { + std::panic::resume_unwind(err.into_panic()); + } + return; + } + + // Now is safe to panic + if let Err(err) = test_handler.await { + // Resume the panic on the main task + std::panic::resume_unwind(err.into_panic()); + } +} From 3b51f51d0164fdb7de998f709f4c8c4713ca91e1 Mon Sep 17 00:00:00 2001 From: ManojJiSharma Date: Fri, 20 Sep 2024 15:06:24 +0530 Subject: [PATCH 2/7] deny fix --- deny.toml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/deny.toml b/deny.toml index a023e845..b78c0065 100644 --- a/deny.toml +++ b/deny.toml @@ -101,6 +101,13 @@ ignore = [ # Subxt 0.37 depends deprecated libraries: https://github.com/paritytech/subxt/issues/1608 { id = 'RUSTSEC-2024-0370', reason = "Waiting for subxt to update their deprecated dependencies" }, + + # RUSTSEC-2024-0377 contains multiple soundness issues: + { id = 'RUSTSEC-2024-0377', reason = 'Version 1.0 fixes these issues, removes the vast majority of unsafe code, and also fixes some correctness issues and on our connector using older' }, + + # RUSTSEC-2023-0086 contains multiple soundness issues: + { id = 'RUSTSEC-2023-0086', reason = 'Version 1.0 fixes these issues, removes the vast majority of unsafe code, and also fixes some correctness issues and on our connector using older' }, + ] # This section is considered when running `cargo deny check sources`. From 30ff04d3deeb7a670aef372e45af354030c14fb2 Mon Sep 17 00:00:00 2001 From: ManojJiSharma Date: Fri, 20 Sep 2024 15:10:54 +0530 Subject: [PATCH 3/7] dprint fix --- deny.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/deny.toml b/deny.toml index b78c0065..0da55ea3 100644 --- a/deny.toml +++ b/deny.toml @@ -107,7 +107,6 @@ ignore = [ # RUSTSEC-2023-0086 contains multiple soundness issues: { id = 'RUSTSEC-2023-0086', reason = 'Version 1.0 fixes these issues, removes the vast majority of unsafe code, and also fixes some correctness issues and on our connector using older' }, - ] # This section is considered when running `cargo deny check sources`. From 246fe2310d46ffd395655f02692ae52a3457a6ec Mon Sep 17 00:00:00 2001 From: ManojJiSharma Date: Fri, 20 Sep 2024 15:34:27 +0530 Subject: [PATCH 4/7] remove unused import --- chains/polygon/rosetta-testing-polygon/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chains/polygon/rosetta-testing-polygon/src/lib.rs b/chains/polygon/rosetta-testing-polygon/src/lib.rs index 210bc64f..9c1046cf 100644 --- a/chains/polygon/rosetta-testing-polygon/src/lib.rs +++ b/chains/polygon/rosetta-testing-polygon/src/lib.rs @@ -48,7 +48,7 @@ mod tests { use rosetta_core::BlockchainClient; use rosetta_server_ethereum::MaybeWsEthereumClient; use sha3::Digest; - use std::{collections::BTreeMap, future::Future, path::Path}; + use std::{collections::BTreeMap, path::Path}; use utils::run_test; /// Polygon rpc url From bc4fdd81510832c680297735ee81fec9056dc3ee Mon Sep 17 00:00:00 2001 From: ManojJiSharma Date: Fri, 20 Sep 2024 15:53:37 +0530 Subject: [PATCH 5/7] check.sh fmt --- chains/avalanche/src/lib.rs | 2 +- chains/binance/src/lib.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/chains/avalanche/src/lib.rs b/chains/avalanche/src/lib.rs index 24faff4d..9e0955f1 100644 --- a/chains/avalanche/src/lib.rs +++ b/chains/avalanche/src/lib.rs @@ -50,7 +50,7 @@ mod tests { use rosetta_server_ethereum::MaybeWsEthereumClient; use serial_test::serial; use sha3::Digest; - use std::{collections::BTreeMap, future::Future, path::Path}; + use std::{collections::BTreeMap, path::Path}; use utils::run_test; /// Account used to fund other testing accounts. diff --git a/chains/binance/src/lib.rs b/chains/binance/src/lib.rs index 04448446..438f40b0 100644 --- a/chains/binance/src/lib.rs +++ b/chains/binance/src/lib.rs @@ -48,7 +48,7 @@ mod tests { use rosetta_core::BlockchainClient; use rosetta_server_ethereum::MaybeWsEthereumClient; use sha3::Digest; - use std::{collections::BTreeMap, future::Future, path::Path}; + use std::{collections::BTreeMap, path::Path}; use utils::run_test; /// Binance rpc url From 26a21e799fde66c2192007fface61c10dc0a8958 Mon Sep 17 00:00:00 2001 From: ManojJiSharma Date: Mon, 23 Sep 2024 12:12:31 +0530 Subject: [PATCH 6/7] updated utils name --- Cargo.lock | 20 +++++++++---------- Cargo.toml | 2 +- chains/avalanche/Cargo.toml | 2 +- chains/avalanche/src/lib.rs | 2 +- chains/binance/Cargo.toml | 2 +- chains/binance/src/lib.rs | 2 +- .../rosetta-testing-polygon/Cargo.toml | 2 +- .../rosetta-testing-polygon/src/lib.rs | 2 +- .../Cargo.toml | 2 +- .../src/lib.rs | 2 +- 10 files changed, 19 insertions(+), 19 deletions(-) rename chains/{utils => rosetta-chain-testing}/Cargo.toml (89%) rename chains/{utils => rosetta-chain-testing}/src/lib.rs (91%) diff --git a/Cargo.lock b/Cargo.lock index 791d7acf..035b00ee 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5579,6 +5579,13 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "rosetta-chain-testing" +version = "0.1.0" +dependencies = [ + "tokio", +] + [[package]] name = "rosetta-client" version = "0.6.0" @@ -5897,6 +5904,7 @@ dependencies = [ "ethers-solc", "hex-literal", "rand_core 0.6.4", + "rosetta-chain-testing", "rosetta-client", "rosetta-config-ethereum", "rosetta-core", @@ -5907,7 +5915,6 @@ dependencies = [ "tokio", "tracing", "url", - "utils", ] [[package]] @@ -5919,13 +5926,13 @@ dependencies = [ "ethers", "ethers-solc", "hex-literal", + "rosetta-chain-testing", "rosetta-client", "rosetta-config-ethereum", "rosetta-core", "rosetta-server-ethereum", "sha3", "tokio", - "utils", ] [[package]] @@ -5937,13 +5944,13 @@ dependencies = [ "ethers", "ethers-solc", "hex-literal", + "rosetta-chain-testing", "rosetta-client", "rosetta-config-ethereum", "rosetta-core", "rosetta-server-ethereum", "sha3", "tokio", - "utils", ] [[package]] @@ -8645,13 +8652,6 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" -[[package]] -name = "utils" -version = "0.1.0" -dependencies = [ - "tokio", -] - [[package]] name = "uuid" version = "0.8.2" diff --git a/Cargo.toml b/Cargo.toml index 19fc81c0..fba29034 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,7 +21,7 @@ members = [ "chains/polygon/rosetta-testing-polygon", "chains/binance", "chains/avalanche", - "chains/utils", + "chains/rosetta-chain-testing", ] resolver = "2" diff --git a/chains/avalanche/Cargo.toml b/chains/avalanche/Cargo.toml index 232f13cf..efebd629 100644 --- a/chains/avalanche/Cargo.toml +++ b/chains/avalanche/Cargo.toml @@ -13,6 +13,7 @@ ethers = { version = "2.0", default-features = true, features = ["abigen", "rust ethers-solc = "2.0" hex-literal = "0.4" rand_core = { version = "0.6", features = ["getrandom"] } +rosetta-chain-testing = { path = "../rosetta-chain-testing" } rosetta-client.workspace = true rosetta-config-ethereum.workspace = true rosetta-core.workspace = true @@ -22,7 +23,6 @@ sha3 = "0.10" tokio = { workspace = true, features = ["rt-multi-thread", "macros"] } tracing = "0.1.40" url = "2.4" -utils = { path = "../utils" } [dev-dependencies] serial_test = "3.1.1" diff --git a/chains/avalanche/src/lib.rs b/chains/avalanche/src/lib.rs index 9e0955f1..c316c3c9 100644 --- a/chains/avalanche/src/lib.rs +++ b/chains/avalanche/src/lib.rs @@ -44,6 +44,7 @@ mod tests { use ethers::types::H256; use ethers_solc::{artifacts::Source, CompilerInput, EvmVersion, Solc}; use hex_literal::hex; + use rosetta_chain_testing::run_test; use rosetta_client::Wallet; use rosetta_config_ethereum::{AtBlock, CallResult}; use rosetta_core::BlockchainClient; @@ -51,7 +52,6 @@ mod tests { use serial_test::serial; use sha3::Digest; use std::{collections::BTreeMap, path::Path}; - use utils::run_test; /// Account used to fund other testing accounts. const FUNDING_ACCOUNT_PRIVATE_KEY: [u8; 32] = diff --git a/chains/binance/Cargo.toml b/chains/binance/Cargo.toml index b2f58f87..e252ef8d 100644 --- a/chains/binance/Cargo.toml +++ b/chains/binance/Cargo.toml @@ -12,10 +12,10 @@ anyhow = "1.0" ethers = { version = "2.0", default-features = true, features = ["abigen", "rustls", "ws"] } ethers-solc = "2.0" hex-literal = "0.4" +rosetta-chain-testing = { path = "../rosetta-chain-testing" } rosetta-client.workspace = true rosetta-config-ethereum.workspace = true rosetta-core.workspace = true rosetta-server-ethereum.workspace = true sha3 = "0.10" tokio = { workspace = true, features = ["rt-multi-thread", "macros"] } -utils = { path = "../utils" } diff --git a/chains/binance/src/lib.rs b/chains/binance/src/lib.rs index 438f40b0..149a7d59 100644 --- a/chains/binance/src/lib.rs +++ b/chains/binance/src/lib.rs @@ -43,13 +43,13 @@ mod tests { use ethers_solc::{artifacts::Source, CompilerInput, EvmVersion, Solc}; use hex_literal::hex; + use rosetta_chain_testing::run_test; use rosetta_client::Wallet; use rosetta_config_ethereum::{AtBlock, CallResult}; use rosetta_core::BlockchainClient; use rosetta_server_ethereum::MaybeWsEthereumClient; use sha3::Digest; use std::{collections::BTreeMap, path::Path}; - use utils::run_test; /// Binance rpc url const BINANCE_RPC_WS_URL: &str = "ws://127.0.0.1:8546"; diff --git a/chains/polygon/rosetta-testing-polygon/Cargo.toml b/chains/polygon/rosetta-testing-polygon/Cargo.toml index 84847779..d66824b6 100644 --- a/chains/polygon/rosetta-testing-polygon/Cargo.toml +++ b/chains/polygon/rosetta-testing-polygon/Cargo.toml @@ -12,10 +12,10 @@ anyhow = "1.0" ethers = { version = "2.0", default-features = true, features = ["abigen", "rustls", "ws"] } ethers-solc = "2.0" hex-literal = "0.4" +rosetta-chain-testing = { path = "../../rosetta-chain-testing" } rosetta-client.workspace = true rosetta-config-ethereum.workspace = true rosetta-core.workspace = true rosetta-server-ethereum.workspace = true sha3 = "0.10" tokio = { workspace = true, features = ["rt-multi-thread", "macros"] } -utils = { path = "../../utils" } diff --git a/chains/polygon/rosetta-testing-polygon/src/lib.rs b/chains/polygon/rosetta-testing-polygon/src/lib.rs index 9c1046cf..0c8b5097 100644 --- a/chains/polygon/rosetta-testing-polygon/src/lib.rs +++ b/chains/polygon/rosetta-testing-polygon/src/lib.rs @@ -43,13 +43,13 @@ mod tests { use ethers_solc::{artifacts::Source, CompilerInput, EvmVersion, Solc}; use hex_literal::hex; + use rosetta_chain_testing::run_test; use rosetta_client::Wallet; use rosetta_config_ethereum::{AtBlock, CallResult}; use rosetta_core::BlockchainClient; use rosetta_server_ethereum::MaybeWsEthereumClient; use sha3::Digest; use std::{collections::BTreeMap, path::Path}; - use utils::run_test; /// Polygon rpc url const POLYGON_RPC_WS_URL: &str = "ws://127.0.0.1:8546"; diff --git a/chains/utils/Cargo.toml b/chains/rosetta-chain-testing/Cargo.toml similarity index 89% rename from chains/utils/Cargo.toml rename to chains/rosetta-chain-testing/Cargo.toml index 84fa5a04..7d9963aa 100644 --- a/chains/utils/Cargo.toml +++ b/chains/rosetta-chain-testing/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "utils" +name = "rosetta-chain-testing" version = "0.1.0" edition = "2021" license = "MIT" diff --git a/chains/utils/src/lib.rs b/chains/rosetta-chain-testing/src/lib.rs similarity index 91% rename from chains/utils/src/lib.rs rename to chains/rosetta-chain-testing/src/lib.rs index ab03aaba..de5be757 100644 --- a/chains/utils/src/lib.rs +++ b/chains/rosetta-chain-testing/src/lib.rs @@ -1,6 +1,6 @@ use std::future::Future; -/// Run the test in another thread while sending txs to force binance to mine new blocks +/// Run the test in another thread while sending txs /// # Panic /// Panics if the future panics pub async fn run_test + Send + 'static>(future: Fut) { From 6d46ff96069a4b8f6b409b5b7167500e81f3fbfe Mon Sep 17 00:00:00 2001 From: ManojJiSharma Date: Mon, 23 Sep 2024 12:23:52 +0530 Subject: [PATCH 7/7] fmt fix --- chains/ethereum/backend/src/jsonrpsee.rs | 10 ++++++-- chains/ethereum/backend/src/lib.rs | 30 +++++++++++++++++++----- chains/ethereum/server/src/lib.rs | 5 +++- rosetta-server/src/ws/reconnect_impl.rs | 15 +++++++++--- 4 files changed, 48 insertions(+), 12 deletions(-) diff --git a/chains/ethereum/backend/src/jsonrpsee.rs b/chains/ethereum/backend/src/jsonrpsee.rs index 453b34fb..756e6459 100644 --- a/chains/ethereum/backend/src/jsonrpsee.rs +++ b/chains/ethereum/backend/src/jsonrpsee.rs @@ -398,8 +398,14 @@ where T: SubscriptionClientT + Send + Sync, { type SubscriptionError = serde_json::Error; - type NewHeadsStream<'a> = Subscription> where Self: 'a; - type LogsStream<'a> = Subscription where Self: 'a; + type NewHeadsStream<'a> + = Subscription> + where + Self: 'a; + type LogsStream<'a> + = Subscription + where + Self: 'a; /// Fires a notification each time a new header is appended to the chain, including chain /// reorganizations. diff --git a/chains/ethereum/backend/src/lib.rs b/chains/ethereum/backend/src/lib.rs index ff9dffe2..603b5c30 100644 --- a/chains/ethereum/backend/src/lib.rs +++ b/chains/ethereum/backend/src/lib.rs @@ -313,8 +313,14 @@ pub trait EthereumPubSub: EthereumRpc { impl<'b, T: 'b + EthereumPubSub + ?Sized> EthereumPubSub for &'b T { type SubscriptionError = T::SubscriptionError; - type NewHeadsStream<'a> = T::NewHeadsStream<'a> where Self: 'a; - type LogsStream<'a> = T::LogsStream<'a> where Self: 'a; + type NewHeadsStream<'a> + = T::NewHeadsStream<'a> + where + Self: 'a; + type LogsStream<'a> + = T::LogsStream<'a> + where + Self: 'a; fn new_heads<'a, 'async_trait>( &'a self, ) -> BoxFuture<'async_trait, Result, Self::Error>> @@ -342,8 +348,14 @@ impl<'b, T: 'b + EthereumPubSub + ?Sized> EthereumPubSub for &'b T { // https://github.com/auto-impl-rs/auto_impl/issues/93 impl EthereumPubSub for Arc { type SubscriptionError = T::SubscriptionError; - type NewHeadsStream<'a> = T::NewHeadsStream<'a> where Self: 'a; - type LogsStream<'a> = T::LogsStream<'a> where Self: 'a; + type NewHeadsStream<'a> + = T::NewHeadsStream<'a> + where + Self: 'a; + type LogsStream<'a> + = T::LogsStream<'a> + where + Self: 'a; fn new_heads<'a, 'async_trait>( &'a self, @@ -370,8 +382,14 @@ impl EthereumPubSub for Arc { impl EthereumPubSub for Box { type SubscriptionError = T::SubscriptionError; - type NewHeadsStream<'a> = T::NewHeadsStream<'a> where Self: 'a; - type LogsStream<'a> = T::LogsStream<'a> where Self: 'a; + type NewHeadsStream<'a> + = T::NewHeadsStream<'a> + where + Self: 'a; + type LogsStream<'a> + = T::LogsStream<'a> + where + Self: 'a; fn new_heads<'a, 'async_trait>( &'a self, diff --git a/chains/ethereum/server/src/lib.rs b/chains/ethereum/server/src/lib.rs index 13691714..71832655 100644 --- a/chains/ethereum/server/src/lib.rs +++ b/chains/ethereum/server/src/lib.rs @@ -113,7 +113,10 @@ impl MaybeWsEthereumClient { impl BlockchainClient for MaybeWsEthereumClient { type MetadataParams = EthereumMetadataParams; type Metadata = EthereumMetadata; - type EventStream<'a> = BlockStreamType where Self: 'a; + type EventStream<'a> + = BlockStreamType + where + Self: 'a; type Call = EthQuery; type CallResult = EthQueryResult; diff --git a/rosetta-server/src/ws/reconnect_impl.rs b/rosetta-server/src/ws/reconnect_impl.rs index e6e2ff5e..1712f9d2 100644 --- a/rosetta-server/src/ws/reconnect_impl.rs +++ b/rosetta-server/src/ws/reconnect_impl.rs @@ -137,9 +137,18 @@ impl DefaultStrategy { impl Reconnect for DefaultStrategy { type Client = T::Client; type ClientRef = Arc; - type ReadyFuture<'a> = ReadyOrWaitFuture where Self: 'a; - type RestartNeededFuture<'a> = ReadyOrWaitFuture where Self: 'a; - type ReconnectFuture<'a> = ReadyOrWaitFuture where Self: 'a; + type ReadyFuture<'a> + = ReadyOrWaitFuture + where + Self: 'a; + type RestartNeededFuture<'a> + = ReadyOrWaitFuture + where + Self: 'a; + type ReconnectFuture<'a> + = ReadyOrWaitFuture + where + Self: 'a; fn ready(&self) -> Self::ReadyFuture<'_> { self.acquire_client()