use of tech.pegasys.teku.spec.datastructures.state.beaconstate.versions.phase0.BeaconStateSchemaPhase0 in project teku by ConsenSys.
the class BeaconStateBuilderPhase0 method initDefaults.
@Override
protected void initDefaults() {
super.initDefaults();
final BeaconStateSchemaPhase0 schema = getBeaconStateSchema();
previousEpochAttestations = dataStructureUtil.randomSszList(schema.getPreviousEpochAttestationsSchema(), defaultItemsInSSZLists, () -> dataStructureUtil.randomPendingAttestation(schema.getPendingAttestationSchema()));
currentEpochAttestations = dataStructureUtil.randomSszList(schema.getCurrentEpochAttestationsSchema(), defaultItemsInSSZLists, () -> dataStructureUtil.randomPendingAttestation(schema.getPendingAttestationSchema()));
}
use of tech.pegasys.teku.spec.datastructures.state.beaconstate.versions.phase0.BeaconStateSchemaPhase0 in project teku by ConsenSys.
the class ForkUpgradeTestExecutor method processAltairUpgrade.
private void processAltairUpgrade(final TestDefinition testDefinition) {
final SpecVersion spec = testDefinition.getSpec().getGenesisSpec();
final BeaconStateSchema<BeaconStatePhase0, MutableBeaconStatePhase0> phase0Schema = BeaconStateSchemaPhase0.create(spec.getConfig());
final BeaconState preState = TestDataUtils.loadSsz(testDefinition, "pre.ssz_snappy", phase0Schema);
final BeaconState postState = TestDataUtils.loadStateFromSsz(testDefinition, "post.ssz_snappy");
final StateUpgrade<?> stateUpgrade = testDefinition.getSpec().getGenesisSpec().getStateUpgrade().orElseThrow();
final BeaconState updated = stateUpgrade.upgrade(preState);
assertThatSszData(updated).isEqualByGettersTo(postState);
}
use of tech.pegasys.teku.spec.datastructures.state.beaconstate.versions.phase0.BeaconStateSchemaPhase0 in project teku by ConsenSys.
the class DataStructureUtil method randomPendingAttestation.
public PendingAttestation randomPendingAttestation() {
final BeaconStateSchema<?, ?> beaconStateSchema = getBeaconStateSchema();
checkState(beaconStateSchema instanceof BeaconStateSchemaPhase0, "Pending attestations only exist in phase0");
final PendingAttestationSchema pendingAttestationSchema = ((BeaconStateSchemaPhase0) beaconStateSchema).getPendingAttestationSchema();
return randomPendingAttestation(pendingAttestationSchema);
}
Aggregations