Skip to content

Commit e328b95

Browse files
committed
Merge branch 'master' into get-graffiti
# Conflicts: # CHANGELOG.md
2 parents 09794e1 + 38708fb commit e328b95

File tree

411 files changed

+3350
-1706
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

411 files changed

+3350
-1706
lines changed

.circleci/config.yml

+8-2
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ commands:
148148
name: "Publish Docker Images"
149149
command: |
150150
docker login --username "${DOCKER_USER_RW}" --password "${DOCKER_PASSWORD_RW}"
151-
./gradlew --no-daemon --parallel "-Pbranch=${CIRCLE_BRANCH}" uploadDocker
151+
./gradlew --no-daemon --parallel "-Pbranch=${CIRCLE_BRANCH} -PincludeCommitHashInDockerTag=<< pipeline.parameters.include_commit_hash_in_docker_tag >>" uploadDocker
152152
153153
notify:
154154
description: "Notify Slack"
@@ -157,6 +157,12 @@ commands:
157157
mentions: "team-centaur"
158158
fail_only: true
159159
only_for_branches: 'master'
160+
161+
parameters:
162+
include_commit_hash_in_docker_tag:
163+
type: boolean
164+
default: false
165+
160166
jobs:
161167
assemble:
162168
executor: large_executor
@@ -497,7 +503,7 @@ jobs:
497503
paths:
498504
- .openapidoc/spec/teku.json
499505

500-
# longish story here: we store the openapi json spec in the `gh-pages` branch of teku on Github
506+
# longish story here: we store the openapi json spec in the `gh-pages` branch of teku on Github
501507
# The reason we don't use GHA and instead use Circle to push to GHA is:
502508
# 1. We need assemble -> extractAPISpec -> publishAPISpec and this takes circa 10 mins to build in GHA,
503509
# 2. We publish artifacts (openapi, docker, binaries etc) only after ALL tests and we can't check for all the jobs passing to kick this one off

CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ the [releases page](https://github.com/Consensys/teku/releases).
1616
- Added `peers_direction_current` libp2p metric to track the number of peers by direction (inbound and outbound).
1717
- Deposit tree snapshots will be loaded from database as a default unless custom snapshot has been provided.
1818
- Added hidden option `--Xdeposit-contract-logs-syncing-enabled` to allow disabling the syncing of the deposit contract logs from the EL. This is useful when running a non-validating node. It is advisable to be used alongside with `--Xeth1-missing-deposits-event-logging-enabled=false` to avoid unnecessary logging of missing deposits.
19-
- Updated the bootnodes for Chiado and Gnosis networks
19+
- Updated the bootnodes for Chiado and Gnosis networks.
20+
- Added hidden option `--Xp2p-dumps-to-file-enabled` to enable saving p2p dumps to file.
2021
- Added GET `/eth/v1/validator/{pubkey}/graffiti` validator API.
2122

2223
### Bug Fixes

beacon/pow/src/main/java/tech/pegasys/teku/beacon/pow/AbstractMonitorableEth1Provider.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,16 @@ protected enum Result {
3030
protected Result lastCallResult = Result.FAILED;
3131
protected Result lastValidationResult = Result.FAILED;
3232

33-
protected AbstractMonitorableEth1Provider(TimeProvider timeProvider) {
33+
protected AbstractMonitorableEth1Provider(final TimeProvider timeProvider) {
3434
this.timeProvider = timeProvider;
3535
}
3636

37-
protected synchronized void updateLastValidation(Result result) {
37+
protected synchronized void updateLastValidation(final Result result) {
3838
lastValidationTime = timeProvider.getTimeInSeconds();
3939
lastValidationResult = result;
4040
}
4141

42-
protected synchronized void updateLastCall(Result result) {
42+
protected synchronized void updateLastCall(final Result result) {
4343
lastCallTime = timeProvider.getTimeInSeconds();
4444
lastCallResult = result;
4545
}

beacon/pow/src/main/java/tech/pegasys/teku/beacon/pow/DepositEventsAccessor.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ public class DepositEventsAccessor {
2727
private final Eth1Provider eth1Provider;
2828
private final String contractAddress;
2929

30-
public DepositEventsAccessor(Eth1Provider eth1Provider, String contractAddress) {
30+
public DepositEventsAccessor(final Eth1Provider eth1Provider, final String contractAddress) {
3131
this.eth1Provider = eth1Provider;
3232
this.contractAddress = contractAddress;
3333
}
3434

3535
public SafeFuture<List<DepositEventEventResponse>> depositEventInRange(
36-
DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
36+
final DefaultBlockParameter startBlock, final DefaultBlockParameter endBlock) {
3737
final EthFilter filter = new EthFilter(startBlock, endBlock, this.contractAddress);
3838
filter.addSingleTopic(EventEncoder.encode(DepositContract.DEPOSITEVENT_EVENT));
3939
return SafeFuture.of(

beacon/pow/src/main/java/tech/pegasys/teku/beacon/pow/DepositFetcher.java

+9-8
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public DepositFetcher(
8484

8585
// Inclusive on both sides
8686
public synchronized SafeFuture<Void> fetchDepositsInRange(
87-
BigInteger fromBlockNumber, BigInteger toBlockNumber) {
87+
final BigInteger fromBlockNumber, final BigInteger toBlockNumber) {
8888
checkArgument(
8989
fromBlockNumber.compareTo(toBlockNumber) <= 0,
9090
"From block number (%s) must be less than or equal to block number (%s)",
@@ -161,10 +161,11 @@ private SafeFuture<Void> processDepositsInBatch(
161161
}
162162

163163
private SafeFuture<Void> postDepositEvents(
164-
List<SafeFuture<EthBlock.Block>> blockRequests,
165-
Map<BlockNumberAndHash, List<DepositContract.DepositEventEventResponse>> depositEventsByBlock,
166-
BigInteger fromBlock,
167-
BigInteger toBlock) {
164+
final List<SafeFuture<EthBlock.Block>> blockRequests,
165+
final Map<BlockNumberAndHash, List<DepositContract.DepositEventEventResponse>>
166+
depositEventsByBlock,
167+
final BigInteger fromBlock,
168+
final BigInteger toBlock) {
168169
LOG.trace("Posting deposit events for {} blocks", depositEventsByBlock.size());
169170
BigInteger from = fromBlock;
170171
// First process completed requests using iteration.
@@ -220,7 +221,7 @@ private DepositsFromBlockEvent createDepositFromBlockEvent(
220221
}
221222

222223
private List<SafeFuture<EthBlock.Block>> getListOfEthBlockFutures(
223-
Set<BlockNumberAndHash> neededBlockHashes) {
224+
final Set<BlockNumberAndHash> neededBlockHashes) {
224225
return neededBlockHashes.stream()
225226
.map(BlockNumberAndHash::getHash)
226227
.map(eth1Provider::getGuaranteedEth1Block)
@@ -229,7 +230,7 @@ private List<SafeFuture<EthBlock.Block>> getListOfEthBlockFutures(
229230

230231
private NavigableMap<BlockNumberAndHash, List<DepositEventEventResponse>>
231232
groupDepositEventResponsesByBlockHash(
232-
List<DepositContract.DepositEventEventResponse> events) {
233+
final List<DepositContract.DepositEventEventResponse> events) {
233234
return events.stream()
234235
.collect(
235236
groupingBy(
@@ -239,7 +240,7 @@ private List<SafeFuture<EthBlock.Block>> getListOfEthBlockFutures(
239240
toList()));
240241
}
241242

242-
private void postDeposits(DepositsFromBlockEvent event) {
243+
private void postDeposits(final DepositsFromBlockEvent event) {
243244
eth1EventsChannel.onDepositsFromBlock(event);
244245
}
245246

beacon/pow/src/main/java/tech/pegasys/teku/beacon/pow/DepositProcessingController.java

+13-12
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ public class DepositProcessingController {
5151
private final Eth1BlockFetcher eth1BlockFetcher;
5252

5353
public DepositProcessingController(
54-
SpecConfig config,
55-
Eth1Provider eth1Provider,
56-
Eth1EventsChannel eth1EventsChannel,
57-
AsyncRunner asyncRunner,
58-
DepositFetcher depositFetcher,
59-
Eth1BlockFetcher eth1BlockFetcher,
60-
Eth1HeadTracker headTracker) {
54+
final SpecConfig config,
55+
final Eth1Provider eth1Provider,
56+
final Eth1EventsChannel eth1EventsChannel,
57+
final AsyncRunner asyncRunner,
58+
final DepositFetcher depositFetcher,
59+
final Eth1BlockFetcher eth1BlockFetcher,
60+
final Eth1HeadTracker headTracker) {
6161
this.config = config;
6262
this.eth1Provider = eth1Provider;
6363
this.eth1EventsChannel = eth1EventsChannel;
@@ -73,7 +73,7 @@ public synchronized void switchToBlockByBlockMode() {
7373
}
7474

7575
// inclusive of start block
76-
public synchronized void startSubscription(BigInteger subscriptionStartBlock) {
76+
public synchronized void startSubscription(final BigInteger subscriptionStartBlock) {
7777
LOG.debug("Starting subscription at block {}", subscriptionStartBlock);
7878
latestSuccessfullyQueriedBlock = subscriptionStartBlock.subtract(BigInteger.ONE);
7979
newBlockSubscription = headTracker.subscribe(this::onNewCanonicalBlockNumber);
@@ -89,7 +89,7 @@ public synchronized SafeFuture<Void> fetchDepositsInRange(
8989
return depositFetcher.fetchDepositsInRange(fromBlockNumber, toBlockNumber);
9090
}
9191

92-
private synchronized void onNewCanonicalBlockNumber(UInt64 newCanonicalBlockNumber) {
92+
private synchronized void onNewCanonicalBlockNumber(final UInt64 newCanonicalBlockNumber) {
9393
this.latestCanonicalBlockNumber = newCanonicalBlockNumber.bigIntegerValue();
9494
fetchLatestSubscriptionDeposits();
9595
}
@@ -165,7 +165,8 @@ private boolean isActiveOrAlreadyQueriedLatestCanonicalBlock() {
165165
return active || latestCanonicalBlockNumber.compareTo(latestSuccessfullyQueriedBlock) <= 0;
166166
}
167167

168-
private synchronized void onSubscriptionDepositRequestSuccessful(BigInteger requestToBlock) {
168+
private synchronized void onSubscriptionDepositRequestSuccessful(
169+
final BigInteger requestToBlock) {
169170
active = false;
170171
latestSuccessfullyQueriedBlock = requestToBlock;
171172
if (latestCanonicalBlockNumber.compareTo(latestSuccessfullyQueriedBlock) > 0) {
@@ -177,12 +178,12 @@ private synchronized void onSubscriptionDepositRequestSuccessful(BigInteger requ
177178
}
178179

179180
private synchronized void onSubscriptionDepositRequestFailed(
180-
Throwable err, BigInteger fromBlock) {
181+
final Throwable err, final BigInteger fromBlock) {
181182
onSubscriptionDepositRequestFailed(err, fromBlock, fromBlock);
182183
}
183184

184185
private synchronized void onSubscriptionDepositRequestFailed(
185-
Throwable err, BigInteger fromBlock, BigInteger toBlock) {
186+
final Throwable err, final BigInteger fromBlock, final BigInteger toBlock) {
186187
active = false;
187188

188189
if (Throwables.getRootCause(err) instanceof InvalidDepositEventsException) {

beacon/pow/src/main/java/tech/pegasys/teku/beacon/pow/ErrorTrackingEth1Provider.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public SafeFuture<Boolean> ethSyncing() {
9696
}
9797

9898
@Override
99-
public SafeFuture<List<EthLog.LogResult<?>>> ethGetLogs(EthFilter ethFilter) {
99+
public SafeFuture<List<EthLog.LogResult<?>>> ethGetLogs(final EthFilter ethFilter) {
100100
return logStatus(delegate.ethGetLogs(ethFilter));
101101
}
102102

beacon/pow/src/main/java/tech/pegasys/teku/beacon/pow/Eth1BlockFetcher.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,11 @@ private void backfillEth1Blocks(final UInt64 nextBlockToRequest) {
147147
error -> LOG.error("Unexpected error while back-filling ETH1 blocks", error));
148148
}
149149

150-
private boolean isAboveLowerBound(UInt64 timestamp) {
150+
private boolean isAboveLowerBound(final UInt64 timestamp) {
151151
return timestamp.compareTo(getCacheRangeLowerBound(timeProvider.getTimeInSeconds())) >= 0;
152152
}
153153

154-
private UInt64 getCacheRangeLowerBound(UInt64 currentTime) {
154+
private UInt64 getCacheRangeLowerBound(final UInt64 currentTime) {
155155
return currentTime.compareTo(cacheDuration) > 0 ? currentTime.minus(cacheDuration) : ZERO;
156156
}
157157
}

beacon/pow/src/main/java/tech/pegasys/teku/beacon/pow/Eth1Provider.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public interface Eth1Provider {
3434
SafeFuture<Optional<Block>> getEth1BlockWithRetry(
3535
UInt64 blockNumber, Duration retryDelay, int maxRetries);
3636

37-
default SafeFuture<Optional<Block>> getEth1BlockWithRetry(UInt64 blockNumber) {
37+
default SafeFuture<Optional<Block>> getEth1BlockWithRetry(final UInt64 blockNumber) {
3838
return getEth1BlockWithRetry(blockNumber, Duration.ofSeconds(5), 2);
3939
}
4040

@@ -43,7 +43,7 @@ default SafeFuture<Optional<Block>> getEth1BlockWithRetry(UInt64 blockNumber) {
4343
SafeFuture<Optional<Block>> getEth1BlockWithRetry(
4444
String blockHash, Duration retryDelay, int maxRetries);
4545

46-
default SafeFuture<Optional<Block>> getEth1BlockWithRetry(String blockHash) {
46+
default SafeFuture<Optional<Block>> getEth1BlockWithRetry(final String blockHash) {
4747
return getEth1BlockWithRetry(blockHash, Duration.ofSeconds(5), 2);
4848
}
4949

beacon/pow/src/main/java/tech/pegasys/teku/beacon/pow/FallbackAwareEth1Provider.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public SafeFuture<Boolean> ethSyncing() {
131131
}
132132

133133
@Override
134-
public SafeFuture<List<EthLog.LogResult<?>>> ethGetLogs(EthFilter ethFilter) {
134+
public SafeFuture<List<EthLog.LogResult<?>>> ethGetLogs(final EthFilter ethFilter) {
135135
return run(eth1Provider -> eth1Provider.ethGetLogs(ethFilter));
136136
}
137137

beacon/pow/src/main/java/tech/pegasys/teku/beacon/pow/MinimumGenesisTimeBlockFinder.java

+14-9
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ public class MinimumGenesisTimeBlockFinder {
4646
private final Optional<UInt64> eth1DepositContractDeployBlock;
4747

4848
public MinimumGenesisTimeBlockFinder(
49-
SpecConfig config,
50-
Eth1Provider eth1Provider,
51-
Optional<UInt64> eth1DepositContractDeployBlock) {
49+
final SpecConfig config,
50+
final Eth1Provider eth1Provider,
51+
final Optional<UInt64> eth1DepositContractDeployBlock) {
5252
this.config = config;
5353
this.eth1Provider = eth1Provider;
5454
this.eth1DepositContractDeployBlock = eth1DepositContractDeployBlock;
@@ -191,12 +191,15 @@ private boolean blockIsAtOrAfterMinGenesis(final SpecConfig config, final EthBlo
191191
}
192192

193193
private void traceWithBlock(
194-
final String message, final EthBlock.Block block, Object... otherArgs) {
194+
final String message, final EthBlock.Block block, final Object... otherArgs) {
195195
logWithBlock(Level.TRACE, message, block, otherArgs);
196196
}
197197

198198
private void logWithBlock(
199-
final Level level, final String message, final EthBlock.Block block, Object... otherArgs) {
199+
final Level level,
200+
final String message,
201+
final EthBlock.Block block,
202+
final Object... otherArgs) {
200203
final Object[] args = new Object[otherArgs.length + 3];
201204
System.arraycopy(otherArgs, 0, args, 0, otherArgs.length);
202205

@@ -211,24 +214,26 @@ private UInt64 calculateMinGenesisTimeThreshold() {
211214
return config.getMinGenesisTime().minusMinZero(config.getGenesisDelay());
212215
}
213216

214-
static UInt64 calculateCandidateGenesisTimestamp(SpecConfig config, BigInteger eth1Timestamp) {
217+
static UInt64 calculateCandidateGenesisTimestamp(
218+
final SpecConfig config, final BigInteger eth1Timestamp) {
215219
return UInt64.valueOf(eth1Timestamp).plus(config.getGenesisDelay());
216220
}
217221

218-
static int compareBlockTimestampToMinGenesisTime(SpecConfig config, EthBlock.Block block) {
222+
static int compareBlockTimestampToMinGenesisTime(
223+
final SpecConfig config, final EthBlock.Block block) {
219224
return calculateCandidateGenesisTimestamp(config, block.getTimestamp())
220225
.compareTo(config.getMinGenesisTime());
221226
}
222227

223-
static Boolean isBlockAfterMinGenesis(SpecConfig config, EthBlock.Block block) {
228+
static Boolean isBlockAfterMinGenesis(final SpecConfig config, final EthBlock.Block block) {
224229
int comparison = compareBlockTimestampToMinGenesisTime(config, block);
225230
// If block timestamp is greater than min genesis time,
226231
// min genesis block must be in the future
227232
return comparison > 0;
228233
}
229234

230235
static void notifyMinGenesisTimeBlockReached(
231-
Eth1EventsChannel eth1EventsChannel, EthBlock.Block block) {
236+
final Eth1EventsChannel eth1EventsChannel, final EthBlock.Block block) {
232237
MinGenesisTimeBlockEvent event =
233238
new MinGenesisTimeBlockEvent(
234239
UInt64.valueOf(block.getTimestamp()),

beacon/pow/src/main/java/tech/pegasys/teku/beacon/pow/ThrottlingEth1Provider.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public SafeFuture<Boolean> ethSyncing() {
106106
}
107107

108108
@Override
109-
public SafeFuture<List<EthLog.LogResult<?>>> ethGetLogs(EthFilter ethFilter) {
109+
public SafeFuture<List<EthLog.LogResult<?>>> ethGetLogs(final EthFilter ethFilter) {
110110
return taskQueue.queueTask(() -> delegate.ethGetLogs(ethFilter));
111111
}
112112
}

beacon/pow/src/main/java/tech/pegasys/teku/beacon/pow/ValidatingEth1EventsPublisher.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ private void assertDepositEventIsValid(final DepositsFromBlockEvent event) {
6060
}
6161

6262
@Override
63-
public void onInitialDepositTreeSnapshot(DepositTreeSnapshot depositTreeSnapshot) {
63+
public void onInitialDepositTreeSnapshot(final DepositTreeSnapshot depositTreeSnapshot) {
6464
delegate.onInitialDepositTreeSnapshot(depositTreeSnapshot);
6565
}
6666
}

beacon/pow/src/main/java/tech/pegasys/teku/beacon/pow/Web3jEth1Provider.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ public SafeFuture<EthBlock.Block> getGuaranteedLatestEth1Block() {
181181

182182
@Override
183183
public SafeFuture<EthCall> ethCall(
184-
final String from, String to, String data, final UInt64 blockNumber) {
184+
final String from, final String to, final String data, final UInt64 blockNumber) {
185185
return SafeFuture.of(
186186
web3j
187187
.ethCall(
@@ -203,7 +203,7 @@ public SafeFuture<Boolean> ethSyncing() {
203203

204204
@Override
205205
@SuppressWarnings({"unchecked", "rawtypes"})
206-
public SafeFuture<List<EthLog.LogResult<?>>> ethGetLogs(EthFilter ethFilter) {
206+
public SafeFuture<List<EthLog.LogResult<?>>> ethGetLogs(final EthFilter ethFilter) {
207207
return sendAsync(web3j.ethGetLogs(ethFilter))
208208
.thenApply(EthLog::getLogs)
209209
.thenApply(logs -> (List<EthLog.LogResult<?>>) (List) logs);

beacon/pow/src/main/java/tech/pegasys/teku/beacon/pow/contract/DepositContract.java

+14-14
Original file line numberDiff line numberDiff line change
@@ -57,23 +57,23 @@ public class DepositContract extends Contract {
5757
new TypeReference<DynamicBytes>() {}));
5858

5959
protected DepositContract(
60-
String contractAddress,
61-
Web3j web3j,
62-
TransactionManager transactionManager,
63-
ContractGasProvider contractGasProvider) {
60+
final String contractAddress,
61+
final Web3j web3j,
62+
final TransactionManager transactionManager,
63+
final ContractGasProvider contractGasProvider) {
6464
super(BINARY, contractAddress, web3j, transactionManager, contractGasProvider);
6565
}
6666

67-
public static EventValuesWithLog staticExtractDepositEventWithLog(Log log) {
67+
public static EventValuesWithLog staticExtractDepositEventWithLog(final Log log) {
6868
return staticExtractEventParametersWithLog(DEPOSITEVENT_EVENT, log);
6969
}
7070

7171
public RemoteFunctionCall<TransactionReceipt> deposit(
72-
byte[] pubkey,
73-
byte[] withdrawalCredentials,
74-
byte[] signature,
75-
byte[] depositDataRoot,
76-
BigInteger weiValue) {
72+
final byte[] pubkey,
73+
final byte[] withdrawalCredentials,
74+
final byte[] signature,
75+
final byte[] depositDataRoot,
76+
final BigInteger weiValue) {
7777
final Function function =
7878
new Function(
7979
FUNC_DEPOSIT,
@@ -87,10 +87,10 @@ public RemoteFunctionCall<TransactionReceipt> deposit(
8787
}
8888

8989
public static DepositContract load(
90-
String contractAddress,
91-
Web3j web3j,
92-
TransactionManager transactionManager,
93-
ContractGasProvider contractGasProvider) {
90+
final String contractAddress,
91+
final Web3j web3j,
92+
final TransactionManager transactionManager,
93+
final ContractGasProvider contractGasProvider) {
9494
return new DepositContract(contractAddress, web3j, transactionManager, contractGasProvider);
9595
}
9696

beacon/pow/src/main/java/tech/pegasys/teku/beacon/pow/exception/Eth1RequestException.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public Eth1RequestException() {
2424
super("Some eth1 endpoints threw an Exception or no eth1 endpoints available");
2525
}
2626

27-
public static boolean shouldTryWithSmallerRange(Throwable err) {
27+
public static boolean shouldTryWithSmallerRange(final Throwable err) {
2828
return ExceptionUtil.hasCause(
2929
err,
3030
SocketTimeoutException.class,

0 commit comments

Comments
 (0)