Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0f9688a
commit 4357bf5
Showing
4 changed files
with
92 additions
and
5 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
testing/jormungandr-integration-tests/src/jormungandr/bft/block.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
use assert_fs::TempDir; | ||
use chain_impl_mockchain::chaintypes::ConsensusType; | ||
use jormungandr_lib::interfaces::SlotDuration; | ||
use jormungandr_testing_utils::testing::{ | ||
adversary::process::AdversaryNodeBuilder, | ||
jormungandr::{ConfigurationBuilder, Starter, StartupVerificationMode}, | ||
network::LeadershipMode, | ||
node::grpc::server::ProtocolVersion, | ||
Block0ConfigurationBuilder, FragmentNode, | ||
}; | ||
use std::time::Duration; | ||
|
||
#[test] | ||
fn block0_with_incorrect_hash() { | ||
let block0 = Block0ConfigurationBuilder::new() | ||
.with_slot_duration(SlotDuration::new(10).unwrap()) | ||
.with_block0_consensus(ConsensusType::Bft) | ||
.build() | ||
.to_block(); | ||
|
||
let adversary = AdversaryNodeBuilder::new(block0.clone()) | ||
.with_protocol_version(ProtocolVersion::Bft) | ||
.with_server_enabled() | ||
.build(); | ||
|
||
assert!(adversary | ||
.node_data | ||
.read() | ||
.unwrap() | ||
.get_block(block0.header().id()) | ||
.is_ok()); | ||
|
||
println!("ADVERSARY ADDR:{}", adversary.address()); | ||
println!("BLOCK0 HASH: {}", adversary.genesis_block_hash()); | ||
|
||
let passive_temp_dir = TempDir::new().unwrap(); | ||
|
||
let passive_params = ConfigurationBuilder::default() | ||
.with_block0_consensus(ConsensusType::Bft) | ||
.with_trusted_peers(vec![adversary.to_trusted_peer()]) | ||
.with_block_hash(format!("{}", adversary.genesis_block_hash())) | ||
.build(&passive_temp_dir); | ||
|
||
let passive = Starter::default() | ||
.config(passive_params) | ||
.leadership_mode(LeadershipMode::Passive) | ||
.start() | ||
.unwrap(); | ||
|
||
for log in passive.log_content() { | ||
println!("{}", log); | ||
} | ||
} |
5 changes: 3 additions & 2 deletions
5
testing/jormungandr-integration-tests/src/jormungandr/bft/mod.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
pub mod mempool; | ||
pub mod start_node; | ||
mod block; | ||
mod mempool; | ||
mod start_node; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters