Skip to content

Commit 4599bb7

Browse files
Merge branch 'master' into draft-fc-generated-integration-3
2 parents eb59725 + 5ff7d1c commit 4599bb7

File tree

16 files changed

+938
-278
lines changed

16 files changed

+938
-278
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ jobs:
260260

261261
integrationTests:
262262
needs: assemble
263-
runs-on: ubuntu-latest-128
263+
runs-on: gha-runner-scale-set-ubuntu-22.04-amd64-xxl
264264
steps:
265265
- name: Checkout
266266
uses: actions/checkout@v5
@@ -317,7 +317,7 @@ jobs:
317317
gradle_task: acceptanceTest
318318
src_pattern: "*/src/acceptance-test/java/*"
319319
src_root: "src/acceptance-test/java"
320-
runner: "ubuntu-latest-128"
320+
runner: "gha-runner-scale-set-ubuntu-22.04-amd64-xxl"
321321

322322
acceptanceTestsReport:
323323
runs-on: ubuntu-24.04

eth-reference-tests/src/referenceTest/java/tech/pegasys/teku/reference/phase0/forkchoice/ForkChoiceTestExecutor.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,6 @@
7676
import tech.pegasys.teku.statetransition.datacolumns.DasCustodyStand;
7777
import tech.pegasys.teku.statetransition.datacolumns.DasSamplerBasic;
7878
import tech.pegasys.teku.statetransition.datacolumns.DataColumnSidecarRecoveringCustody;
79-
import tech.pegasys.teku.statetransition.datacolumns.db.DataColumnSidecarDB;
80-
import tech.pegasys.teku.statetransition.datacolumns.db.DataColumnSidecarDbAccessor;
8179
import tech.pegasys.teku.statetransition.datacolumns.retriever.DataColumnSidecarRetrieverStub;
8280
import tech.pegasys.teku.statetransition.forkchoice.ForkChoice;
8381
import tech.pegasys.teku.statetransition.forkchoice.ForkChoiceStateProvider;
@@ -153,21 +151,16 @@ spec, new SignedBlockAndState(anchorBlock, anchorState)),
153151
final StubBlobSidecarManager blobSidecarManager = new StubBlobSidecarManager(kzg);
154152
final CurrentSlotProvider currentSlotProvider =
155153
CurrentSlotProvider.create(spec, recentChainData.getStore());
156-
final DataColumnSidecarDB sidecarDB =
157-
DataColumnSidecarDB.create(
158-
storageSystem.combinedChainDataClient(), storageSystem.chainStorage());
159-
final DataColumnSidecarDbAccessor dbAccessor =
160-
DataColumnSidecarDbAccessor.builder(sidecarDB).spec(spec).build();
161154
final DasSamplerBasic dasSampler =
162155
new DasSamplerBasic(
163156
spec,
164157
currentSlotProvider,
165-
dbAccessor,
166158
DataColumnSidecarRecoveringCustody.NOOP,
167159
new DataColumnSidecarRetrieverStub(),
168160
// using a const for the custody group count here, the test doesn't care
169161
// and fetching from the config would break when not in fulu
170-
() -> DasCustodyStand.createCustodyGroupCountManager(4, 8));
162+
() -> DasCustodyStand.createCustodyGroupCountManager(4, 8),
163+
recentChainData);
171164
final StubDataColumnSidecarManager dataColumnSidecarManager =
172165
new StubDataColumnSidecarManager(spec, recentChainData, dasSampler);
173166
// forkChoiceLateBlockReorgEnabled is true here always because this is the reference test

ethereum/statetransition/src/main/java/tech/pegasys/teku/statetransition/blobs/RemoteOrigin.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ public enum RemoteOrigin {
1818
GOSSIP,
1919
LOCAL_EL,
2020
LOCAL_PROPOSAL,
21-
RECOVERED
21+
RECOVERED,
22+
CUSTODY
2223
}

ethereum/statetransition/src/main/java/tech/pegasys/teku/statetransition/datacolumns/DasPreSampler.java

Lines changed: 64 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,36 @@
1616
import static tech.pegasys.teku.statetransition.datacolumns.DataAvailabilitySampler.SamplingEligibilityStatus.REQUIRED;
1717

