diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ThreadBesuNodeRunner.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ThreadBesuNodeRunner.java index 968d6260f9f..ab04fba2bc2 100644 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ThreadBesuNodeRunner.java +++ b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ThreadBesuNodeRunner.java @@ -205,6 +205,7 @@ public void startNode(final BesuNode node) { .besuPluginContext(new BesuPluginContextImpl()) .autoLogBloomCaching(false) .storageProvider(storageProvider) + .forkIdSupplier(() -> besuController.getProtocolManager().getForkIdAsBytesList()) .build(); runner.start(); diff --git a/besu/src/main/java/org/hyperledger/besu/RunnerBuilder.java b/besu/src/main/java/org/hyperledger/besu/RunnerBuilder.java index a07e28df906..f76391e9104 100644 --- a/besu/src/main/java/org/hyperledger/besu/RunnerBuilder.java +++ b/besu/src/main/java/org/hyperledger/besu/RunnerBuilder.java @@ -119,6 +119,7 @@ import java.util.Map; import java.util.Optional; import java.util.Set; +import java.util.function.Supplier; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -170,6 +171,7 @@ public class RunnerBuilder { private boolean autoLogBloomCaching = true; private boolean randomPeerPriority; private StorageProvider storageProvider; + private Supplier> forkIdSupplier; public RunnerBuilder vertx(final Vertx vertx) { this.vertx = vertx; @@ -341,6 +343,11 @@ public RunnerBuilder storageProvider(final StorageProvider storageProvider) { return this; } + public RunnerBuilder forkIdSupplier(final Supplier> forkIdSupplier) { + this.forkIdSupplier = forkIdSupplier; + return this; + } + public Runner build() { Preconditions.checkNotNull(besuController); @@ -414,9 +421,9 @@ public Runner build() { LOG.info("Detecting NAT service."); final boolean fallbackEnabled = natMethod == NatMethod.AUTO || natMethodFallbackEnabled; final NatService natService = new NatService(buildNatManager(natMethod), fallbackEnabled); - final NetworkBuilder inactiveNetwork = (caps) -> new NoopP2PNetwork(); + final NetworkBuilder inactiveNetwork = caps -> new NoopP2PNetwork(); final NetworkBuilder activeNetwork = - (caps) -> + caps -> DefaultP2PNetwork.builder() .vertx(vertx) .nodeKey(nodeKey) @@ -427,6 +434,7 @@ public Runner build() { .natService(natService) .randomPeerPriority(randomPeerPriority) .storageProvider(storageProvider) + .forkIdSupplier(forkIdSupplier) .build(); final NetworkRunner networkRunner = diff --git a/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java b/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java index b16e9ebb5b9..401d23d9bd8 100644 --- a/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java +++ b/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java @@ -2257,6 +2257,7 @@ private void synchronize( .ethstatsUrl(unstableEthstatsOptions.getEthstatsUrl()) .ethstatsContact(unstableEthstatsOptions.getEthstatsContact()) .storageProvider(keyValueStorageProvider(keyValueStorageName)) + .forkIdSupplier(() -> besuController.getProtocolManager().getForkIdAsBytesList()) .build(); addShutdownHook(runner); diff --git a/besu/src/test/java/org/hyperledger/besu/RunnerBuilderTest.java b/besu/src/test/java/org/hyperledger/besu/RunnerBuilderTest.java index 38cde4aa2e1..98b4e00e6c1 100644 --- a/besu/src/test/java/org/hyperledger/besu/RunnerBuilderTest.java +++ b/besu/src/test/java/org/hyperledger/besu/RunnerBuilderTest.java @@ -124,6 +124,7 @@ public void enodeUrlShouldHaveAdvertisedHostWhenDiscoveryDisabled() { .vertx(vertx) .dataDir(dataDir.getRoot().toPath()) .storageProvider(mock(KeyValueStorageProvider.class)) + .forkIdSupplier(() -> Collections.singletonList(Bytes.EMPTY)) .build(); runner.start(); diff --git a/besu/src/test/java/org/hyperledger/besu/RunnerTest.java b/besu/src/test/java/org/hyperledger/besu/RunnerTest.java index 522a8a8eb64..365fd038615 100644 --- a/besu/src/test/java/org/hyperledger/besu/RunnerTest.java +++ b/besu/src/test/java/org/hyperledger/besu/RunnerTest.java @@ -82,6 +82,7 @@ import okhttp3.Request; import okhttp3.RequestBody; import okhttp3.Response; +import org.apache.tuweni.bytes.Bytes; import org.apache.tuweni.units.bigints.UInt256; import org.awaitility.Awaitility; import org.junit.After; @@ -203,7 +204,8 @@ private void syncFromGenesis(final SyncMode mode, final GenesisConfigFile genesi .maxPeers(3) .metricsSystem(noOpMetricsSystem) .staticNodes(emptySet()) - .storageProvider(new InMemoryStorageProvider()); + .storageProvider(new InMemoryStorageProvider()) + .forkIdSupplier(() -> Collections.singletonList(Bytes.EMPTY)); Runner runnerBehind = null; final Runner runnerAhead = @@ -217,6 +219,7 @@ private void syncFromGenesis(final SyncMode mode, final GenesisConfigFile genesi .dataDir(dbAhead) .pidPath(pidPath) .besuPluginContext(new BesuPluginContextImpl()) + .forkIdSupplier(() -> controllerAhead.getProtocolManager().getForkIdAsBytesList()) .build(); try { @@ -269,6 +272,7 @@ private void syncFromGenesis(final SyncMode mode, final GenesisConfigFile genesi .metricsConfiguration(behindMetricsConfiguration) .dataDir(temp.newFolder().toPath()) .metricsSystem(noOpMetricsSystem) + .forkIdSupplier(() -> controllerBehind.getProtocolManager().getForkIdAsBytesList()) .build(); runnerBehind.start(); diff --git a/besu/src/test/java/org/hyperledger/besu/cli/CommandTestAbstract.java b/besu/src/test/java/org/hyperledger/besu/cli/CommandTestAbstract.java index f6c0d882451..bd4238fbb1e 100644 --- a/besu/src/test/java/org/hyperledger/besu/cli/CommandTestAbstract.java +++ b/besu/src/test/java/org/hyperledger/besu/cli/CommandTestAbstract.java @@ -238,6 +238,7 @@ public void initMocks() throws Exception { when(mockRunnerBuilder.ethstatsUrl(anyString())).thenReturn(mockRunnerBuilder); when(mockRunnerBuilder.ethstatsContact(anyString())).thenReturn(mockRunnerBuilder); when(mockRunnerBuilder.storageProvider(any())).thenReturn(mockRunnerBuilder); + when(mockRunnerBuilder.forkIdSupplier(any())).thenReturn(mockRunnerBuilder); when(mockRunnerBuilder.build()).thenReturn(mockRunner); final Bytes32 keyPairPrvKey = diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceRpcApisTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceRpcApisTest.java index 6ba804079b0..16eac490d4c 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceRpcApisTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceRpcApisTest.java @@ -51,6 +51,7 @@ import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -67,6 +68,7 @@ import okhttp3.Request; import okhttp3.RequestBody; import okhttp3.Response; +import org.apache.tuweni.bytes.Bytes; import org.junit.After; import org.junit.Before; import org.junit.Rule; @@ -263,6 +265,7 @@ private P2PNetwork createP2pNetwork() { .config(config) .metricsSystem(new NoOpMetricsSystem()) .storageProvider(new InMemoryStorageProvider()) + .forkIdSupplier(() -> Collections.singletonList(Bytes.EMPTY)) .build(); p2pNetwork.start(); 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 352c22631e7..4df9a7805dd 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 @@ -49,6 +49,7 @@ import com.google.common.collect.ImmutableList; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.apache.tuweni.bytes.Bytes; public class EthProtocolManager implements ProtocolManager, MinedBlockObserver { private static final Logger LOG = LogManager.getLogger(); @@ -358,4 +359,8 @@ public void blockMined(final Block block) { "Unable to get total difficulty from blockchain for mined block.")); blockBroadcaster.propagate(block, totalDifficulty); } + + public List getForkIdAsBytesList() { + return forkIdManager.computeForkId().getForkIdAsBytesList(); + } } diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/ForkId.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/ForkId.java index 4ae0dc6d4aa..b854ed6220e 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/ForkId.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/ForkId.java @@ -47,6 +47,14 @@ public Bytes getHash() { return hash; } + public List getForkIdAsBytesList() { + List bytesList = new ArrayList<>(); + bytesList.add(hash); + bytesList.add(next); + + return bytesList; + } + void createForkIdRLP() { final BytesValueRLPOutput out = new BytesValueRLPOutput(); writeTo(out); 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 38fb34b12d0..c866fe8c456 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 @@ -168,6 +168,7 @@ public TestNode( .metricsSystem(new NoOpMetricsSystem()) .supportedCapabilities(capabilities) .storageProvider(new InMemoryStorageProvider()) + .forkIdSupplier(() -> Collections.singletonList(Bytes.EMPTY)) .build()) .metricsSystem(new NoOpMetricsSystem()) .build(); diff --git a/ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/discovery/PeerDiscoveryAgent.java b/ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/discovery/PeerDiscoveryAgent.java index fbfbdd2d46f..229a0ece9e0 100644 --- a/ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/discovery/PeerDiscoveryAgent.java +++ b/ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/discovery/PeerDiscoveryAgent.java @@ -43,10 +43,12 @@ import java.net.InetSocketAddress; import java.net.SocketException; +import java.util.Collections; import java.util.List; import java.util.Optional; import java.util.concurrent.CompletableFuture; import java.util.concurrent.CopyOnWriteArrayList; +import java.util.function.Supplier; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -97,6 +99,7 @@ public abstract class PeerDiscoveryAgent { protected final Subscribers peerBondedObservers = Subscribers.create(); private final StorageProvider storageProvider; + private final Supplier> forkIdSupplier; protected PeerDiscoveryAgent( final NodeKey nodeKey, @@ -104,7 +107,8 @@ protected PeerDiscoveryAgent( final PeerPermissions peerPermissions, final NatService natService, final MetricsSystem metricsSystem, - final StorageProvider storageProvider) { + final StorageProvider storageProvider, + final Supplier> forkIdSupplier) { this.metricsSystem = metricsSystem; checkArgument(nodeKey != null, "nodeKey cannot be null"); checkArgument(config != null, "provided configuration cannot be null"); @@ -122,6 +126,7 @@ protected PeerDiscoveryAgent( id = nodeKey.getPublicKey().getEncodedBytes(); this.storageProvider = storageProvider; + this.forkIdSupplier = forkIdSupplier; } protected abstract TimerUtil createTimer(); @@ -202,7 +207,8 @@ private Optional addLocalNodeRecord( new EnrField(EnrField.PKEY_SECP256K1, Functions.compressPublicKey(nodeId)), new EnrField(EnrField.IP_V4, addressBytes), new EnrField(EnrField.TCP, tcpPort), - new EnrField(EnrField.UDP, udpPort)); + new EnrField(EnrField.UDP, udpPort), + new EnrField("eth", Collections.singletonList(forkIdSupplier.get()))); nodeRecord.setSignature( nodeKey .sign(Hash.keccak256(nodeRecord.serializeNoSignature())) diff --git a/ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/discovery/VertxPeerDiscoveryAgent.java b/ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/discovery/VertxPeerDiscoveryAgent.java index e8c5a43a9e4..6d62f02b37b 100644 --- a/ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/discovery/VertxPeerDiscoveryAgent.java +++ b/ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/discovery/VertxPeerDiscoveryAgent.java @@ -34,6 +34,7 @@ import java.net.BindException; import java.net.InetSocketAddress; import java.net.SocketException; +import java.util.List; import java.util.Optional; import java.util.concurrent.CompletableFuture; import java.util.function.IntSupplier; @@ -49,6 +50,7 @@ import io.vertx.core.datagram.DatagramSocketOptions; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.apache.tuweni.bytes.Bytes; public class VertxPeerDiscoveryAgent extends PeerDiscoveryAgent { private static final Logger LOG = LogManager.getLogger(); @@ -64,8 +66,16 @@ public VertxPeerDiscoveryAgent( final PeerPermissions peerPermissions, final NatService natService, final MetricsSystem metricsSystem, - final StorageProvider storageProvider) { - super(nodeKey, config, peerPermissions, natService, metricsSystem, storageProvider); + final StorageProvider storageProvider, + final Supplier> forkIdSupplier) { + super( + nodeKey, + config, + peerPermissions, + natService, + metricsSystem, + storageProvider, + forkIdSupplier); checkArgument(vertx != null, "vertx instance cannot be null"); this.vertx = vertx; diff --git a/ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/network/DefaultP2PNetwork.java b/ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/network/DefaultP2PNetwork.java index ed1f87b3c5d..b4ba0382712 100644 --- a/ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/network/DefaultP2PNetwork.java +++ b/ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/network/DefaultP2PNetwork.java @@ -64,6 +64,7 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Supplier; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -447,6 +448,7 @@ public static class Builder { private MetricsSystem metricsSystem; private StorageProvider storageProvider; + private Supplier> forkIdSupplier; public P2PNetwork build() { validate(); @@ -487,6 +489,7 @@ private void validate() { checkState(metricsSystem != null, "MetricsSystem must be set."); checkState(storageProvider != null, "StorageProvider must be set."); checkState(peerDiscoveryAgent != null || vertx != null, "Vertx must be set."); + checkState(forkIdSupplier != null, "ForkIdSupplier must be set."); } private PeerDiscoveryAgent createDiscoveryAgent() { @@ -498,7 +501,8 @@ private PeerDiscoveryAgent createDiscoveryAgent() { peerPermissions, natService, metricsSystem, - storageProvider); + storageProvider, + forkIdSupplier); } private RlpxAgent createRlpxAgent( @@ -589,5 +593,11 @@ public Builder storageProvider(final StorageProvider storageProvider) { this.storageProvider = storageProvider; return this; } + + public Builder forkIdSupplier(final Supplier> forkIdSupplier) { + checkNotNull(forkIdSupplier); + this.forkIdSupplier = forkIdSupplier; + return this; + } } } diff --git a/ethereum/p2p/src/test/java/org/hyperledger/besu/ethereum/p2p/discovery/PeerDiscoveryAgentTest.java b/ethereum/p2p/src/test/java/org/hyperledger/besu/ethereum/p2p/discovery/PeerDiscoveryAgentTest.java index b90f3717efa..95839f6f350 100644 --- a/ethereum/p2p/src/test/java/org/hyperledger/besu/ethereum/p2p/discovery/PeerDiscoveryAgentTest.java +++ b/ethereum/p2p/src/test/java/org/hyperledger/besu/ethereum/p2p/discovery/PeerDiscoveryAgentTest.java @@ -45,6 +45,7 @@ import java.util.Optional; import java.util.stream.Collectors; +import org.apache.tuweni.bytes.Bytes; import org.apache.tuweni.bytes.Bytes32; import org.ethereum.beacon.discovery.schema.NodeRecord; import org.junit.Test; @@ -92,11 +93,14 @@ public void testNodeRecordCreated() { assertThat(nodeRecord.getIdentityScheme()).isNotNull(); assertThat(nodeRecord.getSignature()).isNotNull(); assertThat(nodeRecord.getSeq()).isNotNull(); + assertThat(nodeRecord.get("eth")).isNotNull(); + assertThat(nodeRecord.get("eth")) + .isEqualTo(Collections.singletonList(Collections.singletonList(Bytes.EMPTY))); assertThat(nodeRecord.asEnr()) .isEqualTo( - "enr:-Im4QIEcZbEzW8DSEX-0BPB36s1UwTT54D_I-mvrSHqsZpVzGg7wlXyHb6vRq3GTGNBNQyoUkKkJGryrTo" - + "DTersRuNYBgmlkgnY0gmlwhH8AAAGJc2VjcDI1NmsxoQPKY0yuDUmstAHYpMa2_oxVtw0RW_QAdpzBQA" - + "8yWM0xOIN0Y3ACg3VkcIJ2Xw"); + "enr:-JC4QOfroMOa1sB6ajxcBKdWn3s9S4Ojl33pbRm72S5FnCwyZfskmjkJvZznQaWNTrOHrnKxw1R9xMm9rl" + + "EGOcsOyscBg2V0aMLBgIJpZIJ2NIJpcIR_AAABiXNlY3AyNTZrMaEDymNMrg1JrLQB2KTGtv6MVbcNEV" + + "v0AHacwUAPMljNMTiDdGNwAoN1ZHCCdl8"); } @Test diff --git a/ethereum/p2p/src/test/java/org/hyperledger/besu/ethereum/p2p/discovery/PeerDiscoveryTestHelper.java b/ethereum/p2p/src/test/java/org/hyperledger/besu/ethereum/p2p/discovery/PeerDiscoveryTestHelper.java index 05383f2c066..700415844e4 100644 --- a/ethereum/p2p/src/test/java/org/hyperledger/besu/ethereum/p2p/discovery/PeerDiscoveryTestHelper.java +++ b/ethereum/p2p/src/test/java/org/hyperledger/besu/ethereum/p2p/discovery/PeerDiscoveryTestHelper.java @@ -283,7 +283,13 @@ public MockPeerDiscoveryAgent build() { config.setActive(active); MockPeerDiscoveryAgent mockPeerDiscoveryAgent = - new MockPeerDiscoveryAgent(nodeKey, config, peerPermissions, agents, natService); + new MockPeerDiscoveryAgent( + nodeKey, + config, + peerPermissions, + agents, + natService, + () -> Collections.singletonList(Bytes.EMPTY)); mockPeerDiscoveryAgent.getAdvertisedPeer().ifPresent(peer -> peer.setNodeRecord(nodeRecord)); return mockPeerDiscoveryAgent; diff --git a/ethereum/p2p/src/test/java/org/hyperledger/besu/ethereum/p2p/discovery/internal/MockPeerDiscoveryAgent.java b/ethereum/p2p/src/test/java/org/hyperledger/besu/ethereum/p2p/discovery/internal/MockPeerDiscoveryAgent.java index be369946531..dbc4ae8e785 100644 --- a/ethereum/p2p/src/test/java/org/hyperledger/besu/ethereum/p2p/discovery/internal/MockPeerDiscoveryAgent.java +++ b/ethereum/p2p/src/test/java/org/hyperledger/besu/ethereum/p2p/discovery/internal/MockPeerDiscoveryAgent.java @@ -31,6 +31,7 @@ import java.util.List; import java.util.Map; import java.util.concurrent.CompletableFuture; +import java.util.function.Supplier; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -49,14 +50,16 @@ public MockPeerDiscoveryAgent( final DiscoveryConfiguration config, final PeerPermissions peerPermissions, final Map agentNetwork, - final NatService natService) { + final NatService natService, + final Supplier> forkIdSupplier) { super( nodeKey, config, peerPermissions, natService, new NoOpMetricsSystem(), - new InMemoryStorageProvider()); + new InMemoryStorageProvider(), + forkIdSupplier); this.agentNetwork = agentNetwork; } diff --git a/ethereum/p2p/src/test/java/org/hyperledger/besu/ethereum/p2p/network/DefaultP2PNetworkTest.java b/ethereum/p2p/src/test/java/org/hyperledger/besu/ethereum/p2p/network/DefaultP2PNetworkTest.java index d6bb2447d9f..fd282d44cc7 100644 --- a/ethereum/p2p/src/test/java/org/hyperledger/besu/ethereum/p2p/network/DefaultP2PNetworkTest.java +++ b/ethereum/p2p/src/test/java/org/hyperledger/besu/ethereum/p2p/network/DefaultP2PNetworkTest.java @@ -52,12 +52,14 @@ import org.hyperledger.besu.nat.upnp.UpnpNatManager; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import java.util.Optional; import java.util.concurrent.CompletableFuture; import java.util.stream.Collectors; import java.util.stream.Stream; +import org.apache.tuweni.bytes.Bytes; import org.assertj.core.api.Assertions; import org.junit.Before; import org.junit.Test; @@ -347,6 +349,7 @@ private DefaultP2PNetwork.Builder builder() { .maintainedPeers(maintainedPeers) .metricsSystem(new NoOpMetricsSystem()) .supportedCapabilities(Capability.create("eth", 63)) - .storageProvider(new InMemoryStorageProvider()); + .storageProvider(new InMemoryStorageProvider()) + .forkIdSupplier(() -> Collections.singletonList(Bytes.EMPTY)); } } diff --git a/ethereum/p2p/src/test/java/org/hyperledger/besu/ethereum/p2p/network/NetworkingServiceLifecycleTest.java b/ethereum/p2p/src/test/java/org/hyperledger/besu/ethereum/p2p/network/NetworkingServiceLifecycleTest.java index a676db27a76..a131b3b692f 100644 --- a/ethereum/p2p/src/test/java/org/hyperledger/besu/ethereum/p2p/network/NetworkingServiceLifecycleTest.java +++ b/ethereum/p2p/src/test/java/org/hyperledger/besu/ethereum/p2p/network/NetworkingServiceLifecycleTest.java @@ -30,8 +30,10 @@ import java.io.IOException; import java.util.Arrays; +import java.util.Collections; import io.vertx.core.Vertx; +import org.apache.tuweni.bytes.Bytes; import org.assertj.core.api.Assertions; import org.junit.After; import org.junit.Test; @@ -160,6 +162,7 @@ private DefaultP2PNetwork.Builder builder() { .config(config) .metricsSystem(new NoOpMetricsSystem()) .supportedCapabilities(Arrays.asList(Capability.create("eth", 63))) - .storageProvider(new InMemoryStorageProvider()); + .storageProvider(new InMemoryStorageProvider()) + .forkIdSupplier(() -> Collections.singletonList(Bytes.EMPTY)); } } diff --git a/ethereum/p2p/src/test/java/org/hyperledger/besu/ethereum/p2p/network/P2PNetworkTest.java b/ethereum/p2p/src/test/java/org/hyperledger/besu/ethereum/p2p/network/P2PNetworkTest.java index 633d5bdd624..fbec2e3b1b6 100644 --- a/ethereum/p2p/src/test/java/org/hyperledger/besu/ethereum/p2p/network/P2PNetworkTest.java +++ b/ethereum/p2p/src/test/java/org/hyperledger/besu/ethereum/p2p/network/P2PNetworkTest.java @@ -41,6 +41,7 @@ import java.net.InetAddress; import java.util.Arrays; +import java.util.Collections; import java.util.concurrent.CompletableFuture; import java.util.concurrent.TimeUnit; @@ -335,6 +336,7 @@ private DefaultP2PNetwork.Builder builder() { .nodeKey(NodeKeyUtils.generate()) .metricsSystem(new NoOpMetricsSystem()) .supportedCapabilities(Arrays.asList(Capability.create("eth", 63))) - .storageProvider(new InMemoryStorageProvider()); + .storageProvider(new InMemoryStorageProvider()) + .forkIdSupplier(() -> Collections.singletonList(Bytes.EMPTY)); } } diff --git a/gradle/versions.gradle b/gradle/versions.gradle index 64bcbf0f342..0cb74a5fba1 100644 --- a/gradle/versions.gradle +++ b/gradle/versions.gradle @@ -148,7 +148,7 @@ dependencyManagement { dependency 'org.yaml:snakeyaml:1.26' - dependency 'tech.pegasys.discovery:discovery:0.4.1' + dependency 'tech.pegasys.discovery:discovery:0.4.2' dependency 'tech.pegasys.ethsigner.internal:core:0.4.0' dependency 'tech.pegasys.ethsigner.internal:file-based:0.4.0'