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

Disallow Syncing From Genesis By Default #5031

Closed
wants to merge 2 commits into from
Closed
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
8 changes: 8 additions & 0 deletions beacon_node/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -955,6 +955,14 @@ pub fn cli_app<'a, 'b>() -> App<'a, 'b> {
.takes_value(true)
.default_value("180")
)
.arg(
Arg::with_name("allow-insecure-genesis-sync")
.long("allow-insecure-genesis-sync")
.help("Enable syncing from genesis. This is insecure after Capella due to long-range attacks. This should only be used for testing. DO NOT use on mainnet!")
.conflicts_with("checkpoint-sync-url")
.conflicts_with("checkpoint-state")
.takes_value(false)
)
.arg(
Arg::with_name("reconstruct-historic-states")
.long("reconstruct-historic-states")
Expand Down
9 changes: 8 additions & 1 deletion beacon_node/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -518,8 +518,15 @@ pub fn get_config<E: EthSpec>(
.map_err(|e| format!("Invalid checkpoint sync URL: {:?}", e))?;

ClientGenesis::CheckpointSyncUrl { url }
} else {
} else if cli_args.is_present("allow-insecure-genesis-sync") {
ClientGenesis::GenesisState
} else {
return Err(
"Syncing from genesis is not secure post-Capella! \
You should instead perform a checkpoint sync from a trusted node using the --checkpoint-sync-url option. \
For a list of public endpoints, see:\nhttps://eth-clients.github.io/checkpoint-sync-endpoints/"
.to_string(),
);
}
} else {
if cli_args.is_present("checkpoint-state") || cli_args.is_present("checkpoint-sync-url") {
Expand Down
12 changes: 12 additions & 0 deletions lighthouse/tests/beacon_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ struct CommandLineTest {
}
impl CommandLineTest {
fn new() -> CommandLineTest {
let mut base_cmd = base_cmd();
base_cmd.arg("--allow-insecure-genesis-sync");
CommandLineTest { cmd: base_cmd }
}

fn without_allow_genesis_sync() -> CommandLineTest {
let base_cmd = base_cmd();
CommandLineTest { cmd: base_cmd }
}
Expand Down Expand Up @@ -92,6 +98,12 @@ fn staking_flag() {
});
}

#[test]
#[should_panic]
fn run_without_allow_genesis_sync() {
CommandLineTest::without_allow_genesis_sync().run_with_zero_port();
}

#[test]
fn wss_checkpoint_flag() {
let state = Some(Checkpoint {
Expand Down
Loading