Skip to content

Commit

Permalink
Rename objects with prefix ExecutionLayerXXX
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanBratanov committed Jun 24, 2024
1 parent 8b256c0 commit 875fa96
Show file tree
Hide file tree
Showing 30 changed files with 222 additions and 285 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
"withdrawal_requests" : {
"type" : "array",
"items" : {
"$ref" : "#/components/schemas/ExecutionLayerWithdrawalRequest"
"$ref" : "#/components/schemas/WithdrawalRequest"
}
},
"consolidation_requests" : {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"title" : "ExecutionLayerWithdrawalRequest",
"title" : "WithdrawalRequest",
"type" : "object",
"required" : [ "source_address", "validator_pubkey", "amount" ],
"properties" : {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class ExecutionPayloadElectra extends ExecutionPayloadDeneb implements Ex
public final List<DepositRequest> depositRequests;

@JsonProperty("withdrawal_requests")
public final List<ExecutionLayerWithdrawalRequest> withdrawalRequests;
public final List<WithdrawalRequest> withdrawalRequests;

@JsonProperty("consolidation_requests")
public final List<ConsolidationRequest> consolidationRequests;
Expand All @@ -59,8 +59,7 @@ public ExecutionPayloadElectra(
@JsonProperty("blob_gas_used") final UInt64 blobGasUsed,
@JsonProperty("excess_blob_gas") final UInt64 excessBlobGas,
@JsonProperty("deposit_requests") final List<DepositRequest> depositRequests,
@JsonProperty("withdrawal_requests")
final List<ExecutionLayerWithdrawalRequest> withdrawalRequests,
@JsonProperty("withdrawal_requests") final List<WithdrawalRequest> withdrawalRequests,
@JsonProperty("consolidation_requests")
final List<ConsolidationRequest> consolidationRequests) {
super(
Expand Down Expand Up @@ -95,7 +94,7 @@ public ExecutionPayloadElectra(
.toList();
this.withdrawalRequests =
executionPayload.toVersionElectra().orElseThrow().getWithdrawalRequests().stream()
.map(ExecutionLayerWithdrawalRequest::new)
.map(WithdrawalRequest::new)
.toList();
this.consolidationRequests =
executionPayload.toVersionElectra().orElseThrow().getConsolidationRequests().stream()
Expand All @@ -121,9 +120,8 @@ protected ExecutionPayloadBuilder applyToBuilder(
withdrawalRequests.stream()
.map(
exit ->
exit.asInternalExecutionLayerWithdrawalRequest(
executionPayloadSchema
.getExecutionLayerWithdrawalRequestSchemaRequired()))
exit.asInternalWithdrawalRequest(
executionPayloadSchema.getWithdrawalRequestSchemaRequired()))
.toList())
.consolidationRequests(
() ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
import tech.pegasys.teku.bls.BLSPublicKey;
import tech.pegasys.teku.ethereum.execution.types.Eth1Address;
import tech.pegasys.teku.infrastructure.unsigned.UInt64;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.ExecutionLayerWithdrawalRequestSchema;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.WithdrawalRequestSchema;

public class ExecutionLayerWithdrawalRequest {
public class WithdrawalRequest {

@JsonProperty("source_address")
private final Eth1Address sourceAddress;
Expand All @@ -30,7 +30,7 @@ public class ExecutionLayerWithdrawalRequest {
@JsonProperty("amount")
private final UInt64 amount;

public ExecutionLayerWithdrawalRequest(
public WithdrawalRequest(
@JsonProperty("source_address") final Eth1Address sourceAddress,
@JsonProperty("validator_pubkey") final BLSPublicKey validatorPublicKey,
@JsonProperty("amount") final UInt64 amount) {
Expand All @@ -39,20 +39,17 @@ public ExecutionLayerWithdrawalRequest(
this.amount = amount;
}

public ExecutionLayerWithdrawalRequest(
final tech.pegasys.teku.spec.datastructures.execution.versions.electra
.ExecutionLayerWithdrawalRequest
executionLayerWithdrawalRequest) {
public WithdrawalRequest(
final tech.pegasys.teku.spec.datastructures.execution.versions.electra.WithdrawalRequest
withdrawalRequest) {
this.sourceAddress =
Eth1Address.fromBytes(executionLayerWithdrawalRequest.getSourceAddress().getWrappedBytes());
this.validatorPublicKey = executionLayerWithdrawalRequest.getValidatorPublicKey();
this.amount = executionLayerWithdrawalRequest.getAmount();
Eth1Address.fromBytes(withdrawalRequest.getSourceAddress().getWrappedBytes());
this.validatorPublicKey = withdrawalRequest.getValidatorPublicKey();
this.amount = withdrawalRequest.getAmount();
}

public final tech.pegasys.teku.spec.datastructures.execution.versions.electra
.ExecutionLayerWithdrawalRequest
asInternalExecutionLayerWithdrawalRequest(
final ExecutionLayerWithdrawalRequestSchema schema) {
public final tech.pegasys.teku.spec.datastructures.execution.versions.electra.WithdrawalRequest
asInternalWithdrawalRequest(final WithdrawalRequestSchema schema) {
return schema.create(sourceAddress, validatorPublicKey, amount);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import tech.pegasys.teku.spec.datastructures.consolidations.SignedConsolidation;
import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayloadSummary;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.DepositRequest;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.ExecutionLayerWithdrawalRequest;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.WithdrawalRequest;
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 @@ -155,22 +155,20 @@ public void processDepositRequest(
}

@Override
public void processExecutionLayerWithdrawalRequest(
final MutableBeaconState state,
final ExecutionLayerWithdrawalRequest executionLayerWithdrawalRequest)
public void processWithdrawalRequest(
final MutableBeaconState state, final WithdrawalRequest withdrawalRequest)
throws BlockProcessingException {
final SszList<ExecutionLayerWithdrawalRequest> withdrawalRequests =
final SszList<WithdrawalRequest> withdrawalRequests =
BeaconBlockBodySchemaElectra.required(beaconBlockBodySchema)
.getExecutionPayloadSchema()
.getExecutionLayerWithdrawalRequestsSchemaRequired()
.of(executionLayerWithdrawalRequest);
.getWithdrawalRequestsSchemaRequired()
.of(withdrawalRequest);
final Supplier<ValidatorExitContext> validatorExitContextSupplier =
spec.atSlot(state.getSlot())
.beaconStateMutators()
.createValidatorExitContextSupplier(state);
spec.getBlockProcessor(state.getSlot())
.processExecutionLayerWithdrawalRequests(
state, withdrawalRequests, validatorExitContextSupplier);
.processWithdrawalRequests(state, withdrawalRequests, validatorExitContextSupplier);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import tech.pegasys.teku.spec.datastructures.consolidations.SignedConsolidation;
import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayloadSummary;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.DepositRequest;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.ExecutionLayerWithdrawalRequest;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.WithdrawalRequest;
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 @@ -66,11 +66,10 @@ void processBlsToExecutionChange(
void processWithdrawals(MutableBeaconState state, ExecutionPayloadSummary payloadSummary)
throws BlockProcessingException;

void processDepositRequest(final MutableBeaconState state, final DepositRequest depositRequest)
void processDepositRequest(MutableBeaconState state, DepositRequest depositRequest)
throws BlockProcessingException;

void processExecutionLayerWithdrawalRequest(
MutableBeaconState state, ExecutionLayerWithdrawalRequest executionLayerWithdrawalRequest)
void processWithdrawalRequest(MutableBeaconState state, WithdrawalRequest withdrawalRequest)
throws BlockProcessingException;

void processConsolidation(MutableBeaconState state, SignedConsolidation consolidation)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import tech.pegasys.teku.spec.datastructures.consolidations.SignedConsolidation;
import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayload;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.DepositRequest;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.ExecutionLayerWithdrawalRequest;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.WithdrawalRequest;
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 @@ -76,7 +76,7 @@ private enum Operation {
BLS_TO_EXECUTION_CHANGE,
WITHDRAWAL,
DEPOSIT_REQUEST,
EXECUTION_LAYER_WITHDRAWAL_REQUEST,
WITHDRAWAL_REQUEST,
CONSOLIDATION
}

Expand Down Expand Up @@ -122,10 +122,9 @@ private enum Operation {
"operations/deposit_request",
new OperationsTestExecutor<>("deposit_request.ssz_snappy", Operation.DEPOSIT_REQUEST))
.put(
"operations/execution_layer_withdrawal_request",
"operations/withdrawal_request",
new OperationsTestExecutor<>(
"execution_layer_withdrawal_request.ssz_snappy",
Operation.EXECUTION_LAYER_WITHDRAWAL_REQUEST))
"withdrawal_request.ssz_snappy", Operation.WITHDRAWAL_REQUEST))
.put(
"operations/consolidation",
new OperationsTestExecutor<>("consolidation.ssz_snappy", Operation.CONSOLIDATION))
Expand Down Expand Up @@ -316,8 +315,7 @@ private void processOperation(
case BLS_TO_EXECUTION_CHANGE -> processBlsToExecutionChange(testDefinition, state, processor);
case WITHDRAWAL -> processWithdrawal(testDefinition, state, processor);
case DEPOSIT_REQUEST -> processDepositRequest(testDefinition, state, processor);
case EXECUTION_LAYER_WITHDRAWAL_REQUEST -> processExecutionLayerWithdrawalRequest(
testDefinition, state, processor);
case WITHDRAWAL_REQUEST -> processWithdrawalRequest(testDefinition, state, processor);
case CONSOLIDATION -> processConsolidation(testDefinition, state, processor);
default -> throw new UnsupportedOperationException(
"Operation " + operation + " not implemented in OperationTestExecutor");
Expand Down Expand Up @@ -356,14 +354,14 @@ private void processDepositRequest(
processor.processDepositRequest(state, depositRequest);
}

private void processExecutionLayerWithdrawalRequest(
private void processWithdrawalRequest(
final TestDefinition testDefinition,
final MutableBeaconState state,
final OperationProcessor processor)
throws BlockProcessingException {
final ExecutionLayerWithdrawalRequest executionLayerWithdrawalRequest =
loadSsz(testDefinition, dataFileName, ExecutionLayerWithdrawalRequest.SSZ_SCHEMA);
processor.processExecutionLayerWithdrawalRequest(state, executionLayerWithdrawalRequest);
final WithdrawalRequest withdrawalRequest =
loadSsz(testDefinition, dataFileName, WithdrawalRequest.SSZ_SCHEMA);
processor.processWithdrawalRequest(state, withdrawalRequest);
}

private void processConsolidation(
Expand Down Expand Up @@ -440,7 +438,7 @@ public void checkBlockInclusionValidation(
EXECUTION_PAYLOAD,
WITHDRAWAL,
DEPOSIT_REQUEST,
EXECUTION_LAYER_WITHDRAWAL_REQUEST,
WITHDRAWAL_REQUEST,
CONSOLIDATION -> {}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,10 @@ public class SszTestExecutor<T extends SszData> implements TestExecutor {
new SszTestExecutor<>(
schemas -> SchemaDefinitionsElectra.required(schemas).getDepositRequestSchema()))
.put(
"ssz_static/ExecutionLayerWithdrawalRequest",
"ssz_static/WithdrawalRequest",
new SszTestExecutor<>(
schemas ->
SchemaDefinitionsElectra.required(schemas)
.getExecutionLayerWithdrawalRequestSchema()))
SchemaDefinitionsElectra.required(schemas).getWithdrawalRequestSchema()))
.put(
"ssz_static/PendingBalanceDeposit",
new SszTestExecutor<>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
import tech.pegasys.teku.spec.datastructures.execution.versions.deneb.ExecutionPayloadDeneb;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.ConsolidationRequest;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.DepositRequest;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.ExecutionLayerWithdrawalRequest;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.ExecutionPayloadElectra;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.WithdrawalRequest;

public class ExecutionPayloadV4 extends ExecutionPayloadV3 {
public final List<DepositRequestV1> depositRequests;
Expand Down Expand Up @@ -133,11 +133,11 @@ private DepositRequest createInternalDepositRequest(
depositRequestV1.index);
}

private ExecutionLayerWithdrawalRequest createInternalWithdrawalRequest(
private WithdrawalRequest createInternalWithdrawalRequest(
final WithdrawalRequestV1 withdrawalRequestV1,
final ExecutionPayloadSchema<?> executionPayloadSchema) {
return executionPayloadSchema
.getExecutionLayerWithdrawalRequestSchemaRequired()
.getWithdrawalRequestSchemaRequired()
.create(
withdrawalRequestV1.sourceAddress,
BLSPublicKey.fromBytesCompressed(withdrawalRequestV1.validatorPubkey),
Expand Down Expand Up @@ -197,7 +197,7 @@ public static List<DepositRequestV1> getDepositRequests(
}

public static List<WithdrawalRequestV1> getWithdrawalRequests(
final SszList<ExecutionLayerWithdrawalRequest> withdrawalRequests) {
final SszList<WithdrawalRequest> withdrawalRequests) {
return withdrawalRequests.stream()
.map(
withdrawalRequest ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import tech.pegasys.teku.spec.datastructures.execution.versions.capella.Withdrawal;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.ConsolidationRequest;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.DepositRequest;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.ExecutionLayerWithdrawalRequest;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.WithdrawalRequest;

public interface ExecutionPayloadBuilder {
ExecutionPayloadBuilder parentHash(Bytes32 parentHash);
Expand Down Expand Up @@ -63,7 +63,7 @@ public interface ExecutionPayloadBuilder {
ExecutionPayloadBuilder depositRequests(Supplier<List<DepositRequest>> depositRequestsSupplier);

ExecutionPayloadBuilder withdrawalRequests(
Supplier<List<ExecutionLayerWithdrawalRequest>> withdrawalRequestsSupplier);
Supplier<List<WithdrawalRequest>> withdrawalRequestsSupplier);

ExecutionPayloadBuilder consolidationRequests(
Supplier<List<ConsolidationRequest>> consolidationRequestsSupplier);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.ConsolidationRequestSchema;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.DepositRequest;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.DepositRequestSchema;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.ExecutionLayerWithdrawalRequest;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.ExecutionLayerWithdrawalRequestSchema;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.WithdrawalRequest;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.WithdrawalRequestSchema;

public interface ExecutionPayloadSchema<T extends ExecutionPayload>
extends SszContainerSchema<T>, BuilderPayloadSchema<T> {
Expand All @@ -45,10 +45,10 @@ public interface ExecutionPayloadSchema<T extends ExecutionPayload>

DepositRequestSchema getDepositRequestSchemaRequired();

SszListSchema<ExecutionLayerWithdrawalRequest, ? extends SszList<ExecutionLayerWithdrawalRequest>>
getExecutionLayerWithdrawalRequestsSchemaRequired();
SszListSchema<WithdrawalRequest, ? extends SszList<WithdrawalRequest>>
getWithdrawalRequestsSchemaRequired();

ExecutionLayerWithdrawalRequestSchema getExecutionLayerWithdrawalRequestSchemaRequired();
WithdrawalRequestSchema getWithdrawalRequestSchemaRequired();

ConsolidationRequestSchema getConsolidationSchemaRequired();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import tech.pegasys.teku.spec.datastructures.execution.versions.capella.Withdrawal;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.ConsolidationRequest;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.DepositRequest;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.ExecutionLayerWithdrawalRequest;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.WithdrawalRequest;

public class ExecutionPayloadBuilderBellatrix implements ExecutionPayloadBuilder {
private ExecutionPayloadSchemaBellatrix schema;
Expand Down Expand Up @@ -163,7 +163,7 @@ public ExecutionPayloadBuilder depositRequests(

@Override
public ExecutionPayloadBuilder withdrawalRequests(
final Supplier<List<ExecutionLayerWithdrawalRequest>> withdrawalRequestsSupplier) {
final Supplier<List<WithdrawalRequest>> withdrawalRequestsSupplier) {
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.ConsolidationRequestSchema;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.DepositRequest;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.DepositRequestSchema;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.ExecutionLayerWithdrawalRequest;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.ExecutionLayerWithdrawalRequestSchema;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.WithdrawalRequest;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.WithdrawalRequestSchema;

public class ExecutionPayloadSchemaBellatrix
extends ContainerSchema14<
Expand Down Expand Up @@ -129,17 +129,14 @@ public DepositRequestSchema getDepositRequestSchemaRequired() {
}

@Override
public SszListSchema<
ExecutionLayerWithdrawalRequest, ? extends SszList<ExecutionLayerWithdrawalRequest>>
getExecutionLayerWithdrawalRequestsSchemaRequired() {
throw new IllegalStateException(
"Attempted to get execution layer withdrawal requests schema from bellatrix");
public SszListSchema<WithdrawalRequest, ? extends SszList<WithdrawalRequest>>
getWithdrawalRequestsSchemaRequired() {
throw new IllegalStateException("Attempted to get withdrawal requests schema from bellatrix");
}

@Override
public ExecutionLayerWithdrawalRequestSchema getExecutionLayerWithdrawalRequestSchemaRequired() {
throw new IllegalStateException(
"Attempted to get a execution layer withdrawal request schema from bellatrix");
public WithdrawalRequestSchema getWithdrawalRequestSchemaRequired() {
throw new IllegalStateException("Attempted to get a withdrawal request schema from bellatrix");
}

@Override
Expand Down
Loading

0 comments on commit 875fa96

Please sign in to comment.