Skip to content

Commit

Permalink
Merge branch 'master' into skip-randao-string
Browse files Browse the repository at this point in the history
  • Loading branch information
gfukushima authored Jun 3, 2024
2 parents efa5b69 + 7711367 commit 6278f89
Show file tree
Hide file tree
Showing 321 changed files with 2,011 additions and 1,830 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ private static class Request {
private static final AtomicInteger ID_COUNTER = new AtomicInteger(0);
public final int id;

public Request(String method, String... params) {
public Request(final String method, final String... params) {
this.method = method;
this.params = params;
this.id = ID_COUNTER.incrementAndGet();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class ExternalMetricNode extends Node {

private boolean started = false;

private ExternalMetricNode(Network network, ImageFromDockerfile image) {
private ExternalMetricNode(final Network network, final ImageFromDockerfile image) {
super(network, image, LOG);
container.withWorkingDirectory(WORKING_DIRECTORY).withExposedPorts(STUB_PORT);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ protected static File copyToTmpFile(final URL fileUrl) throws Exception {
}

/** Copies contents of the given directory into node's working directory. */
public void copyContentsToWorkingDirectory(File tarFile) {
public void copyContentsToWorkingDirectory(final File tarFile) {
container.withExpandedTarballToContainer(tarFile, WORKING_DIRECTORY);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,23 +64,23 @@ public static class Builder {
private List<String> blockHandlerNodes = new ArrayList<>();
private List<String> attestationPublisherNodes = new ArrayList<>();

public Builder withDutiesProviders(TekuBeaconNode... nodes) {
public Builder withDutiesProviders(final TekuBeaconNode... nodes) {
dutiesProviderNodes =
Arrays.stream(nodes)
.map(TekuBeaconNode::getBeaconRestApiUrl)
.collect(Collectors.toList());
return this;
}

public Builder withBlockHandlers(TekuBeaconNode... nodes) {
public Builder withBlockHandlers(final TekuBeaconNode... nodes) {
blockHandlerNodes =
Arrays.stream(nodes)
.map(TekuBeaconNode::getBeaconRestApiUrl)
.collect(Collectors.toList());
return this;
}

public Builder withAttestationPublisher(TekuBeaconNode... nodes) {
public Builder withAttestationPublisher(final TekuBeaconNode... nodes) {
attestationPublisherNodes =
Arrays.stream(nodes)
.map(TekuBeaconNode::getBeaconRestApiUrl)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ public String get(final URI baseUrl, final String path) throws IOException {
return this.get(baseUrl, path, Collections.emptyMap());
}

public String get(final URI baseUrl, final String path, Map<String, String> headers)
public String get(final URI baseUrl, final String path, final Map<String, String> headers)
throws IOException {
final ResponseBody body = getResponseBody(baseUrl, path, headers);
return body.string();
}

public Bytes getAsBytes(final URI baseUrl, final String path, Map<String, String> headers)
public Bytes getAsBytes(final URI baseUrl, final String path, final Map<String, String> headers)
throws IOException {
final ResponseBody body = getResponseBody(baseUrl, path, headers);
return Bytes.wrap(body.bytes());
Expand Down Expand Up @@ -79,7 +79,10 @@ public String post(final URI baseUrl, final String path, final String jsonBody)
}

public String post(
final URI baseUrl, final String path, final String jsonBody, Map<String, String> headers)
final URI baseUrl,
final String path,
final String jsonBody,
final Map<String, String> headers)
throws IOException {
final RequestBody requestBody = RequestBody.create(jsonBody, JSON);
final Request.Builder builder =
Expand All @@ -98,7 +101,10 @@ public String post(
}

public String delete(
final URI baseUrl, final String path, final String jsonBody, Map<String, String> headers)
final URI baseUrl,
final String path,
final String jsonBody,
final Map<String, String> headers)
throws IOException {
final RequestBody requestBody = RequestBody.create(jsonBody, JSON);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ private Optional<UInt64> getSlotFromHeadEvent(
}

public void checkValidatorLiveness(
final int epoch, final int totalValidatorCount, ValidatorLivenessExpectation... args)
final int epoch, final int totalValidatorCount, final ValidatorLivenessExpectation... args)
throws IOException {
final List<UInt64> validators = new ArrayList<>();
for (UInt64 i = UInt64.ZERO; i.isLessThan(totalValidatorCount); i = i.increment()) {
Expand All @@ -234,7 +234,7 @@ public void checkValidatorLiveness(
}

private Object2BooleanMap<UInt64> getValidatorLivenessAtEpoch(
final UInt64 epoch, List<UInt64> validators) throws IOException {
final UInt64 epoch, final List<UInt64> validators) throws IOException {

final String response =
httpClient.post(
Expand Down Expand Up @@ -352,7 +352,7 @@ public void submitBlsToExecutionChange(
httpClient.post(getRestApiUrl(), "/eth/v1/beacon/pool/bls_to_execution_changes", body);
}

public void waitForBlsToExecutionChangeEventForValidator(int validatorIndex) {
public void waitForBlsToExecutionChangeEventForValidator(final int validatorIndex) {
if (maybeEventStreamListener.isEmpty()) {
fail(
"Must start listening to events before waiting for them... Try calling TekuNode.startEventListener(..)!");
Expand Down Expand Up @@ -658,7 +658,7 @@ private Optional<Validator> fetchValidator(final int validatorId) throws IOExcep
}
}

public void waitForValidators(int numberOfValidators) {
public void waitForValidators(final int numberOfValidators) {
waitFor(
() -> {
Optional<BeaconState> maybeState = fetchHeadState();
Expand All @@ -683,7 +683,7 @@ public void waitForValidatorWithCredentials(
}

public void waitForAttestationBeingGossiped(
int validatorSeparationIndex, int totalValidatorCount) {
final int validatorSeparationIndex, final int totalValidatorCount) {
List<UInt64> node1Validators =
IntStream.range(0, validatorSeparationIndex).mapToObj(UInt64::valueOf).toList();
List<UInt64> node2Validators =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ public abstract class TekuNode extends Node {
protected Optional<EventStreamListener> maybeEventStreamListener = Optional.empty();

protected TekuNode(
Network network, String dockerImageName, TekuDockerVersion dockerImageVersion, Logger log) {
final Network network,
final String dockerImageName,
final TekuDockerVersion dockerImageVersion,
final Logger log) {
super(network, dockerImageName, dockerImageVersion, log);
}

Expand Down Expand Up @@ -135,7 +138,7 @@ public void waitForOwnedValidatorCount(final int expectedValidatorCount) {
});
}

private String getEventUrl(List<EventType> events) {
private String getEventUrl(final List<EventType> events) {
final String eventTypes =
events.isEmpty()
? ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ public class TekuNodeConfig {
private final Map<String, String> writableMountPoints;

public TekuNodeConfig(
Map<String, Object> configMap,
final Map<String, Object> configMap,
final Consumer<SpecConfigBuilder> specConfigModifier,
final Optional<PrivKey> maybePrivateKey,
final Optional<PeerId> maybePeerId,
final Map<String, String> writableMountPoints,
final Map<String, String> readOnlyMountPoints,
final List<File> tarballsToCopy,
Map<File, String> configFileMap) {
final Map<File, String> configFileMap) {
this.configMap = configMap;
this.specConfigModifier = specConfigModifier;
this.maybePrivateKey = maybePrivateKey;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ public TekuNodeConfigBuilder withSpecifiedBearerToken(final String password) thr
}

public TekuNodeConfigBuilder withWritableKeystorePath(
ValidatorKeystores keystores, Path tempDir) {
final ValidatorKeystores keystores, final Path tempDir) {
LOG.debug("Xinterop-enabled=false");
configMap.put("Xinterop-enabled", false);
final String keysFolder = "/" + keystores.getKeysDirectoryName();
Expand Down Expand Up @@ -513,7 +513,7 @@ public TekuNodeConfigBuilder withStubExecutionEngine() {
return this;
}

public TekuNodeConfigBuilder withGenesisTime(int time) {
public TekuNodeConfigBuilder withGenesisTime(final int time) {
mustBe(NodeType.BEACON_NODE);
LOG.debug("Xinterop-genesis-time={}", time);
configMap.put("Xinterop-genesis-time", time);
Expand All @@ -526,7 +526,7 @@ public TekuNodeConfigBuilder withGraffiti(final String graffiti) {
return this;
}

private TekuNodeConfigBuilder withPrivateKey(PrivKey privKey) throws IOException {
private TekuNodeConfigBuilder withPrivateKey(final PrivKey privKey) throws IOException {
mustBe(NodeType.BEACON_NODE);
this.maybePrivKey = Optional.ofNullable(privKey);
this.maybePeerId = maybePrivKey.map(privateKey -> PeerId.fromPubKey(privateKey.publicKey()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ private TekuVoluntaryExit(final Network network, final TekuVoluntaryExit.Config
}

public static TekuVoluntaryExit create(
final Network network, Consumer<TekuVoluntaryExit.Config> configOptions) {
final Network network, final Consumer<TekuVoluntaryExit.Config> configOptions) {

final TekuVoluntaryExit.Config config = new TekuVoluntaryExit.Config();
configOptions.accept(config);
Expand All @@ -54,7 +54,7 @@ public static TekuVoluntaryExit create(
return node;
}

public TekuVoluntaryExit withValidatorKeystores(ValidatorKeystores validatorKeystores)
public TekuVoluntaryExit withValidatorKeystores(final ValidatorKeystores validatorKeystores)
throws Exception {
this.config.withValidatorKeys(
WORKING_DIRECTORY
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ public class TrustingSimpleHttpsClient extends SimpleHttpClient {
new TrustManager[] {
new X509TrustManager() {
@Override
public void checkClientTrusted(X509Certificate[] chain, String authType) {}
public void checkClientTrusted(final X509Certificate[] chain, final String authType) {}

@Override
public void checkServerTrusted(X509Certificate[] chain, String authType)
public void checkServerTrusted(final X509Certificate[] chain, final String authType)
throws CertificateException {

for (X509Certificate certificate : chain) {
Expand All @@ -62,10 +62,10 @@ public X509Certificate[] getAcceptedIssuers() {
private static final X509TrustManager TRUST_MANAGER =
new X509TrustManager() {
@Override
public void checkClientTrusted(X509Certificate[] chain, String authType) {}
public void checkClientTrusted(final X509Certificate[] chain, final String authType) {}

@Override
public void checkServerTrusted(X509Certificate[] chain, String authType) {}
public void checkServerTrusted(final X509Certificate[] chain, final String authType) {}

@Override
public X509Certificate[] getAcceptedIssuers() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ private Web3SignerNode(final Network network, final Web3SignerNode.Config config
}

public static Web3SignerNode create(
final Network network, Consumer<Web3SignerNode.Config> configOptions) {
final Network network, final Consumer<Web3SignerNode.Config> configOptions) {

final Web3SignerNode.Config config = new Web3SignerNode.Config();
configOptions.accept(config);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,26 +67,26 @@ public static MetricLabelsCondition withLabelValueSubstring(
};
}

public static MetricValuesCondition withValueEqualTo(double value) {
public static MetricValuesCondition withValueEqualTo(final double value) {
return (actualValue) -> DoubleMath.fuzzyEquals(actualValue, value, DOUBLE_COMPARE_TOLERANCE);
}

public static MetricValuesCondition withValueGreaterThan(double value) {
public static MetricValuesCondition withValueGreaterThan(final double value) {
return (actualValue) ->
DoubleMath.fuzzyCompare(actualValue, value, DOUBLE_COMPARE_TOLERANCE) > 0;
}

public static MetricValuesCondition withValueGreaterThanOrEqualTo(double value) {
public static MetricValuesCondition withValueGreaterThanOrEqualTo(final double value) {
return (actualValue) ->
DoubleMath.fuzzyCompare(actualValue, value, DOUBLE_COMPARE_TOLERANCE) >= 0;
}

public static MetricValuesCondition withValueLessThan(double value) {
public static MetricValuesCondition withValueLessThan(final double value) {
return (actualValue) ->
DoubleMath.fuzzyCompare(actualValue, value, DOUBLE_COMPARE_TOLERANCE) < 0;
}

public static MetricValuesCondition withValueLessThanOrEqualTo(double value) {
public static MetricValuesCondition withValueLessThanOrEqualTo(final double value) {
return (actualValue) ->
DoubleMath.fuzzyCompare(actualValue, value, DOUBLE_COMPARE_TOLERANCE) <= 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ private List<MetricValue> fetchAllMetricsFromEndpoint() {
}
}

public static MetricValue parse(String line) {
public static MetricValue parse(final String line) {
if (line.contains("{")) {
final String metricName = line.substring(0, line.indexOf("{"));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public SafeFuture<Void> sendDeposits(final ValidatorKeystores validators) {
});
}

private SafeFuture<TransactionReceipt> sendDeposit(ValidatorKeys validatorKeys) {
private SafeFuture<TransactionReceipt> sendDeposit(final ValidatorKeys validatorKeys) {
return depositSenderService.sendDeposit(validatorKeys);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void close() {
executorService.shutdownNow();
}

public SafeFuture<TransactionReceipt> sendDeposit(ValidatorKeys validatorKeys) {
public SafeFuture<TransactionReceipt> sendDeposit(final ValidatorKeys validatorKeys) {
final BLSKeyPair validatorKey = validatorKeys.getValidatorKey();
return sender.sendDepositTransaction(
validatorKey, validatorKeys.getWithdrawalCredentials(), amount);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ public DepositTransactionSender(
}

public SafeFuture<TransactionReceipt> sendDepositTransaction(
BLSKeyPair validatorKeyPair, final Bytes32 withdrawalCredentials, final UInt64 amountInGwei) {
final BLSKeyPair validatorKeyPair,
final Bytes32 withdrawalCredentials,
final UInt64 amountInGwei) {

final DepositData depositData =
depositGenerator.createDepositData(validatorKeyPair, amountInGwei, withdrawalCredentials);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ public class ValidatorKeystoreGenerator {
private final Path passwordsOutputPath;

public ValidatorKeystoreGenerator(
String validatorKeyPassword,
Path keysOutputPath,
Path passwordsOutputPath,
Consumer<String> commandOutput) {
final String validatorKeyPassword,
final Path keysOutputPath,
final Path passwordsOutputPath,
final Consumer<String> commandOutput) {
// Withdrawal key password is unnecessary for this mode of running.
this.encryptedKeystoreWriter =
new EncryptedKeystoreWriter(
Expand Down Expand Up @@ -67,7 +67,7 @@ public void generateKeystoreAndPasswordFiles(final List<ValidatorKeys> validator
}
}

public void createDirectory(Path directoryPath) {
public void createDirectory(final Path directoryPath) {
try {
Files.createDirectories(directoryPath);
} catch (IOException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public class ValidatorKeystores {

Optional<File> maybeTarball = Optional.empty();

public ValidatorKeystores(List<ValidatorKeys> validatorKeys) {
public ValidatorKeystores(final List<ValidatorKeys> validatorKeys) {
this.validatorKeys = validatorKeys;
}

Expand Down Expand Up @@ -150,7 +150,7 @@ public void writeToTempDir(final Path tempDir) {
keystoreGenerator.generateKeystoreAndPasswordFiles(validatorKeys);
}

private static void copyDirectoryToTarFile(Path inputDirectoryPath, Path outputPath)
private static void copyDirectoryToTarFile(final Path inputDirectoryPath, final Path outputPath)
throws IOException {
File outputFile = outputPath.toFile();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
public class RemoteMetricsServiceStub {
private final HttpServer server;

public RemoteMetricsServiceStub(InetSocketAddress inetSocketAddress) throws IOException {
public RemoteMetricsServiceStub(final InetSocketAddress inetSocketAddress) throws IOException {
server = HttpServer.create(inetSocketAddress, 0);
}

Expand All @@ -36,7 +36,7 @@ public void stopServer() {
}
}

public void registerHandler(String uriToHandle, HttpHandler httpHandler) {
public void registerHandler(final String uriToHandle, final HttpHandler httpHandler) {
server.createContext(uriToHandle, httpHandler);
}
}
Loading

0 comments on commit 6278f89

Please sign in to comment.