1818
import java.util.Collection;
19+
import java.util.HashSet;
1920
import java.util.List;
21+
import java.util.Optional;
22+
import java.util.Set;
23+
import java.util.function.Supplier;
2024
import org.apache.logging.log4j.LogManager;
2125
import org.apache.logging.log4j.Logger;
26+
import org.apache.tuweni.bytes.Bytes32;
27+
import tech.pegasys.teku.infrastructure.async.SafeFuture;
28+
import tech.pegasys.teku.infrastructure.unsigned.UInt64;
2229
import tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock;
30+
import tech.pegasys.teku.spec.datastructures.util.DataColumnSlotAndIdentifier;
31+
import tech.pegasys.teku.statetransition.blobs.RemoteOrigin;
2332
import tech.pegasys.teku.statetransition.datacolumns.util.StringifyUtil;
2433

2534
public class DasPreSampler {
2635

2736
private static final Logger LOG = LogManager.getLogger();
2837

2938
private final DataAvailabilitySampler sampler;
39+
private final DataColumnSidecarCustody custody;
40+
private final Supplier<CustodyGroupCountManager> custodyGroupCountManagerSupplier;
3041

31-
public DasPreSampler(final DataAvailabilitySampler sampler) {
42+
public DasPreSampler(
43+
final DataAvailabilitySampler sampler,
44+
final DataColumnSidecarCustody custody,
45+
final Supplier<CustodyGroupCountManager> custodyGroupCountManagerSupplier) {
3246
this.sampler = sampler;
47+
this.custody = custody;
48+
this.custodyGroupCountManagerSupplier = custodyGroupCountManagerSupplier;
3349
}
3450

3551
private boolean isSamplingRequired(final SignedBeaconBlock block) {
@@ -52,19 +68,52 @@ public void onNewPreImportBlocks(final Collection<SignedBeaconBlock> blocks) {
5268
}
5369

5470
private void onNewPreImportBlock(final SignedBeaconBlock block) {
55-
sampler
56-
.checkDataAvailability(block.getSlot(), block.getRoot())
57-
.finish(
58-
succ ->
59-
LOG.debug(
60-
"DasPreSampler: success pre-sampling block {} ({})",
61-
block.getSlot(),
62-
block.getRoot()),
63-
err ->
64-
LOG.debug(
65-
"DasPreSampler: error pre-sampling block {} ({}): {}",
66-
block.getSlot(),
67-
block.getRoot(),
68-
err));
71+
final Set<DataColumnSlotAndIdentifier> requiredColumnIdentifiers =
72+
new HashSet<>(calculateSamplingColumnIds(block.getSlot(), block.getRoot()));
73+
74+
final SafeFuture<List<DataColumnSlotAndIdentifier>> columnsInCustodyFuture =
75+
maybeHasColumnsInCustody(requiredColumnIdentifiers);
76+
77+
columnsInCustodyFuture
78+
.thenAccept(
79+
columnsInCustody ->
80+
columnsInCustody.forEach(
81+
columnId -> sampler.onAlreadyKnownDataColumn(columnId, RemoteOrigin.CUSTODY)))
82+
.always(
83+
() ->
84+
sampler
85+
.checkDataAvailability(block.getSlot(), block.getRoot())
86+
.finish(
87+
succ ->
88+
LOG.debug(
89+
"DasPreSampler: success pre-sampling block {} ({})",
90+
block.getSlot(),
91+
block.getRoot()),
92+
err ->
93+
LOG.debug(
94+
"DasPreSampler: error pre-sampling block {} ({}): {}",
95+
block.getSlot(),
96+
block.getRoot(),
97+
err)));
98+
}
99+
100+
private List<DataColumnSlotAndIdentifier> calculateSamplingColumnIds(
101+
final UInt64 slot, final Bytes32 blockRoot) {
102+
return custodyGroupCountManagerSupplier.get().getSamplingColumnIndices().stream()
103+
.map(columnIndex -> new DataColumnSlotAndIdentifier(slot, blockRoot, columnIndex))
104+
.toList();
105+
}
106+
107+
private SafeFuture<Optional<DataColumnSlotAndIdentifier>> checkColumnInCustody(
108+
final DataColumnSlotAndIdentifier columnIdentifier) {
109+
return custody
110+
.hasCustodyDataColumnSidecar(columnIdentifier)
111+
.thenApply(hasColumn -> hasColumn ? Optional.of(columnIdentifier) : Optional.empty());
112+
}
113+
114+
private SafeFuture<List<DataColumnSlotAndIdentifier>> maybeHasColumnsInCustody(
115+
final Collection<DataColumnSlotAndIdentifier> columnIdentifiers) {
116+
return SafeFuture.collectAll(columnIdentifiers.stream().map(this::checkColumnInCustody))
117+
.thenApply(list -> list.stream().flatMap(Optional::stream).toList());
69118
}
70119
}

0 commit comments

Comments
 (0)