use of tech.pegasys.teku.api.schema.altair.BeaconStateAltair 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);
}
Aggregations