102
102
class BlockOperationSelectorFactoryTest {
103
103
private final Spec spec = TestSpecFactory .createMinimalDeneb ();
104
104
private final Spec specBellatrix = TestSpecFactory .createMinimalBellatrix ();
105
+ final Spec specElectra = TestSpecFactory .createMinimalElectra ();
105
106
private final DataStructureUtil dataStructureUtil = new DataStructureUtil (spec );
106
107
107
108
private final Function <UInt64 , BeaconBlockBodySchema <?>> beaconBlockSchemaSupplier =
@@ -182,11 +183,25 @@ class BlockOperationSelectorFactoryTest {
182
183
.getHeaderOfDefaultPayload ();
183
184
184
185
private final CapturingBeaconBlockBodyBuilder bodyBuilder =
185
- new CapturingBeaconBlockBodyBuilder (false );
186
+ new CapturingBeaconBlockBodyBuilder (false , false );
186
187
187
188
private final GraffitiBuilder graffitiBuilder =
188
189
new GraffitiBuilder (ClientGraffitiAppendFormat .DISABLED , Optional .empty ());
189
190
191
+ private final BlockOperationSelectorFactory factoryElectra =
192
+ new BlockOperationSelectorFactory (
193
+ specElectra ,
194
+ attestationPool ,
195
+ attesterSlashingPool ,
196
+ proposerSlashingPool ,
197
+ voluntaryExitPool ,
198
+ blsToExecutionChangePool ,
199
+ contributionPool ,
200
+ depositProvider ,
201
+ eth1DataCache ,
202
+ graffitiBuilder ,
203
+ forkChoiceNotifier ,
204
+ executionLayer );
190
205
private final BlockOperationSelectorFactory factory =
191
206
new BlockOperationSelectorFactory (
192
207
spec ,
@@ -622,7 +637,8 @@ void shouldIncludeExecutionPayloadIfRequestedBlindedIsEmptyAndBuilderFlowFallsBa
622
637
623
638
final UInt256 blockExecutionValue = dataStructureUtil .randomUInt256 ();
624
639
625
- final CapturingBeaconBlockBodyBuilder bodyBuilder = new CapturingBeaconBlockBodyBuilder (true );
640
+ final CapturingBeaconBlockBodyBuilder bodyBuilder =
641
+ new CapturingBeaconBlockBodyBuilder (true , false );
626
642
627
643
when (forkChoiceNotifier .getPayloadId (any (), any ()))
628
644
.thenReturn (SafeFuture .completedFuture (Optional .of (executionPayloadContext )));
@@ -696,7 +712,8 @@ void shouldIncludeKzgCommitmentsInBlock() {
696
712
blobsBundle ,
697
713
blockExecutionValue );
698
714
699
- final CapturingBeaconBlockBodyBuilder bodyBuilder = new CapturingBeaconBlockBodyBuilder (true );
715
+ final CapturingBeaconBlockBodyBuilder bodyBuilder =
716
+ new CapturingBeaconBlockBodyBuilder (true , false );
700
717
701
718
safeJoin (
702
719
factory
@@ -718,6 +735,37 @@ void shouldIncludeKzgCommitmentsInBlock() {
718
735
.hasSameElementsAs (blobsBundle .getCommitments ());
719
736
}
720
737
738
+ @ Test
739
+ void shouldIncludeConsolidationsInBlock () {
740
+ final BeaconState blockSlotState = dataStructureUtil .randomBeaconState ();
741
+ final ExecutionPayload randomExecutionPayload = dataStructureUtil .randomExecutionPayload ();
742
+ final UInt256 blockExecutionValue = dataStructureUtil .randomUInt256 ();
743
+ final BlobsBundle blobsBundle = dataStructureUtil .randomBlobsBundle ();
744
+
745
+ prepareBlockAndBlobsProduction (
746
+ randomExecutionPayload ,
747
+ executionPayloadContext ,
748
+ blockSlotState ,
749
+ blobsBundle ,
750
+ blockExecutionValue );
751
+
752
+ final CapturingBeaconBlockBodyBuilder bodyBuilder =
753
+ new CapturingBeaconBlockBodyBuilder (true , true );
754
+ safeJoin (
755
+ factoryElectra
756
+ .createSelector (
757
+ parentRoot ,
758
+ blockSlotState ,
759
+ dataStructureUtil .randomSignature (),
760
+ Optional .empty (),
761
+ Optional .of (false ),
762
+ Optional .empty (),
763
+ BlockProductionPerformance .NOOP )
764
+ .apply (bodyBuilder ));
765
+
766
+ assertThat (bodyBuilder .consolidations ).isEmpty ();
767
+ }
768
+
721
769
@ Test
722
770
void shouldIncludeKzgCommitmentsInBlindedBlock () {
723
771
final BeaconState blockSlotState = dataStructureUtil .randomBeaconState ();
@@ -737,7 +785,8 @@ void shouldIncludeKzgCommitmentsInBlindedBlock() {
737
785
blobKzgCommitments ,
738
786
blockExecutionValue );
739
787
740
- final CapturingBeaconBlockBodyBuilder bodyBuilder = new CapturingBeaconBlockBodyBuilder (true );
788
+ final CapturingBeaconBlockBodyBuilder bodyBuilder =
789
+ new CapturingBeaconBlockBodyBuilder (true , false );
741
790
742
791
safeJoin (
743
792
factory
@@ -1180,6 +1229,7 @@ private void prepareCachedFallbackData(
1180
1229
private static class CapturingBeaconBlockBodyBuilder implements BeaconBlockBodyBuilder {
1181
1230
1182
1231
private final boolean supportsKzgCommitments ;
1232
+ private final boolean supportsConsolidations ;
1183
1233
1184
1234
protected BLSSignature randaoReveal ;
1185
1235
protected Bytes32 graffiti ;
@@ -1195,8 +1245,10 @@ private static class CapturingBeaconBlockBodyBuilder implements BeaconBlockBodyB
1195
1245
@ SuppressWarnings ("unused" )
1196
1246
protected SszList <SignedConsolidation > consolidations ;
1197
1247
1198
- public CapturingBeaconBlockBodyBuilder (final boolean supportsKzgCommitments ) {
1248
+ public CapturingBeaconBlockBodyBuilder (
1249
+ final boolean supportsKzgCommitments , final boolean supportsConsolidations ) {
1199
1250
this .supportsKzgCommitments = supportsKzgCommitments ;
1251
+ this .supportsConsolidations = supportsConsolidations ;
1200
1252
}
1201
1253
1202
1254
@ Override
@@ -1293,6 +1345,11 @@ public Boolean supportsKzgCommitments() {
1293
1345
return supportsKzgCommitments ;
1294
1346
}
1295
1347
1348
+ @ Override
1349
+ public Boolean supportsConsolidations () {
1350
+ return supportsConsolidations ;
1351
+ }
1352
+
1296
1353
@ Override
1297
1354
public BeaconBlockBodyBuilder blobKzgCommitments (
1298
1355
final SszList <SszKZGCommitment > blobKzgCommitments ) {
0 commit comments