Skip to content

Commit

Permalink
fix ref tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tbenr committed Nov 17, 2024
1 parent adfd8c5 commit 465efa2
Showing 1 changed file with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
package tech.pegasys.teku.reference.altair.fork;

import static tech.pegasys.teku.infrastructure.ssz.SszDataAssert.assertThatSszData;
import static tech.pegasys.teku.spec.SpecMilestone.BELLATRIX;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.collect.ImmutableMap;
Expand Down Expand Up @@ -44,23 +45,26 @@ public void runTest(final TestDefinition testDefinition) throws Throwable {
}

private void processUpgrade(final TestDefinition testDefinition, final SpecMilestone milestone) {
final SpecVersion spec = testDefinition.getSpec().getGenesisSpec();
final SpecMilestone previousMilestone = milestone.getPreviousMilestone();
final SpecVersion previousMilestoneSpecVersion =
testDefinition.getSpec().forMilestone(previousMilestone);
final BeaconStateSchema<?, ?> fromMilestoneSchema =
switch (milestone) {
case ALTAIR -> BeaconStateSchemaPhase0.create(spec.getConfig());
case BELLATRIX -> BeaconStateSchemaAltair.create(spec.getConfig());
case ALTAIR -> BeaconStateSchemaPhase0.create(previousMilestoneSpecVersion.getConfig());
case BELLATRIX ->
BeaconStateSchemaAltair.create(previousMilestoneSpecVersion.getConfig());
case CAPELLA ->
BeaconStateSchemaBellatrix.create(
spec.getConfig(),
testDefinition.getSpec().getGenesisSchemaDefinitions().getSchemaRegistry());
previousMilestoneSpecVersion.getConfig(),
previousMilestoneSpecVersion.getSchemaDefinitions().getSchemaRegistry());
case DENEB ->
BeaconStateSchemaCapella.create(
spec.getConfig(),
testDefinition.getSpec().getGenesisSchemaDefinitions().getSchemaRegistry());
previousMilestoneSpecVersion.getConfig(),
previousMilestoneSpecVersion.getSchemaDefinitions().getSchemaRegistry());
case ELECTRA ->
BeaconStateSchemaDeneb.create(
spec.getConfig(),
testDefinition.getSpec().getGenesisSchemaDefinitions().getSchemaRegistry());
previousMilestoneSpecVersion.getConfig(),
previousMilestoneSpecVersion.getSchemaDefinitions().getSchemaRegistry());
default ->
throw new IllegalStateException(
"Unhandled fork upgrade for test "
Expand Down

0 comments on commit 465efa2

Please sign in to comment.