Skip to content

Commit

Permalink
Suppress warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
mehdi-aouadi committed Feb 17, 2023
1 parent 54807ba commit 446ee96
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ public Optional<BlobsSidecar> getBlobsSidecar(final Bytes32 blockRoot) {
return Optional.ofNullable(blobsSidecarsByHash.get(blockRoot));
}

public Optional<BlobSidecar> getBlobSidecar(final Bytes32 blockRoot) {
return Optional.ofNullable(blobSidecarsByHash.get(blockRoot));
}

public Optional<SignedBeaconBlockAndBlobsSidecar> getBlockAndBlobsSidecar(
final Bytes32 blockRoot) {
return getBlock(blockRoot)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ class DefaultEth2Peer extends DelegatingPeer implements Eth2Peer {
private final AtomicInteger unansweredPings = new AtomicInteger();
private final RateTracker blockRequestTracker;
private final RateTracker blobsSidecarsRequestTracker;
private final RateTracker blobSidecarsRequestTracker;
private final RateTracker requestTracker;
private final Supplier<UInt64> firstSlotSupportingBlobsSidecarsByRange;

Expand All @@ -92,6 +93,7 @@ class DefaultEth2Peer extends DelegatingPeer implements Eth2Peer {
final PeerChainValidator peerChainValidator,
final RateTracker blockRequestTracker,
final RateTracker blobsSidecarsRequestTracker,
final RateTracker blobSidecarsRequestTracker,
final RateTracker requestTracker) {
super(peer);
this.rpcMethods = rpcMethods;
Expand All @@ -100,6 +102,7 @@ class DefaultEth2Peer extends DelegatingPeer implements Eth2Peer {
this.peerChainValidator = peerChainValidator;
this.blockRequestTracker = blockRequestTracker;
this.blobsSidecarsRequestTracker = blobsSidecarsRequestTracker;
this.blobSidecarsRequestTracker = blobSidecarsRequestTracker;
this.requestTracker = requestTracker;
this.firstSlotSupportingBlobsSidecarsByRange =
Suppliers.memoize(
Expand Down Expand Up @@ -374,7 +377,8 @@ public boolean wantToReceiveBlobsSidecars(
@Override
public boolean wantToReceiveBlobSidecars(
final ResponseCallback<BlobSidecar> callback, final long blobSidecarsCount) {
throw new UnsupportedOperationException("Not yet implemented");
return wantToReceiveObjects(
"blob sidecars", blobSidecarsRequestTracker, callback, blobSidecarsCount);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ static Eth2Peer create(
final PeerChainValidator peerChainValidator,
final RateTracker blockRequestTracker,
final RateTracker blobsSidecarsRequestTracker,
final RateTracker blobSidecarsRequestTracker,
final RateTracker requestTracker) {
return new DefaultEth2Peer(
spec,
Expand All @@ -57,6 +58,7 @@ static Eth2Peer create(
peerChainValidator,
blockRequestTracker,
blobsSidecarsRequestTracker,
blobSidecarsRequestTracker,
requestTracker);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public Eth2Peer create(final Peer peer, final BeaconChainMethods rpcMethods) {
PeerChainValidator.create(spec, metricsSystem, chainDataClient, requiredCheckpoint),
new RateTracker(peerRateLimit, 60, timeProvider),
new RateTracker(peerRateLimit, 60, timeProvider),
new RateTracker(peerRateLimit, 60, timeProvider),
new RateTracker(peerRequestLimit, 60, timeProvider));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class Eth2PeerTest {
private final PeerChainValidator peerChainValidator = mock(PeerChainValidator.class);
private final RateTracker blockRateTracker = mock(RateTracker.class);
private final RateTracker blobsSidecarsRateTracker = mock(RateTracker.class);
private final RateTracker blobSidecarsRateTracker = mock(RateTracker.class);
private final RateTracker rateTracker = mock(RateTracker.class);

private final PeerStatus randomPeerStatus = randomPeerStatus();
Expand All @@ -69,6 +70,7 @@ class Eth2PeerTest {
peerChainValidator,
blockRateTracker,
blobsSidecarsRateTracker,
blobSidecarsRateTracker,
rateTracker);

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,12 @@ public void assertRequestedBlobsSidecars(final long startSlot, final long count)
.contains(new Request(UInt64.valueOf(startSlot), UInt64.valueOf(count)));
}

@SuppressWarnings("unused")
public void assertRequestedBlobSidecars(final long startSlot, final long count) {
assertThat(blobSidecarsRequests)
.contains(new Request(UInt64.valueOf(startSlot), UInt64.valueOf(count)));
}

@Override
public void adjustReputation(final ReputationAdjustment adjustment) {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,7 @@ public SafeFuture<Optional<BlobsSidecar>> getBlobsSidecarBySlotAndBlockRoot(
return historicalChainData.getBlobsSidecar(new SlotAndBlockRoot(slot, blockRoot));
}

@SuppressWarnings("unused")
public SafeFuture<Optional<BlobSidecar>> getBlobSidecarBySlotAndBlockRoot(
final UInt64 slot, final Bytes32 blockRoot) {
return SafeFuture.failedFuture(new UnsupportedOperationException("Not yet implemented"));
Expand Down

0 comments on commit 446ee96

Please sign in to comment.