Search in sources :

Example 1 with BeaconStateBellatrix

use of tech.pegasys.teku.api.schema.bellatrix.BeaconStateBellatrix in project teku by ConsenSys.

the class BeaconStateTest method shouldConvertToInternalObject.

@TestTemplate
public void shouldConvertToInternalObject(SpecContext ctx) {
    final tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconState beaconStateInternal = ctx.getDataStructureUtil().randomBeaconState();
    final Spec spec = ctx.getSpec();
    final BeaconState beaconState;
    switch(spec.getGenesisSpec().getMilestone()) {
        case PHASE0:
            beaconState = new BeaconStatePhase0(beaconStateInternal);
            break;
        case ALTAIR:
            beaconState = new BeaconStateAltair(beaconStateInternal);
            break;
        case BELLATRIX:
            beaconState = new BeaconStateBellatrix(beaconStateInternal);
            break;
        default:
            throw new IllegalStateException("Unsupported milestone");
    }
    assertThat(beaconState.asInternalBeaconState(spec)).isEqualTo(beaconStateInternal);
}
Also used : BeaconStateBellatrix(tech.pegasys.teku.api.schema.bellatrix.BeaconStateBellatrix) BeaconStatePhase0(tech.pegasys.teku.api.schema.phase0.BeaconStatePhase0) Spec(tech.pegasys.teku.spec.Spec) BeaconStateAltair(tech.pegasys.teku.api.schema.altair.BeaconStateAltair) TestTemplate(org.junit.jupiter.api.TestTemplate)

Aggregations

TestTemplate (org.junit.jupiter.api.TestTemplate)1 BeaconStateAltair (tech.pegasys.teku.api.schema.altair.BeaconStateAltair)1 BeaconStateBellatrix (tech.pegasys.teku.api.schema.bellatrix.BeaconStateBellatrix)1 BeaconStatePhase0 (tech.pegasys.teku.api.schema.phase0.BeaconStatePhase0)1 Spec (tech.pegasys.teku.spec.Spec)1