From ce93681da68a5c4eefcee2c557c3cd872819da0e Mon Sep 17 00:00:00 2001 From: Stefan Bratanov Date: Tue, 17 Dec 2024 15:09:52 +0000 Subject: [PATCH] changes --- CHANGELOG.md | 1 + .../util/BlockBlobSidecarsTrackersPoolImpl.java | 8 +++----- .../util/BlockBlobSidecarsTrackersPoolImplTest.java | 7 +++++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d7628c3eec..a6cc88b16f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,5 +10,6 @@ ### Additions and Improvements - Optimized blobs validation pipeline +- Remove delay when fetching blobs from the local EL on block arrival ### Bug Fixes \ No newline at end of file diff --git a/ethereum/statetransition/src/main/java/tech/pegasys/teku/statetransition/util/BlockBlobSidecarsTrackersPoolImpl.java b/ethereum/statetransition/src/main/java/tech/pegasys/teku/statetransition/util/BlockBlobSidecarsTrackersPoolImpl.java index b3be558d5f7..298d69f8f04 100644 --- a/ethereum/statetransition/src/main/java/tech/pegasys/teku/statetransition/util/BlockBlobSidecarsTrackersPoolImpl.java +++ b/ethereum/statetransition/src/main/java/tech/pegasys/teku/statetransition/util/BlockBlobSidecarsTrackersPoolImpl.java @@ -504,13 +504,11 @@ private BlockBlobSidecarsTracker internalOnNewBlock( countBlock(remoteOrigin); - if (existingTracker.isRpcBlockFetchTriggered()) { + if (existingTracker.isRpcBlockFetchTriggered() && !existingTracker.isComplete()) { // if we attempted to fetch this block via RPC, we missed the opportunity to // complete the blob sidecars via local EL and RPC (since the block is required to // be known) Let's try now - if (!existingTracker.isComplete()) { - fetchMissingContent(slotAndBlockRoot); - } + asyncRunner.runAsync(() -> fetchMissingContent(slotAndBlockRoot)); } }); @@ -596,7 +594,7 @@ private void onFirstSeen( final Duration blockFetchDelay = calculateBlockFetchDelay(slotAndBlockRoot); asyncRunner.runAfterDelay(() -> fetchMissingContent(slotAndBlockRoot), blockFetchDelay); } - // no delay for attempting to fetch blobs for when the block is first seen + // no delay for attempting to fetch blobs for when the block is first seen case BLOCK -> asyncRunner.runAsync(() -> fetchMissingContent(slotAndBlockRoot)); } } diff --git a/ethereum/statetransition/src/test/java/tech/pegasys/teku/statetransition/util/BlockBlobSidecarsTrackersPoolImplTest.java b/ethereum/statetransition/src/test/java/tech/pegasys/teku/statetransition/util/BlockBlobSidecarsTrackersPoolImplTest.java index 93c7494e151..82952104728 100644 --- a/ethereum/statetransition/src/test/java/tech/pegasys/teku/statetransition/util/BlockBlobSidecarsTrackersPoolImplTest.java +++ b/ethereum/statetransition/src/test/java/tech/pegasys/teku/statetransition/util/BlockBlobSidecarsTrackersPoolImplTest.java @@ -887,7 +887,7 @@ void shouldDropPossiblyFetchedBlobSidecars() { } @Test - void shouldTryToFetchFromLocalELWhenBlockArrivesAfterRPCFetch() { + void shouldTryToFetchBlobSidecarsWhenBlockArrivesAfterRPCFetch() { final SignedBeaconBlock block = dataStructureUtil.randomSignedBeaconBlock(currentSlot); final Set missingBlobs = @@ -912,7 +912,7 @@ void shouldTryToFetchFromLocalELWhenBlockArrivesAfterRPCFetch() { when(tracker.setBlock(any())).thenReturn(true); when(tracker.getSlotAndBlockRoot()).thenReturn(block.getSlotAndBlockRoot()); when(tracker.isRpcBlockFetchTriggered()).thenReturn(true); - when(tracker.isLocalElBlobsFetchTriggered()).thenReturn(false); + when(tracker.isLocalElBlobsFetchTriggered()).thenReturn(true); return tracker; }); @@ -931,6 +931,9 @@ void shouldTryToFetchFromLocalELWhenBlockArrivesAfterRPCFetch() { blockBlobSidecarsTrackersPool.onNewBlock(block, Optional.empty()); + assertThat(asyncRunner.hasDelayedActions()).isTrue(); + asyncRunner.executeQueuedActions(); + verify(tracker).setLocalElBlobsFetchTriggered(); verify(executionLayer).engineGetBlobs(any(), any()); }