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

Remove NodeImplementation Generics from Network Types #2073

Merged
merged 12 commits into from
Nov 20, 2023
Merged
3 changes: 0 additions & 3 deletions crates/hotshot/examples/combined/all.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use async_compatibility_layer::art::async_spawn;
use async_compatibility_layer::channel::oneshot;
use async_compatibility_layer::logging::{setup_backtrace, setup_logging};
use clap::Parser;
use hotshot::demo::DemoMembership;
use hotshot::demo::DemoTypes;
use hotshot_orchestrator::client::ValidatorArgs;
use hotshot_orchestrator::config::NetworkConfig;
Expand Down Expand Up @@ -65,7 +64,6 @@ async fn main() {
// orchestrator
async_spawn(run_orchestrator::<
DemoTypes,
DemoMembership,
DANetwork,
QuorumNetwork,
ViewSyncNetwork,
Expand All @@ -87,7 +85,6 @@ async fn main() {
let node = async_spawn(async move {
infra::main_entry_point::<
DemoTypes,
DemoMembership,
DANetwork,
QuorumNetwork,
ViewSyncNetwork,
Expand Down
2 changes: 0 additions & 2 deletions crates/hotshot/examples/combined/multi-validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ use tracing::instrument;
use types::VIDNetwork;

use crate::types::{DANetwork, NodeImpl, QuorumNetwork, ThisRun, ViewSyncNetwork};
use hotshot::demo::DemoMembership;

pub mod types;

Expand Down Expand Up @@ -50,7 +49,6 @@ async fn main() {
let node = async_spawn(async move {
infra::main_entry_point::<
DemoTypes,
DemoMembership,
DANetwork,
QuorumNetwork,
ViewSyncNetwork,
Expand Down
13 changes: 3 additions & 10 deletions crates/hotshot/examples/combined/orchestrator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use types::VIDNetwork;
use crate::infra::run_orchestrator;
use crate::infra::OrchestratorArgs;
use crate::types::{DANetwork, NodeImpl, QuorumNetwork, ViewSyncNetwork};
use hotshot::demo::DemoMembership;

#[path = "../infra/mod.rs"]
pub mod infra;
Expand All @@ -25,14 +24,8 @@ async fn main() {
setup_backtrace();
let args = OrchestratorArgs::parse();

run_orchestrator::<
DemoTypes,
DemoMembership,
DANetwork,
QuorumNetwork,
ViewSyncNetwork,
VIDNetwork,
NodeImpl,
>(args)
run_orchestrator::<DemoTypes, DANetwork, QuorumNetwork, ViewSyncNetwork, VIDNetwork, NodeImpl>(
args,
)
.await;
}
28 changes: 12 additions & 16 deletions crates/hotshot/examples/combined/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use hotshot::{
traits::implementations::{CombinedCommChannel, MemoryStorage},
};
use hotshot_types::{
message::{Message, SequencingMessage},
message::Message,
traits::{
election::{CommitteeExchange, QuorumExchange, VIDExchange, ViewSyncExchange},
node_implementation::{ChannelMaps, Exchanges, NodeImplementation, NodeType},
Expand All @@ -17,32 +17,28 @@ use std::fmt::Debug;
#[derive(Clone, Debug, Deserialize, Serialize, Hash, PartialEq, Eq)]
pub struct NodeImpl {}

pub type DANetwork = CombinedCommChannel<DemoTypes, NodeImpl, DemoMembership>;
pub type VIDNetwork = CombinedCommChannel<DemoTypes, NodeImpl, DemoMembership>;
pub type QuorumNetwork = CombinedCommChannel<DemoTypes, NodeImpl, DemoMembership>;
pub type ViewSyncNetwork = CombinedCommChannel<DemoTypes, NodeImpl, DemoMembership>;
pub type DANetwork = CombinedCommChannel<DemoTypes>;
pub type VIDNetwork = CombinedCommChannel<DemoTypes>;
pub type QuorumNetwork = CombinedCommChannel<DemoTypes>;
pub type ViewSyncNetwork = CombinedCommChannel<DemoTypes>;

pub type ThisViewSyncVote = ViewSyncVote<DemoTypes>;

impl NodeImplementation<DemoTypes> for NodeImpl {
type Storage = MemoryStorage<DemoTypes>;
type Exchanges = Exchanges<
DemoTypes,
Message<DemoTypes, Self>,
QuorumExchange<DemoTypes, DemoMembership, QuorumNetwork, Message<DemoTypes, Self>>,
CommitteeExchange<DemoTypes, DemoMembership, DANetwork, Message<DemoTypes, Self>>,
ViewSyncExchange<DemoTypes, DemoMembership, ViewSyncNetwork, Message<DemoTypes, Self>>,
VIDExchange<DemoTypes, DemoMembership, VIDNetwork, Message<DemoTypes, Self>>,
Message<DemoTypes>,
QuorumExchange<DemoTypes, DemoMembership, QuorumNetwork, Message<DemoTypes>>,
CommitteeExchange<DemoTypes, DemoMembership, DANetwork, Message<DemoTypes>>,
ViewSyncExchange<DemoTypes, DemoMembership, ViewSyncNetwork, Message<DemoTypes>>,
VIDExchange<DemoTypes, DemoMembership, VIDNetwork, Message<DemoTypes>>,
>;
type ConsensusMessage = SequencingMessage<DemoTypes, Self>;

fn new_channel_maps(
start_view: <DemoTypes as NodeType>::Time,
) -> (
ChannelMaps<DemoTypes, Self>,
Option<ChannelMaps<DemoTypes, Self>>,
) {
) -> (ChannelMaps<DemoTypes>, Option<ChannelMaps<DemoTypes>>) {
(ChannelMaps::new(start_view), None)
}
}
pub type ThisRun = CombinedDARun<DemoTypes, NodeImpl, DemoMembership>;
pub type ThisRun = CombinedDARun<DemoTypes>;
2 changes: 0 additions & 2 deletions crates/hotshot/examples/combined/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use tracing::{info, instrument};
use types::VIDNetwork;

use crate::types::{DANetwork, NodeImpl, QuorumNetwork, ThisRun, ViewSyncNetwork};
use hotshot::demo::DemoMembership;

use hotshot_orchestrator::client::ValidatorArgs;

Expand All @@ -30,7 +29,6 @@ async fn main() {
);
infra::main_entry_point::<
DemoTypes,
DemoMembership,
DANetwork,
QuorumNetwork,
ViewSyncNetwork,
Expand Down
Loading
Loading