From 62070afd09fb7171ca502cfba63b07b098149838 Mon Sep 17 00:00:00 2001 From: ss-es <155648797+ss-es@users.noreply.github.com> Date: Mon, 29 Jul 2024 13:34:20 -0400 Subject: [PATCH] ungate dependency task modules --- crates/hotshot/src/tasks/mod.rs | 14 +++++++------- .../src/traits/election/static_committee.rs | 6 ++++-- .../election/static_committee_leader_two_views.rs | 6 ++++-- crates/task-impls/src/quorum_proposal/handlers.rs | 2 -- crates/task-impls/src/quorum_proposal/mod.rs | 2 -- .../src/quorum_proposal_recv/handlers.rs | 1 - crates/task-impls/src/quorum_proposal_recv/mod.rs | 1 - crates/task-impls/src/quorum_vote/handlers.rs | 2 -- crates/task-impls/src/quorum_vote/mod.rs | 2 -- 9 files changed, 15 insertions(+), 21 deletions(-) diff --git a/crates/hotshot/src/tasks/mod.rs b/crates/hotshot/src/tasks/mod.rs index a370034a97..dbaa964bc8 100644 --- a/crates/hotshot/src/tasks/mod.rs +++ b/crates/hotshot/src/tasks/mod.rs @@ -9,15 +9,8 @@ use async_compatibility_layer::art::{async_sleep, async_spawn}; use async_lock::RwLock; use async_trait::async_trait; use hotshot_task::task::Task; -#[cfg(not(feature = "dependency-tasks"))] -use hotshot_task_impls::consensus::ConsensusTaskState; #[cfg(feature = "rewind")] use hotshot_task_impls::rewind::RewindTaskState; -#[cfg(feature = "dependency-tasks")] -use hotshot_task_impls::{ - consensus2::Consensus2TaskState, quorum_proposal::QuorumProposalTaskState, - quorum_proposal_recv::QuorumProposalRecvTaskState, quorum_vote::QuorumVoteTaskState, -}; use hotshot_task_impls::{ da::DaTaskState, events::HotShotEvent, @@ -191,10 +184,17 @@ pub async fn add_consensus_tasks>( { #![cfg(not(feature = "dependency-tasks"))] + use hotshot_task_impls::consensus::ConsensusTaskState; + handle.add_task(ConsensusTaskState::::create_from(handle).await); } { #![cfg(feature = "dependency-tasks")] + use hotshot_task_impls::{ + consensus2::Consensus2TaskState, quorum_proposal::QuorumProposalTaskState, + quorum_proposal_recv::QuorumProposalRecvTaskState, quorum_vote::QuorumVoteTaskState, + }; + handle.add_task(QuorumProposalTaskState::::create_from(handle).await); handle.add_task(QuorumVoteTaskState::::create_from(handle).await); handle.add_task(QuorumProposalRecvTaskState::::create_from(handle).await); diff --git a/crates/hotshot/src/traits/election/static_committee.rs b/crates/hotshot/src/traits/election/static_committee.rs index 3163d3b532..255c446401 100644 --- a/crates/hotshot/src/traits/election/static_committee.rs +++ b/crates/hotshot/src/traits/election/static_committee.rs @@ -1,12 +1,14 @@ use std::{marker::PhantomData, num::NonZeroU64}; use ethereum_types::U256; -use hotshot_types::traits::network::Topic; // use ark_bls12_381::Parameters as Param381; use hotshot_types::traits::signature_key::StakeTableEntryType; use hotshot_types::{ signature_key::BLSPubKey, - traits::{election::Membership, node_implementation::NodeType, signature_key::SignatureKey}, + traits::{ + election::Membership, network::Topic, node_implementation::NodeType, + signature_key::SignatureKey, + }, PeerConfig, }; #[cfg(feature = "randomized-leader-election")] diff --git a/crates/hotshot/src/traits/election/static_committee_leader_two_views.rs b/crates/hotshot/src/traits/election/static_committee_leader_two_views.rs index 882b7565c1..d114a5d904 100644 --- a/crates/hotshot/src/traits/election/static_committee_leader_two_views.rs +++ b/crates/hotshot/src/traits/election/static_committee_leader_two_views.rs @@ -1,12 +1,14 @@ use std::{marker::PhantomData, num::NonZeroU64}; use ethereum_types::U256; -use hotshot_types::traits::network::Topic; // use ark_bls12_381::Parameters as Param381; use hotshot_types::traits::signature_key::StakeTableEntryType; use hotshot_types::{ signature_key::BLSPubKey, - traits::{election::Membership, node_implementation::NodeType, signature_key::SignatureKey}, + traits::{ + election::Membership, network::Topic, node_implementation::NodeType, + signature_key::SignatureKey, + }, PeerConfig, }; use tracing::debug; diff --git a/crates/task-impls/src/quorum_proposal/handlers.rs b/crates/task-impls/src/quorum_proposal/handlers.rs index 20f8dbbacd..b344d4679f 100644 --- a/crates/task-impls/src/quorum_proposal/handlers.rs +++ b/crates/task-impls/src/quorum_proposal/handlers.rs @@ -1,8 +1,6 @@ //! This module holds the dependency task for the QuorumProposalTask. It is spawned whenever an event that could //! initiate a proposal occurs. -#![cfg(feature = "dependency-tasks")] - use std::{marker::PhantomData, sync::Arc, time::Duration}; use anyhow::{ensure, Context, Result}; diff --git a/crates/task-impls/src/quorum_proposal/mod.rs b/crates/task-impls/src/quorum_proposal/mod.rs index ea0059b230..596ff0f7d7 100644 --- a/crates/task-impls/src/quorum_proposal/mod.rs +++ b/crates/task-impls/src/quorum_proposal/mod.rs @@ -1,5 +1,3 @@ -#![cfg(feature = "dependency-tasks")] - use std::{collections::HashMap, sync::Arc}; use anyhow::Result; diff --git a/crates/task-impls/src/quorum_proposal_recv/handlers.rs b/crates/task-impls/src/quorum_proposal_recv/handlers.rs index e64fefa9af..fdfafb6666 100644 --- a/crates/task-impls/src/quorum_proposal_recv/handlers.rs +++ b/crates/task-impls/src/quorum_proposal_recv/handlers.rs @@ -1,5 +1,4 @@ #![allow(dead_code)] -#![cfg(feature = "dependency-tasks")] use std::sync::Arc; diff --git a/crates/task-impls/src/quorum_proposal_recv/mod.rs b/crates/task-impls/src/quorum_proposal_recv/mod.rs index 4d79419c2f..80a53375e6 100644 --- a/crates/task-impls/src/quorum_proposal_recv/mod.rs +++ b/crates/task-impls/src/quorum_proposal_recv/mod.rs @@ -1,5 +1,4 @@ #![allow(unused_imports)] -#![cfg(feature = "dependency-tasks")] use std::{collections::BTreeMap, sync::Arc}; diff --git a/crates/task-impls/src/quorum_vote/handlers.rs b/crates/task-impls/src/quorum_vote/handlers.rs index 6f29c5f701..8de6d2eea6 100644 --- a/crates/task-impls/src/quorum_vote/handlers.rs +++ b/crates/task-impls/src/quorum_vote/handlers.rs @@ -1,5 +1,3 @@ -#![cfg(feature = "dependency-tasks")] - use std::sync::Arc; use anyhow::Result; diff --git a/crates/task-impls/src/quorum_vote/mod.rs b/crates/task-impls/src/quorum_vote/mod.rs index 6bc60beb08..5314a27f57 100644 --- a/crates/task-impls/src/quorum_vote/mod.rs +++ b/crates/task-impls/src/quorum_vote/mod.rs @@ -1,5 +1,3 @@ -#![cfg(feature = "dependency-tasks")] - use std::{collections::HashMap, sync::Arc}; use anyhow::{bail, ensure, Context, Result};