Skip to content

Commit

Permalink
Add functions for execution requests to block body
Browse files Browse the repository at this point in the history
  • Loading branch information
jtraglia committed Oct 10, 2024
1 parent e38dcce commit 39cfc33
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayload;
import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayloadHeader;
import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayloadSummary;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.ExecutionRequests;
import tech.pegasys.teku.spec.datastructures.operations.Attestation;
import tech.pegasys.teku.spec.datastructures.operations.AttesterSlashing;
import tech.pegasys.teku.spec.datastructures.operations.Deposit;
Expand Down Expand Up @@ -87,6 +88,10 @@ default Optional<SszList<SszKZGCommitment>> getOptionalBlobKzgCommitments() {
return Optional.empty();
}

default Optional<ExecutionRequests> getOptionalExecutionRequests() {
return Optional.empty();
}

default boolean isBlinded() {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ public enum BlockBodyFields implements SszFieldName {
EXECUTION_PAYLOAD_HEADER,
BLS_TO_EXECUTION_CHANGES,
BLOB_KZG_COMMITMENTS,
CONSOLIDATIONS,
EXECUTION_REQUESTS;

private final String sszFieldName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,12 @@ public ExecutionPayloadSchema<?> getExecutionPayloadSchema() {
getChildSchema(getFieldIndex(BlockBodyFields.BLOB_KZG_COMMITMENTS));
}

@Override
public ExecutionRequestsSchema getExecutionRequestsSchema() {
return (ExecutionRequestsSchema)
getChildSchema(getFieldIndex(BlockBodyFields.EXECUTION_REQUESTS));
}

@Override
public long getBlobKzgCommitmentsGeneralizedIndex() {
return getChildGeneralizedIndex(getFieldIndex(BlockBodyFields.BLOB_KZG_COMMITMENTS));
Expand All @@ -234,9 +240,4 @@ public LongList getBlindedNodeGeneralizedIndices() {
getChildGeneralizedIndex(getFieldIndex(BlockBodyFields.EXECUTION_PAYLOAD)),
getExecutionPayloadSchema().getBlindedNodeGeneralizedIndices());
}

@Override
public ExecutionRequestsSchema getExecutionRequestsSchema() {
return (ExecutionRequestsSchema) getFieldSchema12();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import java.util.Optional;
import tech.pegasys.teku.spec.datastructures.blocks.blockbody.BeaconBlockBody;
import tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.deneb.BlindedBeaconBlockBodyDeneb;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.ExecutionRequests;

public interface BlindedBeaconBlockBodyElectra extends BlindedBeaconBlockBodyDeneb {
static BlindedBeaconBlockBodyElectra required(final BeaconBlockBody body) {
Expand All @@ -27,6 +28,13 @@ static BlindedBeaconBlockBodyElectra required(final BeaconBlockBody body) {
+ body.getClass().getSimpleName()));
}

ExecutionRequests getExecutionRequests();

@Override
default Optional<ExecutionRequests> getOptionalExecutionRequests() {
return Optional.of(getExecutionRequests());
}

@Override
default Optional<BlindedBeaconBlockBodyElectra> toBlindedVersionElectra() {
return Optional.of(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,11 @@ public SszList<SszKZGCommitment> getBlobKzgCommitments() {
return getField11();
}

@Override
public ExecutionRequests getExecutionRequests() {
return getField12();
}

@Override
public BlindedBeaconBlockBodySchemaElectraImpl getSchema() {
return (BlindedBeaconBlockBodySchemaElectraImpl) super.getSchema();
Expand Down

0 comments on commit 39cfc33

Please sign in to comment.