From 875fa964d9d68480ecb4ff650178029f02e2449d Mon Sep 17 00:00:00 2001 From: Stefan Bratanov Date: Mon, 24 Jun 2024 10:15:28 +0100 Subject: [PATCH] Rename objects with prefix ExecutionLayerXXX --- .../schema/ExecutionPayloadElectra.json | 2 +- ...walRequest.json => WithdrawalRequest.json} | 2 +- .../electra/ExecutionPayloadElectra.java | 12 ++- ...walRequest.java => WithdrawalRequest.java} | 25 +++--- .../operations/DefaultOperationProcessor.java | 16 ++-- .../common/operations/OperationProcessor.java | 7 +- .../operations/OperationsTestExecutor.java | 22 +++-- .../phase0/ssz_static/SszTestExecutor.java | 5 +- .../schema/ExecutionPayloadV4.java | 8 +- .../execution/ExecutionPayloadBuilder.java | 4 +- .../execution/ExecutionPayloadSchema.java | 10 +-- .../ExecutionPayloadBuilderBellatrix.java | 4 +- .../ExecutionPayloadSchemaBellatrix.java | 17 ++-- .../ExecutionPayloadSchemaCapella.java | 17 ++-- .../deneb/ExecutionPayloadSchemaDeneb.java | 17 ++-- .../ExecutionPayloadBuilderElectra.java | 6 +- .../electra/ExecutionPayloadElectra.java | 2 +- .../electra/ExecutionPayloadElectraImpl.java | 8 +- .../ExecutionPayloadSchemaElectra.java | 27 +++--- ...walRequest.java => WithdrawalRequest.java} | 18 ++-- ...hema.java => WithdrawalRequestSchema.java} | 17 ++-- .../common/block/AbstractBlockProcessor.java | 14 +-- .../logic/common/block/BlockProcessor.java | 6 +- .../electra/block/BlockProcessorElectra.java | 52 +++++------ .../schemas/SchemaDefinitionsElectra.java | 12 +-- ...ava => WithdrawalRequestPropertyTest.java} | 14 ++- ...stTest.java => WithdrawalRequestTest.java} | 39 ++++---- .../block/BlockProcessorElectraTest.java | 89 ++++++++----------- ...er.java => WithdrawalRequestSupplier.java} | 9 +- .../teku/spec/util/DataStructureUtil.java | 26 +++--- 30 files changed, 222 insertions(+), 285 deletions(-) rename data/beaconrestapi/src/integration-test/resources/tech/pegasys/teku/beaconrestapi/beacon/schema/{ExecutionLayerWithdrawalRequest.json => WithdrawalRequest.json} (92%) rename data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/{ExecutionLayerWithdrawalRequest.java => WithdrawalRequest.java} (70%) rename ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/versions/electra/{ExecutionLayerWithdrawalRequest.java => WithdrawalRequest.java} (74%) rename ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/versions/electra/{ExecutionLayerWithdrawalRequestSchema.java => WithdrawalRequestSchema.java} (75%) rename ethereum/spec/src/property-test/java/tech/pegasys/teku/spec/datastructures/execution/versions/electra/{ExecutionLayerWithdrawalRequestPropertyTest.java => WithdrawalRequestPropertyTest.java} (68%) rename ethereum/spec/src/test/java/tech/pegasys/teku/spec/datastructures/operations/{ExecutionLayerWithdrawalRequestTest.java => WithdrawalRequestTest.java} (52%) rename ethereum/spec/src/testFixtures/java/tech/pegasys/teku/spec/propertytest/suppliers/execution/versions/electra/{ExecutionLayerWithdrawalRequestSupplier.java => WithdrawalRequestSupplier.java} (74%) diff --git a/data/beaconrestapi/src/integration-test/resources/tech/pegasys/teku/beaconrestapi/beacon/schema/ExecutionPayloadElectra.json b/data/beaconrestapi/src/integration-test/resources/tech/pegasys/teku/beaconrestapi/beacon/schema/ExecutionPayloadElectra.json index 50ac27d0f5d..22aea3ddab1 100644 --- a/data/beaconrestapi/src/integration-test/resources/tech/pegasys/teku/beaconrestapi/beacon/schema/ExecutionPayloadElectra.json +++ b/data/beaconrestapi/src/integration-test/resources/tech/pegasys/teku/beaconrestapi/beacon/schema/ExecutionPayloadElectra.json @@ -117,7 +117,7 @@ "withdrawal_requests" : { "type" : "array", "items" : { - "$ref" : "#/components/schemas/ExecutionLayerWithdrawalRequest" + "$ref" : "#/components/schemas/WithdrawalRequest" } }, "consolidation_requests" : { diff --git a/data/beaconrestapi/src/integration-test/resources/tech/pegasys/teku/beaconrestapi/beacon/schema/ExecutionLayerWithdrawalRequest.json b/data/beaconrestapi/src/integration-test/resources/tech/pegasys/teku/beaconrestapi/beacon/schema/WithdrawalRequest.json similarity index 92% rename from data/beaconrestapi/src/integration-test/resources/tech/pegasys/teku/beaconrestapi/beacon/schema/ExecutionLayerWithdrawalRequest.json rename to data/beaconrestapi/src/integration-test/resources/tech/pegasys/teku/beaconrestapi/beacon/schema/WithdrawalRequest.json index 5d74a54df9f..41b37f68341 100644 --- a/data/beaconrestapi/src/integration-test/resources/tech/pegasys/teku/beaconrestapi/beacon/schema/ExecutionLayerWithdrawalRequest.json +++ b/data/beaconrestapi/src/integration-test/resources/tech/pegasys/teku/beaconrestapi/beacon/schema/WithdrawalRequest.json @@ -1,5 +1,5 @@ { - "title" : "ExecutionLayerWithdrawalRequest", + "title" : "WithdrawalRequest", "type" : "object", "required" : [ "source_address", "validator_pubkey", "amount" ], "properties" : { diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/ExecutionPayloadElectra.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/ExecutionPayloadElectra.java index 5d96ee7439f..3dba439a4c1 100644 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/ExecutionPayloadElectra.java +++ b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/ExecutionPayloadElectra.java @@ -34,7 +34,7 @@ public class ExecutionPayloadElectra extends ExecutionPayloadDeneb implements Ex public final List depositRequests; @JsonProperty("withdrawal_requests") - public final List withdrawalRequests; + public final List withdrawalRequests; @JsonProperty("consolidation_requests") public final List consolidationRequests; @@ -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 depositRequests, - @JsonProperty("withdrawal_requests") - final List withdrawalRequests, + @JsonProperty("withdrawal_requests") final List withdrawalRequests, @JsonProperty("consolidation_requests") final List consolidationRequests) { super( @@ -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() @@ -121,9 +120,8 @@ protected ExecutionPayloadBuilder applyToBuilder( withdrawalRequests.stream() .map( exit -> - exit.asInternalExecutionLayerWithdrawalRequest( - executionPayloadSchema - .getExecutionLayerWithdrawalRequestSchemaRequired())) + exit.asInternalWithdrawalRequest( + executionPayloadSchema.getWithdrawalRequestSchemaRequired())) .toList()) .consolidationRequests( () -> diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/ExecutionLayerWithdrawalRequest.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/WithdrawalRequest.java similarity index 70% rename from data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/ExecutionLayerWithdrawalRequest.java rename to data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/WithdrawalRequest.java index 167404914ef..a28cb29275b 100644 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/ExecutionLayerWithdrawalRequest.java +++ b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/WithdrawalRequest.java @@ -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; @@ -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) { @@ -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); } } diff --git a/eth-reference-tests/src/referenceTest/java/tech/pegasys/teku/reference/common/operations/DefaultOperationProcessor.java b/eth-reference-tests/src/referenceTest/java/tech/pegasys/teku/reference/common/operations/DefaultOperationProcessor.java index 1fe3392ae63..c1c38d54a96 100644 --- a/eth-reference-tests/src/referenceTest/java/tech/pegasys/teku/reference/common/operations/DefaultOperationProcessor.java +++ b/eth-reference-tests/src/referenceTest/java/tech/pegasys/teku/reference/common/operations/DefaultOperationProcessor.java @@ -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; @@ -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 withdrawalRequests = + final SszList withdrawalRequests = BeaconBlockBodySchemaElectra.required(beaconBlockBodySchema) .getExecutionPayloadSchema() - .getExecutionLayerWithdrawalRequestsSchemaRequired() - .of(executionLayerWithdrawalRequest); + .getWithdrawalRequestsSchemaRequired() + .of(withdrawalRequest); final Supplier validatorExitContextSupplier = spec.atSlot(state.getSlot()) .beaconStateMutators() .createValidatorExitContextSupplier(state); spec.getBlockProcessor(state.getSlot()) - .processExecutionLayerWithdrawalRequests( - state, withdrawalRequests, validatorExitContextSupplier); + .processWithdrawalRequests(state, withdrawalRequests, validatorExitContextSupplier); } @Override diff --git a/eth-reference-tests/src/referenceTest/java/tech/pegasys/teku/reference/common/operations/OperationProcessor.java b/eth-reference-tests/src/referenceTest/java/tech/pegasys/teku/reference/common/operations/OperationProcessor.java index de028d21af9..2a5bc4933d1 100644 --- a/eth-reference-tests/src/referenceTest/java/tech/pegasys/teku/reference/common/operations/OperationProcessor.java +++ b/eth-reference-tests/src/referenceTest/java/tech/pegasys/teku/reference/common/operations/OperationProcessor.java @@ -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; @@ -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) diff --git a/eth-reference-tests/src/referenceTest/java/tech/pegasys/teku/reference/common/operations/OperationsTestExecutor.java b/eth-reference-tests/src/referenceTest/java/tech/pegasys/teku/reference/common/operations/OperationsTestExecutor.java index 75022fe8afe..1d6261c2db9 100644 --- a/eth-reference-tests/src/referenceTest/java/tech/pegasys/teku/reference/common/operations/OperationsTestExecutor.java +++ b/eth-reference-tests/src/referenceTest/java/tech/pegasys/teku/reference/common/operations/OperationsTestExecutor.java @@ -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; @@ -76,7 +76,7 @@ private enum Operation { BLS_TO_EXECUTION_CHANGE, WITHDRAWAL, DEPOSIT_REQUEST, - EXECUTION_LAYER_WITHDRAWAL_REQUEST, + WITHDRAWAL_REQUEST, CONSOLIDATION } @@ -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)) @@ -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"); @@ -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( @@ -440,7 +438,7 @@ public void checkBlockInclusionValidation( EXECUTION_PAYLOAD, WITHDRAWAL, DEPOSIT_REQUEST, - EXECUTION_LAYER_WITHDRAWAL_REQUEST, + WITHDRAWAL_REQUEST, CONSOLIDATION -> {} } } diff --git a/eth-reference-tests/src/referenceTest/java/tech/pegasys/teku/reference/phase0/ssz_static/SszTestExecutor.java b/eth-reference-tests/src/referenceTest/java/tech/pegasys/teku/reference/phase0/ssz_static/SszTestExecutor.java index 1e4466a494a..a46fa465dba 100644 --- a/eth-reference-tests/src/referenceTest/java/tech/pegasys/teku/reference/phase0/ssz_static/SszTestExecutor.java +++ b/eth-reference-tests/src/referenceTest/java/tech/pegasys/teku/reference/phase0/ssz_static/SszTestExecutor.java @@ -195,11 +195,10 @@ public class SszTestExecutor 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<>( diff --git a/ethereum/executionclient/src/main/java/tech/pegasys/teku/ethereum/executionclient/schema/ExecutionPayloadV4.java b/ethereum/executionclient/src/main/java/tech/pegasys/teku/ethereum/executionclient/schema/ExecutionPayloadV4.java index d8b716b87e4..3a3778a679c 100644 --- a/ethereum/executionclient/src/main/java/tech/pegasys/teku/ethereum/executionclient/schema/ExecutionPayloadV4.java +++ b/ethereum/executionclient/src/main/java/tech/pegasys/teku/ethereum/executionclient/schema/ExecutionPayloadV4.java @@ -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 depositRequests; @@ -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), @@ -197,7 +197,7 @@ public static List getDepositRequests( } public static List getWithdrawalRequests( - final SszList withdrawalRequests) { + final SszList withdrawalRequests) { return withdrawalRequests.stream() .map( withdrawalRequest -> diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/ExecutionPayloadBuilder.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/ExecutionPayloadBuilder.java index 0a67c060bc5..d95ccb49a89 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/ExecutionPayloadBuilder.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/ExecutionPayloadBuilder.java @@ -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); @@ -63,7 +63,7 @@ public interface ExecutionPayloadBuilder { ExecutionPayloadBuilder depositRequests(Supplier> depositRequestsSupplier); ExecutionPayloadBuilder withdrawalRequests( - Supplier> withdrawalRequestsSupplier); + Supplier> withdrawalRequestsSupplier); ExecutionPayloadBuilder consolidationRequests( Supplier> consolidationRequestsSupplier); diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/ExecutionPayloadSchema.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/ExecutionPayloadSchema.java index 0a7cce225f4..674f7a75ea4 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/ExecutionPayloadSchema.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/ExecutionPayloadSchema.java @@ -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 extends SszContainerSchema, BuilderPayloadSchema { @@ -45,10 +45,10 @@ public interface ExecutionPayloadSchema DepositRequestSchema getDepositRequestSchemaRequired(); - SszListSchema> - getExecutionLayerWithdrawalRequestsSchemaRequired(); + SszListSchema> + getWithdrawalRequestsSchemaRequired(); - ExecutionLayerWithdrawalRequestSchema getExecutionLayerWithdrawalRequestSchemaRequired(); + WithdrawalRequestSchema getWithdrawalRequestSchemaRequired(); ConsolidationRequestSchema getConsolidationSchemaRequired(); diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/versions/bellatrix/ExecutionPayloadBuilderBellatrix.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/versions/bellatrix/ExecutionPayloadBuilderBellatrix.java index 8280f8faeab..22520bd9924 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/versions/bellatrix/ExecutionPayloadBuilderBellatrix.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/versions/bellatrix/ExecutionPayloadBuilderBellatrix.java @@ -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; @@ -163,7 +163,7 @@ public ExecutionPayloadBuilder depositRequests( @Override public ExecutionPayloadBuilder withdrawalRequests( - final Supplier> withdrawalRequestsSupplier) { + final Supplier> withdrawalRequestsSupplier) { return this; } diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/versions/bellatrix/ExecutionPayloadSchemaBellatrix.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/versions/bellatrix/ExecutionPayloadSchemaBellatrix.java index 18d2cee214b..bc60e174292 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/versions/bellatrix/ExecutionPayloadSchemaBellatrix.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/versions/bellatrix/ExecutionPayloadSchemaBellatrix.java @@ -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< @@ -129,17 +129,14 @@ public DepositRequestSchema getDepositRequestSchemaRequired() { } @Override - public SszListSchema< - ExecutionLayerWithdrawalRequest, ? extends SszList> - getExecutionLayerWithdrawalRequestsSchemaRequired() { - throw new IllegalStateException( - "Attempted to get execution layer withdrawal requests schema from bellatrix"); + public SszListSchema> + 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 diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/versions/capella/ExecutionPayloadSchemaCapella.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/versions/capella/ExecutionPayloadSchemaCapella.java index fc23b9c986c..6a91ee3294c 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/versions/capella/ExecutionPayloadSchemaCapella.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/versions/capella/ExecutionPayloadSchemaCapella.java @@ -53,8 +53,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 ExecutionPayloadSchemaCapella extends ContainerSchema15< @@ -136,17 +136,14 @@ public DepositRequestSchema getDepositRequestSchemaRequired() { } @Override - public SszListSchema< - ExecutionLayerWithdrawalRequest, ? extends SszList> - getExecutionLayerWithdrawalRequestsSchemaRequired() { - throw new IllegalStateException( - "Attempted to get execution layer withdrawal requests schema from capella"); + public SszListSchema> + getWithdrawalRequestsSchemaRequired() { + throw new IllegalStateException("Attempted to get withdrawal requests schema from capella"); } @Override - public ExecutionLayerWithdrawalRequestSchema getExecutionLayerWithdrawalRequestSchemaRequired() { - throw new IllegalStateException( - "Attempted to get a execution layer withdrawal request schema from capella"); + public WithdrawalRequestSchema getWithdrawalRequestSchemaRequired() { + throw new IllegalStateException("Attempted to get a withdrawal request schema from capella"); } @Override diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/versions/deneb/ExecutionPayloadSchemaDeneb.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/versions/deneb/ExecutionPayloadSchemaDeneb.java index 7b61369c4f6..10928dbad45 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/versions/deneb/ExecutionPayloadSchemaDeneb.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/versions/deneb/ExecutionPayloadSchemaDeneb.java @@ -57,8 +57,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 ExecutionPayloadSchemaDeneb extends ContainerSchema17< @@ -144,17 +144,14 @@ public DepositRequestSchema getDepositRequestSchemaRequired() { } @Override - public SszListSchema< - ExecutionLayerWithdrawalRequest, ? extends SszList> - getExecutionLayerWithdrawalRequestsSchemaRequired() { - throw new IllegalStateException( - "Attempted to get execution layer withdrawal requests schema from deneb"); + public SszListSchema> + getWithdrawalRequestsSchemaRequired() { + throw new IllegalStateException("Attempted to get withdrawal requests schema from deneb"); } @Override - public ExecutionLayerWithdrawalRequestSchema getExecutionLayerWithdrawalRequestSchemaRequired() { - throw new IllegalStateException( - "Attempted to get a execution layer withdrawal request schema from deneb"); + public WithdrawalRequestSchema getWithdrawalRequestSchemaRequired() { + throw new IllegalStateException("Attempted to get a withdrawal request schema from deneb"); } @Override diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/versions/electra/ExecutionPayloadBuilderElectra.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/versions/electra/ExecutionPayloadBuilderElectra.java index 3a3acc643d6..c0f2c1244cb 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/versions/electra/ExecutionPayloadBuilderElectra.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/versions/electra/ExecutionPayloadBuilderElectra.java @@ -29,7 +29,7 @@ public class ExecutionPayloadBuilderElectra extends ExecutionPayloadBuilderDeneb private ExecutionPayloadSchemaElectra schema; protected List depositRequests; - protected List withdrawalRequests; + protected List withdrawalRequests; protected List consolidationRequests; public ExecutionPayloadBuilderElectra schema(final ExecutionPayloadSchemaElectra schema) { @@ -46,7 +46,7 @@ public ExecutionPayloadBuilder depositRequests( @Override public ExecutionPayloadBuilder withdrawalRequests( - final Supplier> withdrawalRequestsSupplier) { + final Supplier> withdrawalRequestsSupplier) { this.withdrawalRequests = withdrawalRequestsSupplier.get(); return this; } @@ -96,7 +96,7 @@ public ExecutionPayload build() { SszUInt64.of(blobGasUsed), SszUInt64.of(excessBlobGas), schema.getDepositRequestsSchema().createFromElements(depositRequests), - schema.getExecutionLayerWithdrawalRequestsSchema().createFromElements(withdrawalRequests), + schema.getWithdrawalRequestsSchema().createFromElements(withdrawalRequests), schema.getConsolidationRequestsSchema().createFromElements(consolidationRequests)); } } diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/versions/electra/ExecutionPayloadElectra.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/versions/electra/ExecutionPayloadElectra.java index 04ea1ed19ec..fd9acf4be7f 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/versions/electra/ExecutionPayloadElectra.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/versions/electra/ExecutionPayloadElectra.java @@ -33,7 +33,7 @@ static ExecutionPayloadElectra required(final ExecutionPayload payload) { SszList getDepositRequests(); - SszList getWithdrawalRequests(); + SszList getWithdrawalRequests(); SszList getConsolidationRequests(); diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/versions/electra/ExecutionPayloadElectraImpl.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/versions/electra/ExecutionPayloadElectraImpl.java index d59fcf764e8..165b4d152d1 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/versions/electra/ExecutionPayloadElectraImpl.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/versions/electra/ExecutionPayloadElectraImpl.java @@ -53,7 +53,7 @@ public class ExecutionPayloadElectraImpl SszUInt64, SszUInt64, SszList, - SszList, + SszList, SszList> implements ExecutionPayloadElectra { @@ -78,7 +78,7 @@ public ExecutionPayloadElectraImpl( SszUInt64, SszUInt64, SszList, - SszList, + SszList, SszList> schema, final TreeNode backingNode) { @@ -105,7 +105,7 @@ public ExecutionPayloadElectraImpl( final SszUInt64 blobGasUsed, final SszUInt64 excessBlobGas, final SszList depositRequests, - final SszList withdrawalRequests, + final SszList withdrawalRequests, final SszList consolidationRequests) { super( schema, @@ -242,7 +242,7 @@ public SszList getDepositRequests() { } @Override - public SszList getWithdrawalRequests() { + public SszList getWithdrawalRequests() { return getField18(); } diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/versions/electra/ExecutionPayloadSchemaElectra.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/versions/electra/ExecutionPayloadSchemaElectra.java index 9980efb49de..6b55b4214b1 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/versions/electra/ExecutionPayloadSchemaElectra.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/versions/electra/ExecutionPayloadSchemaElectra.java @@ -79,7 +79,7 @@ public class ExecutionPayloadSchemaElectra SszUInt64, SszUInt64, SszList, - SszList, + SszList, SszList> implements ExecutionPayloadSchema { @@ -117,8 +117,7 @@ public ExecutionPayloadSchemaElectra(final SpecConfigElectra specConfig) { namedSchema( WITHDRAWAL_REQUESTS, SszListSchema.create( - ExecutionLayerWithdrawalRequest.SSZ_SCHEMA, - specConfig.getMaxWithdrawalRequestsPerPayload())), + WithdrawalRequest.SSZ_SCHEMA, specConfig.getMaxWithdrawalRequestsPerPayload())), namedSchema( CONSOLIDATION_REQUESTS, SszListSchema.create( @@ -159,15 +158,14 @@ public DepositRequestSchema getDepositRequestSchemaRequired() { } @Override - public SszListSchema< - ExecutionLayerWithdrawalRequest, ? extends SszList> - getExecutionLayerWithdrawalRequestsSchemaRequired() { - return getExecutionLayerWithdrawalRequestsSchema(); + public SszListSchema> + getWithdrawalRequestsSchemaRequired() { + return getWithdrawalRequestsSchema(); } @Override - public ExecutionLayerWithdrawalRequestSchema getExecutionLayerWithdrawalRequestSchemaRequired() { - return getExecutionLayerWithdrawalRequestSchema(); + public WithdrawalRequestSchema getWithdrawalRequestSchemaRequired() { + return getWithdrawalRequestSchema(); } @Override @@ -183,9 +181,8 @@ public DepositRequestSchema getDepositRequestSchema() { return (DepositRequestSchema) getDepositRequestsSchema().getElementSchema(); } - public ExecutionLayerWithdrawalRequestSchema getExecutionLayerWithdrawalRequestSchema() { - return (ExecutionLayerWithdrawalRequestSchema) - getExecutionLayerWithdrawalRequestsSchema().getElementSchema(); + public WithdrawalRequestSchema getWithdrawalRequestSchema() { + return (WithdrawalRequestSchema) getWithdrawalRequestsSchema().getElementSchema(); } public ConsolidationRequestSchema getConsolidationRequestSchema() { @@ -236,10 +233,8 @@ public SszByteListSchema getExtraDataSchema() { } @SuppressWarnings("unchecked") - public SszListSchema - getExecutionLayerWithdrawalRequestsSchema() { - return (SszListSchema) - getChildSchema(getFieldIndex(WITHDRAWAL_REQUESTS)); + public SszListSchema getWithdrawalRequestsSchema() { + return (SszListSchema) getChildSchema(getFieldIndex(WITHDRAWAL_REQUESTS)); } @SuppressWarnings("unchecked") diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/versions/electra/ExecutionLayerWithdrawalRequest.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/versions/electra/WithdrawalRequest.java similarity index 74% rename from ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/versions/electra/ExecutionLayerWithdrawalRequest.java rename to ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/versions/electra/WithdrawalRequest.java index 05e6a0b2c3c..f07a9e0de68 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/versions/electra/ExecutionLayerWithdrawalRequest.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/versions/electra/WithdrawalRequest.java @@ -22,14 +22,13 @@ import tech.pegasys.teku.infrastructure.unsigned.UInt64; import tech.pegasys.teku.spec.datastructures.type.SszPublicKey; -public class ExecutionLayerWithdrawalRequest - extends Container3 { +public class WithdrawalRequest + extends Container3 { - public static final ExecutionLayerWithdrawalRequestSchema SSZ_SCHEMA = - new ExecutionLayerWithdrawalRequestSchema(); + public static final WithdrawalRequestSchema SSZ_SCHEMA = new WithdrawalRequestSchema(); - protected ExecutionLayerWithdrawalRequest( - final ExecutionLayerWithdrawalRequestSchema schema, + protected WithdrawalRequest( + final WithdrawalRequestSchema schema, final Bytes20 sourceAddress, final BLSPublicKey validatorPublicKey, final UInt64 amount) { @@ -40,8 +39,7 @@ protected ExecutionLayerWithdrawalRequest( SszUInt64.of(amount)); } - ExecutionLayerWithdrawalRequest( - final ExecutionLayerWithdrawalRequestSchema type, final TreeNode backingNode) { + WithdrawalRequest(final WithdrawalRequestSchema type, final TreeNode backingNode) { super(type, backingNode); } @@ -58,7 +56,7 @@ public UInt64 getAmount() { } @Override - public ExecutionLayerWithdrawalRequestSchema getSchema() { - return (ExecutionLayerWithdrawalRequestSchema) super.getSchema(); + public WithdrawalRequestSchema getSchema() { + return (WithdrawalRequestSchema) super.getSchema(); } } diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/versions/electra/ExecutionLayerWithdrawalRequestSchema.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/versions/electra/WithdrawalRequestSchema.java similarity index 75% rename from ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/versions/electra/ExecutionLayerWithdrawalRequestSchema.java rename to ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/versions/electra/WithdrawalRequestSchema.java index 73bf7420ef3..c985b9cdda2 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/versions/electra/ExecutionLayerWithdrawalRequestSchema.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/versions/electra/WithdrawalRequestSchema.java @@ -25,25 +25,24 @@ import tech.pegasys.teku.spec.datastructures.type.SszPublicKey; import tech.pegasys.teku.spec.datastructures.type.SszPublicKeySchema; -public class ExecutionLayerWithdrawalRequestSchema - extends ContainerSchema3< - ExecutionLayerWithdrawalRequest, SszByteVector, SszPublicKey, SszUInt64> { +public class WithdrawalRequestSchema + extends ContainerSchema3 { - public ExecutionLayerWithdrawalRequestSchema() { + public WithdrawalRequestSchema() { super( - "ExecutionLayerWithdrawalRequest", + "WithdrawalRequest", namedSchema("source_address", SszByteVectorSchema.create(Bytes20.SIZE)), namedSchema("validator_pubkey", SszPublicKeySchema.INSTANCE), namedSchema("amount", SszPrimitiveSchemas.UINT64_SCHEMA)); } - public ExecutionLayerWithdrawalRequest create( + public WithdrawalRequest create( final Bytes20 sourceAddress, final BLSPublicKey validatorPublicKey, final UInt64 amount) { - return new ExecutionLayerWithdrawalRequest(this, sourceAddress, validatorPublicKey, amount); + return new WithdrawalRequest(this, sourceAddress, validatorPublicKey, amount); } @Override - public ExecutionLayerWithdrawalRequest createFromBackingNode(final TreeNode node) { - return new ExecutionLayerWithdrawalRequest(this, node); + public WithdrawalRequest createFromBackingNode(final TreeNode node) { + return new WithdrawalRequest(this, node); } } diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/common/block/AbstractBlockProcessor.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/common/block/AbstractBlockProcessor.java index 05ecdfdaadf..ad61c37e91b 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/common/block/AbstractBlockProcessor.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/common/block/AbstractBlockProcessor.java @@ -49,7 +49,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.AttestationData; import tech.pegasys.teku.spec.datastructures.operations.AttesterSlashing; @@ -449,7 +449,7 @@ protected void processOperationsNoValidation( processDeposits(state, body.getDeposits()); processVoluntaryExitsNoValidation( state, body.getVoluntaryExits(), validatorExitContextSupplier); - processExecutionLayerWithdrawalRequests( + processWithdrawalRequests( state, body.getOptionalExecutionPayload(), validatorExitContextSupplier); }); } @@ -900,12 +900,12 @@ protected BlockValidationResult verifyVoluntaryExits( return BlockValidationResult.SUCCESSFUL; } - protected void processExecutionLayerWithdrawalRequests( + protected void processWithdrawalRequests( final MutableBeaconState state, final Optional executionPayload, final Supplier validatorExitContextSupplier) throws BlockProcessingException { - // No ExecutionLayerWithdrawalRequests until Electra + // No WithdrawalRequests until Electra } @Override @@ -916,12 +916,12 @@ public void processDepositRequests( } @Override - public void processExecutionLayerWithdrawalRequests( + public void processWithdrawalRequests( final MutableBeaconState state, - final SszList withdrawalRequests, + final SszList withdrawalRequests, final Supplier validatorExitContextSupplier) throws BlockProcessingException { - // No ExecutionLayerWithdrawalRequests until Electra + // No WithdrawalRequests until Electra } @Override diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/common/block/BlockProcessor.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/common/block/BlockProcessor.java index 0e5789ba3ab..f7e959d5c68 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/common/block/BlockProcessor.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/common/block/BlockProcessor.java @@ -33,7 +33,7 @@ import tech.pegasys.teku.spec.datastructures.execution.ExpectedWithdrawals; import tech.pegasys.teku.spec.datastructures.execution.NewPayloadRequest; 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.AttestationData; import tech.pegasys.teku.spec.datastructures.operations.AttesterSlashing; @@ -171,9 +171,9 @@ void processWithdrawals(MutableBeaconState state, ExecutionPayloadSummary payloa void processDepositRequests(MutableBeaconState state, SszList depositRequests) throws BlockProcessingException; - void processExecutionLayerWithdrawalRequests( + void processWithdrawalRequests( MutableBeaconState state, - SszList exits, + SszList exits, Supplier validatorExitContextSupplier) throws BlockProcessingException; diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/electra/block/BlockProcessorElectra.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/electra/block/BlockProcessorElectra.java index 81479e8f5c5..15fc7090b21 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/electra/block/BlockProcessorElectra.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/electra/block/BlockProcessorElectra.java @@ -45,8 +45,8 @@ import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayloadSummary; import tech.pegasys.teku.spec.datastructures.execution.ExpectedWithdrawals; 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; import tech.pegasys.teku.spec.datastructures.operations.Attestation; import tech.pegasys.teku.spec.datastructures.state.Validator; import tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconState; @@ -164,15 +164,13 @@ protected void verifyOutstandingDepositsAreProcessed( } @Override - protected void processExecutionLayerWithdrawalRequests( + protected void processWithdrawalRequests( final MutableBeaconState state, final Optional executionPayload, final Supplier validatorExitContextSupplier) throws BlockProcessingException { - this.processExecutionLayerWithdrawalRequests( - state, - getExecutionLayerWithdrawalRequestsFromBlock(executionPayload), - validatorExitContextSupplier); + this.processWithdrawalRequests( + state, getWithdrawalRequestsFromBlock(executionPayload), validatorExitContextSupplier); } // process_withdrawals @@ -189,29 +187,24 @@ public void processWithdrawals( specConfigElectra); } - /** - * Implements process_execution_layer_withdrawal_request from consensus-specs (EIP-7002 & - * EIP-7251). - */ + /** Implements process_withdrawal_request from consensus-specs (EIP-7002 & EIP-7251). */ @Override - public void processExecutionLayerWithdrawalRequests( + public void processWithdrawalRequests( final MutableBeaconState state, - final SszList withdrawalRequests, + final SszList withdrawalRequests, final Supplier validatorExitContextSupplier) { final UInt64 slot = state.getSlot(); final UInt64 currentEpoch = miscHelpers.computeEpochAtSlot(slot); LOG.debug( - "process_execution_layer_withdrawal_request: {} execution layer withdrawal request to process from block at " - + "slot {}", + "process_withdrawal_request: {} withdrawal request to process from block at " + "slot {}", withdrawalRequests.size(), slot); withdrawalRequests.forEach( withdrawalRequest -> { LOG.debug( - "process_execution_layer_withdrawal_request: processing execution layer withdrawal request {}", - withdrawalRequest); + "process_withdrawal_request: processing withdrawal request {}", withdrawalRequest); // If partial withdrawal queue is full, only full exits are processed final boolean isFullExitRequest = @@ -220,8 +213,7 @@ public void processExecutionLayerWithdrawalRequests( state.toVersionElectra().orElseThrow().getPendingPartialWithdrawals().size() >= specConfigElectra.getPendingPartialWithdrawalsLimit(); if (partialWithdrawalsQueueFull && !isFullExitRequest) { - LOG.debug( - "process_execution_layer_withdrawal_request: partial withdrawal queue is full"); + LOG.debug("process_withdrawal_request: partial withdrawal queue is full"); return; } @@ -229,7 +221,7 @@ public void processExecutionLayerWithdrawalRequests( validatorsUtil.getValidatorIndex(state, withdrawalRequest.getValidatorPublicKey()); if (maybeValidatorIndex.isEmpty()) { LOG.debug( - "process_execution_layer_withdrawal_request: no matching validator for public key {}", + "process_withdrawal_request: no matching validator for public key {}", withdrawalRequest.getValidatorPublicKey()); return; } @@ -242,8 +234,7 @@ public void processExecutionLayerWithdrawalRequests( predicatesElectra.hasExecutionWithdrawalCredential(validator); if (!hasExecutionAddress) { LOG.debug( - "process_execution_layer_withdrawal_request: validator index {} does not have execution withdrawal " - + "credentials set", + "process_withdrawal_request: validator index {} does not have withdrawal credentials set", validatorIndex); return; } @@ -256,7 +247,7 @@ public void processExecutionLayerWithdrawalRequests( validatorExecutionAddress.equals(withdrawalRequestSourceAddress); if (!isCorrectSourceAddress) { LOG.debug( - "process_execution_layer_withdrawal_request: WithdrawalRequest source_address {} does not match " + "process_withdrawal_request: WithdrawalRequest source_address {} does not match " + "validator {} withdrawal credentials {}", withdrawalRequestSourceAddress, validatorIndex, @@ -267,9 +258,7 @@ public void processExecutionLayerWithdrawalRequests( // Check if validator is active final boolean isValidatorActive = predicates.isActiveValidator(validator, currentEpoch); if (!isValidatorActive) { - LOG.debug( - "process_execution_layer_withdrawal_request: Validator {} is not active", - validatorIndex); + LOG.debug("process_withdrawal_request: Validator {} is not active", validatorIndex); return; } @@ -277,7 +266,7 @@ public void processExecutionLayerWithdrawalRequests( final boolean hasInitiatedExit = !validator.getExitEpoch().equals(FAR_FUTURE_EPOCH); if (hasInitiatedExit) { LOG.debug( - "process_execution_layer_withdrawal_request: Validator {} has already initiated exit", + "process_withdrawal_request: Validator {} has already initiated exit", validatorIndex); return; } @@ -288,7 +277,7 @@ public void processExecutionLayerWithdrawalRequests( validator.getActivationEpoch().plus(specConfig.getShardCommitteePeriod())); if (!validatorActiveLongEnough) { LOG.debug( - "process_execution_layer_withdrawal_request: Validator {} is not active long enough", + "process_withdrawal_request: Validator {} is not active long enough", validatorIndex); return; } @@ -299,8 +288,7 @@ public void processExecutionLayerWithdrawalRequests( // Only exit validator if it has no pending withdrawals in the queue if (pendingBalanceToWithdraw.isZero()) { LOG.debug( - "process_execution_layer_withdrawal_request: Initiating exit for validator {}", - validatorIndex); + "process_withdrawal_request: Initiating exit for validator {}", validatorIndex); beaconStateMutators.initiateValidatorExit( state, validatorIndex, validatorExitContextSupplier); @@ -333,7 +321,7 @@ public void processExecutionLayerWithdrawalRequests( exitQueueEpoch.plus(specConfigElectra.getMinValidatorWithdrawabilityDelay()); LOG.debug( - "process_execution_layer_withdrawal_request: Creating pending partial withdrawal for validator {}", + "process_withdrawal_request: Creating pending partial withdrawal for validator {}", validatorIndex); electraState @@ -349,7 +337,7 @@ public void processExecutionLayerWithdrawalRequests( }); } - private SszList getExecutionLayerWithdrawalRequestsFromBlock( + private SszList getWithdrawalRequestsFromBlock( final Optional maybeExecutionPayload) throws BlockProcessingException { return maybeExecutionPayload .flatMap(ExecutionPayload::toVersionElectra) @@ -357,7 +345,7 @@ private SszList getExecutionLayerWithdrawalRequ .orElseThrow( () -> new BlockProcessingException( - "Execution layer withdrawal requests were not found during block processing.")); + "Withdrawal requests were not found during block processing.")); } /* diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/schemas/SchemaDefinitionsElectra.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/schemas/SchemaDefinitionsElectra.java index 2009f537d53..64aad13e009 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/schemas/SchemaDefinitionsElectra.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/schemas/SchemaDefinitionsElectra.java @@ -46,10 +46,10 @@ 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.ExecutionPayloadHeaderSchemaElectra; import tech.pegasys.teku.spec.datastructures.execution.versions.electra.ExecutionPayloadSchemaElectra; +import tech.pegasys.teku.spec.datastructures.execution.versions.electra.WithdrawalRequest; +import tech.pegasys.teku.spec.datastructures.execution.versions.electra.WithdrawalRequestSchema; import tech.pegasys.teku.spec.datastructures.operations.AggregateAndProof.AggregateAndProofSchema; import tech.pegasys.teku.spec.datastructures.operations.AttestationSchema; import tech.pegasys.teku.spec.datastructures.operations.SignedAggregateAndProof.SignedAggregateAndProofSchema; @@ -90,7 +90,7 @@ public class SchemaDefinitionsElectra extends SchemaDefinitionsDeneb { private final DepositRequestSchema depositRequestSchema; - private final ExecutionLayerWithdrawalRequestSchema executionLayerWithdrawalRequestSchema; + private final WithdrawalRequestSchema withdrawalRequestSchema; private final ConsolidationRequestSchema consolidationRequestSchema; private final PendingBalanceDeposit.PendingBalanceDepositSchema pendingBalanceDepositSchema; @@ -159,7 +159,7 @@ public SchemaDefinitionsElectra(final SpecConfigElectra specConfig) { new ExecutionPayloadAndBlobsBundleSchema(executionPayloadSchemaElectra, blobsBundleSchema); this.depositRequestSchema = DepositRequest.SSZ_SCHEMA; - this.executionLayerWithdrawalRequestSchema = ExecutionLayerWithdrawalRequest.SSZ_SCHEMA; + this.withdrawalRequestSchema = WithdrawalRequest.SSZ_SCHEMA; this.consolidationRequestSchema = ConsolidationRequest.SSZ_SCHEMA; this.pendingBalanceDepositSchema = new PendingBalanceDeposit.PendingBalanceDepositSchema(); this.pendingPartialWithdrawalSchema = @@ -305,8 +305,8 @@ public DepositRequestSchema getDepositRequestSchema() { return depositRequestSchema; } - public ExecutionLayerWithdrawalRequestSchema getExecutionLayerWithdrawalRequestSchema() { - return executionLayerWithdrawalRequestSchema; + public WithdrawalRequestSchema getWithdrawalRequestSchema() { + return withdrawalRequestSchema; } public PendingBalanceDeposit.PendingBalanceDepositSchema getPendingBalanceDepositSchema() { diff --git a/ethereum/spec/src/property-test/java/tech/pegasys/teku/spec/datastructures/execution/versions/electra/ExecutionLayerWithdrawalRequestPropertyTest.java b/ethereum/spec/src/property-test/java/tech/pegasys/teku/spec/datastructures/execution/versions/electra/WithdrawalRequestPropertyTest.java similarity index 68% rename from ethereum/spec/src/property-test/java/tech/pegasys/teku/spec/datastructures/execution/versions/electra/ExecutionLayerWithdrawalRequestPropertyTest.java rename to ethereum/spec/src/property-test/java/tech/pegasys/teku/spec/datastructures/execution/versions/electra/WithdrawalRequestPropertyTest.java index ae7ecf3be2d..137fe7243ec 100644 --- a/ethereum/spec/src/property-test/java/tech/pegasys/teku/spec/datastructures/execution/versions/electra/ExecutionLayerWithdrawalRequestPropertyTest.java +++ b/ethereum/spec/src/property-test/java/tech/pegasys/teku/spec/datastructures/execution/versions/electra/WithdrawalRequestPropertyTest.java @@ -19,23 +19,21 @@ import com.fasterxml.jackson.core.JsonProcessingException; import net.jqwik.api.ForAll; import net.jqwik.api.Property; -import tech.pegasys.teku.spec.propertytest.suppliers.execution.versions.electra.ExecutionLayerWithdrawalRequestSupplier; +import tech.pegasys.teku.spec.propertytest.suppliers.execution.versions.electra.WithdrawalRequestSupplier; -public class ExecutionLayerWithdrawalRequestPropertyTest { +public class WithdrawalRequestPropertyTest { @Property void roundTrip( - @ForAll(supplier = ExecutionLayerWithdrawalRequestSupplier.class) - final ExecutionLayerWithdrawalRequest executionLayerWithdrawalRequest) + @ForAll(supplier = WithdrawalRequestSupplier.class) final WithdrawalRequest withdrawalRequest) throws JsonProcessingException { - assertRoundTrip(executionLayerWithdrawalRequest); + assertRoundTrip(withdrawalRequest); } @Property void deserializeMutated( - @ForAll(supplier = ExecutionLayerWithdrawalRequestSupplier.class) - final ExecutionLayerWithdrawalRequest executionLayerWithdrawalRequest, + @ForAll(supplier = WithdrawalRequestSupplier.class) final WithdrawalRequest withdrawalRequest, @ForAll final int seed) { - assertDeserializeMutatedThrowsExpected(executionLayerWithdrawalRequest, seed); + assertDeserializeMutatedThrowsExpected(withdrawalRequest, seed); } } diff --git a/ethereum/spec/src/test/java/tech/pegasys/teku/spec/datastructures/operations/ExecutionLayerWithdrawalRequestTest.java b/ethereum/spec/src/test/java/tech/pegasys/teku/spec/datastructures/operations/WithdrawalRequestTest.java similarity index 52% rename from ethereum/spec/src/test/java/tech/pegasys/teku/spec/datastructures/operations/ExecutionLayerWithdrawalRequestTest.java rename to ethereum/spec/src/test/java/tech/pegasys/teku/spec/datastructures/operations/WithdrawalRequestTest.java index 50b8457e92a..4efda405578 100644 --- a/ethereum/spec/src/test/java/tech/pegasys/teku/spec/datastructures/operations/ExecutionLayerWithdrawalRequestTest.java +++ b/ethereum/spec/src/test/java/tech/pegasys/teku/spec/datastructures/operations/WithdrawalRequestTest.java @@ -22,48 +22,45 @@ import tech.pegasys.teku.infrastructure.unsigned.UInt64; import tech.pegasys.teku.spec.SpecMilestone; import tech.pegasys.teku.spec.TestSpecFactory; -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; import tech.pegasys.teku.spec.util.DataStructureUtil; -class ExecutionLayerWithdrawalRequestTest { +class WithdrawalRequestTest { private final DataStructureUtil dataStructureUtil = new DataStructureUtil(TestSpecFactory.createMinimal(SpecMilestone.ELECTRA)); - private final ExecutionLayerWithdrawalRequestSchema executionLayerWithdrawalRequestSchema = - new ExecutionLayerWithdrawalRequestSchema(); + private final WithdrawalRequestSchema withdrawalRequestSchema = new WithdrawalRequestSchema(); private final Bytes20 sourceAddress = dataStructureUtil.randomBytes20(); private final BLSPublicKey validatorPublicKey = dataStructureUtil.randomPublicKey(); private final UInt64 amount = dataStructureUtil.randomUInt64(); @Test public void objectEquality() { - final ExecutionLayerWithdrawalRequest executionLayerWithdrawalRequest1 = - executionLayerWithdrawalRequestSchema.create(sourceAddress, validatorPublicKey, amount); - final ExecutionLayerWithdrawalRequest executionLayerWithdrawalRequest2 = - executionLayerWithdrawalRequestSchema.create(sourceAddress, validatorPublicKey, amount); + final WithdrawalRequest withdrawalRequest1 = + withdrawalRequestSchema.create(sourceAddress, validatorPublicKey, amount); + final WithdrawalRequest withdrawalRequest2 = + withdrawalRequestSchema.create(sourceAddress, validatorPublicKey, amount); - assertThat(executionLayerWithdrawalRequest1).isEqualTo(executionLayerWithdrawalRequest2); + assertThat(withdrawalRequest1).isEqualTo(withdrawalRequest2); } @Test public void objectAccessorMethods() { - final ExecutionLayerWithdrawalRequest executionLayerWithdrawalRequest = - executionLayerWithdrawalRequestSchema.create(sourceAddress, validatorPublicKey, amount); + final WithdrawalRequest withdrawalRequest = + withdrawalRequestSchema.create(sourceAddress, validatorPublicKey, amount); - assertThat(executionLayerWithdrawalRequest.getSourceAddress()).isEqualTo(sourceAddress); - assertThat(executionLayerWithdrawalRequest.getValidatorPublicKey()) - .isEqualTo(validatorPublicKey); + assertThat(withdrawalRequest.getSourceAddress()).isEqualTo(sourceAddress); + assertThat(withdrawalRequest.getValidatorPublicKey()).isEqualTo(validatorPublicKey); } @Test public void roundTripSSZ() { - final ExecutionLayerWithdrawalRequest executionLayerWithdrawalRequest = - executionLayerWithdrawalRequestSchema.create(sourceAddress, validatorPublicKey, amount); + final WithdrawalRequest withdrawalRequest = + withdrawalRequestSchema.create(sourceAddress, validatorPublicKey, amount); - final Bytes sszBytes = executionLayerWithdrawalRequest.sszSerialize(); - final ExecutionLayerWithdrawalRequest deserializedObject = - executionLayerWithdrawalRequestSchema.sszDeserialize(sszBytes); + final Bytes sszBytes = withdrawalRequest.sszSerialize(); + final WithdrawalRequest deserializedObject = withdrawalRequestSchema.sszDeserialize(sszBytes); - assertThat(executionLayerWithdrawalRequest).isEqualTo(deserializedObject); + assertThat(withdrawalRequest).isEqualTo(deserializedObject); } } diff --git a/ethereum/spec/src/test/java/tech/pegasys/teku/spec/logic/versions/electra/block/BlockProcessorElectraTest.java b/ethereum/spec/src/test/java/tech/pegasys/teku/spec/logic/versions/electra/block/BlockProcessorElectraTest.java index 97579349433..9700281b330 100644 --- a/ethereum/spec/src/test/java/tech/pegasys/teku/spec/logic/versions/electra/block/BlockProcessorElectraTest.java +++ b/ethereum/spec/src/test/java/tech/pegasys/teku/spec/logic/versions/electra/block/BlockProcessorElectraTest.java @@ -37,7 +37,7 @@ import tech.pegasys.teku.spec.datastructures.blocks.blockbody.BeaconBlockBody; 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.DepositData; import tech.pegasys.teku.spec.datastructures.state.Validator; import tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconState; @@ -155,7 +155,7 @@ public void processesDepositRequests() throws BlockProcessingException { } @Test - public void processExecutionLayerWithdrawalRequests_WithEmptyWithdrawalRequestsList_DoesNothing() + public void processWithdrawalRequests_WithEmptyWithdrawalRequestsList_DoesNothing() throws BlockProcessingException { final BeaconStateElectra preState = BeaconStateElectra.required(createBeaconState()); @@ -167,7 +167,7 @@ public void processExecutionLayerWithdrawalRequests_WithEmptyWithdrawalRequestsL preState.updated( mutableState -> getBlockProcessor(preState) - .processExecutionLayerWithdrawalRequests( + .processWithdrawalRequests( mutableState, executionPayloadWithWithdrawalRequests, validatorExitContextSupplier(preState)))); @@ -176,23 +176,20 @@ public void processExecutionLayerWithdrawalRequests_WithEmptyWithdrawalRequestsL } @Test - public void processExecutionLayerWithdrawalRequests_ExitForAbsentValidator_DoesNothing() + public void processWithdrawalRequests_ExitForAbsentValidator_DoesNothing() throws BlockProcessingException { final BeaconStateElectra preState = BeaconStateElectra.required(createBeaconState()); - final ExecutionLayerWithdrawalRequest executionLayerWithdrawalRequest = - dataStructureUtil.randomExecutionLayerWithdrawalRequest(); + final WithdrawalRequest withdrawalRequest = dataStructureUtil.randomWithdrawalRequest(); final Optional executionPayloadWithWithdrawalRequests = createExecutionPayloadWithWithdrawalRequests( - preState.getSlot(), List.of(executionLayerWithdrawalRequest)); + preState.getSlot(), List.of(withdrawalRequest)); // Assert the request does not correspond to an existing validator assertThat( preState.getValidators().stream() .filter( validator -> - validator - .getPublicKey() - .equals(executionLayerWithdrawalRequest.getValidatorPublicKey()))) + validator.getPublicKey().equals(withdrawalRequest.getValidatorPublicKey()))) .isEmpty(); final BeaconStateElectra postState = @@ -200,7 +197,7 @@ public void processExecutionLayerWithdrawalRequests_ExitForAbsentValidator_DoesN preState.updated( mutableState -> getBlockProcessor(preState) - .processExecutionLayerWithdrawalRequests( + .processWithdrawalRequests( mutableState, executionPayloadWithWithdrawalRequests, validatorExitContextSupplier(preState)))); @@ -210,7 +207,7 @@ public void processExecutionLayerWithdrawalRequests_ExitForAbsentValidator_DoesN @Test public void - processExecutionLayerWithdrawalRequests_WithdrawalRequestForValidatorWithoutEth1Credentials_DoesNothing() + processWithdrawalRequests_WithdrawalRequestForValidatorWithoutEth1Credentials_DoesNothing() throws BlockProcessingException { final Validator validator = dataStructureUtil.validatorBuilder().withRandomBlsWithdrawalCredentials().build(); @@ -227,15 +224,14 @@ public void processExecutionLayerWithdrawalRequests_ExitForAbsentValidator_DoesN final Optional executionPayloadWithExits = createExecutionPayloadWithWithdrawalRequests( - preState.getSlot(), - List.of(dataStructureUtil.executionLayerWithdrawalRequest(validator))); + preState.getSlot(), List.of(dataStructureUtil.withdrawalRequest(validator))); final BeaconStateElectra postState = BeaconStateElectra.required( preState.updated( mutableState -> getBlockProcessor(preState) - .processExecutionLayerWithdrawalRequests( + .processWithdrawalRequests( mutableState, executionPayloadWithExits, validatorExitContextSupplier(preState)))); @@ -244,9 +240,8 @@ public void processExecutionLayerWithdrawalRequests_ExitForAbsentValidator_DoesN } @Test - public void - processExecutionLayerWithdrawalRequests_WithdrawalRequestWithWrongSourceAddress_DoesNothing() - throws BlockProcessingException { + public void processWithdrawalRequests_WithdrawalRequestWithWrongSourceAddress_DoesNothing() + throws BlockProcessingException { final Validator validator = dataStructureUtil.validatorBuilder().withRandomEth1WithdrawalCredentials().build(); @@ -260,8 +255,8 @@ public void processExecutionLayerWithdrawalRequests_ExitForAbsentValidator_DoesN mutableState.setValidators(validators); })); - final ExecutionLayerWithdrawalRequest withdrawalRequestWithInvalidSourceAddress = - dataStructureUtil.executionLayerWithdrawalRequest( + final WithdrawalRequest withdrawalRequestWithInvalidSourceAddress = + dataStructureUtil.withdrawalRequest( dataStructureUtil.randomEth1Address(), validator.getPublicKey(), UInt64.ZERO); final Optional executionPayloadWithWithdrawalRequests = createExecutionPayloadWithWithdrawalRequests( @@ -272,7 +267,7 @@ public void processExecutionLayerWithdrawalRequests_ExitForAbsentValidator_DoesN preState.updated( mutableState -> getBlockProcessor(preState) - .processExecutionLayerWithdrawalRequests( + .processWithdrawalRequests( mutableState, executionPayloadWithWithdrawalRequests, validatorExitContextSupplier(preState)))); @@ -281,9 +276,8 @@ public void processExecutionLayerWithdrawalRequests_ExitForAbsentValidator_DoesN } @Test - public void - processExecutionLayerWithdrawalRequests_WithdrawalRequestForInactiveValidator_DoesNothing() - throws BlockProcessingException { + public void processWithdrawalRequests_WithdrawalRequestForInactiveValidator_DoesNothing() + throws BlockProcessingException { final Validator validator = dataStructureUtil .validatorBuilder() @@ -303,14 +297,13 @@ public void processExecutionLayerWithdrawalRequests_ExitForAbsentValidator_DoesN final Optional executionPayloadWithExits = createExecutionPayloadWithWithdrawalRequests( - preState.getSlot(), - List.of(dataStructureUtil.executionLayerWithdrawalRequest(validator))); + preState.getSlot(), List.of(dataStructureUtil.withdrawalRequest(validator))); final BeaconStateElectra postState = BeaconStateElectra.required( preState.updated( mutableState -> getBlockProcessor(preState) - .processExecutionLayerWithdrawalRequests( + .processWithdrawalRequests( mutableState, executionPayloadWithExits, validatorExitContextSupplier(preState)))); @@ -319,9 +312,8 @@ public void processExecutionLayerWithdrawalRequests_ExitForAbsentValidator_DoesN } @Test - public void - processExecutionLayerWithdrawalRequests_WithdrawalRequestForValidatorAlreadyExiting_DoesNothing() - throws BlockProcessingException { + public void processWithdrawalRequests_WithdrawalRequestForValidatorAlreadyExiting_DoesNothing() + throws BlockProcessingException { final UInt64 currentEpoch = UInt64.valueOf(1_000); final Validator validator = dataStructureUtil @@ -344,14 +336,13 @@ public void processExecutionLayerWithdrawalRequests_ExitForAbsentValidator_DoesN final Optional executionPayloadWithExits = createExecutionPayloadWithWithdrawalRequests( - preState.getSlot(), - List.of(dataStructureUtil.executionLayerWithdrawalRequest(validator))); + preState.getSlot(), List.of(dataStructureUtil.withdrawalRequest(validator))); final BeaconStateElectra postState = BeaconStateElectra.required( preState.updated( mutableState -> getBlockProcessor(preState) - .processExecutionLayerWithdrawalRequests( + .processWithdrawalRequests( mutableState, executionPayloadWithExits, validatorExitContextSupplier(preState)))); @@ -360,9 +351,8 @@ public void processExecutionLayerWithdrawalRequests_ExitForAbsentValidator_DoesN } @Test - public void - processExecutionLayerWithdrawalRequests_ExitForValidatorNotActiveLongEnough_DoesNothing() - throws BlockProcessingException { + public void processWithdrawalRequests_ExitForValidatorNotActiveLongEnough_DoesNothing() + throws BlockProcessingException { final UInt64 currentEpoch = UInt64.valueOf(1_000); final Validator validator = dataStructureUtil @@ -385,15 +375,14 @@ public void processExecutionLayerWithdrawalRequests_ExitForAbsentValidator_DoesN final Optional executionPayloadWithExits = createExecutionPayloadWithWithdrawalRequests( - preState.getSlot(), - List.of(dataStructureUtil.executionLayerWithdrawalRequest(validator))); + preState.getSlot(), List.of(dataStructureUtil.withdrawalRequest(validator))); final BeaconStateElectra postState = BeaconStateElectra.required( preState.updated( mutableState -> getBlockProcessor(preState) - .processExecutionLayerWithdrawalRequests( + .processWithdrawalRequests( mutableState, executionPayloadWithExits, validatorExitContextSupplier(preState)))); @@ -402,8 +391,7 @@ public void processExecutionLayerWithdrawalRequests_ExitForAbsentValidator_DoesN } @Test - public void processExecutionLayerWithdrawalRequests_ExitForEligibleValidator() - throws BlockProcessingException { + public void processWithdrawalRequests_ExitForEligibleValidator() throws BlockProcessingException { final UInt64 currentEpoch = UInt64.valueOf(1_000); final Validator validator = dataStructureUtil @@ -436,16 +424,14 @@ public void processExecutionLayerWithdrawalRequests_ExitForEligibleValidator() final Optional executionPayloadWithExits = createExecutionPayloadWithWithdrawalRequests( preState.getSlot(), - List.of( - dataStructureUtil.executionLayerWithdrawalRequest( - validator, FULL_EXIT_REQUEST_AMOUNT))); + List.of(dataStructureUtil.withdrawalRequest(validator, FULL_EXIT_REQUEST_AMOUNT))); final BeaconStateElectra postState = BeaconStateElectra.required( preState.updated( mutableState -> getBlockProcessor(preState) - .processExecutionLayerWithdrawalRequests( + .processWithdrawalRequests( mutableState, executionPayloadWithExits, validatorExitContextSupplier(preState)))); @@ -496,7 +482,7 @@ public void processDepositTopsUpValidatorBalanceWhenPubkeyIsFoundInRegistry() } @Test - public void processExecutionLayerWithdrawalRequests_PartialWithdrawalRequestForEligibleValidator() + public void processWithdrawalRequests_PartialWithdrawalRequestForEligibleValidator() throws BlockProcessingException { final UInt64 currentEpoch = UInt64.valueOf(1_000); final Validator validator = @@ -550,19 +536,18 @@ public void processExecutionLayerWithdrawalRequests_PartialWithdrawalRequestForE .minus(specConfigElectra.getMinActivationBalance()); assertThat(amount).isEqualTo(UInt64.valueOf(123_456_789)); - final Optional processExecutionLayerWithdrawalRequests = + final Optional processWithdrawalRequests = createExecutionPayloadWithWithdrawalRequests( - preState.getSlot(), - List.of(dataStructureUtil.executionLayerWithdrawalRequest(validator, amount))); + preState.getSlot(), List.of(dataStructureUtil.withdrawalRequest(validator, amount))); final BeaconStateElectra postState = BeaconStateElectra.required( preState.updated( mutableState -> getBlockProcessor(preState) - .processExecutionLayerWithdrawalRequests( + .processWithdrawalRequests( mutableState, - processExecutionLayerWithdrawalRequests, + processWithdrawalRequests, validatorExitContextSupplier(preState)))); // After processing the request, the validator hasn't updated these @@ -596,7 +581,7 @@ private Supplier validatorExitContextSupplier(final Beacon } private Optional createExecutionPayloadWithWithdrawalRequests( - final UInt64 slot, final List withdrawalRequests) { + final UInt64 slot, final List withdrawalRequests) { return Optional.of( dataStructureUtil.randomExecutionPayload( slot, builder -> builder.withdrawalRequests(() -> withdrawalRequests))); diff --git a/ethereum/spec/src/testFixtures/java/tech/pegasys/teku/spec/propertytest/suppliers/execution/versions/electra/ExecutionLayerWithdrawalRequestSupplier.java b/ethereum/spec/src/testFixtures/java/tech/pegasys/teku/spec/propertytest/suppliers/execution/versions/electra/WithdrawalRequestSupplier.java similarity index 74% rename from ethereum/spec/src/testFixtures/java/tech/pegasys/teku/spec/propertytest/suppliers/execution/versions/electra/ExecutionLayerWithdrawalRequestSupplier.java rename to ethereum/spec/src/testFixtures/java/tech/pegasys/teku/spec/propertytest/suppliers/execution/versions/electra/WithdrawalRequestSupplier.java index b9962cf94ef..a29f8addf16 100644 --- a/ethereum/spec/src/testFixtures/java/tech/pegasys/teku/spec/propertytest/suppliers/execution/versions/electra/ExecutionLayerWithdrawalRequestSupplier.java +++ b/ethereum/spec/src/testFixtures/java/tech/pegasys/teku/spec/propertytest/suppliers/execution/versions/electra/WithdrawalRequestSupplier.java @@ -14,14 +14,13 @@ package tech.pegasys.teku.spec.propertytest.suppliers.execution.versions.electra; import tech.pegasys.teku.spec.SpecMilestone; -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.propertytest.suppliers.DataStructureUtilSupplier; import tech.pegasys.teku.spec.util.DataStructureUtil; -public class ExecutionLayerWithdrawalRequestSupplier - extends DataStructureUtilSupplier { +public class WithdrawalRequestSupplier extends DataStructureUtilSupplier { - public ExecutionLayerWithdrawalRequestSupplier() { - super(DataStructureUtil::randomExecutionLayerWithdrawalRequest, SpecMilestone.ELECTRA); + public WithdrawalRequestSupplier() { + super(DataStructureUtil::randomWithdrawalRequest, SpecMilestone.ELECTRA); } } diff --git a/ethereum/spec/src/testFixtures/java/tech/pegasys/teku/spec/util/DataStructureUtil.java b/ethereum/spec/src/testFixtures/java/tech/pegasys/teku/spec/util/DataStructureUtil.java index eab6fc71292..88c47d0879d 100644 --- a/ethereum/spec/src/testFixtures/java/tech/pegasys/teku/spec/util/DataStructureUtil.java +++ b/ethereum/spec/src/testFixtures/java/tech/pegasys/teku/spec/util/DataStructureUtil.java @@ -130,7 +130,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; import tech.pegasys.teku.spec.datastructures.forkchoice.VoteTracker; import tech.pegasys.teku.spec.datastructures.lightclient.LightClientBootstrap; import tech.pegasys.teku.spec.datastructures.lightclient.LightClientBootstrapSchema; @@ -698,7 +698,7 @@ public ExecutionPayload randomExecutionPayload( .blobGasUsed(this::randomUInt64) .excessBlobGas(this::randomUInt64) .depositRequests(this::randomExecutionPayloadDepositRequests) - .withdrawalRequests(this::randomExecutionLayerWithdrawalRequests) + .withdrawalRequests(this::randomWithdrawalRequests) .consolidationRequests(this::randomConsolidationRequests); builderModifier.accept(executionPayloadBuilder); }); @@ -730,9 +730,9 @@ public List randomExecutionPayloadDepositRequests() { .collect(toList()); } - public List randomExecutionLayerWithdrawalRequests() { + public List randomWithdrawalRequests() { return IntStream.rangeClosed(0, randomInt(MAX_EP_RANDOM_WITHDRAWAL_REQUESTS)) - .mapToObj(__ -> randomExecutionLayerWithdrawalRequest()) + .mapToObj(__ -> randomWithdrawalRequest()) .collect(toList()); } @@ -2500,32 +2500,30 @@ public SszList emptyBlobKzgCommitments() { return getBlobKzgCommitmentsSchema().of(); } - public ExecutionLayerWithdrawalRequest randomExecutionLayerWithdrawalRequest() { + public WithdrawalRequest randomWithdrawalRequest() { return getElectraSchemaDefinitions(randomSlot()) - .getExecutionLayerWithdrawalRequestSchema() + .getWithdrawalRequestSchema() .create(randomEth1Address(), randomPublicKey(), randomUInt64()); } - public ExecutionLayerWithdrawalRequest executionLayerWithdrawalRequest( + public WithdrawalRequest withdrawalRequest( final Bytes20 sourceAddress, final BLSPublicKey validatorPubKey, final UInt64 amount) { return getElectraSchemaDefinitions(randomSlot()) - .getExecutionLayerWithdrawalRequestSchema() + .getWithdrawalRequestSchema() .create(sourceAddress, validatorPubKey, amount); } - public ExecutionLayerWithdrawalRequest executionLayerWithdrawalRequest( - final Validator validator) { + public WithdrawalRequest withdrawalRequest(final Validator validator) { final Bytes20 executionAddress = new Bytes20(validator.getWithdrawalCredentials().slice(12)); return getElectraSchemaDefinitions(randomSlot()) - .getExecutionLayerWithdrawalRequestSchema() + .getWithdrawalRequestSchema() .create(executionAddress, validator.getPublicKey(), randomUInt64()); } - public ExecutionLayerWithdrawalRequest executionLayerWithdrawalRequest( - final Validator validator, final UInt64 amount) { + public WithdrawalRequest withdrawalRequest(final Validator validator, final UInt64 amount) { final Bytes20 executionAddress = new Bytes20(validator.getWithdrawalCredentials().slice(12)); return getElectraSchemaDefinitions(randomSlot()) - .getExecutionLayerWithdrawalRequestSchema() + .getWithdrawalRequestSchema() .create(executionAddress, validator.getPublicKey(), amount); }