Skip to content

Commit

Permalink
unhide shut-down-when-validator-slashed-enabled option (#8011)
Browse files Browse the repository at this point in the history
* unhide shut-down-when-validator-slashed-enabled option
  • Loading branch information
mehdi-aouadi authored Mar 12, 2024
1 parent 6676a5e commit 87fa8ca
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ the [releases page](https://github.com/Consensys/teku/releases).
### Breaking Changes

### Additions and Improvements
- Introduced [Validator Slashing Prevention feature](https://docs.teku.consensys.io/how-to/prevent-slashing/detect-slashing).

### Bug Fixes
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ public class ValidatorSlashingDetectionAcceptanceTest extends AcceptanceTestBase
final SystemTimeProvider timeProvider = new SystemTimeProvider();
final String network = "swift";
final String slashingActionLog =
"Validator(s) with public key(s) %s got slashed. Shutting down...";
"Validator slashing detection is enabled and validator(s) with public key(s) %s detected as slashed. "
+ "Shutting down...";
final int shutdownWaitingSeconds = 60;

enum SlashingEventType {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -411,8 +411,8 @@ public TekuNodeConfigBuilder withExternalMetricsClient(
}

public TekuNodeConfigBuilder withStopVcWhenValidatorSlashedEnabled() {
LOG.debug("Xshut-down-when-validator-slashed-enabled={}", true);
configMap.put("Xshut-down-when-validator-slashed-enabled", true);
LOG.debug("shut-down-when-validator-slashed-enabled={}", true);
configMap.put("shut-down-when-validator-slashed-enabled", true);
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,8 @@ public void exitOnNoValidatorKeys() {

public void validatorSlashedAlert(final Set<String> slashedValidatorPublicKeys) {
log.fatal(
"Validator(s) with public key(s) {} got slashed. Shutting down...",
"Validator slashing detection is enabled and validator(s) with public key(s) {} detected as slashed. "
+ "Shutting down...",
String.join(", ", slashedValidatorPublicKeys));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,12 @@ public class ValidatorOptions {
DEFAULT_VALIDATOR_IS_LOCAL_SLASHING_PROTECTION_SYNCHRONIZED_ENABLED;

@Option(
names = {"--Xshut-down-when-validator-slashed-enabled"},
names = {"--shut-down-when-validator-slashed-enabled"},
paramLabel = "<BOOLEAN>",
description =
"If an owned validator key is detected as slashed, the node should terminate with exit code 2. In this case, the service should not be restarted.",
"If enabled and an owned validator key is detected as slashed, the node will terminate. In this case, the service should not be restarted.",
showDefaultValue = CommandLine.Help.Visibility.ALWAYS,
arity = "0..1",
hidden = true,
fallbackValue = "true")
private boolean shutdownWhenValidatorSlashed = DEFAULT_SHUTDOWN_WHEN_VALIDATOR_SLASHED_ENABLED;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ public void shouldDefaultFalseShutdownWhenValidatorSlashedEnabled() {
@Test
public void shouldSetShutdownWhenValidatorSlashedEnabled() {
final ValidatorConfig config =
getTekuConfigurationFromArguments("--Xshut-down-when-validator-slashed-enabled=true")
getTekuConfigurationFromArguments("--shut-down-when-validator-slashed-enabled=true")
.validatorClient()
.getValidatorConfig();
assertThat(config.isShutdownWhenValidatorSlashedEnabled()).isTrue();
Expand Down

0 comments on commit 87fa8ca

Please sign in to comment.