Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove boostrap whitelist by default #4773

Merged
merged 3 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 32 additions & 4 deletions massa-bootstrap/src/tests/scenarios.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,45 @@ use massa_models::{address::Address, node::NodeId};
use massa_signature::KeyPair;
use massa_test_framework::TestUniverse;
use serial_test::serial;
use std::path::PathBuf;
use std::collections::HashSet;
use std::fs::File;
use std::net::IpAddr;
use std::str::FromStr;
use tempfile::NamedTempFile;

#[test]
#[serial]
fn test_bootstrap_not_whitelisted() {
let port = 8069;
let server_keypair = KeyPair::generate(0).unwrap();

let bootstrap_whitelist_file = NamedTempFile::new().expect("unable to create temp file");

let ips_str = vec![
"149.202.86.103",
"149.202.89.125",
"158.69.120.215",
"158.69.23.120",
"198.27.74.5",
"51.75.60.228",
"2001:41d0:1004:67::",
"2001:41d0:a:7f7d::",
"2001:41d0:602:21e4::",
];

let mut bootstrap_whitelist = HashSet::new();
for ip_str in ips_str {
bootstrap_whitelist.insert(IpAddr::from_str(ip_str).unwrap());
}

serde_json::to_writer_pretty::<&File, HashSet<IpAddr>>(
bootstrap_whitelist_file.as_file(),
&bootstrap_whitelist,
)
.expect("unable to write bootstrap whitelist temp file");

let bootstrap_server_config = BootstrapConfig {
bootstrap_whitelist_path: PathBuf::from(
"../massa-node/base_config/bootstrap_whitelist.json",
damip marked this conversation as resolved.
Show resolved Hide resolved
),
bootstrap_whitelist_path: bootstrap_whitelist_file.path().to_path_buf(),
..Default::default()
};
let server_universe = BootstrapServerTestUniverseBuilder::new()
Expand Down
11 changes: 0 additions & 11 deletions massa-node/base_config/bootstrap_whitelist.json

This file was deleted.