Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into 2584-fault_provingg…
Browse files Browse the repository at this point in the history
…lobal_roots-populate-tables-for-upgrade-transactions
  • Loading branch information
acerone85 committed Feb 5, 2025
2 parents 9e38374 + a7e20df commit 735062d
Show file tree
Hide file tree
Showing 16 changed files with 23 additions and 36 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

### Added
### Added
- [2668](https://github.com/FuelLabs/fuel-core/pull/2668): Expose gas price service test helpers
- [2621](https://github.com/FuelLabs/fuel-core/pull/2598): Global merkle root storage updates process upgrade transactions.

## [Version 0.41.5]
Expand Down
1 change: 0 additions & 1 deletion crates/fuel-core/src/graphql_api/api_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ impl RunnableService for GraphqlService {
}
}

#[async_trait::async_trait]
impl RunnableTask for Task {
async fn run(&mut self, _: &mut StateWatcher) -> TaskNextAction {
match self.server.as_mut().await {
Expand Down
1 change: 0 additions & 1 deletion crates/fuel-core/src/graphql_api/worker_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,6 @@ where
Ok(())
}

#[async_trait::async_trait]
impl<TxPool, D> RunnableTask for Task<TxPool, D>
where
TxPool: ports::worker::TxPool,
Expand Down
1 change: 0 additions & 1 deletion crates/fuel-core/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,6 @@ impl RunnableService for Task {
}
}

#[async_trait::async_trait]
impl RunnableTask for Task {
#[tracing::instrument(skip_all)]
async fn run(&mut self, watcher: &mut StateWatcher) -> TaskNextAction {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ impl SharedState {
}
}

#[async_trait::async_trait]
impl RunnableTask for Task {
async fn run(&mut self, watcher: &mut StateWatcher) -> TaskNextAction {
tokio::select! {
Expand Down
1 change: 0 additions & 1 deletion crates/services/consensus_module/poa/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,6 @@ where
}
}

#[async_trait::async_trait]
impl<T, B, I, S, PB, C> RunnableTask for MainTask<T, B, I, S, PB, C>
where
T: TransactionPool,
Expand Down
3 changes: 1 addition & 2 deletions crates/services/consensus_module/poa/src/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ impl RunnableService for SyncTask {
}
}

#[async_trait::async_trait]
impl RunnableTask for SyncTask {
async fn run(&mut self, watcher: &mut StateWatcher) -> TaskNextAction {
let tick: BoxFuture<tokio::time::Instant> = if let Some(timer) = &mut self.timer {
Expand Down Expand Up @@ -329,7 +328,7 @@ mod tests {
}
}

/// Helper function that creates a `SyncTask` with a given configuration
/// Helper function that creates a `SyncTask` with a given configuration
fn configure_sync_task(
min_connected_reserved_peers: usize,
connections_stream: impl IntoIterator<Item = usize>,
Expand Down
2 changes: 0 additions & 2 deletions crates/services/gas_price_service/src/v0/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use crate::{
v0::algorithm::SharedV0Algorithm,
};
use anyhow::anyhow;
use async_trait::async_trait;
use fuel_core_services::{
RunnableTask,
StateWatcher,
Expand Down Expand Up @@ -137,7 +136,6 @@ where
Ok(())
}
}
#[async_trait]
impl<L2, Metadata> RunnableTask for GasPriceServiceV0<L2, Metadata>
where
L2: L2BlockSource,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ where
}
}

#[async_trait::async_trait]
impl<Source> RunnableTask for DaSourceService<Source>
where
Source: DaBlockCostsSource,
Expand Down
7 changes: 3 additions & 4 deletions crates/services/gas_price_service/src/v1/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,12 @@ where
}
}

#[cfg(test)]
#[cfg(any(test, feature = "test-helpers"))]
pub fn latest_l2_block(&self) -> &AtomicU32 {
&self.latest_l2_block
}

#[cfg(test)]
#[cfg(any(test, feature = "test-helpers"))]
pub fn initial_recorded_height(&self) -> Option<BlockHeight> {
self.initial_recorded_height
}
Expand Down Expand Up @@ -236,7 +236,7 @@ where
self.shared_algo.clone()
}

#[cfg(test)]
#[cfg(any(test, feature = "test-helpers"))]
pub fn storage_tx_provider(&self) -> &AtomicStorage {
&self.storage_tx_provider
}
Expand Down Expand Up @@ -406,7 +406,6 @@ where
}
}

