mirror of
https://github.com/logos-blockchain/logos-blockchain-testing.git
synced 2026-01-03 13:53:09 +00:00
21 lines
631 B
Rust
21 lines
631 B
Rust
use testing_framework_core::scenario::ScenarioBuilder;
|
|
use testing_framework_workflows::ScenarioBuilderExt;
|
|
|
|
use crate::SnippetResult;
|
|
|
|
pub fn declarative_over_imperative() -> SnippetResult<()> {
|
|
// Good: declarative
|
|
let _plan = ScenarioBuilder::topology_with(|t| t.network_star().validators(2).executors(1))
|
|
.transactions_with(|txs| {
|
|
txs.rate(5) // 5 transactions per block
|
|
})
|
|
.expect_consensus_liveness()
|
|
.build()?;
|
|
|
|
// Bad: imperative (framework doesn't work this way)
|
|
// spawn_validator(); spawn_executor();
|
|
// loop { submit_tx(); check_block(); }
|
|
|
|
Ok(())
|
|
}
|