use of tech.pegasys.teku.test.acceptance.dsl.TekuNode in project teku by ConsenSys.
the class VoluntaryExitAcceptanceTest method shouldChangeValidatorStatusAfterSubmittingVoluntaryExit.
@Test
void shouldChangeValidatorStatusAfterSubmittingVoluntaryExit() throws Exception {
final String networkName = "less-swift";
final BesuNode eth1Node = createBesuNode();
eth1Node.start();
final ValidatorKeystores validatorKeystores = createTekuDepositSender(networkName).sendValidatorDeposits(eth1Node, 4);
final TekuNode beaconNode = createTekuNode(config -> config.withNetwork(networkName).withDepositsFrom(eth1Node));
final TekuVoluntaryExit voluntaryExitProcessFailing = createVoluntaryExit(config -> config.withBeaconNode(beaconNode)).withValidatorKeystores(validatorKeystores);
final TekuVoluntaryExit voluntaryExitProcessSuccessful = createVoluntaryExit(config -> config.withBeaconNode(beaconNode)).withValidatorKeystores(validatorKeystores);
final TekuValidatorNode validatorClient = createValidatorNode(config -> config.withNetwork(networkName).withInteropModeDisabled().withBeaconNode(beaconNode)).withValidatorKeystores(validatorKeystores);
beaconNode.start();
validatorClient.start();
validatorClient.waitForLogMessageContaining("Published block");
validatorClient.waitForLogMessageContaining("Published attestation");
validatorClient.waitForLogMessageContaining("Published aggregate");
beaconNode.waitForLogMessageContaining("Epoch: 1");
voluntaryExitProcessFailing.start();
beaconNode.waitForLogMessageContaining("Epoch: 3");
voluntaryExitProcessSuccessful.start();
validatorClient.waitForLogMessageContaining("has changed status from");
assertThat(voluntaryExitProcessFailing.getLoggedErrors()).contains("Failed to submit exit for validator");
}
use of tech.pegasys.teku.test.acceptance.dsl.TekuNode in project teku by ConsenSys.
the class GenesisStateAcceptanceTest method shouldCreateTheSameGenesisState.
@Test
public void shouldCreateTheSameGenesisState() throws Exception {
final BesuNode eth1Node = createBesuNode();
eth1Node.start();
createTekuDepositSender(Config.DEFAULT_NETWORK_NAME).sendValidatorDeposits(eth1Node, 4);
final TekuNode firstTeku = createTekuNode(config -> config.withDepositsFrom(eth1Node));
firstTeku.start();
firstTeku.waitForGenesis();
final TekuNode lateJoinTeku = createTekuNode(config -> config.withDepositsFrom(eth1Node));
lateJoinTeku.start();
lateJoinTeku.waitForGenesis();
// Even though the nodes aren't connected to each other they should generate the same genesis
// state because they processed the same deposits from the same ETH1 chain.
lateJoinTeku.waitUntilInSyncWith(firstTeku);
}
use of tech.pegasys.teku.test.acceptance.dsl.TekuNode in project teku by ConsenSys.
the class GenesisStateAcceptanceTest method shouldCreateGenesisFromPartialDeposits.
@Test
public void shouldCreateGenesisFromPartialDeposits() throws Exception {
final BesuNode eth1Node = createBesuNode();
eth1Node.start();
int numberOfValidators = 4;
final TekuDepositSender depositSender = createTekuDepositSender(Config.DEFAULT_NETWORK_NAME);
final List<ValidatorKeys> validatorKeys = depositSender.generateValidatorKeys(numberOfValidators);
depositSender.sendValidatorDeposits(eth1Node, validatorKeys, depositSender.getMinDepositAmount());
depositSender.sendValidatorDeposits(eth1Node, validatorKeys, depositSender.getMaxEffectiveBalance().minus(depositSender.getMinDepositAmount()));
final TekuNode teku = createTekuNode(config -> config.withDepositsFrom(eth1Node));
teku.start();
teku.waitForGenesis();
teku.waitForValidators(numberOfValidators);
}
use of tech.pegasys.teku.test.acceptance.dsl.TekuNode in project teku by ConsenSys.
the class RemoteValidatorKeysAcceptanceTest method shouldMaintainValidatorsInMutableClient.
@Test
void shouldMaintainValidatorsInMutableClient() throws Exception {
final String networkName = "less-swift";
final BesuNode eth1Node = createBesuNode();
eth1Node.start();
final URL resource = Resources.getResource("tech/pegasys/teku/spec/config/configs/less-swift.yaml");
final ValidatorKeystores validatorKeystores = createTekuDepositSender(networkName).sendValidatorDeposits(eth1Node, 8);
final TekuNode beaconNode = createTekuNode(config -> {
try {
config.withNetwork(resource.openStream(), networkName).withDepositsFrom(eth1Node);
} catch (IOException e) {
LOG.error("BN configuration failed", e);
}
});
final Web3SignerNode web3SignerNode = createWeb3SignerNode(config -> {
try {
config.withNetwork(resource.openStream());
} catch (IOException e) {
LOG.error("Signer configuration failed", e);
}
});
web3SignerNode.start();
final ValidatorKeysApi signerApi = web3SignerNode.getValidatorKeysApi();
final TekuValidatorNode validatorClient = createValidatorNode(config -> {
try {
config.withNetwork(resource.openStream()).withValidatorApiEnabled().withExternalSignerUrl(web3SignerNode.getValidatorRestApiUrl()).withInteropModeDisabled().withBeaconNode(beaconNode);
} catch (IOException e) {
LOG.error("VC configuration failed", e);
}
});
beaconNode.start();
validatorClient.start();
signerApi.addLocalValidatorsAndExpect(validatorKeystores, "imported");
signerApi.assertLocalValidatorListing(validatorKeystores.getPublicKeys());
final ValidatorKeysApi validatorNodeApi = validatorClient.getValidatorKeysApi();
validatorNodeApi.assertLocalValidatorListing(Collections.emptyList());
validatorNodeApi.assertRemoteValidatorListing(Collections.emptyList());
validatorNodeApi.addRemoteValidatorsAndExpect(validatorKeystores.getPublicKeys(), web3SignerNode.getValidatorRestApiUrl(), "imported");
validatorClient.waitForLogMessageContaining("Added validator");
validatorNodeApi.assertLocalValidatorListing(Collections.emptyList());
validatorNodeApi.assertRemoteValidatorListing(validatorKeystores.getPublicKeys());
// add Local should see duplicates, as they're already loaded
validatorNodeApi.addLocalValidatorsAndExpect(validatorKeystores, "duplicate");
// second remote add should also see as duplicates
validatorNodeApi.addRemoteValidatorsAndExpect(validatorKeystores.getPublicKeys(), web3SignerNode.getValidatorRestApiUrl(), "duplicate");
validatorClient.waitForLogMessageContaining("Published block");
// remove a validator
final BLSPublicKey removedPubKey = validatorKeystores.getPublicKeys().get(0);
validatorNodeApi.removeRemoteValidatorAndCheckStatus(removedPubKey, "deleted");
// should only be 7 validators left
validatorClient.waitForLogMessageContaining("Removed remote validator");
validatorClient.waitForLogMessageContaining("Published block");
validatorNodeApi.assertRemoteValidatorListing(validatorKeystores.getPublicKeys().subList(1, 7));
// remove validator that doesn't exist
validatorNodeApi.removeRemoteValidatorAndCheckStatus(removedPubKey, "not_found");
validatorClient.stop();
web3SignerNode.stop();
beaconNode.stop();
eth1Node.stop();
}
use of tech.pegasys.teku.test.acceptance.dsl.TekuNode in project teku by ConsenSys.
the class SyncAcceptanceTest method shouldSyncToNodeWithGreaterFinalizedEpoch.
@Test
public void shouldSyncToNodeWithGreaterFinalizedEpoch() throws Exception {
final TekuNode primaryNode = createTekuNode(Config::withRealNetwork);
primaryNode.start();
UInt64 genesisTime = primaryNode.getGenesisTime();
final TekuNode lateJoiningNode = createTekuNode(configureLateJoiningNode(primaryNode, genesisTime.intValue()));
primaryNode.waitForNewFinalization();
lateJoiningNode.start();
lateJoiningNode.waitForGenesis();
lateJoiningNode.waitUntilInSyncWith(primaryNode);
}
Aggregations