From 4aca1e2b88f8835f0331b96e9168d8ad5b4c6b04 Mon Sep 17 00:00:00 2001 From: Daniel Savu <23065004+daniel-savu@users.noreply.github.com> Date: Thu, 27 Jun 2024 17:37:42 +0100 Subject: [PATCH] try without the new dep --- Cargo.lock | 1 - ethers-middleware/Cargo.toml | 1 - ethers-middleware/src/gas_escalator/mod.rs | 26 +++++++--------------- 3 files changed, 8 insertions(+), 20 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3afb1ce88..3ecf6d76f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1392,7 +1392,6 @@ dependencies = [ "ethers-providers", "ethers-signers", "ethers-solc", - "futures-channel", "futures-locks", "futures-util", "hex", diff --git a/ethers-middleware/Cargo.toml b/ethers-middleware/Cargo.toml index 5a1541f62..b53788bf8 100644 --- a/ethers-middleware/Cargo.toml +++ b/ethers-middleware/Cargo.toml @@ -27,7 +27,6 @@ serde = { version = "1.0.124", default-features = false, features = ["derive"] } thiserror = { version = "1.0", default-features = false } futures-util = { version = "^0.3" } futures-locks = { version = "0.7", default-features = false } -futures-channel.workspace = "0.2.9" tracing = { version = "0.1.37", default-features = false } tracing-futures = { version = "0.2.5", default-features = false } diff --git a/ethers-middleware/src/gas_escalator/mod.rs b/ethers-middleware/src/gas_escalator/mod.rs index 8a7619c30..5fc1c2725 100644 --- a/ethers-middleware/src/gas_escalator/mod.rs +++ b/ethers-middleware/src/gas_escalator/mod.rs @@ -6,7 +6,7 @@ pub use linear::LinearGasPrice; use async_trait::async_trait; -use futures_channel::oneshot; +// use futures_channel::oneshot; use futures_util::{lock::Mutex, select_biased}; use instant::Instant; use std::{pin::Pin, sync::Arc}; @@ -60,7 +60,7 @@ pub(crate) struct GasEscalatorMiddlewareInternal { /// The transactions which are currently being monitored for escalation #[allow(clippy::type_complexity)] pub txs: ToEscalate, - _background: oneshot::Sender<()>, + // _background: oneshot::Sender<()>, } /// A Gas escalator allows bumping transactions' gas price to avoid getting them @@ -192,7 +192,7 @@ where E: GasEscalator + 'static, M: 'static, { - let (tx, rx) = oneshot::channel(); + // let (tx, rx) = oneshot::channel(); let inner = Arc::new(inner); let txs: ToEscalate = Default::default(); @@ -200,10 +200,10 @@ where let this = Arc::new(GasEscalatorMiddlewareInternal { inner: inner.clone(), txs: txs.clone(), - _background: tx, + // _background: tx, }); - let esc = EscalationTask { inner, escalator, frequency, txs, shutdown: rx }; + let esc = EscalationTask { inner, escalator, frequency, txs }; { spawn(esc.escalate().instrument(tracing::debug_span!("gas-escalation"))); @@ -220,19 +220,13 @@ pub struct EscalationTask { escalator: E, frequency: Frequency, txs: ToEscalate, - shutdown: oneshot::Receiver<()>, + // shutdown: oneshot::Receiver<()>, } #[cfg(not(target_arch = "wasm32"))] impl EscalationTask { - pub fn new( - inner: M, - escalator: E, - frequency: Frequency, - txs: ToEscalate, - shutdown: oneshot::Receiver<()>, - ) -> Self { - Self { inner, escalator, frequency, txs, shutdown } + pub fn new(inner: M, escalator: E, frequency: Frequency, txs: ToEscalate) -> Self { + Self { inner, escalator, frequency, txs } } async fn escalate(mut self) -> Result<(), GasEscalatorError> @@ -256,10 +250,6 @@ impl EscalationTask { loop { select_biased! { - _ = &mut self.shutdown => { - tracing::debug!("Shutting down escalation task, middleware has gone away"); - return Ok(()) - } opt = watcher.next() => { if opt.is_none() { tracing::error!("timing future has gone away");