7311: Fix up everything broken after merge

Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
pull/7638/head
Matilda Clerke 2 months ago
parent 64adedc63b
commit 2c1446efa0
  1. 19
      besu/src/main/java/org/hyperledger/besu/controller/BesuControllerBuilder.java
  2. 6
      besu/src/main/java/org/hyperledger/besu/controller/ConsensusScheduleBesuControllerBuilder.java
  3. 6
      besu/src/main/java/org/hyperledger/besu/controller/MergeBesuControllerBuilder.java
  4. 6
      besu/src/main/java/org/hyperledger/besu/controller/TransitionBesuControllerBuilder.java
  5. 16
      ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/EthProtocolManager.java
  6. 12
      ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/peertask/task/GetReceiptsFromPeerTask.java
  7. 4
      ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/checkpointsync/CheckpointDownloadBlockStep.java
  8. 6
      ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/DownloadReceiptsStep.java
  9. 4
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/manager/EthProtocolManagerTest.java
  10. 6
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/manager/EthProtocolManagerTestUtil.java
  11. 4
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/manager/peertask/task/GetReceiptsFromPeerTaskTest.java
  12. 2
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/checkpointsync/CheckPointSyncChainDownloaderTest.java
  13. 4
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/DownloadReceiptsStepTest.java
  14. 2
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/FastSyncActionsTest.java
  15. 2
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/FastSyncChainDownloaderTest.java
  16. 4
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/TestNode.java
  17. 4
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/TransactionPoolFactoryTest.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.EthScheduler;
import org.hyperledger.besu.ethereum.eth.manager.MergePeerFilter; import org.hyperledger.besu.ethereum.eth.manager.MergePeerFilter;
import org.hyperledger.besu.ethereum.eth.manager.MonitoredExecutors; 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.DefaultPeerSelector;
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.manager.peertask.PeerTaskExecutor;
import org.hyperledger.besu.ethereum.eth.manager.peertask.PeerTaskRequestSender; import org.hyperledger.besu.ethereum.eth.manager.peertask.PeerTaskRequestSender;
import org.hyperledger.besu.ethereum.eth.manager.snap.SnapProtocolManager; 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 EthContext ethContext = new EthContext(ethPeers, ethMessages, snapMessages, scheduler);
final PeerManager peerManager = new DefaultPeerManager(); final PeerSelector peerSelector = new DefaultPeerSelector(currentProtocolSpecSupplier);
ethPeers.streamAllPeers().forEach(peerManager::addPeer); ethPeers.streamAllPeers().forEach(peerSelector::addPeer);
final PeerTaskExecutor peerTaskExecutor = final PeerTaskExecutor peerTaskExecutor =
new PeerTaskExecutor( new PeerTaskExecutor(peerSelector, new PeerTaskRequestSender(), metricsSystem);
peerManager, new PeerTaskRequestSender(), currentProtocolSpecSupplier, metricsSystem);
final boolean fullSyncDisabled = !SyncMode.isFullSync(syncConfig.getSyncMode()); final boolean fullSyncDisabled = !SyncMode.isFullSync(syncConfig.getSyncMode());
final SyncState syncState = new SyncState(blockchain, ethPeers, fullSyncDisabled, checkpoint); final SyncState syncState = new SyncState(blockchain, ethPeers, fullSyncDisabled, checkpoint);
@ -701,7 +700,7 @@ public abstract class BesuControllerBuilder implements MiningParameterOverrides
peerValidators, peerValidators,
Optional.empty(), Optional.empty(),
forkIdManager, forkIdManager,
peerManager); peerSelector);
final PivotBlockSelector pivotBlockSelector = final PivotBlockSelector pivotBlockSelector =
createPivotSelector( createPivotSelector(
@ -1036,7 +1035,7 @@ public abstract class BesuControllerBuilder implements MiningParameterOverrides
* @param peerValidators the peer validators * @param peerValidators the peer validators
* @param mergePeerFilter the merge peer filter * @param mergePeerFilter the merge peer filter
* @param forkIdManager the fork id manager * @param forkIdManager the fork id manager
* @param peerManager the PeerManager * @param peerSelector the PeerSelector
* @return the eth protocol manager * @return the eth protocol manager
*/ */
protected EthProtocolManager createEthProtocolManager( protected EthProtocolManager createEthProtocolManager(
@ -1051,7 +1050,7 @@ public abstract class BesuControllerBuilder implements MiningParameterOverrides
final List<PeerValidator> peerValidators, final List<PeerValidator> peerValidators,
final Optional<MergePeerFilter> mergePeerFilter, final Optional<MergePeerFilter> mergePeerFilter,
final ForkIdManager forkIdManager, final ForkIdManager forkIdManager,
final PeerManager peerManager) { final PeerSelector peerSelector) {
return new EthProtocolManager( return new EthProtocolManager(
protocolContext.getBlockchain(), protocolContext.getBlockchain(),
networkId, networkId,
@ -1066,7 +1065,7 @@ public abstract class BesuControllerBuilder implements MiningParameterOverrides
synchronizerConfiguration, synchronizerConfiguration,
scheduler, scheduler,
forkIdManager, forkIdManager,
peerManager); peerSelector);
} }
/** /**

@ -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.EthProtocolManager;
import org.hyperledger.besu.ethereum.eth.manager.EthScheduler; import org.hyperledger.besu.ethereum.eth.manager.EthScheduler;
import org.hyperledger.besu.ethereum.eth.manager.MergePeerFilter; 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.manager.snap.SnapProtocolManager;
import org.hyperledger.besu.ethereum.eth.peervalidation.PeerValidator; import org.hyperledger.besu.ethereum.eth.peervalidation.PeerValidator;
import org.hyperledger.besu.ethereum.eth.sync.SynchronizerConfiguration; import org.hyperledger.besu.ethereum.eth.sync.SynchronizerConfiguration;
@ -245,7 +245,7 @@ public class ConsensusScheduleBesuControllerBuilder extends BesuControllerBuilde
final List<PeerValidator> peerValidators, final List<PeerValidator> peerValidators,
final Optional<MergePeerFilter> mergePeerFilter, final Optional<MergePeerFilter> mergePeerFilter,
final ForkIdManager forkIdManager, final ForkIdManager forkIdManager,
final PeerManager peerManager) { final PeerSelector peerSelector) {
return besuControllerBuilderSchedule return besuControllerBuilderSchedule
.get(0L) .get(0L)
.createEthProtocolManager( .createEthProtocolManager(
@ -260,7 +260,7 @@ public class ConsensusScheduleBesuControllerBuilder extends BesuControllerBuilde
peerValidators, peerValidators,
mergePeerFilter, mergePeerFilter,
forkIdManager, forkIdManager,
peerManager); peerSelector);
} }
@Override @Override

@ -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.EthProtocolManager;
import org.hyperledger.besu.ethereum.eth.manager.EthScheduler; import org.hyperledger.besu.ethereum.eth.manager.EthScheduler;
import org.hyperledger.besu.ethereum.eth.manager.MergePeerFilter; 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.PeerValidator;
import org.hyperledger.besu.ethereum.eth.peervalidation.RequiredBlocksPeerValidator; import org.hyperledger.besu.ethereum.eth.peervalidation.RequiredBlocksPeerValidator;
import org.hyperledger.besu.ethereum.eth.sync.SynchronizerConfiguration; import org.hyperledger.besu.ethereum.eth.sync.SynchronizerConfiguration;
@ -101,7 +101,7 @@ public class MergeBesuControllerBuilder extends BesuControllerBuilder {
final List<PeerValidator> peerValidators, final List<PeerValidator> peerValidators,
final Optional<MergePeerFilter> mergePeerFilter, final Optional<MergePeerFilter> mergePeerFilter,
final ForkIdManager forkIdManager, final ForkIdManager forkIdManager,
final PeerManager peerManager) { final PeerSelector peerSelector) {
var mergeContext = protocolContext.getConsensusContext(MergeContext.class); var mergeContext = protocolContext.getConsensusContext(MergeContext.class);
@ -132,7 +132,7 @@ public class MergeBesuControllerBuilder extends BesuControllerBuilder {
peerValidators, peerValidators,
filterToUse, filterToUse,
forkIdManager, forkIdManager,
peerManager); peerSelector);
return ethProtocolManager; return ethProtocolManager;
} }

@ -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.EthProtocolManager;
import org.hyperledger.besu.ethereum.eth.manager.EthScheduler; import org.hyperledger.besu.ethereum.eth.manager.EthScheduler;
import org.hyperledger.besu.ethereum.eth.manager.MergePeerFilter; 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.manager.peertask.PeerTaskExecutor;
import org.hyperledger.besu.ethereum.eth.peervalidation.PeerValidator; import org.hyperledger.besu.ethereum.eth.peervalidation.PeerValidator;
import org.hyperledger.besu.ethereum.eth.sync.DefaultSynchronizer; import org.hyperledger.besu.ethereum.eth.sync.DefaultSynchronizer;
@ -166,7 +166,7 @@ public class TransitionBesuControllerBuilder extends BesuControllerBuilder {
final List<PeerValidator> peerValidators, final List<PeerValidator> peerValidators,
final Optional<MergePeerFilter> mergePeerFilter, final Optional<MergePeerFilter> mergePeerFilter,
final ForkIdManager forkIdManager, final ForkIdManager forkIdManager,
final PeerManager peerManager) { final PeerSelector peerSelector) {
return mergeBesuControllerBuilder.createEthProtocolManager( return mergeBesuControllerBuilder.createEthProtocolManager(
protocolContext, protocolContext,
synchronizerConfiguration, synchronizerConfiguration,
@ -179,7 +179,7 @@ public class TransitionBesuControllerBuilder extends BesuControllerBuilder {
peerValidators, peerValidators,
mergePeerFilter, mergePeerFilter,
forkIdManager, forkIdManager,
peerManager); peerSelector);
} }
@Override @Override

@ -23,7 +23,7 @@ import org.hyperledger.besu.ethereum.core.Block;
import org.hyperledger.besu.ethereum.core.Difficulty; import org.hyperledger.besu.ethereum.core.Difficulty;
import org.hyperledger.besu.ethereum.eth.EthProtocol; import org.hyperledger.besu.ethereum.eth.EthProtocol;
import org.hyperledger.besu.ethereum.eth.EthProtocolConfiguration; 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.EthPV62;
import org.hyperledger.besu.ethereum.eth.messages.StatusMessage; import org.hyperledger.besu.ethereum.eth.messages.StatusMessage;
import org.hyperledger.besu.ethereum.eth.peervalidation.PeerValidator; import org.hyperledger.besu.ethereum.eth.peervalidation.PeerValidator;
@ -70,7 +70,7 @@ public class EthProtocolManager implements ProtocolManager, MinedBlockObserver {
private final Hash genesisHash; private final Hash genesisHash;
private final ForkIdManager forkIdManager; private final ForkIdManager forkIdManager;
private final PeerManager peerManager; private final PeerSelector peerSelector;
private final BigInteger networkId; private final BigInteger networkId;
private final EthPeers ethPeers; private final EthPeers ethPeers;
private final EthMessages ethMessages; private final EthMessages ethMessages;
@ -95,7 +95,7 @@ public class EthProtocolManager implements ProtocolManager, MinedBlockObserver {
final SynchronizerConfiguration synchronizerConfiguration, final SynchronizerConfiguration synchronizerConfiguration,
final EthScheduler scheduler, final EthScheduler scheduler,
final ForkIdManager forkIdManager, final ForkIdManager forkIdManager,
final PeerManager peerManager) { final PeerSelector peerSelector) {
this.networkId = networkId; this.networkId = networkId;
this.peerValidators = peerValidators; this.peerValidators = peerValidators;
this.scheduler = scheduler; this.scheduler = scheduler;
@ -105,7 +105,7 @@ public class EthProtocolManager implements ProtocolManager, MinedBlockObserver {
this.genesisHash = blockchain.getBlockHashByNumber(0L).orElse(Hash.ZERO); this.genesisHash = blockchain.getBlockHashByNumber(0L).orElse(Hash.ZERO);
this.forkIdManager = forkIdManager; this.forkIdManager = forkIdManager;
this.peerManager = peerManager; this.peerSelector = peerSelector;
this.ethPeers = ethPeers; this.ethPeers = ethPeers;
this.ethMessages = ethMessages; this.ethMessages = ethMessages;
@ -145,7 +145,7 @@ public class EthProtocolManager implements ProtocolManager, MinedBlockObserver {
final Optional<MergePeerFilter> mergePeerFilter, final Optional<MergePeerFilter> mergePeerFilter,
final SynchronizerConfiguration synchronizerConfiguration, final SynchronizerConfiguration synchronizerConfiguration,
final EthScheduler scheduler, final EthScheduler scheduler,
final PeerManager peerManager) { final PeerSelector peerSelector) {
this( this(
blockchain, blockchain,
networkId, networkId,
@ -164,7 +164,7 @@ public class EthProtocolManager implements ProtocolManager, MinedBlockObserver {
Collections.emptyList(), Collections.emptyList(),
Collections.emptyList(), Collections.emptyList(),
ethereumWireProtocolConfiguration.isLegacyEth64ForkIdEnabled()), ethereumWireProtocolConfiguration.isLegacyEth64ForkIdEnabled()),
peerManager); peerSelector);
} }
public EthContext ethContext() { public EthContext ethContext() {
@ -343,7 +343,7 @@ public class EthProtocolManager implements ProtocolManager, MinedBlockObserver {
public void handleNewConnection(final PeerConnection connection) { public void handleNewConnection(final PeerConnection connection) {
ethPeers.registerNewConnection(connection, peerValidators); ethPeers.registerNewConnection(connection, peerValidators);
final EthPeer peer = ethPeers.peer(connection); final EthPeer peer = ethPeers.peer(connection);
peerManager.addPeer(peer); peerSelector.addPeer(peer);
final Capability cap = connection.capability(getSupportedProtocol()); final Capability cap = connection.capability(getSupportedProtocol());
final ForkId latestForkId = final ForkId latestForkId =
cap.getVersion() >= 64 ? forkIdManager.getForkIdForChainHead() : null; cap.getVersion() >= 64 ? forkIdManager.getForkIdForChainHead() : null;
@ -375,7 +375,7 @@ public class EthProtocolManager implements ProtocolManager, MinedBlockObserver {
final DisconnectReason reason, final DisconnectReason reason,
final boolean initiatedByPeer) { final boolean initiatedByPeer) {
final boolean wasActiveConnection = ethPeers.registerDisconnect(connection); final boolean wasActiveConnection = ethPeers.registerDisconnect(connection);
peerManager.removePeer(connection.getPeer()); peerSelector.removePeer(connection.getPeer());
LOG.atDebug() LOG.atDebug()
.setMessage("Disconnect - active Connection? {} - {} - {} - {} {} - {} peers left") .setMessage("Disconnect - active Connection? {} - {} - {} - {} {} - {} peers left")
.addArgument(wasActiveConnection) .addArgument(wasActiveConnection)

@ -20,11 +20,12 @@ import org.hyperledger.besu.ethereum.core.TransactionReceipt;
import org.hyperledger.besu.ethereum.eth.EthProtocol; import org.hyperledger.besu.ethereum.eth.EthProtocol;
import org.hyperledger.besu.ethereum.eth.manager.peertask.InvalidPeerTaskResponseException; 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.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.GetReceiptsMessage;
import org.hyperledger.besu.ethereum.eth.messages.ReceiptsMessage; import org.hyperledger.besu.ethereum.eth.messages.ReceiptsMessage;
import org.hyperledger.besu.ethereum.mainnet.BodyValidator; import org.hyperledger.besu.ethereum.mainnet.BodyValidator;
import org.hyperledger.besu.ethereum.p2p.rlpx.wire.MessageData; 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.ArrayList;
import java.util.Collection; import java.util.Collection;
@ -52,8 +53,8 @@ public class GetReceiptsFromPeerTask
} }
@Override @Override
public String getSubProtocol() { public SubProtocol getSubProtocol() {
return EthProtocol.NAME; return EthProtocol.get();
} }
@Override @Override
@ -101,7 +102,8 @@ public class GetReceiptsFromPeerTask
} }
@Override @Override
public Collection<PeerTaskBehavior> getPeerTaskBehaviors() { public Collection<PeerTaskRetryBehavior> getPeerTaskBehaviors() {
return List.of(PeerTaskBehavior.RETRY_WITH_OTHER_PEERS, PeerTaskBehavior.RETRY_WITH_SAME_PEER); return List.of(
PeerTaskRetryBehavior.RETRY_WITH_OTHER_PEERS, PeerTaskRetryBehavior.RETRY_WITH_SAME_PEER);
} }
} }

@ -85,10 +85,10 @@ public class CheckpointDownloadBlockStep {
PeerTaskExecutorResult<Map<BlockHeader, List<TransactionReceipt>>> executorResult = PeerTaskExecutorResult<Map<BlockHeader, List<TransactionReceipt>>> executorResult =
peerTaskExecutor.execute(task); peerTaskExecutor.execute(task);
if (executorResult.getResponseCode() == PeerTaskExecutorResponseCode.SUCCESS) { if (executorResult.responseCode() == PeerTaskExecutorResponseCode.SUCCESS) {
List<TransactionReceipt> transactionReceipts = List<TransactionReceipt> transactionReceipts =
executorResult executorResult
.getResult() .result()
.map((map) -> map.get(block.getHeader())) .map((map) -> map.get(block.getHeader()))
.orElseThrow( .orElseThrow(
() -> () ->

@ -66,10 +66,10 @@ public class DownloadReceiptsStep
new GetReceiptsFromPeerTask(headers, new BodyValidator()); new GetReceiptsFromPeerTask(headers, new BodyValidator());
PeerTaskExecutorResult<Map<BlockHeader, List<TransactionReceipt>>> getReceiptsResult = PeerTaskExecutorResult<Map<BlockHeader, List<TransactionReceipt>>> getReceiptsResult =
peerTaskExecutor.execute(getReceiptsFromPeerTask); peerTaskExecutor.execute(getReceiptsFromPeerTask);
if (getReceiptsResult.getResponseCode() == PeerTaskExecutorResponseCode.SUCCESS if (getReceiptsResult.responseCode() == PeerTaskExecutorResponseCode.SUCCESS
&& getReceiptsResult.getResult().isPresent()) { && getReceiptsResult.result().isPresent()) {
Map<BlockHeader, List<TransactionReceipt>> receiptsResult = Map<BlockHeader, List<TransactionReceipt>> receiptsResult =
getReceiptsResult.getResult().get(); getReceiptsResult.result().get();
receiptsResult receiptsResult
.keySet() .keySet()
.forEach( .forEach(

@ -44,7 +44,7 @@ import org.hyperledger.besu.ethereum.eth.EthProtocol;
import org.hyperledger.besu.ethereum.eth.EthProtocolConfiguration; import org.hyperledger.besu.ethereum.eth.EthProtocolConfiguration;
import org.hyperledger.besu.ethereum.eth.EthProtocolVersion; import org.hyperledger.besu.ethereum.eth.EthProtocolVersion;
import org.hyperledger.besu.ethereum.eth.manager.MockPeerConnection.PeerSendHandler; 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.BlockBodiesMessage;
import org.hyperledger.besu.ethereum.eth.messages.BlockHeadersMessage; import org.hyperledger.besu.ethereum.eth.messages.BlockHeadersMessage;
import org.hyperledger.besu.ethereum.eth.messages.EthPV62; import org.hyperledger.besu.ethereum.eth.messages.EthPV62;
@ -1245,7 +1245,7 @@ public final class EthProtocolManagerTest {
syncConfig, syncConfig,
mock(EthScheduler.class), mock(EthScheduler.class),
mock(ForkIdManager.class), mock(ForkIdManager.class),
new DefaultPeerManager())) { new DefaultPeerSelector(() -> null))) {
return ethManager; return ethManager;
} }

@ -30,7 +30,7 @@ import org.hyperledger.besu.ethereum.core.Difficulty;
import org.hyperledger.besu.ethereum.core.ProtocolScheduleFixture; import org.hyperledger.besu.ethereum.core.ProtocolScheduleFixture;
import org.hyperledger.besu.ethereum.eth.EthProtocol; import org.hyperledger.besu.ethereum.eth.EthProtocol;
import org.hyperledger.besu.ethereum.eth.EthProtocolConfiguration; 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.manager.snap.SnapProtocolManager;
import org.hyperledger.besu.ethereum.eth.peervalidation.PeerValidator; import org.hyperledger.besu.ethereum.eth.peervalidation.PeerValidator;
import org.hyperledger.besu.ethereum.eth.sync.ChainHeadTracker; import org.hyperledger.besu.ethereum.eth.sync.ChainHeadTracker;
@ -119,7 +119,7 @@ public class EthProtocolManagerTestUtil {
mock(SynchronizerConfiguration.class), mock(SynchronizerConfiguration.class),
ethScheduler, ethScheduler,
new ForkIdManager(blockchain, Collections.emptyList(), Collections.emptyList(), false), new ForkIdManager(blockchain, Collections.emptyList(), Collections.emptyList(), false),
new DefaultPeerManager()); new DefaultPeerSelector(() -> null));
} }
public static EthProtocolManager create( public static EthProtocolManager create(
@ -171,7 +171,7 @@ public class EthProtocolManagerTestUtil {
mock(SynchronizerConfiguration.class), mock(SynchronizerConfiguration.class),
ethScheduler, ethScheduler,
forkIdManager, forkIdManager,
new DefaultPeerManager()); new DefaultPeerSelector(() -> null));
} }
public static EthProtocolManager create(final Blockchain blockchain) { public static EthProtocolManager create(final Blockchain blockchain) {

@ -41,7 +41,7 @@ public class GetReceiptsFromPeerTaskTest {
@Test @Test
public void testGetSubProtocol() { public void testGetSubProtocol() {
GetReceiptsFromPeerTask task = new GetReceiptsFromPeerTask(Collections.emptyList(), null); GetReceiptsFromPeerTask task = new GetReceiptsFromPeerTask(Collections.emptyList(), null);
Assertions.assertEquals(EthProtocol.NAME, task.getSubProtocol()); Assertions.assertEquals(EthProtocol.get(), task.getSubProtocol());
} }
@Test @Test
@ -83,7 +83,7 @@ public class GetReceiptsFromPeerTaskTest {
} }
@Test @Test
public void testParseResponseForInvalidResponse() throws InvalidPeerTaskResponseException { public void testParseResponseForInvalidResponse() {
GetReceiptsFromPeerTask task = GetReceiptsFromPeerTask task =
new GetReceiptsFromPeerTask( new GetReceiptsFromPeerTask(
List.of(mockBlockHeader(1), mockBlockHeader(2), mockBlockHeader(3)), null); List.of(mockBlockHeader(1), mockBlockHeader(2), mockBlockHeader(3)), null);

@ -191,7 +191,7 @@ public class CheckPointSyncChainDownloaderTest {
bh, otherBlockchain.getTxReceipts(bh.getHash()).get())); bh, otherBlockchain.getTxReceipts(bh.getHash()).get()));
return new PeerTaskExecutorResult<>( return new PeerTaskExecutorResult<>(
getReceiptsFromPeerTaskResult, PeerTaskExecutorResponseCode.SUCCESS); Optional.of(getReceiptsFromPeerTaskResult), PeerTaskExecutorResponseCode.SUCCESS);
} }
@AfterEach @AfterEach

@ -44,6 +44,7 @@ import org.hyperledger.besu.plugin.services.storage.DataStorageFormat;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
@ -121,7 +122,8 @@ public class DownloadReceiptsStepTest {
blocks.forEach( blocks.forEach(
(b) -> receiptsMap.put(b.getHeader(), List.of(Mockito.mock(TransactionReceipt.class)))); (b) -> receiptsMap.put(b.getHeader(), List.of(Mockito.mock(TransactionReceipt.class))));
PeerTaskExecutorResult<Map<BlockHeader, List<TransactionReceipt>>> peerTaskResult = PeerTaskExecutorResult<Map<BlockHeader, List<TransactionReceipt>>> peerTaskResult =
new PeerTaskExecutorResult<>(receiptsMap, PeerTaskExecutorResponseCode.SUCCESS); new PeerTaskExecutorResult<>(
Optional.of(receiptsMap), PeerTaskExecutorResponseCode.SUCCESS);
Mockito.when(peerTaskExecutor.execute(Mockito.any(GetReceiptsFromPeerTask.class))) Mockito.when(peerTaskExecutor.execute(Mockito.any(GetReceiptsFromPeerTask.class)))
.thenReturn(peerTaskResult); .thenReturn(peerTaskResult);

@ -537,7 +537,7 @@ public class FastSyncActionsTest {
protocolSchedule, protocolSchedule,
protocolContext, protocolContext,
ethContext, ethContext,
new PeerTaskExecutor(null, null, null, new NoOpMetricsSystem()), new PeerTaskExecutor(null, null, new NoOpMetricsSystem()),
new SyncState(blockchain, ethContext.getEthPeers(), true, Optional.empty()), new SyncState(blockchain, ethContext.getEthPeers(), true, Optional.empty()),
pivotBlockSelector, pivotBlockSelector,
new NoOpMetricsSystem()); new NoOpMetricsSystem());

@ -111,7 +111,7 @@ public class FastSyncChainDownloaderTest {
protocolSchedule, protocolSchedule,
protocolContext, protocolContext,
ethContext, ethContext,
new PeerTaskExecutor(null, null, null, new NoOpMetricsSystem()), new PeerTaskExecutor(null, null, new NoOpMetricsSystem()),
syncState, syncState,
new NoOpMetricsSystem(), new NoOpMetricsSystem(),
new FastSyncState(otherBlockchain.getBlockHeader(pivotBlockNumber).get()), new FastSyncState(otherBlockchain.getBlockHeader(pivotBlockNumber).get()),

@ -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.EthPeers;
import org.hyperledger.besu.ethereum.eth.manager.EthProtocolManager; import org.hyperledger.besu.ethereum.eth.manager.EthProtocolManager;
import org.hyperledger.besu.ethereum.eth.manager.EthScheduler; 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.ChainHeadTracker;
import org.hyperledger.besu.ethereum.eth.sync.SyncMode; import org.hyperledger.besu.ethereum.eth.sync.SyncMode;
import org.hyperledger.besu.ethereum.eth.sync.SynchronizerConfiguration; import org.hyperledger.besu.ethereum.eth.sync.SynchronizerConfiguration;
@ -198,7 +198,7 @@ public class TestNode implements Closeable {
Optional.empty(), Optional.empty(),
syncConfig, syncConfig,
scheduler, scheduler,
new DefaultPeerManager()); new DefaultPeerSelector(() -> null));
final NetworkRunner networkRunner = final NetworkRunner networkRunner =
NetworkRunner.builder() NetworkRunner.builder()

@ -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.EthPeers;
import org.hyperledger.besu.ethereum.eth.manager.EthProtocolManager; import org.hyperledger.besu.ethereum.eth.manager.EthProtocolManager;
import org.hyperledger.besu.ethereum.eth.manager.EthScheduler; 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.SyncMode;
import org.hyperledger.besu.ethereum.eth.sync.SynchronizerConfiguration; import org.hyperledger.besu.ethereum.eth.sync.SynchronizerConfiguration;
import org.hyperledger.besu.ethereum.eth.sync.state.SyncState; import org.hyperledger.besu.ethereum.eth.sync.state.SyncState;
@ -320,7 +320,7 @@ public class TransactionPoolFactoryTest {
mock(SynchronizerConfiguration.class), mock(SynchronizerConfiguration.class),
mock(EthScheduler.class), mock(EthScheduler.class),
mock(ForkIdManager.class), mock(ForkIdManager.class),
new DefaultPeerManager()); new DefaultPeerSelector(() -> null));
} }
@Test @Test

Loading…
Cancel
Save