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 7fff62db99..18646a1306 100644 --- a/besu/src/main/java/org/hyperledger/besu/controller/BesuControllerBuilder.java +++ b/besu/src/main/java/org/hyperledger/besu/controller/BesuControllerBuilder.java @@ -55,8 +55,8 @@ import org.hyperledger.besu.ethereum.eth.manager.EthProtocolManager; import org.hyperledger.besu.ethereum.eth.manager.EthScheduler; import org.hyperledger.besu.ethereum.eth.manager.MergePeerFilter; import org.hyperledger.besu.ethereum.eth.manager.MonitoredExecutors; -import org.hyperledger.besu.ethereum.eth.manager.peertask.DefaultPeerManager; -import org.hyperledger.besu.ethereum.eth.manager.peertask.PeerManager; +import org.hyperledger.besu.ethereum.eth.manager.peertask.DefaultPeerSelector; +import org.hyperledger.besu.ethereum.eth.manager.peertask.PeerSelector; import org.hyperledger.besu.ethereum.eth.manager.peertask.PeerTaskExecutor; import org.hyperledger.besu.ethereum.eth.manager.peertask.PeerTaskRequestSender; import org.hyperledger.besu.ethereum.eth.manager.snap.SnapProtocolManager; @@ -656,11 +656,10 @@ public abstract class BesuControllerBuilder implements MiningParameterOverrides } final EthContext ethContext = new EthContext(ethPeers, ethMessages, snapMessages, scheduler); - final PeerManager peerManager = new DefaultPeerManager(); - ethPeers.streamAllPeers().forEach(peerManager::addPeer); + final PeerSelector peerSelector = new DefaultPeerSelector(currentProtocolSpecSupplier); + ethPeers.streamAllPeers().forEach(peerSelector::addPeer); final PeerTaskExecutor peerTaskExecutor = - new PeerTaskExecutor( - peerManager, new PeerTaskRequestSender(), currentProtocolSpecSupplier, metricsSystem); + new PeerTaskExecutor(peerSelector, new PeerTaskRequestSender(), metricsSystem); final boolean fullSyncDisabled = !SyncMode.isFullSync(syncConfig.getSyncMode()); final SyncState syncState = new SyncState(blockchain, ethPeers, fullSyncDisabled, checkpoint); @@ -701,7 +700,7 @@ public abstract class BesuControllerBuilder implements MiningParameterOverrides peerValidators, Optional.empty(), forkIdManager, - peerManager); + peerSelector); final PivotBlockSelector pivotBlockSelector = createPivotSelector( @@ -1036,7 +1035,7 @@ public abstract class BesuControllerBuilder implements MiningParameterOverrides * @param peerValidators the peer validators * @param mergePeerFilter the merge peer filter * @param forkIdManager the fork id manager - * @param peerManager the PeerManager + * @param peerSelector the PeerSelector * @return the eth protocol manager */ protected EthProtocolManager createEthProtocolManager( @@ -1051,7 +1050,7 @@ public abstract class BesuControllerBuilder implements MiningParameterOverrides final List peerValidators, final Optional mergePeerFilter, final ForkIdManager forkIdManager, - final PeerManager peerManager) { + final PeerSelector peerSelector) { return new EthProtocolManager( protocolContext.getBlockchain(), networkId, @@ -1066,7 +1065,7 @@ public abstract class BesuControllerBuilder implements MiningParameterOverrides synchronizerConfiguration, scheduler, forkIdManager, - peerManager); + peerSelector); } /** diff --git a/besu/src/main/java/org/hyperledger/besu/controller/ConsensusScheduleBesuControllerBuilder.java b/besu/src/main/java/org/hyperledger/besu/controller/ConsensusScheduleBesuControllerBuilder.java index 897f2e3ace..2e28a3179c 100644 --- a/besu/src/main/java/org/hyperledger/besu/controller/ConsensusScheduleBesuControllerBuilder.java +++ b/besu/src/main/java/org/hyperledger/besu/controller/ConsensusScheduleBesuControllerBuilder.java @@ -42,7 +42,7 @@ import org.hyperledger.besu.ethereum.eth.manager.EthPeers; import org.hyperledger.besu.ethereum.eth.manager.EthProtocolManager; import org.hyperledger.besu.ethereum.eth.manager.EthScheduler; import org.hyperledger.besu.ethereum.eth.manager.MergePeerFilter; -import org.hyperledger.besu.ethereum.eth.manager.peertask.PeerManager; +import org.hyperledger.besu.ethereum.eth.manager.peertask.PeerSelector; import org.hyperledger.besu.ethereum.eth.manager.snap.SnapProtocolManager; import org.hyperledger.besu.ethereum.eth.peervalidation.PeerValidator; import org.hyperledger.besu.ethereum.eth.sync.SynchronizerConfiguration; @@ -245,7 +245,7 @@ public class ConsensusScheduleBesuControllerBuilder extends BesuControllerBuilde final List peerValidators, final Optional mergePeerFilter, final ForkIdManager forkIdManager, - final PeerManager peerManager) { + final PeerSelector peerSelector) { return besuControllerBuilderSchedule .get(0L) .createEthProtocolManager( @@ -260,7 +260,7 @@ public class ConsensusScheduleBesuControllerBuilder extends BesuControllerBuilde peerValidators, mergePeerFilter, forkIdManager, - peerManager); + peerSelector); } @Override diff --git a/besu/src/main/java/org/hyperledger/besu/controller/MergeBesuControllerBuilder.java b/besu/src/main/java/org/hyperledger/besu/controller/MergeBesuControllerBuilder.java index f860f399da..88629a7441 100644 --- a/besu/src/main/java/org/hyperledger/besu/controller/MergeBesuControllerBuilder.java +++ b/besu/src/main/java/org/hyperledger/besu/controller/MergeBesuControllerBuilder.java @@ -34,7 +34,7 @@ import org.hyperledger.besu.ethereum.eth.manager.EthPeers; import org.hyperledger.besu.ethereum.eth.manager.EthProtocolManager; import org.hyperledger.besu.ethereum.eth.manager.EthScheduler; import org.hyperledger.besu.ethereum.eth.manager.MergePeerFilter; -import org.hyperledger.besu.ethereum.eth.manager.peertask.PeerManager; +import org.hyperledger.besu.ethereum.eth.manager.peertask.PeerSelector; import org.hyperledger.besu.ethereum.eth.peervalidation.PeerValidator; import org.hyperledger.besu.ethereum.eth.peervalidation.RequiredBlocksPeerValidator; import org.hyperledger.besu.ethereum.eth.sync.SynchronizerConfiguration; @@ -101,7 +101,7 @@ public class MergeBesuControllerBuilder extends BesuControllerBuilder { final List peerValidators, final Optional mergePeerFilter, final ForkIdManager forkIdManager, - final PeerManager peerManager) { + final PeerSelector peerSelector) { var mergeContext = protocolContext.getConsensusContext(MergeContext.class); @@ -132,7 +132,7 @@ public class MergeBesuControllerBuilder extends BesuControllerBuilder { peerValidators, filterToUse, forkIdManager, - peerManager); + peerSelector); return ethProtocolManager; } diff --git a/besu/src/main/java/org/hyperledger/besu/controller/TransitionBesuControllerBuilder.java b/besu/src/main/java/org/hyperledger/besu/controller/TransitionBesuControllerBuilder.java index 9b71e0bdc9..0f56d0c618 100644 --- a/besu/src/main/java/org/hyperledger/besu/controller/TransitionBesuControllerBuilder.java +++ b/besu/src/main/java/org/hyperledger/besu/controller/TransitionBesuControllerBuilder.java @@ -40,7 +40,7 @@ import org.hyperledger.besu.ethereum.eth.manager.EthPeers; import org.hyperledger.besu.ethereum.eth.manager.EthProtocolManager; import org.hyperledger.besu.ethereum.eth.manager.EthScheduler; import org.hyperledger.besu.ethereum.eth.manager.MergePeerFilter; -import org.hyperledger.besu.ethereum.eth.manager.peertask.PeerManager; +import org.hyperledger.besu.ethereum.eth.manager.peertask.PeerSelector; import org.hyperledger.besu.ethereum.eth.manager.peertask.PeerTaskExecutor; import org.hyperledger.besu.ethereum.eth.peervalidation.PeerValidator; import org.hyperledger.besu.ethereum.eth.sync.DefaultSynchronizer; @@ -166,7 +166,7 @@ public class TransitionBesuControllerBuilder extends BesuControllerBuilder { final List peerValidators, final Optional mergePeerFilter, final ForkIdManager forkIdManager, - final PeerManager peerManager) { + final PeerSelector peerSelector) { return mergeBesuControllerBuilder.createEthProtocolManager( protocolContext, synchronizerConfiguration, @@ -179,7 +179,7 @@ public class TransitionBesuControllerBuilder extends BesuControllerBuilder { peerValidators, mergePeerFilter, forkIdManager, - peerManager); + peerSelector); } @Override diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/EthProtocolManager.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/EthProtocolManager.java index d69910d59c..97e91f6bad 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/EthProtocolManager.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/EthProtocolManager.java @@ -23,7 +23,7 @@ import org.hyperledger.besu.ethereum.core.Block; import org.hyperledger.besu.ethereum.core.Difficulty; import org.hyperledger.besu.ethereum.eth.EthProtocol; import org.hyperledger.besu.ethereum.eth.EthProtocolConfiguration; -import org.hyperledger.besu.ethereum.eth.manager.peertask.PeerManager; +import org.hyperledger.besu.ethereum.eth.manager.peertask.PeerSelector; import org.hyperledger.besu.ethereum.eth.messages.EthPV62; import org.hyperledger.besu.ethereum.eth.messages.StatusMessage; import org.hyperledger.besu.ethereum.eth.peervalidation.PeerValidator; @@ -70,7 +70,7 @@ public class EthProtocolManager implements ProtocolManager, MinedBlockObserver { private final Hash genesisHash; private final ForkIdManager forkIdManager; - private final PeerManager peerManager; + private final PeerSelector peerSelector; private final BigInteger networkId; private final EthPeers ethPeers; private final EthMessages ethMessages; @@ -95,7 +95,7 @@ public class EthProtocolManager implements ProtocolManager, MinedBlockObserver { final SynchronizerConfiguration synchronizerConfiguration, final EthScheduler scheduler, final ForkIdManager forkIdManager, - final PeerManager peerManager) { + final PeerSelector peerSelector) { this.networkId = networkId; this.peerValidators = peerValidators; this.scheduler = scheduler; @@ -105,7 +105,7 @@ public class EthProtocolManager implements ProtocolManager, MinedBlockObserver { this.genesisHash = blockchain.getBlockHashByNumber(0L).orElse(Hash.ZERO); this.forkIdManager = forkIdManager; - this.peerManager = peerManager; + this.peerSelector = peerSelector; this.ethPeers = ethPeers; this.ethMessages = ethMessages; @@ -145,7 +145,7 @@ public class EthProtocolManager implements ProtocolManager, MinedBlockObserver { final Optional mergePeerFilter, final SynchronizerConfiguration synchronizerConfiguration, final EthScheduler scheduler, - final PeerManager peerManager) { + final PeerSelector peerSelector) { this( blockchain, networkId, @@ -164,7 +164,7 @@ public class EthProtocolManager implements ProtocolManager, MinedBlockObserver { Collections.emptyList(), Collections.emptyList(), ethereumWireProtocolConfiguration.isLegacyEth64ForkIdEnabled()), - peerManager); + peerSelector); } public EthContext ethContext() { @@ -343,7 +343,7 @@ public class EthProtocolManager implements ProtocolManager, MinedBlockObserver { public void handleNewConnection(final PeerConnection connection) { ethPeers.registerNewConnection(connection, peerValidators); final EthPeer peer = ethPeers.peer(connection); - peerManager.addPeer(peer); + peerSelector.addPeer(peer); final Capability cap = connection.capability(getSupportedProtocol()); final ForkId latestForkId = cap.getVersion() >= 64 ? forkIdManager.getForkIdForChainHead() : null; @@ -375,7 +375,7 @@ public class EthProtocolManager implements ProtocolManager, MinedBlockObserver { final DisconnectReason reason, final boolean initiatedByPeer) { final boolean wasActiveConnection = ethPeers.registerDisconnect(connection); - peerManager.removePeer(connection.getPeer()); + peerSelector.removePeer(connection.getPeer()); LOG.atDebug() .setMessage("Disconnect - active Connection? {} - {} - {} - {} {} - {} peers left") .addArgument(wasActiveConnection) diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/peertask/task/GetReceiptsFromPeerTask.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/peertask/task/GetReceiptsFromPeerTask.java index f4760de884..75263f460e 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/peertask/task/GetReceiptsFromPeerTask.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/peertask/task/GetReceiptsFromPeerTask.java @@ -20,11 +20,12 @@ import org.hyperledger.besu.ethereum.core.TransactionReceipt; import org.hyperledger.besu.ethereum.eth.EthProtocol; import org.hyperledger.besu.ethereum.eth.manager.peertask.InvalidPeerTaskResponseException; import org.hyperledger.besu.ethereum.eth.manager.peertask.PeerTask; -import org.hyperledger.besu.ethereum.eth.manager.peertask.PeerTaskBehavior; +import org.hyperledger.besu.ethereum.eth.manager.peertask.PeerTaskRetryBehavior; import org.hyperledger.besu.ethereum.eth.messages.GetReceiptsMessage; import org.hyperledger.besu.ethereum.eth.messages.ReceiptsMessage; import org.hyperledger.besu.ethereum.mainnet.BodyValidator; import org.hyperledger.besu.ethereum.p2p.rlpx.wire.MessageData; +import org.hyperledger.besu.ethereum.p2p.rlpx.wire.SubProtocol; import java.util.ArrayList; import java.util.Collection; @@ -52,8 +53,8 @@ public class GetReceiptsFromPeerTask } @Override - public String getSubProtocol() { - return EthProtocol.NAME; + public SubProtocol getSubProtocol() { + return EthProtocol.get(); } @Override @@ -101,7 +102,8 @@ public class GetReceiptsFromPeerTask } @Override - public Collection getPeerTaskBehaviors() { - return List.of(PeerTaskBehavior.RETRY_WITH_OTHER_PEERS, PeerTaskBehavior.RETRY_WITH_SAME_PEER); + public Collection getPeerTaskBehaviors() { + return List.of( + PeerTaskRetryBehavior.RETRY_WITH_OTHER_PEERS, PeerTaskRetryBehavior.RETRY_WITH_SAME_PEER); } } diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/checkpointsync/CheckpointDownloadBlockStep.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/checkpointsync/CheckpointDownloadBlockStep.java index 603d4448a6..a0bb5ee595 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/checkpointsync/CheckpointDownloadBlockStep.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/checkpointsync/CheckpointDownloadBlockStep.java @@ -85,10 +85,10 @@ public class CheckpointDownloadBlockStep { PeerTaskExecutorResult>> executorResult = peerTaskExecutor.execute(task); - if (executorResult.getResponseCode() == PeerTaskExecutorResponseCode.SUCCESS) { + if (executorResult.responseCode() == PeerTaskExecutorResponseCode.SUCCESS) { List transactionReceipts = executorResult - .getResult() + .result() .map((map) -> map.get(block.getHeader())) .orElseThrow( () -> diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/DownloadReceiptsStep.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/DownloadReceiptsStep.java index 5e0a44cee2..bd7bd934ec 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/DownloadReceiptsStep.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/DownloadReceiptsStep.java @@ -66,10 +66,10 @@ public class DownloadReceiptsStep new GetReceiptsFromPeerTask(headers, new BodyValidator()); PeerTaskExecutorResult>> getReceiptsResult = peerTaskExecutor.execute(getReceiptsFromPeerTask); - if (getReceiptsResult.getResponseCode() == PeerTaskExecutorResponseCode.SUCCESS - && getReceiptsResult.getResult().isPresent()) { + if (getReceiptsResult.responseCode() == PeerTaskExecutorResponseCode.SUCCESS + && getReceiptsResult.result().isPresent()) { Map> receiptsResult = - getReceiptsResult.getResult().get(); + getReceiptsResult.result().get(); receiptsResult .keySet() .forEach( diff --git a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/manager/EthProtocolManagerTest.java b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/manager/EthProtocolManagerTest.java index 31f66e31d2..95f3d76222 100644 --- a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/manager/EthProtocolManagerTest.java +++ b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/manager/EthProtocolManagerTest.java @@ -44,7 +44,7 @@ import org.hyperledger.besu.ethereum.eth.EthProtocol; import org.hyperledger.besu.ethereum.eth.EthProtocolConfiguration; import org.hyperledger.besu.ethereum.eth.EthProtocolVersion; import org.hyperledger.besu.ethereum.eth.manager.MockPeerConnection.PeerSendHandler; -import org.hyperledger.besu.ethereum.eth.manager.peertask.DefaultPeerManager; +import org.hyperledger.besu.ethereum.eth.manager.peertask.DefaultPeerSelector; import org.hyperledger.besu.ethereum.eth.messages.BlockBodiesMessage; import org.hyperledger.besu.ethereum.eth.messages.BlockHeadersMessage; import org.hyperledger.besu.ethereum.eth.messages.EthPV62; @@ -1245,7 +1245,7 @@ public final class EthProtocolManagerTest { syncConfig, mock(EthScheduler.class), mock(ForkIdManager.class), - new DefaultPeerManager())) { + new DefaultPeerSelector(() -> null))) { return ethManager; } diff --git a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/manager/EthProtocolManagerTestUtil.java b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/manager/EthProtocolManagerTestUtil.java index b71ffa9133..16199571e6 100644 --- a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/manager/EthProtocolManagerTestUtil.java +++ b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/manager/EthProtocolManagerTestUtil.java @@ -30,7 +30,7 @@ import org.hyperledger.besu.ethereum.core.Difficulty; import org.hyperledger.besu.ethereum.core.ProtocolScheduleFixture; import org.hyperledger.besu.ethereum.eth.EthProtocol; import org.hyperledger.besu.ethereum.eth.EthProtocolConfiguration; -import org.hyperledger.besu.ethereum.eth.manager.peertask.DefaultPeerManager; +import org.hyperledger.besu.ethereum.eth.manager.peertask.DefaultPeerSelector; import org.hyperledger.besu.ethereum.eth.manager.snap.SnapProtocolManager; import org.hyperledger.besu.ethereum.eth.peervalidation.PeerValidator; import org.hyperledger.besu.ethereum.eth.sync.ChainHeadTracker; @@ -119,7 +119,7 @@ public class EthProtocolManagerTestUtil { mock(SynchronizerConfiguration.class), ethScheduler, new ForkIdManager(blockchain, Collections.emptyList(), Collections.emptyList(), false), - new DefaultPeerManager()); + new DefaultPeerSelector(() -> null)); } public static EthProtocolManager create( @@ -171,7 +171,7 @@ public class EthProtocolManagerTestUtil { mock(SynchronizerConfiguration.class), ethScheduler, forkIdManager, - new DefaultPeerManager()); + new DefaultPeerSelector(() -> null)); } public static EthProtocolManager create(final Blockchain blockchain) { diff --git a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/manager/peertask/task/GetReceiptsFromPeerTaskTest.java b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/manager/peertask/task/GetReceiptsFromPeerTaskTest.java index 131026a276..f8f1c88e1e 100644 --- a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/manager/peertask/task/GetReceiptsFromPeerTaskTest.java +++ b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/manager/peertask/task/GetReceiptsFromPeerTaskTest.java @@ -41,7 +41,7 @@ public class GetReceiptsFromPeerTaskTest { @Test public void testGetSubProtocol() { GetReceiptsFromPeerTask task = new GetReceiptsFromPeerTask(Collections.emptyList(), null); - Assertions.assertEquals(EthProtocol.NAME, task.getSubProtocol()); + Assertions.assertEquals(EthProtocol.get(), task.getSubProtocol()); } @Test @@ -83,7 +83,7 @@ public class GetReceiptsFromPeerTaskTest { } @Test - public void testParseResponseForInvalidResponse() throws InvalidPeerTaskResponseException { + public void testParseResponseForInvalidResponse() { GetReceiptsFromPeerTask task = new GetReceiptsFromPeerTask( List.of(mockBlockHeader(1), mockBlockHeader(2), mockBlockHeader(3)), null); diff --git a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/checkpointsync/CheckPointSyncChainDownloaderTest.java b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/checkpointsync/CheckPointSyncChainDownloaderTest.java index 68e1023fbc..c2a9930667 100644 --- a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/checkpointsync/CheckPointSyncChainDownloaderTest.java +++ b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/checkpointsync/CheckPointSyncChainDownloaderTest.java @@ -191,7 +191,7 @@ public class CheckPointSyncChainDownloaderTest { bh, otherBlockchain.getTxReceipts(bh.getHash()).get())); return new PeerTaskExecutorResult<>( - getReceiptsFromPeerTaskResult, PeerTaskExecutorResponseCode.SUCCESS); + Optional.of(getReceiptsFromPeerTaskResult), PeerTaskExecutorResponseCode.SUCCESS); } @AfterEach diff --git a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/DownloadReceiptsStepTest.java b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/DownloadReceiptsStepTest.java index 4270251e6c..554e09c3e9 100644 --- a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/DownloadReceiptsStepTest.java +++ b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/DownloadReceiptsStepTest.java @@ -44,6 +44,7 @@ import org.hyperledger.besu.plugin.services.storage.DataStorageFormat; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Optional; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; @@ -121,7 +122,8 @@ public class DownloadReceiptsStepTest { blocks.forEach( (b) -> receiptsMap.put(b.getHeader(), List.of(Mockito.mock(TransactionReceipt.class)))); PeerTaskExecutorResult>> peerTaskResult = - new PeerTaskExecutorResult<>(receiptsMap, PeerTaskExecutorResponseCode.SUCCESS); + new PeerTaskExecutorResult<>( + Optional.of(receiptsMap), PeerTaskExecutorResponseCode.SUCCESS); Mockito.when(peerTaskExecutor.execute(Mockito.any(GetReceiptsFromPeerTask.class))) .thenReturn(peerTaskResult); 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 6d194cb8e0..7af807c1c7 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 @@ -537,7 +537,7 @@ public class FastSyncActionsTest { protocolSchedule, protocolContext, ethContext, - new PeerTaskExecutor(null, null, null, new NoOpMetricsSystem()), + new PeerTaskExecutor(null, null, new NoOpMetricsSystem()), new SyncState(blockchain, ethContext.getEthPeers(), true, Optional.empty()), pivotBlockSelector, new NoOpMetricsSystem()); diff --git a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/FastSyncChainDownloaderTest.java b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/FastSyncChainDownloaderTest.java index da82034eaa..0e5b5ec2c7 100644 --- a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/FastSyncChainDownloaderTest.java +++ b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/FastSyncChainDownloaderTest.java @@ -111,7 +111,7 @@ public class FastSyncChainDownloaderTest { protocolSchedule, protocolContext, ethContext, - new PeerTaskExecutor(null, null, null, new NoOpMetricsSystem()), + new PeerTaskExecutor(null, null, new NoOpMetricsSystem()), syncState, new NoOpMetricsSystem(), new FastSyncState(otherBlockchain.getBlockHeader(pivotBlockNumber).get()), diff --git a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/TestNode.java b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/TestNode.java index f8671b675f..c41e326fac 100644 --- a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/TestNode.java +++ b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/TestNode.java @@ -44,7 +44,7 @@ import org.hyperledger.besu.ethereum.eth.manager.EthMessages; import org.hyperledger.besu.ethereum.eth.manager.EthPeers; import org.hyperledger.besu.ethereum.eth.manager.EthProtocolManager; import org.hyperledger.besu.ethereum.eth.manager.EthScheduler; -import org.hyperledger.besu.ethereum.eth.manager.peertask.DefaultPeerManager; +import org.hyperledger.besu.ethereum.eth.manager.peertask.DefaultPeerSelector; import org.hyperledger.besu.ethereum.eth.sync.ChainHeadTracker; import org.hyperledger.besu.ethereum.eth.sync.SyncMode; import org.hyperledger.besu.ethereum.eth.sync.SynchronizerConfiguration; @@ -198,7 +198,7 @@ public class TestNode implements Closeable { Optional.empty(), syncConfig, scheduler, - new DefaultPeerManager()); + new DefaultPeerSelector(() -> null)); final NetworkRunner networkRunner = NetworkRunner.builder() diff --git a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/TransactionPoolFactoryTest.java b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/TransactionPoolFactoryTest.java index f85abc4e96..f4dac8a244 100644 --- a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/TransactionPoolFactoryTest.java +++ b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/TransactionPoolFactoryTest.java @@ -45,7 +45,7 @@ import org.hyperledger.besu.ethereum.eth.manager.EthMessages; import org.hyperledger.besu.ethereum.eth.manager.EthPeers; import org.hyperledger.besu.ethereum.eth.manager.EthProtocolManager; import org.hyperledger.besu.ethereum.eth.manager.EthScheduler; -import org.hyperledger.besu.ethereum.eth.manager.peertask.DefaultPeerManager; +import org.hyperledger.besu.ethereum.eth.manager.peertask.DefaultPeerSelector; import org.hyperledger.besu.ethereum.eth.sync.SyncMode; import org.hyperledger.besu.ethereum.eth.sync.SynchronizerConfiguration; import org.hyperledger.besu.ethereum.eth.sync.state.SyncState; @@ -320,7 +320,7 @@ public class TransactionPoolFactoryTest { mock(SynchronizerConfiguration.class), mock(EthScheduler.class), mock(ForkIdManager.class), - new DefaultPeerManager()); + new DefaultPeerSelector(() -> null)); } @Test