diff --git a/beacon/validator/src/main/java/tech/pegasys/teku/validator/coordinator/BlockOperationSelectorFactory.java b/beacon/validator/src/main/java/tech/pegasys/teku/validator/coordinator/BlockOperationSelectorFactory.java index 5321e6ec167..8edc09340f0 100644 --- a/beacon/validator/src/main/java/tech/pegasys/teku/validator/coordinator/BlockOperationSelectorFactory.java +++ b/beacon/validator/src/main/java/tech/pegasys/teku/validator/coordinator/BlockOperationSelectorFactory.java @@ -64,6 +64,7 @@ import tech.pegasys.teku.spec.schemas.SchemaDefinitions; import tech.pegasys.teku.spec.schemas.SchemaDefinitionsBellatrix; import tech.pegasys.teku.spec.schemas.SchemaDefinitionsDeneb; +import tech.pegasys.teku.spec.schemas.SchemaDefinitionsEip7732; import tech.pegasys.teku.statetransition.OperationPool; import tech.pegasys.teku.statetransition.attestation.AggregatingAttestationPool; import tech.pegasys.teku.statetransition.attestation.AttestationForkChecker; @@ -236,7 +237,18 @@ private SafeFuture setExecutionData( // pre-Merge Execution Payload / Execution Payload Header if (executionPayloadContext.isEmpty()) { - bodyBuilder.executionPayload(schemaDefinitions.getExecutionPayloadSchema().getDefault()); + if (bodyBuilder.supportsSignedExecutionPayloadHeader()) { + // ePBS + final ExecutionPayloadHeader header = + schemaDefinitions.getExecutionPayloadHeaderSchema().getHeaderOfDefaultPayload(); + final SignedExecutionPayloadHeader bid = + SchemaDefinitionsEip7732.required(schemaDefinitions) + .getSignedExecutionPayloadHeaderSchema() + .create(header, BLSSignature.empty()); + bodyBuilder.signedExecutionPayloadHeader(bid); + } else { + bodyBuilder.executionPayload(schemaDefinitions.getExecutionPayloadSchema().getDefault()); + } return SafeFuture.COMPLETE; } diff --git a/data/provider/src/main/java/tech/pegasys/teku/api/blobselector/BlobSidecarSelectorFactory.java b/data/provider/src/main/java/tech/pegasys/teku/api/blobselector/BlobSidecarSelectorFactory.java index 1263ae75c0b..a39474070e9 100644 --- a/data/provider/src/main/java/tech/pegasys/teku/api/blobselector/BlobSidecarSelectorFactory.java +++ b/data/provider/src/main/java/tech/pegasys/teku/api/blobselector/BlobSidecarSelectorFactory.java @@ -21,13 +21,13 @@ import org.apache.tuweni.bytes.Bytes32; import tech.pegasys.teku.api.AbstractSelectorFactory; import tech.pegasys.teku.infrastructure.async.SafeFuture; +import tech.pegasys.teku.infrastructure.ssz.SszList; import tech.pegasys.teku.infrastructure.unsigned.UInt64; import tech.pegasys.teku.spec.Spec; import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.BlobSidecar; import tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock; import tech.pegasys.teku.spec.datastructures.blocks.SlotAndBlockRoot; import tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.deneb.BeaconBlockBodyDeneb; -import tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.eip7732.BeaconBlockBodyEip7732; import tech.pegasys.teku.spec.datastructures.metadata.BlobSidecarsAndMetaData; import tech.pegasys.teku.storage.client.ChainHead; import tech.pegasys.teku.storage.client.CombinedChainDataClient; @@ -170,10 +170,8 @@ private SafeFuture>> getBlobSidecarsForBlock( if (maybeDenebBlock.isEmpty()) { return SafeFuture.completedFuture(Optional.empty()); } - final Optional maybeEip7732Block = - maybeBlock.get().getMessage().getBody().toVersionEip7732(); // no blob kzg commitments in EIP-7732 blocks - if (maybeEip7732Block.isEmpty() && maybeDenebBlock.get().getBlobKzgCommitments().isEmpty()) { + if (maybeDenebBlock.get().getOptionalBlobKzgCommitments().map(SszList::isEmpty).orElse(true)) { return SafeFuture.completedFuture(Optional.of(Collections.emptyList())); } final SignedBeaconBlock block = maybeBlock.get(); diff --git a/data/serializer/src/property-test/java/tech/pegasys/teku/provider/JsonProviderPropertyTest.java b/data/serializer/src/property-test/java/tech/pegasys/teku/provider/JsonProviderPropertyTest.java index 287565f5dba..6772dd985ce 100644 --- a/data/serializer/src/property-test/java/tech/pegasys/teku/provider/JsonProviderPropertyTest.java +++ b/data/serializer/src/property-test/java/tech/pegasys/teku/provider/JsonProviderPropertyTest.java @@ -58,6 +58,8 @@ import tech.pegasys.teku.api.schema.capella.SignedBeaconBlockCapella; import tech.pegasys.teku.api.schema.deneb.BeaconStateDeneb; import tech.pegasys.teku.api.schema.deneb.SignedBeaconBlockDeneb; +import tech.pegasys.teku.api.schema.eip7732.BeaconStateEip7732; +import tech.pegasys.teku.api.schema.eip7732.SignedBeaconBlockEip7732; import tech.pegasys.teku.api.schema.electra.BeaconStateElectra; import tech.pegasys.teku.api.schema.electra.SignedBeaconBlockElectra; import tech.pegasys.teku.api.schema.phase0.BeaconStatePhase0; @@ -92,7 +94,9 @@ public class JsonProviderPropertyTest { SpecMilestone.DENEB, SignedBeaconBlockDeneb.class, SpecMilestone.ELECTRA, - SignedBeaconBlockElectra.class); + SignedBeaconBlockElectra.class, + SpecMilestone.EIP7732, + SignedBeaconBlockEip7732.class); private static final Map> BEACON_STATE_CLASS_MAP = Map.of( @@ -107,7 +111,9 @@ public class JsonProviderPropertyTest { SpecMilestone.DENEB, BeaconStateDeneb.class, SpecMilestone.ELECTRA, - BeaconStateElectra.class); + BeaconStateElectra.class, + SpecMilestone.EIP7732, + BeaconStateEip7732.class); @Property void roundTripBytes32(@ForAll @Size(32) final byte[] value) throws JsonProcessingException { diff --git a/ethereum/spec/src/main/resources/tech/pegasys/teku/spec/config/presets/gnosis/eip7732.yaml b/ethereum/spec/src/main/resources/tech/pegasys/teku/spec/config/presets/gnosis/eip7732.yaml new file mode 100644 index 00000000000..a8c03bc49d1 --- /dev/null +++ b/ethereum/spec/src/main/resources/tech/pegasys/teku/spec/config/presets/gnosis/eip7732.yaml @@ -0,0 +1,9 @@ +# Gnosis preset - EIP7732 + +# Execution +# --------------------------------------------------------------- +# 2**9 (= 512) +PTC_SIZE: 512 +# 2**2 (= 4) +MAX_PAYLOAD_ATTESTATIONS: 4 +KZG_COMMITMENT_INCLUSION_PROOF_DEPTH_EIP7732: 13 \ No newline at end of file diff --git a/ethereum/spec/src/main/resources/tech/pegasys/teku/spec/config/presets/gnosis/electra.yaml b/ethereum/spec/src/main/resources/tech/pegasys/teku/spec/config/presets/gnosis/electra.yaml new file mode 100644 index 00000000000..13ec312c9c0 --- /dev/null +++ b/ethereum/spec/src/main/resources/tech/pegasys/teku/spec/config/presets/gnosis/electra.yaml @@ -0,0 +1,45 @@ +# Gnosis preset - Electra + +# Gwei values +# --------------------------------------------------------------- +# 2**5 * 10**9 (= 32,000,000,000) Gwei +MIN_ACTIVATION_BALANCE: 32000000000 +# 2**11 * 10**9 (= 2,048,000,000,000) Gwei +MAX_EFFECTIVE_BALANCE_ELECTRA: 2048000000000 + +# State list lengths +# --------------------------------------------------------------- +# `uint64(2**27)` (= 134,217,728) +PENDING_BALANCE_DEPOSITS_LIMIT: 134217728 +# `uint64(2**27)` (= 134,217,728) +PENDING_PARTIAL_WITHDRAWALS_LIMIT: 134217728 +# `uint64(2**18)` (= 262,144) +PENDING_CONSOLIDATIONS_LIMIT: 262144 + +# Reward and penalty quotients +# --------------------------------------------------------------- +# `uint64(2**12)` (= 4,096) +MIN_SLASHING_PENALTY_QUOTIENT_ELECTRA: 4096 +# `uint64(2**12)` (= 4,096) +WHISTLEBLOWER_REWARD_QUOTIENT_ELECTRA: 4096 + +# # Max operations per block +# --------------------------------------------------------------- +# `uint64(2**0)` (= 1) +MAX_ATTESTER_SLASHINGS_ELECTRA: 1 +# `uint64(2**3)` (= 8) +MAX_ATTESTATIONS_ELECTRA: 8 +# `uint64(2**0)` (= 1) +MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD: 1 + +# Execution +# --------------------------------------------------------------- +# 2**13 (= 8192) receipts +MAX_DEPOSIT_REQUESTS_PER_PAYLOAD: 8192 +# 2**4 (= 16) withdrawal requests +MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD: 16 + +# Withdrawals processing +# --------------------------------------------------------------- +# 2**3 ( = 8) pending withdrawals +MAX_PENDING_PARTIALS_PER_WITHDRAWALS_SWEEP: 8 \ No newline at end of file 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 47a52346234..1771999dcd3 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 @@ -2504,9 +2504,16 @@ public BlobSidecar build() { } public List randomKzgCommitmentInclusionProof() { - final int depth = - SpecConfigDeneb.required(spec.forMilestone(SpecMilestone.DENEB).getConfig()) - .getKzgCommitmentInclusionProofDepth(); + final int depth; + if (spec.getGenesisSpec().getMilestone().isGreaterThanOrEqualTo(SpecMilestone.EIP7732)) { + depth = + SpecConfigEip7732.required(spec.forMilestone(SpecMilestone.EIP7732).getConfig()) + .getKzgCommitmentInclusionProofDepthEip7732(); + } else { + depth = + SpecConfigDeneb.required(spec.forMilestone(SpecMilestone.DENEB).getConfig()) + .getKzgCommitmentInclusionProofDepth(); + } return IntStream.range(0, depth).mapToObj(__ -> randomBytes32()).toList(); }