Deprecate eth1 and dummy-eth1 flags (#6566)

* Deprecate eth1/dummy-eth1 flags

* Update book

* Simplify + make staking conflict with disable-deposit-contract
This commit is contained in:
Michael Sproul
2024-11-18 19:36:01 +11:00
committed by GitHub
parent 9fdd53df56
commit c5007eaa1c
7 changed files with 29 additions and 53 deletions

View File

@@ -59,10 +59,6 @@ pub struct Config {
/// Path where the blobs database will be located if blobs should be in a separate database. /// Path where the blobs database will be located if blobs should be in a separate database.
pub blobs_db_path: Option<PathBuf>, pub blobs_db_path: Option<PathBuf>,
pub log_file: PathBuf, pub log_file: PathBuf,
/// If true, the node will use co-ordinated junk for eth1 values.
///
/// This is the method used for the 2019 client interop in Canada.
pub dummy_eth1_backend: bool,
pub sync_eth1_chain: bool, pub sync_eth1_chain: bool,
/// Graffiti to be inserted everytime we create a block if the validator doesn't specify. /// Graffiti to be inserted everytime we create a block if the validator doesn't specify.
pub beacon_graffiti: GraffitiOrigin, pub beacon_graffiti: GraffitiOrigin,
@@ -103,8 +99,7 @@ impl Default for Config {
store: <_>::default(), store: <_>::default(),
network: NetworkConfig::default(), network: NetworkConfig::default(),
chain: <_>::default(), chain: <_>::default(),
dummy_eth1_backend: false, sync_eth1_chain: true,
sync_eth1_chain: false,
eth1: <_>::default(), eth1: <_>::default(),
execution_layer: None, execution_layer: None,
trusted_setup, trusted_setup,

View File

@@ -693,8 +693,7 @@ pub fn cli_app() -> Command {
Arg::new("staking") Arg::new("staking")
.long("staking") .long("staking")
.help("Standard option for a staking beacon node. This will enable the HTTP server \ .help("Standard option for a staking beacon node. This will enable the HTTP server \
on localhost:5052 and import deposit logs from the execution node. This is \ on localhost:5052 and import deposit logs from the execution node.")
equivalent to `--http` on merge-ready networks, or `--http --eth1` pre-merge")
.action(ArgAction::SetTrue) .action(ArgAction::SetTrue)
.help_heading(FLAG_HEADER) .help_heading(FLAG_HEADER)
.display_order(0) .display_order(0)
@@ -706,21 +705,21 @@ pub fn cli_app() -> Command {
.arg( .arg(
Arg::new("eth1") Arg::new("eth1")
.long("eth1") .long("eth1")
.help("If present the node will connect to an eth1 node. This is required for \ .help("DEPRECATED")
block production, you must use this flag if you wish to serve a validator.")
.action(ArgAction::SetTrue) .action(ArgAction::SetTrue)
.help_heading(FLAG_HEADER) .help_heading(FLAG_HEADER)
.display_order(0) .display_order(0)
.hide(true)
) )
.arg( .arg(
Arg::new("dummy-eth1") Arg::new("dummy-eth1")
.long("dummy-eth1") .long("dummy-eth1")
.help("DEPRECATED")
.action(ArgAction::SetTrue) .action(ArgAction::SetTrue)
.help_heading(FLAG_HEADER) .help_heading(FLAG_HEADER)
.conflicts_with("eth1") .conflicts_with("eth1")
.help("If present, uses an eth1 backend that generates static dummy data.\
Identical to the method used at the 2019 Canada interop.")
.display_order(0) .display_order(0)
.hide(true)
) )
.arg( .arg(
Arg::new("eth1-purge-cache") Arg::new("eth1-purge-cache")
@@ -1489,6 +1488,7 @@ pub fn cli_app() -> Command {
Useful if you intend to run a non-validating beacon node.") Useful if you intend to run a non-validating beacon node.")
.action(ArgAction::SetTrue) .action(ArgAction::SetTrue)
.help_heading(FLAG_HEADER) .help_heading(FLAG_HEADER)
.conflicts_with("staking")
.display_order(0) .display_order(0)
) )
.arg( .arg(

View File

@@ -121,7 +121,6 @@ pub fn get_config<E: EthSpec>(
if cli_args.get_flag("staking") { if cli_args.get_flag("staking") {
client_config.http_api.enabled = true; client_config.http_api.enabled = true;
client_config.sync_eth1_chain = true;
} }
/* /*
@@ -263,18 +262,12 @@ pub fn get_config<E: EthSpec>(
* Eth1 * Eth1
*/ */
// When present, use an eth1 backend that generates deterministic junk.
//
// Useful for running testnets without the overhead of a deposit contract.
if cli_args.get_flag("dummy-eth1") { if cli_args.get_flag("dummy-eth1") {
client_config.dummy_eth1_backend = true; warn!(log, "The --dummy-eth1 flag is deprecated");
} }
// When present, attempt to sync to an eth1 node.
//
// Required for block production.
if cli_args.get_flag("eth1") { if cli_args.get_flag("eth1") {
client_config.sync_eth1_chain = true; warn!(log, "The --eth1 flag is deprecated");
} }
if let Some(val) = cli_args.get_one::<String>("eth1-blocks-per-log-query") { if let Some(val) = cli_args.get_one::<String>("eth1-blocks-per-log-query") {
@@ -297,17 +290,6 @@ pub fn get_config<E: EthSpec>(
let endpoints: String = clap_utils::parse_required(cli_args, "execution-endpoint")?; let endpoints: String = clap_utils::parse_required(cli_args, "execution-endpoint")?;
let mut el_config = execution_layer::Config::default(); let mut el_config = execution_layer::Config::default();
// Always follow the deposit contract when there is an execution endpoint.
//
// This is wasteful for non-staking nodes as they have no need to process deposit contract
// logs and build an "eth1" cache. The alternative is to explicitly require the `--eth1` or
// `--staking` flags, however that poses a risk to stakers since they cannot produce blocks
// without "eth1".
//
// The waste for non-staking nodes is relatively small so we err on the side of safety for
// stakers. The merge is already complicated enough.
client_config.sync_eth1_chain = true;
// Parse a single execution endpoint, logging warnings if multiple endpoints are supplied. // Parse a single execution endpoint, logging warnings if multiple endpoints are supplied.
let execution_endpoint = parse_only_one_value( let execution_endpoint = parse_only_one_value(
endpoints.as_str(), endpoints.as_str(),

View File

@@ -140,7 +140,7 @@ impl<E: EthSpec> ProductionBeaconNode<E> {
let builder = builder let builder = builder
.beacon_chain_builder(client_genesis, client_config.clone()) .beacon_chain_builder(client_genesis, client_config.clone())
.await?; .await?;
let builder = if client_config.sync_eth1_chain && !client_config.dummy_eth1_backend { let builder = if client_config.sync_eth1_chain {
info!( info!(
log, log,
"Block production enabled"; "Block production enabled";
@@ -150,13 +150,6 @@ impl<E: EthSpec> ProductionBeaconNode<E> {
builder builder
.caching_eth1_backend(client_config.eth1.clone()) .caching_eth1_backend(client_config.eth1.clone())
.await? .await?
} else if client_config.dummy_eth1_backend {
warn!(
log,
"Block production impaired";
"reason" => "dummy eth1 backend is enabled"
);
builder.dummy_eth1_backend()?
} else { } else {
info!( info!(
log, log,

View File

@@ -480,9 +480,6 @@ Flags:
--disable-upnp --disable-upnp
Disables UPnP support. Setting this will prevent Lighthouse from Disables UPnP support. Setting this will prevent Lighthouse from
attempting to automatically establish external port mappings. attempting to automatically establish external port mappings.
--dummy-eth1
If present, uses an eth1 backend that generates static dummy
data.Identical to the method used at the 2019 Canada interop.
-e, --enr-match -e, --enr-match
Sets the local ENR IP address and port to match those set for Sets the local ENR IP address and port to match those set for
lighthouse. Specifically, the IP address will be the value of lighthouse. Specifically, the IP address will be the value of
@@ -490,10 +487,6 @@ Flags:
--enable-private-discovery --enable-private-discovery
Lighthouse by default does not discover private IP addresses. Set this Lighthouse by default does not discover private IP addresses. Set this
flag to enable connection attempts to local addresses. flag to enable connection attempts to local addresses.
--eth1
If present the node will connect to an eth1 node. This is required for
block production, you must use this flag if you wish to serve a
validator.
--eth1-purge-cache --eth1-purge-cache
Purges the eth1 block and deposit caches Purges the eth1 block and deposit caches
--genesis-backfill --genesis-backfill
@@ -561,8 +554,7 @@ Flags:
--staking --staking
Standard option for a staking beacon node. This will enable the HTTP Standard option for a staking beacon node. This will enable the HTTP
server on localhost:5052 and import deposit logs from the execution server on localhost:5052 and import deposit logs from the execution
node. This is equivalent to `--http` on merge-ready networks, or node.
`--http --eth1` pre-merge
--stdin-inputs --stdin-inputs
If present, read all user inputs from stdin instead of tty. If present, read all user inputs from stdin instead of tty.
--subscribe-all-subnets --subscribe-all-subnets

View File

@@ -396,13 +396,14 @@ fn genesis_backfill_with_historic_flag() {
} }
// Tests for Eth1 flags. // Tests for Eth1 flags.
// DEPRECATED but should not crash
#[test] #[test]
fn dummy_eth1_flag() { fn dummy_eth1_flag() {
CommandLineTest::new() CommandLineTest::new()
.flag("dummy-eth1", None) .flag("dummy-eth1", None)
.run_with_zero_port() .run_with_zero_port();
.with_config(|config| assert!(config.dummy_eth1_backend));
} }
// DEPRECATED but should not crash
#[test] #[test]
fn eth1_flag() { fn eth1_flag() {
CommandLineTest::new() CommandLineTest::new()
@@ -2483,6 +2484,21 @@ fn sync_eth1_chain_disable_deposit_contract_sync_flag() {
.with_config(|config| assert_eq!(config.sync_eth1_chain, false)); .with_config(|config| assert_eq!(config.sync_eth1_chain, false));
} }
#[test]
#[should_panic]
fn disable_deposit_contract_sync_conflicts_with_staking() {
let dir = TempDir::new().expect("Unable to create temporary directory");
CommandLineTest::new_with_no_execution_endpoint()
.flag("disable-deposit-contract-sync", None)
.flag("staking", None)
.flag("execution-endpoints", Some("http://localhost:8551/"))
.flag(
"execution-jwt",
dir.path().join("jwt-file").as_os_str().to_str(),
)
.run_with_zero_port();
}
#[test] #[test]
fn light_client_server_default() { fn light_client_server_default() {
CommandLineTest::new() CommandLineTest::new()

View File

@@ -104,8 +104,6 @@ pub fn testing_client_config() -> ClientConfig {
client_config.http_api.enabled = true; client_config.http_api.enabled = true;
client_config.http_api.listen_port = 0; client_config.http_api.listen_port = 0;
client_config.dummy_eth1_backend = true;
let now = SystemTime::now() let now = SystemTime::now()
.duration_since(UNIX_EPOCH) .duration_since(UNIX_EPOCH)
.expect("should get system time") .expect("should get system time")