From 48a76a5afab3532b3fb33da8dc77d585f029d645 Mon Sep 17 00:00:00 2001 From: Enrico Del Fante Date: Tue, 22 Oct 2024 15:27:04 +0200 Subject: [PATCH 1/3] tmp --- .../spec/schemas/SchemaDefinitionsAltair.java | 4 +-- .../registry/SchemaRegistryBuilder.java | 25 +++++++++++++++++-- .../spec/schemas/registry/SchemaTypes.java | 7 ++++++ 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/schemas/SchemaDefinitionsAltair.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/schemas/SchemaDefinitionsAltair.java index 8e932b11a93..5cd8c89843d 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/schemas/SchemaDefinitionsAltair.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/schemas/SchemaDefinitionsAltair.java @@ -75,9 +75,7 @@ public SchemaDefinitionsAltair(final SchemaRegistry schemaRegistry) { final SpecConfigAltair specConfig = SpecConfigAltair.required(schemaRegistry.getSpecConfig()); this.indexedAttestationSchema = schemaRegistry.get(SchemaTypes.INDEXED_ATTESTATION_SCHEMA); this.attesterSlashingSchema = schemaRegistry.get(SchemaTypes.ATTESTER_SLASHING_SCHEMA); - this.attestationSchema = - new AttestationPhase0Schema(getMaxValidatorPerAttestation(specConfig)) - .castTypeToAttestationSchema(); + this.attestationSchema = schemaRegistry.get(SchemaTypes.ATTESTATION_SCHEMA); this.aggregateAndProofSchema = new AggregateAndProofSchema(attestationSchema); this.signedAggregateAndProofSchema = new SignedAggregateAndProofSchema(aggregateAndProofSchema); this.beaconStateSchema = BeaconStateSchemaAltair.create(specConfig); diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/schemas/registry/SchemaRegistryBuilder.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/schemas/registry/SchemaRegistryBuilder.java index 6d17881ffe7..6671185ff97 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/schemas/registry/SchemaRegistryBuilder.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/schemas/registry/SchemaRegistryBuilder.java @@ -16,6 +16,7 @@ import static tech.pegasys.teku.spec.SpecMilestone.ELECTRA; import static tech.pegasys.teku.spec.SpecMilestone.PHASE0; import static tech.pegasys.teku.spec.schemas.registry.BaseSchemaProvider.constantProviderBuilder; +import static tech.pegasys.teku.spec.schemas.registry.SchemaTypes.AGGREGATE_AND_PROOF_SCHEMA; import static tech.pegasys.teku.spec.schemas.registry.SchemaTypes.ATTESTATION_SCHEMA; import static tech.pegasys.teku.spec.schemas.registry.SchemaTypes.ATTESTER_SLASHING_SCHEMA; import static tech.pegasys.teku.spec.schemas.registry.SchemaTypes.ATTNETS_ENR_FIELD_SCHEMA; @@ -125,7 +126,7 @@ private static SchemaProvider createIndexedAttestationSchemaProvider() { .build(); } - private static SchemaProvider> createAttestationSchemaProvider() { + private static SchemaProvider createAttestationSchemaProvider() { return constantProviderBuilder(ATTESTATION_SCHEMA) .withCreator( PHASE0, @@ -133,7 +134,7 @@ private static SchemaProvider> createAttestationS new AttestationPhase0Schema(getMaxValidatorPerAttestationPhase0(specConfig)) .castTypeToAttestationSchema()) .withCreator( - SpecMilestone.DENEB, + ELECTRA, (registry, specConfig) -> new AttestationElectraSchema( getMaxValidatorPerAttestationElectra(specConfig), @@ -142,6 +143,26 @@ private static SchemaProvider> createAttestationS .build(); } + private static SchemaProvider createAggregateAndProofSchemaProvider() { + return constantProviderBuilder(AGGREGATE_AND_PROOF_SCHEMA) + .withCreator( + PHASE0, + (registry, specConfig) -> + new AggregateAndProofSchema( + AGGREGATE_AND_PROOF_SCHEMA.getContainerName(registry.getMilestone()), + getMaxValidatorPerAttestationPhase0(specConfig))) + .withCreator( + ELECTRA, + (registry, specConfig) -> + new AggregateAndProofSchema( + AGGREGATE_AND_PROOF_SCHEMA.getContainerName(registry.getMilestone()), + getMaxValidatorPerAttestationElectra(specConfig))) + .build(); + } + + + AGGREGATE_AND_PROOF_SCHEMA + private static long getMaxValidatorPerAttestationPhase0(final SpecConfig specConfig) { return specConfig.getMaxValidatorsPerCommittee(); } diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/schemas/registry/SchemaTypes.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/schemas/registry/SchemaTypes.java index 1062b0c6d63..94c92f6d541 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/schemas/registry/SchemaTypes.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/schemas/registry/SchemaTypes.java @@ -24,10 +24,12 @@ import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayloadHeader; import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayloadHeaderSchema; import tech.pegasys.teku.spec.datastructures.networking.libp2p.rpc.BeaconBlocksByRootRequestMessage.BeaconBlocksByRootRequestMessageSchema; +import tech.pegasys.teku.spec.datastructures.operations.AggregateAndProof.AggregateAndProofSchema; import tech.pegasys.teku.spec.datastructures.operations.Attestation; import tech.pegasys.teku.spec.datastructures.operations.AttestationSchema; import tech.pegasys.teku.spec.datastructures.operations.AttesterSlashingSchema; import tech.pegasys.teku.spec.datastructures.operations.IndexedAttestationSchema; +import tech.pegasys.teku.spec.datastructures.operations.SignedAggregateAndProof.SignedAggregateAndProofSchema; import tech.pegasys.teku.spec.datastructures.state.HistoricalBatch.HistoricalBatchSchema; import tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconState; import tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconStateSchema; @@ -52,6 +54,11 @@ public class SchemaTypes { public static final SchemaId> ATTESTATION_SCHEMA = create("ATTESTATION_SCHEMA"); + public static final SchemaId AGGREGATE_AND_PROOF_SCHEMA = + create("AGGREGATE_AND_PROOF_SCHEMA"); + public static final SchemaId SIGNED_AGGREGATE_AND_PROOF_SCHEMA = + create("SIGNED_AGGREGATE_AND_PROOF_SCHEMA"); + public static final SchemaId> EXECUTION_PAYLOAD_HEADER_SCHEMA = create("EXECUTION_PAYLOAD_HEADER_SCHEMA"); From 2cd898a62fe0697982bef856189697c10a690cd4 Mon Sep 17 00:00:00 2001 From: Enrico Del Fante Date: Tue, 22 Oct 2024 15:52:11 +0200 Subject: [PATCH 2/3] AggregateAndProof and SignedAggregateAndProof bug fix on attestation --- .../operations/AggregateAndProof.java | 12 +++---- .../operations/SignedAggregateAndProof.java | 12 ++++--- .../spec/schemas/SchemaDefinitionsAltair.java | 8 +++-- .../schemas/SchemaDefinitionsElectra.java | 28 ----------------- .../spec/schemas/SchemaDefinitionsPhase0.java | 7 +++-- .../registry/SchemaRegistryBuilder.java | 31 +++++++++++++------ 6 files changed, 45 insertions(+), 53 deletions(-) diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/operations/AggregateAndProof.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/operations/AggregateAndProof.java index 6894978a128..f826573b161 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/operations/AggregateAndProof.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/operations/AggregateAndProof.java @@ -13,17 +13,19 @@ package tech.pegasys.teku.spec.datastructures.operations; +import static tech.pegasys.teku.spec.schemas.registry.SchemaTypes.ATTESTATION_SCHEMA; + import tech.pegasys.teku.bls.BLSSignature; import tech.pegasys.teku.infrastructure.ssz.containers.Container3; import tech.pegasys.teku.infrastructure.ssz.containers.ContainerSchema3; import tech.pegasys.teku.infrastructure.ssz.primitive.SszUInt64; import tech.pegasys.teku.infrastructure.ssz.schema.SszPrimitiveSchemas; -import tech.pegasys.teku.infrastructure.ssz.schema.SszSchema; import tech.pegasys.teku.infrastructure.ssz.tree.TreeNode; import tech.pegasys.teku.infrastructure.unsigned.UInt64; import tech.pegasys.teku.spec.datastructures.operations.versions.phase0.AttestationPhase0; import tech.pegasys.teku.spec.datastructures.type.SszSignature; import tech.pegasys.teku.spec.datastructures.type.SszSignatureSchema; +import tech.pegasys.teku.spec.schemas.registry.SchemaRegistry; public class AggregateAndProof extends Container3 { @@ -32,13 +34,11 @@ public static class AggregateAndProofSchema extends ContainerSchema3 { public AggregateAndProofSchema( - final AttestationSchema attestationSchema) { + final String containerName, final SchemaRegistry schemaRegistry) { super( - attestationSchema.requiresCommitteeBits() - ? "AggregateAndProofElectra" - : "AggregateAndProofPhase0", + containerName, namedSchema("aggregator_index", SszPrimitiveSchemas.UINT64_SCHEMA), - namedSchema("aggregate", SszSchema.as(Attestation.class, attestationSchema)), + namedSchema("aggregate", schemaRegistry.get(ATTESTATION_SCHEMA)), namedSchema("selection_proof", SszSignatureSchema.INSTANCE)); } diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/operations/SignedAggregateAndProof.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/operations/SignedAggregateAndProof.java index 0e5c5435bb3..6c62014b238 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/operations/SignedAggregateAndProof.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/operations/SignedAggregateAndProof.java @@ -13,6 +13,8 @@ package tech.pegasys.teku.spec.datastructures.operations; +import static tech.pegasys.teku.spec.schemas.registry.SchemaTypes.AGGREGATE_AND_PROOF_SCHEMA; + import tech.pegasys.teku.bls.BLSSignature; import tech.pegasys.teku.infrastructure.ssz.containers.Container2; import tech.pegasys.teku.infrastructure.ssz.containers.ContainerSchema2; @@ -20,6 +22,7 @@ import tech.pegasys.teku.spec.datastructures.operations.AggregateAndProof.AggregateAndProofSchema; import tech.pegasys.teku.spec.datastructures.type.SszSignature; import tech.pegasys.teku.spec.datastructures.type.SszSignatureSchema; +import tech.pegasys.teku.spec.schemas.registry.SchemaRegistry; public class SignedAggregateAndProof extends Container2 { @@ -27,12 +30,11 @@ public class SignedAggregateAndProof public static class SignedAggregateAndProofSchema extends ContainerSchema2 { - public SignedAggregateAndProofSchema(final AggregateAndProofSchema aggregateAndProofSchema) { + public SignedAggregateAndProofSchema( + final String containerName, final SchemaRegistry schemaRegistry) { super( - aggregateAndProofSchema.getAttestationSchema().requiresCommitteeBits() - ? "SignedAggregateAndProofElectra" - : "SignedAggregateAndProofPhase0", - namedSchema("message", aggregateAndProofSchema), + containerName, + namedSchema("message", schemaRegistry.get(AGGREGATE_AND_PROOF_SCHEMA)), namedSchema("signature", SszSignatureSchema.INSTANCE)); } diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/schemas/SchemaDefinitionsAltair.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/schemas/SchemaDefinitionsAltair.java index 5cd8c89843d..ce63e9585e5 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/schemas/SchemaDefinitionsAltair.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/schemas/SchemaDefinitionsAltair.java @@ -13,6 +13,9 @@ package tech.pegasys.teku.spec.schemas; +import static tech.pegasys.teku.spec.schemas.registry.SchemaTypes.AGGREGATE_AND_PROOF_SCHEMA; +import static tech.pegasys.teku.spec.schemas.registry.SchemaTypes.SIGNED_AGGREGATE_AND_PROOF_SCHEMA; + import com.google.common.base.Preconditions; import java.util.Optional; import tech.pegasys.teku.spec.config.SpecConfig; @@ -43,7 +46,6 @@ import tech.pegasys.teku.spec.datastructures.operations.versions.altair.SyncAggregatorSelectionDataSchema; import tech.pegasys.teku.spec.datastructures.operations.versions.altair.SyncCommitteeContributionSchema; import tech.pegasys.teku.spec.datastructures.operations.versions.altair.SyncCommitteeMessageSchema; -import tech.pegasys.teku.spec.datastructures.operations.versions.phase0.AttestationPhase0Schema; import tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconStateSchema; import tech.pegasys.teku.spec.datastructures.state.beaconstate.versions.altair.BeaconStateAltair; import tech.pegasys.teku.spec.datastructures.state.beaconstate.versions.altair.BeaconStateSchemaAltair; @@ -76,8 +78,8 @@ public SchemaDefinitionsAltair(final SchemaRegistry schemaRegistry) { this.indexedAttestationSchema = schemaRegistry.get(SchemaTypes.INDEXED_ATTESTATION_SCHEMA); this.attesterSlashingSchema = schemaRegistry.get(SchemaTypes.ATTESTER_SLASHING_SCHEMA); this.attestationSchema = schemaRegistry.get(SchemaTypes.ATTESTATION_SCHEMA); - this.aggregateAndProofSchema = new AggregateAndProofSchema(attestationSchema); - this.signedAggregateAndProofSchema = new SignedAggregateAndProofSchema(aggregateAndProofSchema); + this.aggregateAndProofSchema = schemaRegistry.get(AGGREGATE_AND_PROOF_SCHEMA); + this.signedAggregateAndProofSchema = schemaRegistry.get(SIGNED_AGGREGATE_AND_PROOF_SCHEMA); this.beaconStateSchema = BeaconStateSchemaAltair.create(specConfig); this.beaconBlockBodySchema = BeaconBlockBodySchemaAltairImpl.create( 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 bcd78684b51..e843ba1d95b 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 @@ -45,10 +45,6 @@ import tech.pegasys.teku.spec.datastructures.execution.versions.electra.ExecutionRequestsSchema; 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.Attestation; -import tech.pegasys.teku.spec.datastructures.operations.AttestationSchema; -import tech.pegasys.teku.spec.datastructures.operations.SignedAggregateAndProof.SignedAggregateAndProofSchema; import tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconStateSchema; import tech.pegasys.teku.spec.datastructures.state.beaconstate.versions.electra.BeaconStateElectra; import tech.pegasys.teku.spec.datastructures.state.beaconstate.versions.electra.BeaconStateSchemaElectra; @@ -57,13 +53,8 @@ import tech.pegasys.teku.spec.datastructures.state.versions.electra.PendingDeposit; import tech.pegasys.teku.spec.datastructures.state.versions.electra.PendingPartialWithdrawal; import tech.pegasys.teku.spec.schemas.registry.SchemaRegistry; -import tech.pegasys.teku.spec.schemas.registry.SchemaTypes; public class SchemaDefinitionsElectra extends SchemaDefinitionsDeneb { - private final AttestationSchema attestationSchema; - private final SignedAggregateAndProofSchema signedAggregateAndProofSchema; - private final AggregateAndProofSchema aggregateAndProofSchema; - private final BeaconStateSchemaElectra beaconStateSchema; private final BeaconBlockBodySchemaElectraImpl beaconBlockBodySchema; @@ -99,10 +90,6 @@ public SchemaDefinitionsElectra(final SchemaRegistry schemaRegistry) { final long maxValidatorsPerAttestation = getMaxValidatorPerAttestation(specConfig); - this.attestationSchema = schemaRegistry.get(SchemaTypes.ATTESTATION_SCHEMA); - this.aggregateAndProofSchema = new AggregateAndProofSchema(attestationSchema); - this.signedAggregateAndProofSchema = new SignedAggregateAndProofSchema(aggregateAndProofSchema); - this.executionRequestsSchema = new ExecutionRequestsSchema(specConfig); this.beaconStateSchema = BeaconStateSchemaElectra.create(specConfig); this.beaconBlockBodySchema = @@ -169,21 +156,6 @@ public static SchemaDefinitionsElectra required(final SchemaDefinitions schemaDe return (SchemaDefinitionsElectra) schemaDefinitions; } - @Override - public SignedAggregateAndProofSchema getSignedAggregateAndProofSchema() { - return signedAggregateAndProofSchema; - } - - @Override - public AggregateAndProofSchema getAggregateAndProofSchema() { - return aggregateAndProofSchema; - } - - @Override - public AttestationSchema getAttestationSchema() { - return attestationSchema; - } - @Override public BeaconStateSchema getBeaconStateSchema() { diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/schemas/SchemaDefinitionsPhase0.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/schemas/SchemaDefinitionsPhase0.java index 3352cef3609..ef38dd68cbb 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/schemas/SchemaDefinitionsPhase0.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/schemas/SchemaDefinitionsPhase0.java @@ -13,6 +13,9 @@ package tech.pegasys.teku.spec.schemas; +import static tech.pegasys.teku.spec.schemas.registry.SchemaTypes.AGGREGATE_AND_PROOF_SCHEMA; +import static tech.pegasys.teku.spec.schemas.registry.SchemaTypes.SIGNED_AGGREGATE_AND_PROOF_SCHEMA; + import java.util.Optional; import tech.pegasys.teku.spec.config.SpecConfig; import tech.pegasys.teku.spec.datastructures.blocks.BeaconBlockSchema; @@ -56,8 +59,8 @@ public SchemaDefinitionsPhase0(final SchemaRegistry schemaRegistry) { this.attesterSlashingSchema = schemaRegistry.get(SchemaTypes.ATTESTER_SLASHING_SCHEMA); this.attestationSchema = schemaRegistry.get(SchemaTypes.ATTESTATION_SCHEMA); - this.aggregateAndProofSchema = new AggregateAndProofSchema(attestationSchema); - this.signedAggregateAndProofSchema = new SignedAggregateAndProofSchema(aggregateAndProofSchema); + this.aggregateAndProofSchema = schemaRegistry.get(AGGREGATE_AND_PROOF_SCHEMA); + this.signedAggregateAndProofSchema = schemaRegistry.get(SIGNED_AGGREGATE_AND_PROOF_SCHEMA); this.beaconStateSchema = BeaconStateSchemaPhase0.create(specConfig); this.beaconBlockBodySchema = BeaconBlockBodySchemaPhase0.create( diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/schemas/registry/SchemaRegistryBuilder.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/schemas/registry/SchemaRegistryBuilder.java index 6671185ff97..c68fc761334 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/schemas/registry/SchemaRegistryBuilder.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/schemas/registry/SchemaRegistryBuilder.java @@ -23,6 +23,7 @@ import static tech.pegasys.teku.spec.schemas.registry.SchemaTypes.BEACON_BLOCKS_BY_ROOT_REQUEST_MESSAGE_SCHEMA; import static tech.pegasys.teku.spec.schemas.registry.SchemaTypes.HISTORICAL_BATCH_SCHEMA; import static tech.pegasys.teku.spec.schemas.registry.SchemaTypes.INDEXED_ATTESTATION_SCHEMA; +import static tech.pegasys.teku.spec.schemas.registry.SchemaTypes.SIGNED_AGGREGATE_AND_PROOF_SCHEMA; import static tech.pegasys.teku.spec.schemas.registry.SchemaTypes.SYNCNETS_ENR_FIELD_SCHEMA; import com.google.common.annotations.VisibleForTesting; @@ -33,10 +34,10 @@ import tech.pegasys.teku.spec.config.SpecConfig; import tech.pegasys.teku.spec.constants.NetworkConstants; import tech.pegasys.teku.spec.datastructures.networking.libp2p.rpc.BeaconBlocksByRootRequestMessage.BeaconBlocksByRootRequestMessageSchema; -import tech.pegasys.teku.spec.datastructures.operations.Attestation; -import tech.pegasys.teku.spec.datastructures.operations.AttestationSchema; +import tech.pegasys.teku.spec.datastructures.operations.AggregateAndProof.AggregateAndProofSchema; import tech.pegasys.teku.spec.datastructures.operations.AttesterSlashingSchema; import tech.pegasys.teku.spec.datastructures.operations.IndexedAttestationSchema; +import tech.pegasys.teku.spec.datastructures.operations.SignedAggregateAndProof.SignedAggregateAndProofSchema; import tech.pegasys.teku.spec.datastructures.operations.versions.electra.AttestationElectraSchema; import tech.pegasys.teku.spec.datastructures.operations.versions.phase0.AttestationPhase0Schema; import tech.pegasys.teku.spec.datastructures.state.HistoricalBatch.HistoricalBatchSchema; @@ -56,7 +57,9 @@ public static SchemaRegistryBuilder create() { .addProvider(createHistoricalBatchSchemaProvider()) .addProvider(createIndexedAttestationSchemaProvider()) .addProvider(createAttesterSlashingSchemaProvider()) - .addProvider(createAttestationSchemaProvider()); + .addProvider(createAttestationSchemaProvider()) + .addProvider(createAggregateAndProofSchemaProvider()) + .addProvider(createSignedAggregateAndProofSchemaProvider()); } private static SchemaProvider createAttnetsENRFieldSchemaProvider() { @@ -149,19 +152,29 @@ private static SchemaProvider createAggregateAndProofSchemaProvider() { PHASE0, (registry, specConfig) -> new AggregateAndProofSchema( - AGGREGATE_AND_PROOF_SCHEMA.getContainerName(registry.getMilestone()), - getMaxValidatorPerAttestationPhase0(specConfig))) + AGGREGATE_AND_PROOF_SCHEMA.getContainerName(registry.getMilestone()), registry)) .withCreator( ELECTRA, (registry, specConfig) -> new AggregateAndProofSchema( - AGGREGATE_AND_PROOF_SCHEMA.getContainerName(registry.getMilestone()), - getMaxValidatorPerAttestationElectra(specConfig))) + AGGREGATE_AND_PROOF_SCHEMA.getContainerName(registry.getMilestone()), registry)) .build(); } - - AGGREGATE_AND_PROOF_SCHEMA + private static SchemaProvider createSignedAggregateAndProofSchemaProvider() { + return constantProviderBuilder(SIGNED_AGGREGATE_AND_PROOF_SCHEMA) + .withCreator( + PHASE0, + (registry, specConfig) -> + new SignedAggregateAndProofSchema( + AGGREGATE_AND_PROOF_SCHEMA.getContainerName(registry.getMilestone()), registry)) + .withCreator( + ELECTRA, + (registry, specConfig) -> + new SignedAggregateAndProofSchema( + AGGREGATE_AND_PROOF_SCHEMA.getContainerName(registry.getMilestone()), registry)) + .build(); + } private static long getMaxValidatorPerAttestationPhase0(final SpecConfig specConfig) { return specConfig.getMaxValidatorsPerCommittee(); From 08246626aac5053dbaa721f0eb858f245ded4ea5 Mon Sep 17 00:00:00 2001 From: Enrico Del Fante Date: Tue, 22 Oct 2024 16:25:38 +0200 Subject: [PATCH 3/3] fix container names --- .../teku/spec/schemas/registry/SchemaRegistryBuilder.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/schemas/registry/SchemaRegistryBuilder.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/schemas/registry/SchemaRegistryBuilder.java index c68fc761334..3024a6b50c1 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/schemas/registry/SchemaRegistryBuilder.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/schemas/registry/SchemaRegistryBuilder.java @@ -167,12 +167,14 @@ private static SchemaProvider createSignedAggregateAndProofSchemaProvider() { PHASE0, (registry, specConfig) -> new SignedAggregateAndProofSchema( - AGGREGATE_AND_PROOF_SCHEMA.getContainerName(registry.getMilestone()), registry)) + SIGNED_AGGREGATE_AND_PROOF_SCHEMA.getContainerName(registry.getMilestone()), + registry)) .withCreator( ELECTRA, (registry, specConfig) -> new SignedAggregateAndProofSchema( - AGGREGATE_AND_PROOF_SCHEMA.getContainerName(registry.getMilestone()), registry)) + SIGNED_AGGREGATE_AND_PROOF_SCHEMA.getContainerName(registry.getMilestone()), + registry)) .build(); }