Search in sources :

Example 1 with ValidatorConfig

use of tech.pegasys.teku.validator.api.ValidatorConfig in project teku by ConsenSys.

the class ExternalSignerUpcheckTLSIntegrationTest method buildExternalSignerUpcheck.

private static ExternalSignerUpcheck buildExternalSignerUpcheck(final URL serverUrl) {
    final ValidatorConfig config = ValidatorConfig.builder().validatorExternalSignerPublicKeySources(List.of(KEYPAIR.getPublicKey().toString())).validatorExternalSignerUrl(serverUrl).validatorExternalSignerTimeout(TIMEOUT).validatorExternalSignerKeystore(TEKU_KEYSTORE).validatorExternalSignerKeystorePasswordFile(PASSWORD_FILE).validatorExternalSignerTruststore(EXTERNAL_SIGNER_TRUSTSTORE).validatorExternalSignerTruststorePasswordFile(PASSWORD_FILE).build();
    final HttpClientExternalSignerFactory httpClientExternalSignerFactory = new HttpClientExternalSignerFactory(config);
    return new ExternalSignerUpcheck(httpClientExternalSignerFactory.get(), config.getValidatorExternalSignerUrl(), config.getValidatorExternalSignerTimeout());
}
Also used : HttpClientExternalSignerFactory(tech.pegasys.teku.validator.client.loader.HttpClientExternalSignerFactory) ValidatorConfig(tech.pegasys.teku.validator.api.ValidatorConfig)

Example 2 with ValidatorConfig

use of tech.pegasys.teku.validator.api.ValidatorConfig in project teku by ConsenSys.

the class ValidatorOptionsTest method shouldDisableSlashingProtectionForExternalSigners.

@Test
void shouldDisableSlashingProtectionForExternalSigners() {
    final ValidatorConfig config = getTekuConfigurationFromArguments("--validators-external-signer-slashing-protection-enabled=false").validatorClient().getValidatorConfig();
    assertThat(config.isValidatorExternalSignerSlashingProtectionEnabled()).isFalse();
}
Also used : ValidatorConfig(tech.pegasys.teku.validator.api.ValidatorConfig) Test(org.junit.jupiter.api.Test) AbstractBeaconNodeCommandTest(tech.pegasys.teku.cli.AbstractBeaconNodeCommandTest)

Example 3 with ValidatorConfig

use of tech.pegasys.teku.validator.api.ValidatorConfig in project teku by ConsenSys.

the class ValidatorOptionsTest method shouldReadFromConfigurationFile.

@Test
public void shouldReadFromConfigurationFile() throws MalformedURLException {
    final ValidatorConfig config = getTekuConfigurationFromFile("validatorOptions_config.yaml").validatorClient().getValidatorConfig();
    assertThat(config.getValidatorKeys()).containsExactlyInAnyOrder("a.key:a.password", "b.json:b.txt");
    assertThat(config.getValidatorExternalSignerPublicKeySources()).containsExactly("0xad113a7d152dc74ae2b26db65bfb89ed07501c818bf47671c6d34e5a2f7224e4c5525dd4fddaa93aa328da86b7205009");
    assertThat(config.getValidatorExternalSignerUrl()).isEqualTo(new URL("https://signer.url/"));
    assertThat(config.getValidatorExternalSignerTimeout()).isEqualTo(Duration.ofMillis(1234));
    assertThat(config.getGraffitiProvider().get()).isEqualTo(Optional.of(graffiti));
}
Also used : URL(java.net.URL) ValidatorConfig(tech.pegasys.teku.validator.api.ValidatorConfig) Test(org.junit.jupiter.api.Test) AbstractBeaconNodeCommandTest(tech.pegasys.teku.cli.AbstractBeaconNodeCommandTest)

Example 4 with ValidatorConfig

use of tech.pegasys.teku.validator.api.ValidatorConfig in project teku by ConsenSys.

the class ValidatorOptionsTest method shouldLoadGraffitiFromFile.

@Test
void shouldLoadGraffitiFromFile() {
    final ValidatorConfig config = getTekuConfigurationFromFile("validatorOptionsWithGraffitiFile_config.yaml").validatorClient().getValidatorConfig();
    assertThat(config.getGraffitiProvider().get()).isEqualTo(Optional.of(graffiti));
}
Also used : ValidatorConfig(tech.pegasys.teku.validator.api.ValidatorConfig) Test(org.junit.jupiter.api.Test) AbstractBeaconNodeCommandTest(tech.pegasys.teku.cli.AbstractBeaconNodeCommandTest)

Example 5 with ValidatorConfig

use of tech.pegasys.teku.validator.api.ValidatorConfig in project teku by ConsenSys.

the class ExternalSignerAltairIntegrationTest method setup.

@BeforeEach
void setup(final ClientAndServer client) throws MalformedURLException {
    this.client = client;
    final ValidatorConfig config = ValidatorConfig.builder().validatorExternalSignerPublicKeySources(List.of(KEYPAIR.getPublicKey().toString())).validatorExternalSignerUrl(new URL("http://127.0.0.1:" + client.getLocalPort())).validatorExternalSignerTimeout(TIMEOUT).build();
    final HttpClientExternalSignerFactory httpClientExternalSignerFactory = new HttpClientExternalSignerFactory(config);
    externalSigner = new ExternalSigner(spec, httpClientExternalSignerFactory.get(), config.getValidatorExternalSignerUrl(), KEYPAIR.getPublicKey(), TIMEOUT, queue, metricsSystem);
}
Also used : URL(java.net.URL) HttpClientExternalSignerFactory(tech.pegasys.teku.validator.client.loader.HttpClientExternalSignerFactory) ValidatorConfig(tech.pegasys.teku.validator.api.ValidatorConfig) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

ValidatorConfig (tech.pegasys.teku.validator.api.ValidatorConfig)26 Test (org.junit.jupiter.api.Test)23 Validator (tech.pegasys.teku.validator.client.Validator)10 AbstractBeaconNodeCommandTest (tech.pegasys.teku.cli.AbstractBeaconNodeCommandTest)6 SimpleDataDirLayout (tech.pegasys.techu.service.serviceutils.layout.SimpleDataDirLayout)4 BLSPublicKey (tech.pegasys.teku.bls.BLSPublicKey)4 URL (java.net.URL)3 DataDirLayout (tech.pegasys.teku.service.serviceutils.layout.DataDirLayout)3 BeaconBlock (tech.pegasys.teku.spec.datastructures.blocks.BeaconBlock)3 ForkInfo (tech.pegasys.teku.spec.datastructures.state.ForkInfo)3 HttpClientExternalSignerFactory (tech.pegasys.teku.validator.client.loader.HttpClientExternalSignerFactory)3 BeforeEach (org.junit.jupiter.api.BeforeEach)2 BLSSignature (tech.pegasys.teku.bls.BLSSignature)2 InteropConfig (tech.pegasys.teku.validator.api.InteropConfig)2 PostKeyResult (tech.pegasys.teku.validator.client.restapi.apis.schema.PostKeyResult)2 DeleteKeyResult (tech.pegasys.teku.validator.client.restapi.apis.schema.DeleteKeyResult)1