use of tech.pegasys.teku.api.response.v1.beacon.GenesisData in project teku by ConsenSys.
the class GetGenesisTest method shouldReturnGenesisInformation.
@Test
public void shouldReturnGenesisInformation() throws Exception {
final GetGenesis handler = new GetGenesis(chainDataProvider, jsonProvider);
final GenesisData expectedGenesisData = new GenesisData(dataStructureUtil.randomUInt64(), dataStructureUtil.randomBytes32(), dataStructureUtil.randomBytes4());
when(chainDataProvider.isStoreAvailable()).thenReturn(true);
when(chainDataProvider.getGenesisData()).thenReturn(expectedGenesisData);
handler.handle(context);
final GetGenesisResponse response = getResponseObject(GetGenesisResponse.class);
assertThat(response.data).isEqualTo(expectedGenesisData);
}
use of tech.pegasys.teku.api.response.v1.beacon.GenesisData in project teku by ConsenSys.
the class ChainDataProviderTest method getGenesisData_shouldReturnValueIfStoreAvailable.
@Test
public void getGenesisData_shouldReturnValueIfStoreAvailable() {
final UInt64 genesisTime = beaconStateInternal.getGenesis_time();
final Bytes32 genesisValidatorsRoot = beaconStateInternal.getGenesis_validators_root();
final Bytes4 genesisForkVersion = spec.atEpoch(ZERO).getConfig().getGenesisForkVersion();
final ChainDataProvider provider = new ChainDataProvider(spec, recentChainData, combinedChainDataClient);
final GenesisData result = provider.getGenesisData();
assertThat(result).isEqualTo(new GenesisData(genesisTime, genesisValidatorsRoot, genesisForkVersion));
}
use of tech.pegasys.teku.api.response.v1.beacon.GenesisData in project teku by ConsenSys.
the class RemoteValidatorApiHandlerTest method getGenesisTime_WhenPresent_ReturnsValue.
@Test
public void getGenesisTime_WhenPresent_ReturnsValue() {
final UInt64 genesisTime = dataStructureUtil.randomUInt64();
when(apiClient.getGenesis()).thenReturn(Optional.of(new GetGenesisResponse(new GenesisData(genesisTime, dataStructureUtil.randomBytes32(), dataStructureUtil.randomBytes4()))));
SafeFuture<Optional<tech.pegasys.teku.spec.datastructures.genesis.GenesisData>> future = apiHandler.getGenesisData();
assertThat(unwrapToValue(future).getGenesisTime()).isEqualTo(genesisTime);
}
Aggregations