pub trait TestableNodeImplementation<TYPES: NodeType>: NodeImplementation<TYPES> {
// Required methods
fn state_create_random_transaction(
state: Option<&TYPES::ValidatedState>,
rng: &mut dyn RngCore,
padding: u64,
) -> <TYPES::BlockPayload as BlockPayload<TYPES>>::Transaction;
fn leaf_create_random_transaction(
leaf: &Leaf2<TYPES>,
rng: &mut dyn RngCore,
padding: u64,
) -> <TYPES::BlockPayload as BlockPayload<TYPES>>::Transaction;
fn block_genesis() -> TYPES::BlockPayload;
fn txn_count(block: &TYPES::BlockPayload) -> u64;
fn gen_networks(
expected_node_count: usize,
num_bootstrap: usize,
da_committee_size: usize,
reliability_config: Option<Box<dyn NetworkReliability>>,
secondary_network_delay: Duration,
) -> AsyncGenerator<Arc<Self::Network>>;
}
Expand description
extra functions required on a node implementation to be usable by hotshot-testing
Required Methods§
sourcefn state_create_random_transaction(
state: Option<&TYPES::ValidatedState>,
rng: &mut dyn RngCore,
padding: u64,
) -> <TYPES::BlockPayload as BlockPayload<TYPES>>::Transaction
fn state_create_random_transaction( state: Option<&TYPES::ValidatedState>, rng: &mut dyn RngCore, padding: u64, ) -> <TYPES::BlockPayload as BlockPayload<TYPES>>::Transaction
Creates random transaction if possible
otherwise panics
padding
is the bytes of padding to add to the transaction
sourcefn leaf_create_random_transaction(
leaf: &Leaf2<TYPES>,
rng: &mut dyn RngCore,
padding: u64,
) -> <TYPES::BlockPayload as BlockPayload<TYPES>>::Transaction
fn leaf_create_random_transaction( leaf: &Leaf2<TYPES>, rng: &mut dyn RngCore, padding: u64, ) -> <TYPES::BlockPayload as BlockPayload<TYPES>>::Transaction
Creates random transaction if possible
otherwise panics
padding
is the bytes of padding to add to the transaction
sourcefn block_genesis() -> TYPES::BlockPayload
fn block_genesis() -> TYPES::BlockPayload
generate a genesis block
sourcefn txn_count(block: &TYPES::BlockPayload) -> u64
fn txn_count(block: &TYPES::BlockPayload) -> u64
the number of transactions in a block
sourcefn gen_networks(
expected_node_count: usize,
num_bootstrap: usize,
da_committee_size: usize,
reliability_config: Option<Box<dyn NetworkReliability>>,
secondary_network_delay: Duration,
) -> AsyncGenerator<Arc<Self::Network>>
fn gen_networks( expected_node_count: usize, num_bootstrap: usize, da_committee_size: usize, reliability_config: Option<Box<dyn NetworkReliability>>, secondary_network_delay: Duration, ) -> AsyncGenerator<Arc<Self::Network>>
Generate the communication channels for testing
Object Safety§
This trait is not object safe.