Skip to content

Commit

Permalink
fix hotshot-testing flag
Browse files Browse the repository at this point in the history
  • Loading branch information
rob-maron committed Mar 26, 2024
1 parent 1c4d190 commit 61b0e1c
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 15 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
RUST_BACKTRACE: full

- name: Build examples in release mode
run: just ${{ matrix.just_variants }} build_release --examples --package hotshot-examples --no-default-features --features="docs,doc-images"
run: just ${{ matrix.just_variants }} build_release --examples --package hotshot-examples --no-default-features

- name: Upload Binaries
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -89,7 +89,7 @@ jobs:
prefix-key: arm-${{ matrix.just_variants }}

- name: Build examples in release mode
run: just ${{ matrix.just_variants }} build_release --examples --package hotshot-examples --no-default-features --features="docs,doc-images"
run: just ${{ matrix.just_variants }} build_release --examples --package hotshot-examples --no-default-features

- name: Upload Binaries
uses: actions/upload-artifact@v4
Expand Down
4 changes: 2 additions & 2 deletions crates/examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ version = { workspace = true }
rust-version = "1.65.0"

[features]
default = ["docs", "doc-images"]
default = ["docs", "doc-images", "hotshot-testing"]
gpu-vid = ["hotshot-task-impls/gpu-vid"]

# Features required for binaries
Expand All @@ -17,7 +17,7 @@ bin-orchestrator = ["clap"]
# Build the extended documentation
docs = []
doc-images = []
hotshot-testing = []
hotshot-testing = ["hotshot/hotshot-testing"]
randomized-leader-election = []

# libp2p
Expand Down
1 change: 1 addition & 0 deletions crates/examples/infra/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,7 @@ async fn libp2p_network_from_config<TYPES: NodeType>(
// NOTE: this introduces an invariant that the keys are assigned using this indexed
// function
all_keys,
#[cfg(feature = "hotshot-testing")]
None,
da_keys.clone(),
da_keys.contains(&pub_key),
Expand Down
6 changes: 4 additions & 2 deletions crates/hotshot/src/traits/networking/libp2p_network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ use futures::{
future::{join_all, Either},
FutureExt, StreamExt,
};
#[cfg(feature = "hotshot-testing")]
use hotshot_types::traits::network::NetworkReliability;
use hotshot_types::{
boxed_sync,
constants::{Version01, LOOK_AHEAD, STATIC_VER_0_1, VERSION_0_1},
Expand All @@ -33,7 +35,7 @@ use hotshot_types::{
#[cfg(feature = "hotshot-testing")]
use hotshot_types::{
message::{Message, MessageKind},
traits::network::{NetworkReliability, TestableNetworkingImplementation, ViewMessage},
traits::network::{TestableNetworkingImplementation, ViewMessage},
};
use libp2p_identity::PeerId;
#[cfg(feature = "hotshot-testing")]
Expand Down Expand Up @@ -332,7 +334,7 @@ impl<M: NetworkMsg, K: SignatureKey + 'static> Libp2pNetwork<M, K> {
id: usize,
// HACK
committee_pks: BTreeSet<K>,
reliability_config: Option<Box<dyn NetworkReliability>>,
#[cfg(feature = "hotshot-testing")] reliability_config: Option<Box<dyn NetworkReliability>>,
da_pks: BTreeSet<K>,
is_da: bool,
) -> Result<Libp2pNetwork<M, K>, NetworkError> {
Expand Down
20 changes: 12 additions & 8 deletions crates/hotshot/src/traits/networking/push_cdn_network.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
use super::NetworkError;
#[cfg(feature = "hotshot-testing")]
use async_compatibility_layer::art::{async_block_on, async_spawn};
use async_compatibility_layer::channel::UnboundedSendError;
use async_trait::async_trait;
use bincode::config::Options;
use cdn_broker::reexports::connection::protocols::Tcp;
use cdn_broker::reexports::def::RunDef;
use cdn_broker::reexports::discovery::{Embedded, Redis};
use cdn_broker::{
reexports::connection::protocols::Tcp, Broker, Config, ConfigBuilder as BrokerConfigBuilder,
};
#[cfg(feature = "hotshot-testing")]
use cdn_broker::{Broker, Config, ConfigBuilder as BrokerConfigBuilder};
use cdn_client::{
reexports::{
connection::protocols::Quic,
Expand All @@ -16,28 +17,31 @@ use cdn_client::{
},
Client, ConfigBuilder as ClientConfigBuilder,
};
#[cfg(feature = "hotshot-testing")]
use cdn_marshal::{ConfigBuilder as MarshalConfigBuilder, Marshal};
#[cfg(feature = "hotshot-testing")]
use hotshot_types::traits::network::TestableNetworkingImplementation;
use hotshot_types::traits::network::{NetworkReliability, TestableNetworkingImplementation};
use hotshot_types::{
boxed_sync,
constants::{Version01, VERSION_0_1},
data::ViewNumber,
message::Message,
traits::{
network::{
ConnectedNetwork, ConsensusIntentEvent, NetworkReliability, PushCdnNetworkError,
},
network::{ConnectedNetwork, ConsensusIntentEvent, PushCdnNetworkError},
node_implementation::NodeType,
signature_key::SignatureKey,
},
utils::bincode_opts,
BoxSyncFuture,
};
#[cfg(feature = "hotshot-testing")]
use rand::rngs::StdRng;
#[cfg(feature = "hotshot-testing")]
use rand::{RngCore, SeedableRng};
use std::collections::BTreeSet;
use std::marker::PhantomData;
use std::{collections::BTreeSet, path::Path, sync::Arc, time::Duration};
#[cfg(feature = "hotshot-testing")]
use std::{path::Path, sync::Arc, time::Duration};
use tracing::{error, warn};
use versioned_binary_serialization::{
version::{StaticVersionType, Version},
Expand Down
2 changes: 1 addition & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ build_release *ARGS:
cargo build --profile=release {{ARGS}}

example *ARGS:
cargo run --profile=release-lto --example {{ARGS}}
cargo run --profile=release-lto --package hotshot-examples --no-default-features --example {{ARGS}}

test *ARGS:
echo Testing {{ARGS}}
Expand Down

0 comments on commit 61b0e1c

Please sign in to comment.