use of tech.pegasys.teku.spec.datastructures.state.beaconstate.versions.phase0.MutableBeaconStatePhase0 in project teku by ConsenSys.
the class EpochProcessorPhase0 method processParticipationUpdates.
@Override
public void processParticipationUpdates(MutableBeaconState genericState) {
// Rotate current/previous epoch attestations
final MutableBeaconStatePhase0 state = MutableBeaconStatePhase0.required(genericState);
state.getPrevious_epoch_attestations().setAll(state.getCurrent_epoch_attestations());
state.getCurrent_epoch_attestations().clear();
}
use of tech.pegasys.teku.spec.datastructures.state.beaconstate.versions.phase0.MutableBeaconStatePhase0 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.MutableBeaconStatePhase0 in project teku by ConsenSys.
the class BlockProcessorPhase0 method processAttestation.
@Override
protected void processAttestation(final MutableBeaconState genericState, final Attestation attestation, final IndexedAttestationProvider indexedAttestationProvider) {
final MutableBeaconStatePhase0 state = MutableBeaconStatePhase0.required(genericState);
final AttestationData data = attestation.getData();
PendingAttestation pendingAttestation = state.getBeaconStateSchema().getPendingAttestationSchema().create(attestation.getAggregationBits(), data, state.getSlot().minus(data.getSlot()), UInt64.valueOf(beaconStateAccessors.getBeaconProposerIndex(state)));
if (data.getTarget().getEpoch().equals(beaconStateAccessors.getCurrentEpoch(state))) {
state.getCurrent_epoch_attestations().append(pendingAttestation);
} else {
state.getPrevious_epoch_attestations().append(pendingAttestation);
}
}
Aggregations