diff --git a/hotshot/src/lib.rs b/hotshot/src/lib.rs index cf81d1b6b3..f85af247a5 100644 --- a/hotshot/src/lib.rs +++ b/hotshot/src/lib.rs @@ -60,7 +60,7 @@ use hotshot_types::{ traits::{ consensus_api::ConsensusApi, network::{CommunicationChannel, NetworkError}, - node_implementation::{ChannelMaps, NodeType, SendToTasks}, + node_implementation::{NodeType, SendToTasks}, signature_key::SignatureKey, state::ConsensusTime, storage::StoredView, @@ -78,6 +78,10 @@ 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 @@ -162,6 +166,7 @@ pub struct SystemContextInner> { /// Channels for sending/recv-ing proposals and votes for quorum and committee exchanges, the /// latter of which is only applicable for sequencing consensus. + #[cfg(feature = "hotshot-testing")] channel_maps: (ChannelMaps, Option>), // global_registry: GlobalRegistry, @@ -256,6 +261,7 @@ impl> SystemContext { let inner: Arc> = Arc::new(SystemContextInner { id: nonce, + #[cfg(feature = "hotshot-testing")] channel_maps: I::new_channel_maps(start_view), consensus, public_key, diff --git a/hotshot/src/types/handle.rs b/hotshot/src/types/handle.rs index 0d52a18842..2040061489 100644 --- a/hotshot/src/types/handle.rs +++ b/hotshot/src/types/handle.rs @@ -16,17 +16,21 @@ use hotshot_task_impls::events::HotShotEvent; use hotshot_types::simple_vote::QuorumData; use hotshot_types::{ consensus::Consensus, + data::Leaf, error::HotShotError, event::EventType, - message::{MessageKind, SequencingMessage}, - traits::{ - election::Membership, node_implementation::NodeType, state::ConsensusTime, storage::Storage, - }, + simple_certificate::QuorumCertificate, + traits::{node_implementation::NodeType, state::ConsensusTime, storage::Storage}, }; -use hotshot_types::{data::Leaf, simple_certificate::QuorumCertificate}; use std::sync::Arc; use tracing::error; +#[cfg(feature = "hotshot-testing")] +use hotshot_types::{ + message::{MessageKind, SequencingMessage}, + traits::election::Membership, +}; + /// Event streaming handle for a [`SystemContext`] instance running in the background /// /// This type provides the means to message and interact with a background [`SystemContext`] instance, diff --git a/task-impls/src/consensus.rs b/task-impls/src/consensus.rs index b7909dfec2..8d190e16ff 100644 --- a/task-impls/src/consensus.rs +++ b/task-impls/src/consensus.rs @@ -664,8 +664,10 @@ impl, A: ConsensusApi + } leaf_views.push(leaf.clone()); - if let Some(payload) = leaf.block_payload { - for txn in payload.transaction_commitments() { + if let Some(ref payload) = leaf.block_payload { + for txn in payload + .transaction_commitments(leaf.get_block_header().metadata()) + { included_txns.insert(txn); } } diff --git a/task-impls/src/transactions.rs b/task-impls/src/transactions.rs index 7b6df7300a..e162a6c26f 100644 --- a/task-impls/src/transactions.rs +++ b/task-impls/src/transactions.rs @@ -16,6 +16,7 @@ use hotshot_types::{ consensus::Consensus, data::Leaf, traits::{ + block_contents::BlockHeader, consensus_api::ConsensusApi, election::Membership, node_implementation::{NodeImplementation, NodeType}, @@ -121,8 +122,10 @@ impl, A: ConsensusApi + let mut included_txn_size = 0; let mut included_txn_count = 0; for leaf in leaf_chain { - if let Some(payload) = leaf.block_payload { - for txn in payload.transaction_commitments() { + if let Some(ref payload) = leaf.block_payload { + for txn in + payload.transaction_commitments(leaf.get_block_header().metadata()) + { included_txns.insert(txn); } } diff --git a/testing/src/block_types.rs b/testing/src/block_types.rs index ba701cbbc3..20572510a1 100644 --- a/testing/src/block_types.rs +++ b/testing/src/block_types.rs @@ -149,7 +149,7 @@ impl BlockPayload for TestBlockPayload { Ok(TestTransaction::encode(self.transactions.clone())?.into_iter()) } - fn transaction_commitments(&self) -> Vec> { + fn transaction_commitments(&self, _metadata: &Self::Metadata) -> Vec> { self.transactions .iter() .map(commit::Committable::commit) diff --git a/types/src/traits/block_contents.rs b/types/src/traits/block_contents.rs index f3d3769c35..5b8bf39600 100644 --- a/types/src/traits/block_contents.rs +++ b/types/src/traits/block_contents.rs @@ -70,7 +70,7 @@ pub trait BlockPayload: fn encode(&self) -> Result, Self::Error>; /// List of transaction commitments. - fn transaction_commitments(&self) -> Vec>; + fn transaction_commitments(&self, metadata: &Self::Metadata) -> Vec>; } /// Compute the VID payload commitment.