Skip to content

Commit

Permalink
Remove validating/sequencing ambiguity for readability (#1950)
Browse files Browse the repository at this point in the history
* remove validating/sequencing ambiguity for readability

* remove everything but message
  • Loading branch information
rob-maron authored Oct 27, 2023
1 parent 2081882 commit bcccc48
Show file tree
Hide file tree
Showing 39 changed files with 1,010 additions and 2,302 deletions.
70 changes: 33 additions & 37 deletions crates/hotshot/examples/infra/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,15 @@ use hotshot_types::{
block_impl::{VIDBlockPayload, VIDTransaction},
certificate::ViewSyncCertificate,
consensus::ConsensusMetricsValue,
data::{QuorumProposal, SequencingLeaf, TestableLeaf},
data::{Leaf, QuorumProposal, TestableLeaf},
event::{Event, EventType},
message::{Message, SequencingMessage},
traits::{
election::{
CommitteeExchange, ConsensusExchange, Membership, QuorumExchange, ViewSyncExchange,
},
network::CommunicationChannel,
node_implementation::{
CommitteeEx, ExchangesType, NodeType, QuorumEx, SequencingExchanges,
},
node_implementation::{CommitteeEx, Exchanges, ExchangesType, NodeType, QuorumEx},
state::{ConsensusTime, TestableBlock, TestableState},
},
HotShotConfig,
Expand Down Expand Up @@ -141,14 +139,14 @@ pub async fn run_orchestrator<
VIDNETWORK: CommunicationChannel<TYPES, Message<TYPES, NODE>, MEMBERSHIP> + Debug,
NODE: NodeImplementation<
TYPES,
Leaf = SequencingLeaf<TYPES>,
Exchanges = SequencingExchanges<
Leaf = Leaf<TYPES>,
Exchanges = Exchanges<
TYPES,
Message<TYPES, NODE>,
QuorumExchange<
TYPES,
SequencingLeaf<TYPES>,
QuorumProposal<TYPES, SequencingLeaf<TYPES>>,
Leaf<TYPES>,
QuorumProposal<TYPES, Leaf<TYPES>>,
MEMBERSHIP,
QUORUMNETWORK,
Message<TYPES, NODE>,
Expand All @@ -163,7 +161,7 @@ pub async fn run_orchestrator<
>,
VIDExchange<TYPES, MEMBERSHIP, VIDNETWORK, Message<TYPES, NODE>>,
>,
Storage = MemoryStorage<TYPES, SequencingLeaf<TYPES>>,
Storage = MemoryStorage<TYPES, Leaf<TYPES>>,
ConsensusMessage = SequencingMessage<TYPES, NODE>,
>,
>(
Expand Down Expand Up @@ -206,14 +204,14 @@ pub trait RunDA<
VIDNETWORK: CommunicationChannel<TYPES, Message<TYPES, NODE>, MEMBERSHIP> + Debug,
NODE: NodeImplementation<
TYPES,
Leaf = SequencingLeaf<TYPES>,
Exchanges = SequencingExchanges<
Leaf = Leaf<TYPES>,
Exchanges = Exchanges<
TYPES,
Message<TYPES, NODE>,
QuorumExchange<
TYPES,
SequencingLeaf<TYPES>,
QuorumProposal<TYPES, SequencingLeaf<TYPES>>,
Leaf<TYPES>,
QuorumProposal<TYPES, Leaf<TYPES>>,
MEMBERSHIP,
QUORUMNETWORK,
Message<TYPES, NODE>,
Expand All @@ -228,13 +226,13 @@ pub trait RunDA<
>,
VIDExchange<TYPES, MEMBERSHIP, VIDNETWORK, Message<TYPES, NODE>>,
>,
Storage = MemoryStorage<TYPES, SequencingLeaf<TYPES>>,
Storage = MemoryStorage<TYPES, Leaf<TYPES>>,
ConsensusMessage = SequencingMessage<TYPES, NODE>,
>,
> where
<TYPES as NodeType>::StateType: TestableState,
<TYPES as NodeType>::BlockType: TestableBlock,
SequencingLeaf<TYPES>: TestableLeaf,
Leaf<TYPES>: TestableLeaf,
Self: Sync,
SystemContext<TYPES, NODE>: HotShotType<TYPES, NODE>,
{
Expand All @@ -254,10 +252,8 @@ pub trait RunDA<
async fn initialize_state_and_hotshot(&self) -> SystemContextHandle<TYPES, NODE> {
let genesis_block = TYPES::BlockType::genesis();
let initializer =
hotshot::HotShotInitializer::<TYPES, SequencingLeaf<TYPES>>::from_genesis(
genesis_block,
)
.expect("Couldn't generate genesis block");
hotshot::HotShotInitializer::<TYPES, Leaf<TYPES>>::from_genesis(genesis_block)
.expect("Couldn't generate genesis block");

let config = self.get_config();

Expand Down Expand Up @@ -464,14 +460,14 @@ impl<
MEMBERSHIP: Membership<TYPES> + Debug,
NODE: NodeImplementation<
TYPES,
Leaf = SequencingLeaf<TYPES>,
Exchanges = SequencingExchanges<
Leaf = Leaf<TYPES>,
Exchanges = Exchanges<
TYPES,
Message<TYPES, NODE>,
QuorumExchange<
TYPES,
SequencingLeaf<TYPES>,
QuorumProposal<TYPES, SequencingLeaf<TYPES>>,
Leaf<TYPES>,
QuorumProposal<TYPES, Leaf<TYPES>>,
MEMBERSHIP,
WebCommChannel<TYPES, NODE, MEMBERSHIP>,
Message<TYPES, NODE>,
Expand All @@ -496,7 +492,7 @@ impl<
Message<TYPES, NODE>,
>,
>,
Storage = MemoryStorage<TYPES, SequencingLeaf<TYPES>>,
Storage = MemoryStorage<TYPES, Leaf<TYPES>>,
ConsensusMessage = SequencingMessage<TYPES, NODE>,
>,
>
Expand All @@ -512,7 +508,7 @@ impl<
where
<TYPES as NodeType>::StateType: TestableState,
<TYPES as NodeType>::BlockType: TestableBlock,
SequencingLeaf<TYPES>: TestableLeaf,
Leaf<TYPES>: TestableLeaf,
Self: Sync,
{
async fn initialize_networking(
Expand Down Expand Up @@ -632,14 +628,14 @@ impl<
MEMBERSHIP: Membership<TYPES> + Debug,
NODE: NodeImplementation<
TYPES,
Leaf = SequencingLeaf<TYPES>,
Exchanges = SequencingExchanges<
Leaf = Leaf<TYPES>,
Exchanges = Exchanges<
TYPES,
Message<TYPES, NODE>,
QuorumExchange<
TYPES,
SequencingLeaf<TYPES>,
QuorumProposal<TYPES, SequencingLeaf<TYPES>>,
Leaf<TYPES>,
QuorumProposal<TYPES, Leaf<TYPES>>,
MEMBERSHIP,
Libp2pCommChannel<TYPES, NODE, MEMBERSHIP>,
Message<TYPES, NODE>,
Expand All @@ -664,7 +660,7 @@ impl<
Message<TYPES, NODE>,
>,
>,
Storage = MemoryStorage<TYPES, SequencingLeaf<TYPES>>,
Storage = MemoryStorage<TYPES, Leaf<TYPES>>,
ConsensusMessage = SequencingMessage<TYPES, NODE>,
>,
>
Expand All @@ -680,7 +676,7 @@ impl<
where
<TYPES as NodeType>::StateType: TestableState,
<TYPES as NodeType>::BlockType: TestableBlock,
SequencingLeaf<TYPES>: TestableLeaf,
Leaf<TYPES>: TestableLeaf,
Self: Sync,
{
async fn initialize_networking(
Expand Down Expand Up @@ -865,14 +861,14 @@ pub async fn main_entry_point<
VIDNETWORK: CommunicationChannel<TYPES, Message<TYPES, NODE>, MEMBERSHIP> + Debug,
NODE: NodeImplementation<
TYPES,
Leaf = SequencingLeaf<TYPES>,
Exchanges = SequencingExchanges<
Leaf = Leaf<TYPES>,
Exchanges = Exchanges<
TYPES,
Message<TYPES, NODE>,
QuorumExchange<
TYPES,
SequencingLeaf<TYPES>,
QuorumProposal<TYPES, SequencingLeaf<TYPES>>,
Leaf<TYPES>,
QuorumProposal<TYPES, Leaf<TYPES>>,
MEMBERSHIP,
QUORUMNETWORK,
Message<TYPES, NODE>,
Expand All @@ -887,7 +883,7 @@ pub async fn main_entry_point<
>,
VIDExchange<TYPES, MEMBERSHIP, VIDNETWORK, Message<TYPES, NODE>>,
>,
Storage = MemoryStorage<TYPES, SequencingLeaf<TYPES>>,
Storage = MemoryStorage<TYPES, Leaf<TYPES>>,
ConsensusMessage = SequencingMessage<TYPES, NODE>,
>,
RUNDA: RunDA<TYPES, MEMBERSHIP, DANETWORK, QUORUMNETWORK, VIEWSYNCNETWORK, VIDNETWORK, NODE>,
Expand All @@ -896,7 +892,7 @@ pub async fn main_entry_point<
) where
<TYPES as NodeType>::StateType: TestableState,
<TYPES as NodeType>::BlockType: TestableBlock,
SequencingLeaf<TYPES>: TestableLeaf,
Leaf<TYPES>: TestableLeaf,
{
setup_logging();
setup_backtrace();
Expand Down
10 changes: 5 additions & 5 deletions crates/hotshot/examples/libp2p/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ use hotshot::{
};
use hotshot_types::{
certificate::ViewSyncCertificate,
data::{DAProposal, QuorumProposal, SequencingLeaf},
data::{DAProposal, Leaf, QuorumProposal},
message::{Message, SequencingMessage},
traits::{
election::{CommitteeExchange, QuorumExchange, VIDExchange, ViewSyncExchange},
node_implementation::{ChannelMaps, NodeImplementation, NodeType, SequencingExchanges},
node_implementation::{ChannelMaps, Exchanges, NodeImplementation, NodeType},
},
vote::{DAVote, QuorumVote, ViewSyncVote},
};
Expand All @@ -22,7 +22,7 @@ use std::fmt::Debug;
#[derive(Clone, Debug, Deserialize, Serialize, Hash, PartialEq, Eq)]
pub struct NodeImpl {}

pub type ThisLeaf = SequencingLeaf<DemoTypes>;
pub type ThisLeaf = Leaf<DemoTypes>;
pub type ThisMembership =
GeneralStaticCommittee<DemoTypes, ThisLeaf, <DemoTypes as NodeType>::SignatureKey>;
pub type DANetwork = Libp2pCommChannel<DemoTypes, NodeImpl, ThisMembership>;
Expand All @@ -41,8 +41,8 @@ pub type ThisViewSyncVote = ViewSyncVote<DemoTypes>;

impl NodeImplementation<DemoTypes> for NodeImpl {
type Storage = MemoryStorage<DemoTypes, Self::Leaf>;
type Leaf = SequencingLeaf<DemoTypes>;
type Exchanges = SequencingExchanges<
type Leaf = Leaf<DemoTypes>;
type Exchanges = Exchanges<
DemoTypes,
Message<DemoTypes, Self>,
QuorumExchange<
Expand Down
10 changes: 5 additions & 5 deletions crates/hotshot/examples/web-server-da/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ use hotshot::{
};
use hotshot_types::{
certificate::ViewSyncCertificate,
data::{DAProposal, QuorumProposal, SequencingLeaf},
data::{DAProposal, Leaf, QuorumProposal},
message::{Message, SequencingMessage},
traits::{
election::{CommitteeExchange, QuorumExchange, VIDExchange, ViewSyncExchange},
node_implementation::{ChannelMaps, NodeImplementation, NodeType, SequencingExchanges},
node_implementation::{ChannelMaps, Exchanges, NodeImplementation, NodeType},
},
vote::{DAVote, QuorumVote, ViewSyncVote},
};
Expand All @@ -22,7 +22,7 @@ use std::fmt::Debug;
#[derive(Clone, Debug, Deserialize, Serialize, Hash, PartialEq, Eq)]
pub struct NodeImpl {}

pub type ThisLeaf = SequencingLeaf<DemoTypes>;
pub type ThisLeaf = Leaf<DemoTypes>;
pub type ThisMembership =
GeneralStaticCommittee<DemoTypes, ThisLeaf, <DemoTypes as NodeType>::SignatureKey>;
pub type DANetwork = WebCommChannel<DemoTypes, NodeImpl, ThisMembership>;
Expand All @@ -41,8 +41,8 @@ pub type ThisViewSyncVote = ViewSyncVote<DemoTypes>;

impl NodeImplementation<DemoTypes> for NodeImpl {
type Storage = MemoryStorage<DemoTypes, Self::Leaf>;
type Leaf = SequencingLeaf<DemoTypes>;
type Exchanges = SequencingExchanges<
type Leaf = Leaf<DemoTypes>;
type Exchanges = Exchanges<
DemoTypes,
Message<DemoTypes, Self>,
QuorumExchange<
Expand Down
Loading

0 comments on commit bcccc48

Please sign in to comment.