Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixing view/timing issues in consensus #1398

Merged
merged 1 commit into from
Jul 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion consensus/src/da_member.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ pub struct DAMember<

/// needed for type checking
pub _pd: PhantomData<I>,

}

impl<
Expand Down
6 changes: 3 additions & 3 deletions src/tasks/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ where
certs: HashMap::new(),
current_proposal: None,
id: handle.hotshot.inner.id,
qc: None,
qc: None,
};
let filter = FilterEvent(Arc::new(consensus_event_filter));
let consensus_name = "Consensus Task";
Expand Down Expand Up @@ -588,7 +588,7 @@ where
committee_exchange: committee_exchange.into(),
vote_collector: None,
event_stream: event_stream.clone(),
id: handle.hotshot.inner.id
id: handle.hotshot.inner.id,
};
let da_event_handler = HandleEvent(Arc::new(
move |event, mut state: DATaskState<TYPES, I, HotShotSequencingConsensusApi<TYPES, I>>| {
Expand Down Expand Up @@ -660,7 +660,7 @@ where
replica_task_map: HashMap::default(),
relay_task_map: HashMap::default(),
view_sync_timeout: Duration::new(5, 0),
id: handle.hotshot.inner.id
id: handle.hotshot.inner.id,
};
let registry = task_runner.registry.clone();
let view_sync_event_handler =
Expand Down
16 changes: 5 additions & 11 deletions src/traits/election/vrf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,16 @@ use bincode::Options;
// use commit::{Commitment, Committable, RawCommitmentBuilder};
// use derivative::Derivative;
// use espresso_systems_common::hotshot::tag;
use hotshot_types::{
// data::LeafType,
traits::{
election::{
// Checked, ElectionConfig, ElectionError, Membership, TestableElection, VoteToken,
},
// node_implementation::NodeType,
signature_key::{EncodedPublicKey, EncodedSignature, SignatureKey, TestableSignatureKey},
},
use hotshot_types::traits::signature_key::{
EncodedPublicKey, EncodedSignature, SignatureKey, TestableSignatureKey,
};
use hotshot_utils::bincode::bincode_opts;
use jf_primitives::{
// hash_to_group::TEHashToGroup,
signatures::{
// bls_over_bls12381::{BLSSignature, BLSVerKey},
BLSSignatureScheme, SignatureScheme,
BLSSignatureScheme,
SignatureScheme,
},
vrf::{blsvrf::BLSVRFScheme, Vrf},
};
Expand All @@ -35,7 +29,7 @@ use rand::SeedableRng;
// use rand_chacha::ChaChaRng;
use serde::{de, Deserialize, Serialize};
use std::{
collections::{BTreeMap, /* HashMap */ },
collections::BTreeMap,
fmt::Debug,
hash::Hash,
marker::PhantomData,
Expand Down
10 changes: 8 additions & 2 deletions src/traits/networking/centralized_server_network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,10 @@ impl<M: NetworkMsg, K: SignatureKey + 'static, E: ElectionConfig + 'static> Conn
Ok(())
}

async fn inject_consensus_info(&self, _event: ConsensusIntentEvent) -> Result<(), NetworkError> {
async fn inject_consensus_info(
&self,
_event: ConsensusIntentEvent,
) -> Result<(), NetworkError> {
// Not required
Ok(())
}
Expand Down Expand Up @@ -975,7 +978,10 @@ where
.await
}

async fn inject_consensus_info(&self, _event: ConsensusIntentEvent) -> Result<(), NetworkError> {
async fn inject_consensus_info(
&self,
_event: ConsensusIntentEvent,
) -> Result<(), NetworkError> {
// Not required
Ok(())
}
Expand Down
12 changes: 9 additions & 3 deletions src/traits/networking/libp2p_network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ use async_trait::async_trait;
use bimap::BiHashMap;
use bincode::Options;
use hotshot_task::{boxed_sync, BoxSyncFuture};
use hotshot_types::traits::network::ViewMessage;
use hotshot_types::traits::network::ConsensusIntentEvent;
use hotshot_types::traits::network::ViewMessage;
use hotshot_types::{
data::ProposalType,
message::{Message, MessageKind},
Expand Down Expand Up @@ -701,7 +701,10 @@ impl<M: NetworkMsg, K: SignatureKey + 'static> ConnectedNetwork<M, K> for Libp2p
Ok(())
}

async fn inject_consensus_info(&self, _event: ConsensusIntentEvent) -> Result<(), NetworkError> {
async fn inject_consensus_info(
&self,
_event: ConsensusIntentEvent,
) -> Result<(), NetworkError> {
// Not required
Ok(())
}
Expand Down Expand Up @@ -853,7 +856,10 @@ where
self.0.lookup_node(pk).await
}

async fn inject_consensus_info(&self, _event: ConsensusIntentEvent) -> Result<(), NetworkError> {
async fn inject_consensus_info(
&self,
_event: ConsensusIntentEvent,
) -> Result<(), NetworkError> {
// Not required
Ok(())
}
Expand Down
12 changes: 9 additions & 3 deletions src/traits/networking/memory_network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ use async_lock::{Mutex, RwLock};
use async_trait::async_trait;
use bincode::Options;
use dashmap::DashMap;
use hotshot_types::traits::network::ConsensusIntentEvent;
use futures::StreamExt;
use hotshot_task::{boxed_sync, BoxSyncFuture};
use hotshot_types::traits::network::ConsensusIntentEvent;
use hotshot_types::traits::network::ViewMessage;
use hotshot_types::{
data::ProposalType,
Expand Down Expand Up @@ -458,7 +458,10 @@ impl<M: NetworkMsg, K: SignatureKey + 'static> ConnectedNetwork<M, K> for Memory
Ok(())
}

async fn inject_consensus_info(&self, _event: ConsensusIntentEvent) -> Result<(), NetworkError> {
async fn inject_consensus_info(
&self,
_event: ConsensusIntentEvent,
) -> Result<(), NetworkError> {
// Not required
Ok(())
}
Expand Down Expand Up @@ -598,7 +601,10 @@ where
self.0.lookup_node(pk).await
}

async fn inject_consensus_info(&self, _event: ConsensusIntentEvent) -> Result<(), NetworkError> {
async fn inject_consensus_info(
&self,
_event: ConsensusIntentEvent,
) -> Result<(), NetworkError> {
// Not required
Ok(())
}
Expand Down
8 changes: 6 additions & 2 deletions src/traits/networking/web_server_network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1291,7 +1291,9 @@ impl<

// If task already exited we expect an error
let _res = sender
.send(ConsensusIntentEvent::CancelPollForViewSyncCertificate((view_number)))
.send(ConsensusIntentEvent::CancelPollForViewSyncCertificate(
(view_number),
))
.await;
Ok(())
} else {
Expand All @@ -1307,7 +1309,9 @@ impl<

// If task already exited we expect an error
let _res = sender
.send(ConsensusIntentEvent::CancelPollForViewSyncVotes((view_number)))
.send(ConsensusIntentEvent::CancelPollForViewSyncVotes(
(view_number),
))
.await;
Ok(())
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/traits/networking/web_sever_libp2p_fallback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use async_trait::async_trait;
use futures::join;

use hotshot_task::{boxed_sync, BoxSyncFuture};
use hotshot_types::traits::network::ConsensusIntentEvent;
use hotshot_types::traits::network::TestableChannelImplementation;
use hotshot_types::traits::network::TestableNetworkingImplementation;
use hotshot_types::traits::network::ViewMessage;
Expand All @@ -24,7 +25,6 @@ use hotshot_types::{
},
vote::VoteType,
};
use hotshot_types::traits::network::ConsensusIntentEvent;
use std::{marker::PhantomData, sync::Arc};
use tracing::error;
/// A communication channel with 2 networks, where we can fall back to the slower network if the
Expand Down
Loading
Loading