diff --git a/networking/eth2/src/main/java/tech/pegasys/teku/networking/eth2/rpc/beaconchain/BeaconChainMethods.java b/networking/eth2/src/main/java/tech/pegasys/teku/networking/eth2/rpc/beaconchain/BeaconChainMethods.java index 63ba993db5f..75a4feed619 100644 --- a/networking/eth2/src/main/java/tech/pegasys/teku/networking/eth2/rpc/beaconchain/BeaconChainMethods.java +++ b/networking/eth2/src/main/java/tech/pegasys/teku/networking/eth2/rpc/beaconchain/BeaconChainMethods.java @@ -115,8 +115,8 @@ public static BeaconChainMethods create( final MetadataMessagesFactory metadataMessagesFactory, final RpcEncoding rpcEncoding) { return new BeaconChainMethods( - createStatus(spec, asyncRunner, statusMessageFactory, peerLookup, rpcEncoding), - createGoodBye(spec, asyncRunner, metricsSystem, peerLookup, rpcEncoding), + createStatus(asyncRunner, statusMessageFactory, peerLookup, rpcEncoding), + createGoodBye(asyncRunner, metricsSystem, peerLookup, rpcEncoding), createBeaconBlocksByRoot( spec, metricsSystem, asyncRunner, recentChainData, peerLookup, rpcEncoding), createBeaconBlocksByRange( @@ -144,11 +144,10 @@ public static BeaconChainMethods create( rpcEncoding, recentChainData), createMetadata(spec, asyncRunner, metadataMessagesFactory, peerLookup, rpcEncoding), - createPing(spec, asyncRunner, metadataMessagesFactory, peerLookup, rpcEncoding)); + createPing(asyncRunner, metadataMessagesFactory, peerLookup, rpcEncoding)); } private static Eth2RpcMethod createStatus( - final Spec spec, final AsyncRunner asyncRunner, final StatusMessageFactory statusMessageFactory, final PeerLookup peerLookup, @@ -165,12 +164,10 @@ private static Eth2RpcMethod createStatus( true, contextCodec, statusHandler, - peerLookup, - spec.getNetworkingConfig()); + peerLookup); } private static Eth2RpcMethod createGoodBye( - final Spec spec, final AsyncRunner asyncRunner, final MetricsSystem metricsSystem, final PeerLookup peerLookup, @@ -187,8 +184,7 @@ private static Eth2RpcMethod createGoodBye( false, contextCodec, goodbyeHandler, - peerLookup, - spec.getNetworkingConfig()); + peerLookup); } private static Eth2RpcMethod @@ -221,8 +217,7 @@ private static Eth2RpcMethod createGoodBye( expectResponseToRequest, forkDigestContextCodec, beaconBlocksByRootHandler, - peerLookup, - spec.getNetworkingConfig()); + peerLookup); return VersionedEth2RpcMethod.create( rpcEncoding, requestType, expectResponseToRequest, List.of(v2Method)); @@ -259,8 +254,7 @@ private static Eth2RpcMethod createGoodBye( expectResponseToRequest, forkDigestContextCodec, beaconBlocksByRangeHandler, - peerLookup, - spec.getNetworkingConfig()); + peerLookup); return VersionedEth2RpcMethod.create( rpcEncoding, requestType, expectResponseToRequest, List.of(v2Method)); @@ -299,8 +293,7 @@ private static Eth2RpcMethod createGoodBye( true, forkDigestContextCodec, blobSidecarsByRootHandler, - peerLookup, - spec.getNetworkingConfig())); + peerLookup)); } private static Optional> @@ -336,8 +329,7 @@ private static Eth2RpcMethod createGoodBye( true, forkDigestContextCodec, blobSidecarsByRangeHandler, - peerLookup, - spec.getNetworkingConfig())); + peerLookup)); } private static Eth2RpcMethod createMetadata( @@ -369,8 +361,7 @@ private static Eth2RpcMethod createMetadata( expectResponse, phase0ContextCodec, messageHandler, - peerLookup, - spec.getNetworkingConfig()); + peerLookup); if (spec.isMilestoneSupported(SpecMilestone.ALTAIR)) { final SszSchema altairMetadataSchema = @@ -392,8 +383,7 @@ private static Eth2RpcMethod createMetadata( expectResponse, altairContextCodec, messageHandler, - peerLookup, - spec.getNetworkingConfig()); + peerLookup); return VersionedEth2RpcMethod.create( rpcEncoding, requestType, expectResponse, List.of(v2Method, v1Method)); } else { @@ -402,7 +392,6 @@ private static Eth2RpcMethod createMetadata( } private static Eth2RpcMethod createPing( - final Spec spec, final AsyncRunner asyncRunner, final MetadataMessagesFactory metadataMessagesFactory, final PeerLookup peerLookup, @@ -419,8 +408,7 @@ private static Eth2RpcMethod createPing( true, contextCodec, statusHandler, - peerLookup, - spec.getNetworkingConfig()); + peerLookup); } public Collection> all() { diff --git a/networking/eth2/src/main/java/tech/pegasys/teku/networking/eth2/rpc/core/Eth2IncomingRequestHandler.java b/networking/eth2/src/main/java/tech/pegasys/teku/networking/eth2/rpc/core/Eth2IncomingRequestHandler.java index 64ae039ce30..1f1e47325eb 100644 --- a/networking/eth2/src/main/java/tech/pegasys/teku/networking/eth2/rpc/core/Eth2IncomingRequestHandler.java +++ b/networking/eth2/src/main/java/tech/pegasys/teku/networking/eth2/rpc/core/Eth2IncomingRequestHandler.java @@ -19,7 +19,6 @@ import java.util.concurrent.atomic.AtomicBoolean; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import tech.pegasys.teku.infrastructure.async.AsyncRunner; import tech.pegasys.teku.infrastructure.ssz.SszData; import tech.pegasys.teku.networking.eth2.peers.Eth2Peer; import tech.pegasys.teku.networking.eth2.peers.PeerLookup; @@ -41,18 +40,15 @@ public class Eth2IncomingRequestHandler< private final RpcRequestDecoder requestDecoder; private final String protocolId; - private final AsyncRunner asyncRunner; private final AtomicBoolean requestHandled = new AtomicBoolean(false); public Eth2IncomingRequestHandler( final String protocolId, final RpcResponseEncoder responseEncoder, final RpcRequestDecoder requestDecoder, - final AsyncRunner asyncRunner, final PeerLookup peerLookup, final LocalMessageHandler localMessageHandler) { this.protocolId = protocolId; - this.asyncRunner = asyncRunner; this.peerLookup = peerLookup; this.localMessageHandler = localMessageHandler; this.responseEncoder = responseEncoder; diff --git a/networking/eth2/src/main/java/tech/pegasys/teku/networking/eth2/rpc/core/methods/SingleProtocolEth2RpcMethod.java b/networking/eth2/src/main/java/tech/pegasys/teku/networking/eth2/rpc/core/methods/SingleProtocolEth2RpcMethod.java index f55f021769c..dec4c5f5cd2 100644 --- a/networking/eth2/src/main/java/tech/pegasys/teku/networking/eth2/rpc/core/methods/SingleProtocolEth2RpcMethod.java +++ b/networking/eth2/src/main/java/tech/pegasys/teku/networking/eth2/rpc/core/methods/SingleProtocolEth2RpcMethod.java @@ -29,7 +29,6 @@ import tech.pegasys.teku.networking.eth2.rpc.core.RpcResponseEncoder; import tech.pegasys.teku.networking.eth2.rpc.core.encodings.RpcEncoding; import tech.pegasys.teku.networking.eth2.rpc.core.encodings.context.RpcContextCodec; -import tech.pegasys.teku.spec.config.NetworkingSpecConfig; import tech.pegasys.teku.spec.datastructures.networking.libp2p.rpc.RpcRequest; public class SingleProtocolEth2RpcMethod< @@ -45,7 +44,6 @@ public class SingleProtocolEth2RpcMethod< private final LocalMessageHandler localMessageHandler; private final PeerLookup peerLookup; - private final NetworkingSpecConfig networkingConfig; public SingleProtocolEth2RpcMethod( final AsyncRunner asyncRunner, @@ -56,8 +54,7 @@ public SingleProtocolEth2RpcMethod( final boolean expectResponseToRequest, final RpcContextCodec contextCodec, final LocalMessageHandler localMessageHandler, - final PeerLookup peerLookup, - final NetworkingSpecConfig networkingConfig) { + final PeerLookup peerLookup) { super(encoding, requestType, expectResponseToRequest); this.asyncRunner = asyncRunner; this.contextCodec = contextCodec; @@ -66,7 +63,6 @@ public SingleProtocolEth2RpcMethod( this.protocolVersion = protocolVersion; this.localMessageHandler = localMessageHandler; this.peerLookup = peerLookup; - this.networkingConfig = networkingConfig; } @Override @@ -86,12 +82,7 @@ public int getProtocolVersion() { public Eth2IncomingRequestHandler createIncomingRequestHandler( final String protocolId) { return new Eth2IncomingRequestHandler<>( - protocolId, - responseEncoder, - createRequestDecoder(), - asyncRunner, - peerLookup, - localMessageHandler); + protocolId, responseEncoder, createRequestDecoder(), peerLookup, localMessageHandler); } @Override diff --git a/networking/eth2/src/test/java/tech/pegasys/teku/networking/eth2/rpc/core/RpcDecoderTestBase.java b/networking/eth2/src/test/java/tech/pegasys/teku/networking/eth2/rpc/core/RpcDecoderTestBase.java index 30e54675f05..9f526c9c21b 100644 --- a/networking/eth2/src/test/java/tech/pegasys/teku/networking/eth2/rpc/core/RpcDecoderTestBase.java +++ b/networking/eth2/src/test/java/tech/pegasys/teku/networking/eth2/rpc/core/RpcDecoderTestBase.java @@ -78,8 +78,7 @@ public class RpcDecoderTestBase { false, contextEncoder, mock(LocalMessageHandler.class), - peerLookup, - spec.getNetworkingConfig()); + peerLookup); protected List> testByteBufSlices(final Bytes... bytes) { List> ret = Utils.generateTestSlices(bytes);