Skip to content

Commit

Permalink
Add more logs
Browse files Browse the repository at this point in the history
  • Loading branch information
matthew1001 committed Jun 10, 2024
1 parent 9beaf88 commit 4c58a86
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- Default bonsai to use full-flat db and code-storage-by-code-hash [#6984](https://github.com/hyperledger/besu/pull/6894)
- New RPC methods miner_setExtraData and miner_getExtraData [#7078](https://github.com/hyperledger/besu/pull/7078)
- Disconnect peers that have multiple discovery ports since they give us bad neighbours [#7089](https://github.com/hyperledger/besu/pull/7089)
- `--Xsnapsync-bft-enabled` option enables experimental support for snap sync with IBFT/QBFT permissioned chains [#7140](https://github.com/hyperledger/besu/pull/7140)

### Bug fixes
- Fix parsing `gasLimit` parameter when its value is > `Long.MAX_VALUE` [#7116](https://github.com/hyperledger/besu/pull/7116)
Expand Down
4 changes: 2 additions & 2 deletions besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -1506,11 +1506,11 @@ private void validateOptions() {
}

private void validateConsensusSyncCompatibilityOptions() {
// snap and checkpoint can't be used with BFT but can for clique
// snap and checkpoint are experimental for BFT
if ((genesisConfigOptionsSupplier.get().isIbftLegacy()
|| genesisConfigOptionsSupplier.get().isIbft2()
|| genesisConfigOptionsSupplier.get().isQbft())
&& genesisConfigOptionsSupplier.get().isEthHash()) {
&& !unstableSynchronizerOptions.isSnapSyncBftEnabled()) {
final String errorSuffix = "can't be used with BFT networks";
if (SyncMode.CHECKPOINT.equals(syncMode) || SyncMode.X_CHECKPOINT.equals(syncMode)) {
throw new ParameterException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -837,7 +837,9 @@ private PivotBlockSelector createPivotSelector(
final MetricsSystem metricsSystem) {

if (genesisConfigOptions.isQbft() || genesisConfigOptions.isIbft2()) {
LOG.info("QBFT is configured, creating initial sync for BFT");
LOG.info(
"{} is configured, creating initial sync for BFT",
genesisConfigOptions.getConsensusEngine().toUpperCase());
return new BFTPivotSelectorFromPeers(
ethContext, syncConfig, syncState, metricsSystem, protocolContext, nodeKey);
} else if (genesisConfigOptions.getTerminalTotalDifficulty().isPresent()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ public Optional<FastSyncState> selectNewPivotBlock() {
// pivot distance
if (bestPeer.get().chainState().getEstimatedHeight()
<= syncConfig.getFastSyncPivotDistance()) {
LOG.info(
"Best peer for sync found but chain height hasn't reached minimum sync pivot distance {}, exiting sync process",
syncConfig.getFastSyncPivotDistance());
throw new NoSyncRequiredException();
}

Expand All @@ -78,6 +81,7 @@ public Optional<FastSyncState> selectNewPivotBlock() {
&& validatorProvider
.getValidatorsAtHead()
.contains(Util.publicKeyToAddress(nodeKey.getPublicKey()))) {
LOG.info("This node is the only BFT validator, exiting sync process");
throw new NoSyncRequiredException();
}

Expand Down Expand Up @@ -105,6 +109,9 @@ public Optional<FastSyncState> selectNewPivotBlock() {
// assume this is a new chain
// and skip waiting for any more peers to sync with. The worst case is this puts us into
// full sync mode.
LOG.info(
"Peered with {} validators but no best peer found to sync from. Assuming new BFT chain, exiting sync process",
peerValidatorCount.get());
throw new NoSyncRequiredException();
}
}
Expand Down

0 comments on commit 4c58a86

Please sign in to comment.