Skip to content

Commit 7e4b0e8

Browse files
committed
More logging & CLI tests
1 parent bb7107a commit 7e4b0e8

File tree

4 files changed

+44
-12
lines changed

4 files changed

+44
-12
lines changed

book/src/help_vc.md

+11-9
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,19 @@ FLAGS:
1313
--disable-auto-discover
1414
If present, do not attempt to discover new validators in the validators-dir. Validators will need to be
1515
manually added to the validator_definitions.yml file.
16-
--disable-log-timestamp If present, do not include timestamps in logging output.
16+
--disable-log-timestamp If present, do not include timestamps in logging output.
1717
--disable-malloc-tuning
1818
If present, do not configure the system allocator. Providing this flag will generally increase memory usage,
1919
it should only be provided when debugging specific memory allocation issues.
2020
--disable-run-on-all
2121
DEPRECATED. Use --broadcast. By default, Lighthouse publishes attestation, sync committee subscriptions and
2222
proposer preparation messages to all beacon nodes provided in the `--beacon-nodes flag`. This option changes
2323
that behaviour such that these api calls only go out to the first available and synced beacon node
24+
--disable-slashing-protection-web3signer
25+
Disable Lighthouse's slashing protection for all web3signer keys. This can reduce the I/O burden on the VC
26+
but is only safe if slashing protection is enabled on the remote signer and is implemented correctly. DO NOT
27+
ENABLE THIS FLAG UNLESS YOU ARE CERTAIN THAT SLASHING PROTECTION IS ENABLED ON THE REMOTE SIGNER. IT IS OFF
28+
BY DEFAULT, AND YOU WILL GET SLASHED IF YOU USE THIS FLAG WITHOUT ENABLING IT.
2429
--enable-doppelganger-protection
2530
If this flag is set, Lighthouse will delay startup for three epochs and monitor for messages on the network
2631
by any of the validators managed by this client. This will result in three (possibly four) epochs worth of
@@ -32,8 +37,8 @@ FLAGS:
3237
Enable per validator metrics for > 64 validators. Note: This flag is automatically enabled for <= 64
3338
validators. Enabling this metric for higher validator counts will lead to higher volume of prometheus
3439
metrics being collected.
35-
-h, --help Prints help information
36-
--http Enable the RESTful HTTP API server. Disabled by default.
40+
-h, --help Prints help information
41+
--http Enable the RESTful HTTP API server. Disabled by default.
3742
--http-allow-keystore-export
3843
If present, allow access to the DELETE /lighthouse/keystores HTTP API method, which allows exporting
3944
keystores and passwords to HTTP API consumers who have access to the API token. This method is useful for
@@ -47,15 +52,15 @@ FLAGS:
4752
flag unless you're certain that a new slashing protection database is required. Usually, your database will
4853
have been initialized when you imported your validator keys. If you misplace your database and then run with
4954
this flag you risk being slashed.
50-
--log-color Force outputting colors when emitting logs to the terminal.
55+
--log-color Force outputting colors when emitting logs to the terminal.
5156
--logfile-compress
5257
If present, compress old log files. This can help reduce the space needed to store old logs.
5358
5459
--logfile-no-restricted-perms
5560
If present, log files will be generated as world-readable meaning they can be read by any user on the
5661
machine. Note that logs can often contain sensitive information about your validator and so this flag should
5762
be used with caution. For Windows users, the log file permissions will be inherited from the parent folder.
58-
--metrics Enable the Prometheus metrics HTTP server. Disabled by default.
63+
--metrics Enable the Prometheus metrics HTTP server. Disabled by default.
5964
--prefer-builder-proposals
6065
If this flag is set, Lighthouse will always prefer blocks constructed by builders, regardless of payload
6166
value.
@@ -69,7 +74,7 @@ FLAGS:
6974
--use-long-timeouts
7075
If present, the validator client will use longer timeouts for requests made to the beacon node. This flag is
7176
generally not recommended, longer timeouts can cause missed duties when fallbacks are used.
72-
-V, --version Prints version information
77+
-V, --version Prints version information
7378
7479
OPTIONS:
7580
--beacon-nodes <NETWORK_ADDRESSES>
@@ -96,9 +101,6 @@ OPTIONS:
96101
--debug-level <LEVEL>
97102
Specifies the verbosity level used when emitting logs to the terminal. [default: info] [possible values:
98103
info, debug, trace, warn, error, crit]
99-
--disable-slashing-protection-web3signer <disable-slashing-protection-web3signer>
100-
Disable Lighthouse's slashing protection for all web3signer keys. This can reduce the I/O burden on the VC
101-
and is safe as long as slashing protection is enabled on the remote signer and is implemented correctly.
102104
--gas-limit <INTEGER>
103105
The gas limit to be used in all builder proposals for all validators managed by this validator client. Note
104106
this will not necessarily be used if the gas limit set here moves too far from the previous block's gas

lighthouse/tests/validator_client.rs

+17
Original file line numberDiff line numberDiff line change
@@ -636,3 +636,20 @@ fn validator_registration_batch_size_zero_value() {
636636
.flag("validator-registration-batch-size", Some("0"))
637637
.run();
638638
}
639+
640+
#[test]
641+
fn validator_disable_web3_signer_slashing_protection_default() {
642+
CommandLineTest::new().run().with_config(|config| {
643+
assert!(config.enable_web3signer_slashing_protection);
644+
});
645+
}
646+
647+
#[test]
648+
fn validator_disable_web3_signer_slashing_protection() {
649+
CommandLineTest::new()
650+
.flag("disable-slashing-protection-web3signer", None)
651+
.run()
652+
.with_config(|config| {
653+
assert!(!config.enable_web3signer_slashing_protection);
654+
});
655+
}

validator_client/src/cli.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -371,8 +371,11 @@ pub fn cli_app<'a, 'b>() -> App<'a, 'b> {
371371
Arg::with_name("disable-slashing-protection-web3signer")
372372
.long("disable-slashing-protection-web3signer")
373373
.help("Disable Lighthouse's slashing protection for all web3signer keys. This can \
374-
reduce the I/O burden on the VC and is safe as long as slashing protection \
375-
is enabled on the remote signer and is implemented correctly.")
374+
reduce the I/O burden on the VC but is only safe if slashing protection \
375+
is enabled on the remote signer and is implemented correctly. DO NOT ENABLE \
376+
THIS FLAG UNLESS YOU ARE CERTAIN THAT SLASHING PROTECTION IS ENABLED ON \
377+
THE REMOTE SIGNER. IT IS OFF BY DEFAULT, AND YOU WILL GET SLASHED IF YOU \
378+
USE THIS FLAG WITHOUT ENABLING IT.")
376379
)
377380
/*
378381
* Experimental/development options.

validator_client/src/config.rs

+11-1
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,17 @@ impl Config {
411411
}
412412

413413
config.enable_web3signer_slashing_protection =
414-
!cli_args.is_present("disable-slashing-protection-web3signer");
414+
if cli_args.is_present("disable-slashing-protection-web3signer") {
415+
warn!(
416+
log,
417+
"Slashing protection for remote keys disabled";
418+
"info" => "ensure slashing protection on web3signer is enabled or you WILL \
419+
get slashed"
420+
);
421+
false
422+
} else {
423+
true
424+
};
415425

416426
Ok(config)
417427
}

0 commit comments

Comments
 (0)