Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tbenr committed Sep 12, 2024
1 parent b72530e commit 32e92e9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ public AbstractSchemaDefinitions(final SchemaRegistry schemaRegistry) {
this.schemaRegistry = schemaRegistry;
}

@Override
public SchemaRegistry getSchemaRegistry() {
return schemaRegistry;
}

@Override
public SszBitvectorSchema<SszBitvector> getAttnetsENRFieldSchema() {
return schemaRegistry.get(ATTNETS_ENR_FIELD_SCHEMA);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ public interface SchemaDefinitions {
@NonSchema
BeaconBlockBodyBuilder createBeaconBlockBodyBuilder();

@NonSchema
SchemaRegistry getSchemaRegistry();

@NonSchema
default Optional<SchemaDefinitionsAltair> toVersionAltair() {
return Optional.empty();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,32 +19,22 @@
import tech.pegasys.teku.spec.Spec;
import tech.pegasys.teku.spec.TestSpecFactory;
import tech.pegasys.teku.spec.config.SpecConfig;
import tech.pegasys.teku.spec.datastructures.operations.IndexedAttestationSchema;
import tech.pegasys.teku.spec.datastructures.operations.versions.phase0.AttesterSlashingPhase0Schema;

public class BeaconBlockBodySchemaPhase0Test {

@Test
public void create_minimal() {
final Spec spec = TestSpecFactory.createMinimalPhase0();
final SpecConfig specConfig = spec.getGenesisSpecConfig();
final IndexedAttestationSchema<?> indexAttestationSchemaA =
spec.getGenesisSchemaDefinitions().getIndexedAttestationSchema();
final IndexedAttestationSchema<?> indexAttestationSchemaB =
spec.getGenesisSchemaDefinitions().getIndexedAttestationSchema();
final BeaconBlockBodySchemaPhase0 specA =
BeaconBlockBodySchemaPhase0.create(
specConfig,
new AttesterSlashingPhase0Schema(
indexAttestationSchemaA.castTypeToIndexedAttestationSchema()),
specConfig.getMaxValidatorsPerCommittee(),
spec.getGenesisSchemaDefinitions().getSchemaRegistry(),
"BeaconBlockBodyPhase0");
final BeaconBlockBodySchemaPhase0 specB =
BeaconBlockBodySchemaPhase0.create(
specConfig,
new AttesterSlashingPhase0Schema(
indexAttestationSchemaB.castTypeToIndexedAttestationSchema()),
specConfig.getMaxValidatorsPerCommittee(),
spec.getGenesisSchemaDefinitions().getSchemaRegistry(),
"BeaconBlockBodyPhase0");

assertThat(specA).isEqualTo(specB);
Expand All @@ -54,23 +44,15 @@ public void create_minimal() {
public void create_mainnet() {
final Spec spec = TestSpecFactory.createMainnetPhase0();
final SpecConfig specConfig = spec.getGenesisSpecConfig();
final IndexedAttestationSchema<?> indexAttestationSchemaA =
spec.getGenesisSchemaDefinitions().getIndexedAttestationSchema();
final IndexedAttestationSchema<?> indexAttestationSchemaB =
spec.getGenesisSchemaDefinitions().getIndexedAttestationSchema();
final BeaconBlockBodySchemaPhase0 specA =
BeaconBlockBodySchemaPhase0.create(
specConfig,
new AttesterSlashingPhase0Schema(
indexAttestationSchemaA.castTypeToIndexedAttestationSchema()),
specConfig.getMaxValidatorsPerCommittee(),
spec.getGenesisSchemaDefinitions().getSchemaRegistry(),
"BeaconBlockBodyPhase0");
final BeaconBlockBodySchemaPhase0 specB =
BeaconBlockBodySchemaPhase0.create(
specConfig,
new AttesterSlashingPhase0Schema(
indexAttestationSchemaB.castTypeToIndexedAttestationSchema()),
specConfig.getMaxValidatorsPerCommittee(),
spec.getGenesisSchemaDefinitions().getSchemaRegistry(),
"BeaconBlockBodyPhase0");

assertThat(specA).isEqualTo(specB);
Expand Down

0 comments on commit 32e92e9

Please sign in to comment.