use of tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconStateSchema in project teku by ConsenSys.
the class ForkChoiceTestExecutor method parseForkChoiceFile.
@SuppressWarnings("unchecked")
private static Optional<? extends Arguments> parseForkChoiceFile(Path path) {
final File file = path.toFile();
final SchemaDefinitions schemaDefinitions = SPEC.getGenesisSchemaDefinitions();
final BeaconStateSchema<?, ?> beaconStateSchema = schemaDefinitions.getBeaconStateSchema();
try {
@SuppressWarnings("rawtypes") Map content = mapper.readValue(file, Map.class);
if (content.containsKey("steps")) {
BeaconState genesisState = resolvePart(BeaconState.class, beaconStateSchema, file, content.get("genesis"));
@SuppressWarnings("unchecked") List<Object> steps = ((List<Map<String, Object>>) content.get("steps")).stream().map(step -> extractTestStep(file, step)).collect(Collectors.toList());
return Optional.of(Arguments.of(genesisState, steps, file.getName(), true));
} else {
return Optional.empty();
}
} catch (IOException e) {
return Optional.empty();
}
}
Aggregations