#[async_trait]
impl<L2, DA, AtomicStorage> RunnableTask for GasPriceServiceV1<L2, DA, AtomicStorage>
where
L2: L2BlockSource,
Expand Down
11 changes: 8 additions & 3 deletions crates/services/p2p/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,6 @@ where
}

// TODO: Add tests https://github.com/FuelLabs/fuel-core/issues/1275
#[async_trait::async_trait]
impl<P, V, B, T> RunnableTask for Task<P, V, B, T>
where
P: TaskP2PService + 'static,
Expand Down Expand Up @@ -1019,8 +1018,14 @@ where
tracing::error!("Failed to perform peer heartbeat reputation checks: {:?}", e);
}
}
self.next_check_time += self.heartbeat_check_interval;
TaskNextAction::Continue

if let Some(next_check_time) = self.next_check_time.checked_add(self.heartbeat_check_interval) {
self.next_check_time = next_check_time;
TaskNextAction::Continue
} else {
tracing::error!("Next check time overflowed");
TaskNextAction::Stop
}
}
}
}
Expand Down
1 change: 0 additions & 1 deletion crates/services/relayer/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ where
}
}

#[async_trait]
impl<P, D> RunnableTask for Task<P, D>
where
P: Middleware<Error = ProviderError> + 'static,
Expand Down
1 change: 0 additions & 1 deletion crates/services/shared-sequencer/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ where
}
}

#[async_trait]
impl<S> RunnableTask for Task<S>
where
S: Signer + 'static,
Expand Down
22 changes: 9 additions & 13 deletions crates/services/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ impl From<Result<bool, anyhow::Error>> for TaskNextAction {

/// The trait is implemented by the service task and contains a single iteration of the infinity
/// loop.
#[async_trait::async_trait]
pub trait RunnableTask: Send {
/// This function should contain the main business logic of the service task. It will run until
/// the service either returns false, panics or a stop signal is received.
Expand All @@ -134,10 +133,13 @@ pub trait RunnableTask: Send {
/// `State::Started`. So first, the `run` method should return a value, and after, the service
/// will stop. If the service should react to the state change earlier, it should handle it in
/// the `run` loop on its own. See [`StateWatcher::while_started`].
async fn run(&mut self, watcher: &mut StateWatcher) -> TaskNextAction;
fn run(
&mut self,
watcher: &mut StateWatcher,
) -> impl core::future::Future<Output = TaskNextAction> + Send;

/// Gracefully shutdowns the task after the end of the execution cycle.
async fn shutdown(self) -> anyhow::Result<()>;
fn shutdown(self) -> impl core::future::Future<Output = anyhow::Result<()>> + Send;
}

/// The service runner manages the lifecycle, execution and error handling of a `RunnableService`.
Expand Down Expand Up @@ -458,7 +460,6 @@ fn panic_to_string(e: Box<dyn core::any::Any + Send>) -> String {
#[cfg(test)]
mod tests {
use super::*;
use futures::future::BoxFuture;

mockall::mock! {
Service {}
Expand All @@ -480,16 +481,11 @@ mod tests {
mockall::mock! {
Task {}

#[async_trait::async_trait]
impl RunnableTask for Task {
fn run<'_self, '_state, 'a>(
&'_self mut self,
state: &'_state mut StateWatcher
) -> BoxFuture<'a, TaskNextAction>
where
'_self: 'a,
'_state: 'a,
Self: Sync + 'a;
fn run(
&mut self,
state: &mut StateWatcher
) -> impl core::future::Future<Output = TaskNextAction> + Send;

async fn shutdown(self) -> anyhow::Result<()>;
}
Expand Down
2 changes: 0 additions & 2 deletions crates/services/sync/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ where
}
}

#[async_trait::async_trait]
impl<P, E, C> RunnableTask for SyncTask<P, E, C>
where
P: PeerToPeerPort + Send + Sync + 'static,
Expand Down Expand Up @@ -171,7 +170,6 @@ where
}
}

#[async_trait::async_trait]
impl<P, E, C> RunnableTask for ImportTask<P, E, C>
where
P: PeerToPeerPort + Send + Sync + 'static,
Expand Down
1 change: 0 additions & 1 deletion crates/services/txpool_v2/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,6 @@ where
}
}

#[async_trait::async_trait]
impl<View> RunnableTask for Task<View>
where
View: TxPoolPersistentStorage,
Expand Down

0 comments on commit 735062d

Please sign in to comment.