@@ -563,6 +563,36 @@ void onBlockImported_shouldRetainTrackerWhenDataAvailabilityDeferredToExecutionP
563563 .doesNotContainKey (blockWithBlobs .getRoot ());
564564 }
565565
566+ @ Test
567+ void onSlot_shouldRetainGloasImportedBlockTrackerUntilExecutionPayloadImported () {
568+ final DasSamplerBasic gloasSampler = createGloasSampler ();
569+ final SignedBeaconBlock blockWithBlobs =
570+ dataStructureUtil .randomSignedBeaconBlockWithCommitments (UInt64 .ONE , 1 );
571+ when (rpcFetchDelayProvider .calculate (blockWithBlobs .getSlot ())).thenReturn (Duration .ZERO );
572+ when (recentChainData .getFinalizedEpoch ()).thenReturn (UInt64 .ZERO );
573+ when (recentChainData .containsBlock (blockWithBlobs .getRoot ())).thenReturn (true );
574+
575+ gloasSampler .onNewBlock (blockWithBlobs , Optional .of (RemoteOrigin .GOSSIP ));
576+ final SafeFuture <List <UInt64 >> completionFuture =
577+ gloasSampler
578+ .getRecentlySampledColumnsByRoot ()
579+ .get (blockWithBlobs .getRoot ())
580+ .completionFuture ();
581+
582+ gloasSampler .onSlot (UInt64 .valueOf (2 ));
583+
584+ assertThat (gloasSampler .getRecentlySampledColumnsByRoot ())
585+ .containsKey (blockWithBlobs .getRoot ());
586+ assertThat (completionFuture ).isNotDone ();
587+
588+ // Data availability is deferred to the payload, so the tracker is pruned now.
589+ gloasSampler .onExecutionPayloadImported (blockWithBlobs .getSlotAndBlockRoot ());
590+
591+ assertThat (gloasSampler .getRecentlySampledColumnsByRoot ())
592+ .doesNotContainKey (blockWithBlobs .getRoot ());
593+ assertThat (completionFuture ).isCancelled ();
594+ }
595+
566596 @ Test
567597 void enableBlockImportOnCompletion_shouldImportOnlyOnceWhenCalledMultipleTimes () {
568598 final SignedBeaconBlock blockWithBlobs =
0 commit comments