Search in sources :

Example 1 with EpochProcessor

use of tech.pegasys.teku.spec.logic.common.statetransition.epoch.EpochProcessor in project teku by ConsenSys.

the class EpochProcessingTestExecutor method runTest.

@Override
public void runTest(final TestDefinition testDefinition) throws Exception {
    final BeaconState preState = loadStateFromSsz(testDefinition, "pre.ssz_snappy");
    final BeaconState expectedPostState = loadStateFromSsz(testDefinition, "post.ssz_snappy");
    final SpecVersion genesisSpec = testDefinition.getSpec().getGenesisSpec();
    final EpochProcessor epochProcessor = genesisSpec.getEpochProcessor();
    final ValidatorStatusFactory validatorStatusFactory = genesisSpec.getValidatorStatusFactory();
    final EpochProcessingExecutor processor = new EpochProcessingExecutor(epochProcessor, validatorStatusFactory);
    final BeaconState result = preState.updated(state -> processor.executeOperation(operation, state));
    assertThat(result).isEqualTo(expectedPostState);
}
Also used : EpochProcessor(tech.pegasys.teku.spec.logic.common.statetransition.epoch.EpochProcessor) SpecVersion(tech.pegasys.teku.spec.SpecVersion) ValidatorStatusFactory(tech.pegasys.teku.spec.logic.common.statetransition.epoch.status.ValidatorStatusFactory) BeaconState(tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconState)

Aggregations

SpecVersion (tech.pegasys.teku.spec.SpecVersion)1 BeaconState (tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconState)1 EpochProcessor (tech.pegasys.teku.spec.logic.common.statetransition.epoch.EpochProcessor)1 ValidatorStatusFactory (tech.pegasys.teku.spec.logic.common.statetransition.epoch.status.ValidatorStatusFactory)1