Skip to content

Commit

Permalink
🎨 add consensus secret key to file, in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgeantonio21 committed Jul 14, 2023
1 parent 1c9c39f commit 9114444
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions integration_tests/Cargo.toml
Expand Up @@ -41,6 +41,7 @@ tari_wallet = { git = "https://github.com/tari-project/tari.git", tag = "v0.51.0

anyhow = "1.0.53"
base64 = "0.21.0"
blst = "0.3.10"
config = "0.13.0"
cucumber = { version = "0.18.0", features = ["default", "libtest", "output-junit"] }
httpmock = { git = "https://github.com/sdbondi/httpmock.git", branch = "remove-signal-handling" }
Expand Down
11 changes: 11 additions & 0 deletions integration_tests/src/validator_node.rs
Expand Up @@ -143,6 +143,17 @@ pub async fn spawn_validator_node(

// Add all other VNs as peer seeds
config.peer_seeds.peer_seeds = StringList::from(peer_seeds);

// write BLS consensus secret key on the file
let random_seed: [u8; 32] = rand::random();
let consensus_secret_key = blst::min_sig::SecretKey::key_gen(&random_seed, &[])
.expect("Failed to generate secret key from random material");
std::fs::write(
temp_dir.join("consensus_secret_key_file.json"),
consensus_secret_key.to_bytes(),
)
.expect("Failed to save BLS secret key to file");

run_validator_node(&config, shutdown_signal).await
});

Expand Down

0 comments on commit 9114444

Please sign in to comment.