Skip to content

Commit

Permalink
remove consensus, extraneous parameter for update_view, repoint deps
Browse files Browse the repository at this point in the history
  • Loading branch information
pls148 committed Oct 11, 2024
1 parent 297bd91 commit f81c9ca
Show file tree
Hide file tree
Showing 22 changed files with 68 additions and 3,163 deletions.
2 changes: 0 additions & 2 deletions crates/hotshot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,6 @@ impl<TYPES: NodeType, I: NodeImplementation<TYPES>, V: Versions> SystemContext<T
/// Panics if sending genesis fails
#[instrument(skip_all, target = "SystemContext", fields(id = self.id))]
pub async fn start_consensus(&self) {
#[cfg(feature = "dependency-tasks")]
tracing::error!("HotShot is running with the dependency tasks feature enabled!!");

#[cfg(all(feature = "rewind", not(debug_assertions)))]
Expand Down Expand Up @@ -388,7 +387,6 @@ impl<TYPES: NodeType, I: NodeImplementation<TYPES>, V: Versions> SystemContext<T
.await;
}
});
#[cfg(feature = "dependency-tasks")]
{
if let Some(validated_state) = consensus.validated_state_map().get(&self.start_view) {
#[allow(clippy::panic)]
Expand Down
7 changes: 0 additions & 7 deletions crates/hotshot/src/tasks/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,13 +216,6 @@ pub async fn add_consensus_tasks<TYPES: NodeType, I: NodeImplementation<TYPES>,
}

{
#![cfg(not(feature = "dependency-tasks"))]
use hotshot_task_impls::consensus::ConsensusTaskState;

handle.add_task(ConsensusTaskState::<TYPES, I, V>::create_from(handle).await);
}
{
#![cfg(feature = "dependency-tasks")]
use hotshot_task_impls::{
consensus2::Consensus2TaskState, quorum_proposal::QuorumProposalTaskState,
quorum_proposal_recv::QuorumProposalRecvTaskState, quorum_vote::QuorumVoteTaskState,
Expand Down
38 changes: 1 addition & 37 deletions crates/hotshot/src/tasks/task_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use async_compatibility_layer::art::async_spawn;
use async_trait::async_trait;
use chrono::Utc;
use hotshot_task_impls::{
builder::BuilderClient, consensus::ConsensusTaskState, consensus2::Consensus2TaskState,
builder::BuilderClient, consensus2::Consensus2TaskState,
da::DaTaskState, quorum_proposal::QuorumProposalTaskState,
quorum_proposal_recv::QuorumProposalRecvTaskState, quorum_vote::QuorumVoteTaskState,
request::NetworkRequestState, rewind::RewindTaskState, transactions::TransactionTaskState,
Expand Down Expand Up @@ -214,42 +214,6 @@ impl<TYPES: NodeType, I: NodeImplementation<TYPES>, V: Versions> CreateTaskState
}
}

#[async_trait]
impl<TYPES: NodeType, I: NodeImplementation<TYPES>, V: Versions> CreateTaskState<TYPES, I, V>
for ConsensusTaskState<TYPES, I, V>
{
async fn create_from(handle: &SystemContextHandle<TYPES, I, V>) -> Self {
let consensus = handle.hotshot.consensus();

Self {
consensus: OuterConsensus::new(consensus),
instance_state: handle.hotshot.instance_state(),
timeout: handle.hotshot.config.next_view_timeout,
round_start_delay: handle.hotshot.config.round_start_delay,
cur_view: handle.cur_view().await,
cur_view_time: Utc::now().timestamp(),
payload_commitment_and_metadata: None,
vote_collectors: BTreeMap::default(),
timeout_vote_collectors: BTreeMap::default(),
timeout_task: async_spawn(async {}),
spawned_tasks: BTreeMap::new(),
formed_upgrade_certificate: None,
proposal_cert: None,
output_event_stream: handle.hotshot.external_event_stream.0.clone(),
current_proposal: None,
id: handle.hotshot.id,
public_key: handle.public_key().clone(),
private_key: handle.private_key().clone(),
network: Arc::clone(&handle.hotshot.network),
timeout_membership: handle.hotshot.memberships.quorum_membership.clone().into(),
quorum_membership: handle.hotshot.memberships.quorum_membership.clone().into(),
da_membership: handle.hotshot.memberships.da_membership.clone().into(),
storage: Arc::clone(&handle.storage),
upgrade_lock: handle.hotshot.upgrade_lock.clone(),
}
}
}

#[async_trait]
impl<TYPES: NodeType, I: NodeImplementation<TYPES>, V: Versions> CreateTaskState<TYPES, I, V>
for QuorumVoteTaskState<TYPES, I, V>
Expand Down
Loading

0 comments on commit f81c9ca

Please sign in to comment.