Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into bf/payload-commit-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
bfish713 committed Jan 24, 2024
2 parents 5cbb87c + 875edca commit 835b058
Show file tree
Hide file tree
Showing 18 changed files with 627 additions and 106 deletions.
36 changes: 18 additions & 18 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ jobs:
with:
name: binaries-amd64-${{ matrix.just_variants }}
path: |
target/debug/examples/counter
target/debug/examples/multi-validator-libp2p
target/debug/examples/orchestrator-libp2p
target/debug/examples/validator-libp2p
target/debug/examples/multi-validator-webserver
target/debug/examples/multi-webserver
target/debug/examples/webserver
target/debug/examples/orchestrator-webserver
target/debug/examples/validator-webserver
target/release/examples/counter
target/release/examples/multi-validator-libp2p
target/release/examples/orchestrator-libp2p
target/release/examples/validator-libp2p
target/release/examples/multi-validator-webserver
target/release/examples/multi-webserver
target/release/examples/webserver
target/release/examples/orchestrator-webserver
target/release/examples/validator-webserver
build-arm:
strategy:
Expand Down Expand Up @@ -98,15 +98,15 @@ jobs:
with:
name: binaries-aarch64-${{ matrix.just_variants }}
path: |
target/debug/examples/counter
target/debug/examples/multi-validator-libp2p
target/debug/examples/orchestrator-libp2p
target/debug/examples/validator-libp2p
target/debug/examples/multi-validator-webserver
target/debug/examples/multi-webserver
target/debug/examples/webserver
target/debug/examples/orchestrator-webserver
target/debug/examples/validator-webserver
target/release/examples/counter
target/release/examples/multi-validator-libp2p
target/release/examples/orchestrator-libp2p
target/release/examples/validator-libp2p
target/release/examples/multi-validator-webserver
target/release/examples/multi-webserver
target/release/examples/webserver
target/release/examples/orchestrator-webserver
target/release/examples/validator-webserver
build-dockers:
strategy:
Expand Down
12 changes: 6 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 17 additions & 16 deletions crates/hotshot/examples/infra/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,22 +239,22 @@ async fn libp2p_network_from_config<TYPES: NodeType>(
config_builder.to_connect_addrs(to_connect_addrs);

let mesh_params =
// NOTE I'm arbitrarily choosing these.
match node_type {
NetworkNodeType::Bootstrap => MeshParams {
mesh_n_high: libp2p_config.bootstrap_mesh_n_high,
mesh_n_low: libp2p_config.bootstrap_mesh_n_low,
mesh_outbound_min: libp2p_config.bootstrap_mesh_outbound_min,
mesh_n: libp2p_config.bootstrap_mesh_n,
},
NetworkNodeType::Regular => MeshParams {
mesh_n_high: libp2p_config.mesh_n_high,
mesh_n_low: libp2p_config.mesh_n_low,
mesh_outbound_min: libp2p_config.mesh_outbound_min,
mesh_n: libp2p_config.mesh_n,
},
NetworkNodeType::Conductor => unreachable!(),
};
// NOTE I'm arbitrarily choosing these.
match node_type {
NetworkNodeType::Bootstrap => MeshParams {
mesh_n_high: libp2p_config.bootstrap_mesh_n_high,
mesh_n_low: libp2p_config.bootstrap_mesh_n_low,
mesh_outbound_min: libp2p_config.bootstrap_mesh_outbound_min,
mesh_n: libp2p_config.bootstrap_mesh_n,
},
NetworkNodeType::Regular => MeshParams {
mesh_n_high: libp2p_config.mesh_n_high,
mesh_n_low: libp2p_config.mesh_n_low,
mesh_outbound_min: libp2p_config.mesh_outbound_min,
mesh_n: libp2p_config.mesh_n,
},
NetworkNodeType::Conductor => unreachable!(),
};
config_builder.mesh_params(Some(mesh_params));

let mut all_keys = BTreeSet::new();
Expand Down Expand Up @@ -285,6 +285,7 @@ match node_type {
// NOTE: this introduces an invariant that the keys are assigned using this indexed
// function
all_keys,
None,
da_keys.clone(),
da_keys.contains(&pub_key),
)
Expand Down
6 changes: 3 additions & 3 deletions crates/hotshot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ use hotshot_task::{
};
use hotshot_task_impls::{events::HotShotEvent, network::NetworkTaskKind};

#[cfg(feature = "hotshot-testing")]
use hotshot_types::traits::node_implementation::ChannelMaps;

use hotshot_types::{
consensus::{Consensus, ConsensusMetricsValue, View, ViewInner, ViewQueue},
data::Leaf,
Expand Down Expand Up @@ -69,9 +72,6 @@ use std::{
use tasks::add_vid_task;
use tracing::{debug, error, info, instrument, trace, warn};

#[cfg(feature = "hotshot-testing")]
use hotshot_types::traits::node_implementation::ChannelMaps;

// -- Rexports
// External
/// Reexport rand crate
Expand Down
16 changes: 12 additions & 4 deletions crates/hotshot/src/traits/networking/combined_network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,16 @@ use futures::join;

use async_compatibility_layer::channel::UnboundedSendError;
use hotshot_task::{boxed_sync, BoxSyncFuture};
#[cfg(feature = "hotshot-testing")]
use hotshot_types::traits::network::{NetworkReliability, TestableNetworkingImplementation};
use hotshot_types::{
data::ViewNumber,
message::Message,
traits::{
election::Membership,
network::{
CommunicationChannel, ConnectedNetwork, ConsensusIntentEvent,
TestableChannelImplementation, TestableNetworkingImplementation, TransmitType,
ViewMessage,
TestableChannelImplementation, TransmitType, ViewMessage,
},
node_implementation::NodeType,
},
Expand Down Expand Up @@ -144,13 +145,15 @@ pub struct CombinedNetworks<TYPES: NodeType>(
pub Libp2pNetwork<Message<TYPES>, TYPES::SignatureKey>,
);

#[cfg(feature = "hotshot-testing")]
impl<TYPES: NodeType> TestableNetworkingImplementation<TYPES> for CombinedNetworks<TYPES> {
fn generator(
expected_node_count: usize,
num_bootstrap: usize,
network_id: usize,
da_committee_size: usize,
is_da: bool,
reliability_config: Option<Box<dyn NetworkReliability>>,
) -> Box<dyn Fn(u64) -> Self + 'static> {
let generators = (
<WebServerNetwork<
Expand All @@ -160,14 +163,16 @@ impl<TYPES: NodeType> TestableNetworkingImplementation<TYPES> for CombinedNetwor
num_bootstrap,
network_id,
da_committee_size,
is_da
is_da,
None,
),
<Libp2pNetwork<Message<TYPES>, TYPES::SignatureKey> as TestableNetworkingImplementation<_>>::generator(
expected_node_count,
num_bootstrap,
network_id,
da_committee_size,
is_da
is_da,
reliability_config,
)
);
Box::new(move |node_id| CombinedNetworks(generators.0(node_id), generators.1(node_id)))
Expand All @@ -181,20 +186,23 @@ impl<TYPES: NodeType> TestableNetworkingImplementation<TYPES> for CombinedNetwor
}
}

#[cfg(feature = "hotshot-testing")]
impl<TYPES: NodeType> TestableNetworkingImplementation<TYPES> for CombinedCommChannel<TYPES> {
fn generator(
expected_node_count: usize,
num_bootstrap: usize,
network_id: usize,
da_committee_size: usize,
is_da: bool,
reliability_config: Option<Box<dyn NetworkReliability>>,
) -> Box<dyn Fn(u64) -> Self + 'static> {
let generator = <CombinedNetworks<TYPES> as TestableNetworkingImplementation<_>>::generator(
expected_node_count,
num_bootstrap,
network_id,
da_committee_size,
is_da,
reliability_config,
);
Box::new(move |node_id| Self {
networks: generator(node_id).into(),
Expand Down
Loading

0 comments on commit 835b058

Please sign in to comment.