diff --git a/besu/src/main/java/org/hyperledger/besu/controller/BesuControllerBuilder.java b/besu/src/main/java/org/hyperledger/besu/controller/BesuControllerBuilder.java index 258cf95ca35..206f365ecc3 100644 --- a/besu/src/main/java/org/hyperledger/besu/controller/BesuControllerBuilder.java +++ b/besu/src/main/java/org/hyperledger/besu/controller/BesuControllerBuilder.java @@ -924,7 +924,6 @@ private PivotBlockSelector createPivotSelector( ethContext, syncConfig, syncState, - metricsSystem, protocolContext, nodeKey, blockchain.getChainHeadHeader()); @@ -954,7 +953,7 @@ private PivotBlockSelector createPivotSelector( unsubscribeForkchoiceListener); } else { LOG.info("TTD difficulty is not present, creating initial sync phase for PoW"); - return new PivotSelectorFromPeers(ethContext, syncConfig, syncState, metricsSystem); + return new PivotSelectorFromPeers(ethContext, syncConfig, syncState); } } diff --git a/consensus/qbft/src/main/java/org/hyperledger/besu/consensus/qbft/BFTPivotSelectorFromPeers.java b/consensus/qbft/src/main/java/org/hyperledger/besu/consensus/qbft/BFTPivotSelectorFromPeers.java index 7437b349a2a..78ad1816635 100644 --- a/consensus/qbft/src/main/java/org/hyperledger/besu/consensus/qbft/BFTPivotSelectorFromPeers.java +++ b/consensus/qbft/src/main/java/org/hyperledger/besu/consensus/qbft/BFTPivotSelectorFromPeers.java @@ -26,7 +26,6 @@ import org.hyperledger.besu.ethereum.eth.sync.fastsync.NoSyncRequiredException; import org.hyperledger.besu.ethereum.eth.sync.fastsync.PivotSelectorFromPeers; import org.hyperledger.besu.ethereum.eth.sync.state.SyncState; -import org.hyperledger.besu.plugin.services.MetricsSystem; import java.util.Optional; import java.util.concurrent.atomic.AtomicBoolean; @@ -56,7 +55,6 @@ public class BFTPivotSelectorFromPeers extends PivotSelectorFromPeers { * @param ethContext the eth context * @param syncConfig the sync config * @param syncState the sync state - * @param metricsSystem the metrics * @param protocolContext the protocol context * @param nodeKey the node key * @param blockHeader the block header @@ -65,11 +63,10 @@ public BFTPivotSelectorFromPeers( final EthContext ethContext, final SynchronizerConfiguration syncConfig, final SyncState syncState, - final MetricsSystem metricsSystem, final ProtocolContext protocolContext, final NodeKey nodeKey, final BlockHeader blockHeader) { - super(ethContext, syncConfig, syncState, metricsSystem); + super(ethContext, syncConfig, syncState); this.protocolContext = protocolContext; this.blockHeader = blockHeader; this.nodeKey = nodeKey; diff --git a/consensus/qbft/src/test/java/org/hyperledger/besu/consensus/qbft/sync/QbftPivotSelectorTest.java b/consensus/qbft/src/test/java/org/hyperledger/besu/consensus/qbft/sync/QbftPivotSelectorTest.java index 2f3013ea714..76f41dc6506 100644 --- a/consensus/qbft/src/test/java/org/hyperledger/besu/consensus/qbft/sync/QbftPivotSelectorTest.java +++ b/consensus/qbft/src/test/java/org/hyperledger/besu/consensus/qbft/sync/QbftPivotSelectorTest.java @@ -33,7 +33,6 @@ import org.hyperledger.besu.ethereum.eth.sync.fastsync.FastSyncState; import org.hyperledger.besu.ethereum.eth.sync.fastsync.NoSyncRequiredException; import org.hyperledger.besu.ethereum.eth.sync.state.SyncState; -import org.hyperledger.besu.plugin.services.MetricsSystem; import java.util.ArrayList; import java.util.List; @@ -55,7 +54,6 @@ public class QbftPivotSelectorTest { @Mock private ProtocolContext protocolContext; @Mock private BftContext bftContext; @Mock private SyncState syncState; - @Mock private MetricsSystem metricsSystem; @Mock private EthContext ethContext; @Mock private EthPeers ethPeers; @Mock private ValidatorProvider validatorProvider; @@ -80,13 +78,7 @@ public void returnEmptySyncStateIfValidatorWithOtherValidatorsButNoPeers() { when(validatorProvider.getValidatorsAtHead()).thenReturn(validatorList); BFTPivotSelectorFromPeers pivotSelector = new BFTPivotSelectorFromPeers( - ethContext, - syncConfig, - syncState, - metricsSystem, - protocolContext, - nodeKey, - blockHeader); + ethContext, syncConfig, syncState, protocolContext, nodeKey, blockHeader); Optional pivotState = pivotSelector.selectNewPivotBlock(); assertThat(pivotState.isEmpty()).isTrue(); } @@ -104,13 +96,7 @@ public void returnNoSyncRequiredIfOnlyValidatorAndNoPeers() { when(validatorProvider.getValidatorsAtHead()).thenReturn(validatorList); BFTPivotSelectorFromPeers pivotSelector = new BFTPivotSelectorFromPeers( - ethContext, - syncConfig, - syncState, - metricsSystem, - protocolContext, - nodeKey, - blockHeader); + ethContext, syncConfig, syncState, protocolContext, nodeKey, blockHeader); try { Optional pivotState = pivotSelector.selectNewPivotBlock(); @@ -126,13 +112,7 @@ public void returnEmptySyncStateIfNonValidatorWithNoBestPeer() { when(validatorProvider.nodeIsValidator(any())).thenReturn(false); BFTPivotSelectorFromPeers pivotSelector = new BFTPivotSelectorFromPeers( - ethContext, - syncConfig, - syncState, - metricsSystem, - protocolContext, - nodeKey, - blockHeader); + ethContext, syncConfig, syncState, protocolContext, nodeKey, blockHeader); Optional pivotState = pivotSelector.selectNewPivotBlock(); assertThat(pivotState.isEmpty()).isTrue(); @@ -145,13 +125,7 @@ public void returnEmptySyncStateIfValidatorAndNotAtGenesisAndOtherValidators() { when(blockHeader.getNumber()).thenReturn(10L); BFTPivotSelectorFromPeers pivotSelector = new BFTPivotSelectorFromPeers( - ethContext, - syncConfig, - syncState, - metricsSystem, - protocolContext, - nodeKey, - blockHeader); + ethContext, syncConfig, syncState, protocolContext, nodeKey, blockHeader); Optional pivotState = pivotSelector.selectNewPivotBlock(); assertThat(pivotState.isEmpty()).isTrue(); diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/PivotSelectorFromPeers.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/PivotSelectorFromPeers.java index 0c0f2cee3a5..9816dc66d3f 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/PivotSelectorFromPeers.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/PivotSelectorFromPeers.java @@ -22,7 +22,6 @@ import org.hyperledger.besu.ethereum.eth.sync.TrailingPeerLimiter; import org.hyperledger.besu.ethereum.eth.sync.TrailingPeerRequirements; import org.hyperledger.besu.ethereum.eth.sync.state.SyncState; -import org.hyperledger.besu.plugin.services.MetricsSystem; import java.util.Optional; import java.util.concurrent.CompletableFuture; @@ -41,8 +40,7 @@ public class PivotSelectorFromPeers implements PivotBlockSelector { public PivotSelectorFromPeers( final EthContext ethContext, final SynchronizerConfiguration syncConfig, - final SyncState syncState, - final MetricsSystem metricsSystem) { + final SyncState syncState) { this.ethContext = ethContext; this.syncConfig = syncConfig; this.syncState = syncState; diff --git a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/FastSyncActionsTest.java b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/FastSyncActionsTest.java index 90730b1a04d..fe9683059f4 100644 --- a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/FastSyncActionsTest.java +++ b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/FastSyncActionsTest.java @@ -120,8 +120,7 @@ public void setUp( metricsSystem = new NoOpMetricsSystem(); fastSyncActions = createFastSyncActions( - syncConfig, - new PivotSelectorFromPeers(ethContext, syncConfig, syncState, metricsSystem)); + syncConfig, new PivotSelectorFromPeers(ethContext, syncConfig, syncState)); } @ParameterizedTest @@ -171,8 +170,7 @@ public void selectPivotBlockShouldSelectBlockPivotDistanceFromBestPeer( fastSyncActions = createFastSyncActions( - syncConfig, - new PivotSelectorFromPeers(ethContext, syncConfig, syncState, metricsSystem)); + syncConfig, new PivotSelectorFromPeers(ethContext, syncConfig, syncState)); EthProtocolManagerTestUtil.createPeer(ethProtocolManager, 5000); @@ -189,8 +187,7 @@ public void selectPivotBlockShouldConsiderTotalDifficultyWhenSelectingBestPeer( setUp(storageFormat, false, Optional.of(1)); fastSyncActions = createFastSyncActions( - syncConfig, - new PivotSelectorFromPeers(ethContext, syncConfig, syncState, metricsSystem)); + syncConfig, new PivotSelectorFromPeers(ethContext, syncConfig, syncState)); EthProtocolManagerTestUtil.createPeer(ethProtocolManager, Difficulty.of(1000), 5500); EthProtocolManagerTestUtil.createPeer(ethProtocolManager, Difficulty.of(2000), 4000); @@ -209,8 +206,7 @@ public void selectPivotBlockShouldWaitAndRetryUntilMinHeightEstimatesAreAvailabl EthProtocolManagerTestUtil.disableEthSchedulerAutoRun(ethProtocolManager); fastSyncActions = createFastSyncActions( - syncConfig, - new PivotSelectorFromPeers(ethContext, syncConfig, syncState, metricsSystem)); + syncConfig, new PivotSelectorFromPeers(ethContext, syncConfig, syncState)); final CompletableFuture result = fastSyncActions.selectPivotBlock(FastSyncState.EMPTY_SYNC_STATE); @@ -283,8 +279,7 @@ private void selectPivotBlockUsesBestPeerMatchingRequiredCriteria( final int peerCount = 4; fastSyncActions = createFastSyncActions( - syncConfig, - new PivotSelectorFromPeers(ethContext, syncConfig, syncState, metricsSystem)); + syncConfig, new PivotSelectorFromPeers(ethContext, syncConfig, syncState)); final long minPivotHeight = syncConfig.getSyncPivotDistance() + 1L; EthProtocolManagerTestUtil.disableEthSchedulerAutoRun(ethProtocolManager); @@ -332,8 +327,7 @@ public void selectPivotBlockShouldWaitAndRetryIfBestPeerChainIsShorterThanPivotD setUp(storageFormat, false, Optional.of(1)); fastSyncActions = createFastSyncActions( - syncConfig, - new PivotSelectorFromPeers(ethContext, syncConfig, syncState, metricsSystem)); + syncConfig, new PivotSelectorFromPeers(ethContext, syncConfig, syncState)); final long pivotDistance = syncConfig.getSyncPivotDistance(); EthProtocolManagerTestUtil.disableEthSchedulerAutoRun(ethProtocolManager); @@ -394,8 +388,7 @@ public void downloadPivotBlockHeaderShouldRetrievePivotBlockHeader( setUp(storageFormat, false, Optional.of(1)); fastSyncActions = createFastSyncActions( - syncConfig, - new PivotSelectorFromPeers(ethContext, syncConfig, syncState, metricsSystem)); + syncConfig, new PivotSelectorFromPeers(ethContext, syncConfig, syncState)); final RespondingEthPeer peer = EthProtocolManagerTestUtil.createPeer(ethProtocolManager, 1001); final CompletableFuture result =