Skip to content

Commit

Permalink
Merge branch 'main' into ss/test-fixes-again
Browse files Browse the repository at this point in the history
  • Loading branch information
ss-es committed Jun 17, 2024
2 parents 2051226 + 47e3d35 commit c008384
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 56 deletions.
64 changes: 26 additions & 38 deletions crates/task-impls/src/consensus/helpers.rs
Original file line number Diff line number Diff line change
@@ -1,39 +1,15 @@
#[cfg(not(feature = "dependency-tasks"))]
use core::time::Duration;
#[cfg(not(feature = "dependency-tasks"))]
use std::marker::PhantomData;
use std::{
collections::{HashMap, HashSet},
sync::Arc,
};

#[cfg(not(feature = "dependency-tasks"))]
use anyhow::bail;
use anyhow::{ensure, Context, Result};
#[cfg(not(feature = "dependency-tasks"))]
use async_broadcast::broadcast;
use async_broadcast::Sender;
#[cfg(not(feature = "dependency-tasks"))]
use async_compatibility_layer::art::async_timeout;
#[cfg(not(feature = "dependency-tasks"))]
use async_compatibility_layer::art::{async_sleep, async_spawn};
use async_lock::RwLock;
#[cfg(not(feature = "dependency-tasks"))]
#[cfg(async_executor_impl = "async-std")]
use async_std::task::JoinHandle;
#[cfg(not(feature = "dependency-tasks"))]
use chrono::Utc;
use committable::{Commitment, Committable};
#[cfg(not(feature = "dependency-tasks"))]
use futures::FutureExt;
#[cfg(not(feature = "dependency-tasks"))]
use hotshot_types::{
consensus::CommitmentAndMetadata,
traits::{
node_implementation::{ConsensusTime, NodeImplementation},
storage::Storage,
},
};
use hotshot_types::{
consensus::{Consensus, View},
data::{Leaf, QuorumProposal, ViewChangeEvidence},
Expand All @@ -47,26 +23,38 @@ use hotshot_types::{
utils::{Terminator, ViewInner},
vote::{Certificate, HasViewNumber},
};
#[cfg(not(feature = "dependency-tasks"))]
use hotshot_types::{data::null_block, message::GeneralConsensusMessage, simple_vote::QuorumData};
#[cfg(async_executor_impl = "tokio")]
use tokio::task::JoinHandle;
#[cfg(not(feature = "dependency-tasks"))]
use tracing::error;
use tracing::{debug, info, warn};
#[cfg(not(feature = "dependency-tasks"))]
use vbs::version::Version;

#[cfg(not(feature = "dependency-tasks"))]
use super::ConsensusTaskState;
#[cfg(not(feature = "dependency-tasks"))]
use crate::{
consensus::{update_view, view_change::SEND_VIEW_CHANGE_EVENT},
helpers::AnyhowTracing,
use {
super::ConsensusTaskState,
crate::{
consensus::{update_view, view_change::SEND_VIEW_CHANGE_EVENT},
helpers::AnyhowTracing,
},
crate::{events::ProposalMissing, request::REQUEST_TIMEOUT},
anyhow::bail,
async_broadcast::broadcast,
async_compatibility_layer::art::async_timeout,
async_compatibility_layer::art::{async_sleep, async_spawn},
chrono::Utc,
core::time::Duration,
futures::FutureExt,
hotshot_types::{
consensus::CommitmentAndMetadata,
traits::{
node_implementation::{ConsensusTime, NodeImplementation},
storage::Storage,
},
},
hotshot_types::{data::null_block, message::GeneralConsensusMessage, simple_vote::QuorumData},
std::marker::PhantomData,
tracing::error,
vbs::version::Version,
};

use crate::{events::HotShotEvent, helpers::broadcast_event};
#[cfg(not(feature = "dependency-tasks"))]
use crate::{events::ProposalMissing, request::REQUEST_TIMEOUT};

/// Validate the state and safety and liveness of a proposal then emit
/// a `QuorumProposalValidated` event.
Expand Down
31 changes: 13 additions & 18 deletions crates/task-impls/src/consensus/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,12 @@ use std::{collections::BTreeMap, sync::Arc};

use anyhow::Result;
use async_broadcast::{Receiver, Sender};
#[cfg(not(feature = "dependency-tasks"))]
use async_compatibility_layer::art::async_spawn;
use async_lock::RwLock;
#[cfg(async_executor_impl = "async-std")]
use async_std::task::JoinHandle;
use async_trait::async_trait;
use futures::future::join_all;
use hotshot_task::task::TaskState;
#[cfg(not(feature = "dependency-tasks"))]
use hotshot_types::data::VidDisperseShare;
#[cfg(not(feature = "dependency-tasks"))]
use hotshot_types::message::Proposal;
#[cfg(not(feature = "dependency-tasks"))]
use hotshot_types::vid::vid_scheme;
use hotshot_types::{
consensus::{CommitmentAndMetadata, Consensus},
data::{QuorumProposal, ViewChangeEvidence},
Expand All @@ -29,22 +21,25 @@ use hotshot_types::{
},
vote::HasViewNumber,
};
#[cfg(not(feature = "dependency-tasks"))]
use hotshot_types::{traits::storage::Storage, vote::Certificate};
#[cfg(not(feature = "dependency-tasks"))]
use jf_vid::VidScheme;
#[cfg(async_executor_impl = "tokio")]
use tokio::task::JoinHandle;
#[cfg(not(feature = "dependency-tasks"))]
use tracing::info;
use tracing::{debug, error, instrument, warn};
use vbs::version::Version;

#[cfg(not(feature = "dependency-tasks"))]
use crate::consensus::helpers::{
handle_quorum_proposal_recv, handle_quorum_proposal_validated, publish_proposal_if_able,
update_state_and_vote_if_able,
use {
crate::consensus::helpers::{
handle_quorum_proposal_recv, handle_quorum_proposal_validated, publish_proposal_if_able,
update_state_and_vote_if_able,
},
async_compatibility_layer::art::async_spawn,
hotshot_types::data::VidDisperseShare,
hotshot_types::message::Proposal,
hotshot_types::vid::vid_scheme,
hotshot_types::{traits::storage::Storage, vote::Certificate},
jf_vid::VidScheme,
tracing::info,
};

use crate::{
consensus::view_change::{update_view, DONT_SEND_VIEW_CHANGE_EVENT},
events::{HotShotEvent, HotShotTaskCompleted},
Expand Down

0 comments on commit c008384

Please sign in to comment.