Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check that ExecutionRequests is not null in block body #8697

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ public BeaconBlockBodyElectra(
deposits,
voluntaryExits,
syncAggregate);
checkNotNull(executionPayload, "Execution Payload is required for Electra blocks");
checkNotNull(executionPayload, "ExecutionPayload is required for Electra blocks");
this.executionPayload = executionPayload;
checkNotNull(blsToExecutionChanges, "BlsToExecutionChanges is required for Electra blocks");
this.blsToExecutionChanges = blsToExecutionChanges;
checkNotNull(blobKZGCommitments, "blobKZGCommitments is required for Electra blocks");
checkNotNull(blobKZGCommitments, "BlobKZGCommitments is required for Electra blocks");
this.blobKZGCommitments = blobKZGCommitments;
checkNotNull(executionRequests, "Execution Requests is required for Electra blocks");
checkNotNull(executionRequests, "ExecutionRequests is required for Electra blocks");
this.executionRequests = executionRequests;
}

Expand All @@ -94,33 +94,22 @@ public BeaconBlockBodyElectra(
.BeaconBlockBodyElectra
message) {
super(message);
checkNotNull(message.getExecutionPayload(), "Execution Payload is required for Electra blocks");
checkNotNull(message.getExecutionPayload(), "ExecutionPayload is required for Electra blocks");
this.executionPayload = new ExecutionPayloadDeneb(message.getExecutionPayload());
checkNotNull(
message.getBlsToExecutionChanges(),
"BlsToExecutionChanges are required for Electra blocks");
message.getBlsToExecutionChanges(), "BlsToExecutionChanges is required for Electra blocks");
this.blsToExecutionChanges =
message.getBlsToExecutionChanges().stream().map(SignedBlsToExecutionChange::new).toList();
checkNotNull(
message.getBlobKzgCommitments(), "BlobKzgCommitments are required for Electra blocks");
message.getBlobKzgCommitments(), "BlobKzgCommitments is required for Electra blocks");
this.blobKZGCommitments =
message.getBlobKzgCommitments().stream()
.map(SszKZGCommitment::getKZGCommitment)
.map(KZGCommitment::new)
.toList();

final List<DepositRequest> depositRequests =
message.getExecutionRequests().getDeposits().stream().map(DepositRequest::new).toList();
final List<WithdrawalRequest> withdrawalRequests =
message.getExecutionRequests().getWithdrawals().stream()
.map(WithdrawalRequest::new)
.toList();
final List<ConsolidationRequest> consolidationRequests =
message.getExecutionRequests().getConsolidations().stream()
.map(ConsolidationRequest::new)
.toList();
this.executionRequests =
new ExecutionRequests(depositRequests, withdrawalRequests, consolidationRequests);
checkNotNull(
message.getExecutionRequests(), "ExecutionRequests is required for Electra blocks");
this.executionRequests = new ExecutionRequests(message.getExecutionRequests());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,15 @@ public BlindedBeaconBlockBodyElectra(
voluntaryExits,
syncAggregate);
checkNotNull(
executionPayloadHeader, "Execution Payload Header is required for Electra blinded blocks");
executionPayloadHeader, "ExecutionPayloadHeader is required for Electra blinded blocks");
this.executionPayloadHeader = executionPayloadHeader;
checkNotNull(
blsToExecutionChanges, "blsToExecutionChanges is required for Electra blinded blocks");
blsToExecutionChanges, "BlsToExecutionChanges is required for Electra blinded blocks");
this.blsToExecutionChanges = blsToExecutionChanges;
checkNotNull(blobKZGCommitments, "blobKZGCommitments is required for Electra blinded blocks");
checkNotNull(blobKZGCommitments, "BlobKZGCommitments is required for Electra blinded blocks");
this.blobKZGCommitments = blobKZGCommitments;
checkNotNull(
executionRequestsRoot, "execution_requests_root is required for Electra blinded blocks");
executionRequestsRoot, "ExecutionRequestsRoot is required for Electra blinded blocks");
this.executionRequestsRoot = executionRequestsRoot;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public UInt64 getActiveBalance(final BeaconState state, final int validatorIndex
*
* @param state The state
* @param validatorIndex The index of the validator
* @return The sum of the withdrawal amounts for the validator in the partial withdrawal queue
* @return The sum of the withdrawal amounts for the validator in the partial withdrawal queue.
*/
public UInt64 getPendingBalanceToWithdraw(
final BeaconStateElectra state, final int validatorIndex) {
Expand Down