use of tech.pegasys.teku.ethereum.executionlayer.client.schema.ForkChoiceUpdatedResult in project teku by ConsenSys.
the class Web3JExecutionEngineClientTest method shouldDeserializeForkChoiceUpdatedResultWithNulls.
@TestTemplate
void shouldDeserializeForkChoiceUpdatedResultWithNulls() throws IOException {
ForkChoiceUpdatedResult forkChoiceUpdatedResultExpected = createExternalForkChoiceUpdatedResult(ExecutionPayloadStatus.SYNCING, null, null);
tech.pegasys.teku.spec.executionengine.ForkChoiceUpdatedResult internalForkChoiceUpdatedResultExpected = createInternalForkChoiceUpdatedResult(ExecutionPayloadStatus.SYNCING, Optional.empty(), Optional.empty());
String json = "{\"payloadStatus\": {\"status\": \"SYNCING\"}, \"payloadId\": null }";
ForkChoiceUpdatedResult executeForkChoiceUpdatedResultDeserialized = objectMapper.readValue(json, ForkChoiceUpdatedResult.class);
tech.pegasys.teku.spec.executionengine.ForkChoiceUpdatedResult internalForkChoiceUpdatedResult = executeForkChoiceUpdatedResultDeserialized.asInternalExecutionPayload();
assertThat(executeForkChoiceUpdatedResultDeserialized).isEqualTo(forkChoiceUpdatedResultExpected);
assertThat(internalForkChoiceUpdatedResult).isEqualTo(internalForkChoiceUpdatedResultExpected);
}
use of tech.pegasys.teku.ethereum.executionlayer.client.schema.ForkChoiceUpdatedResult in project teku by ConsenSys.
the class Web3JExecutionEngineClientTest method shouldDeserializeForkChoiceUpdatedResult.
@TestTemplate
void shouldDeserializeForkChoiceUpdatedResult() throws IOException {
Bytes8 payloadId = dataStructureUtil.randomBytes8();
Bytes32 latestValidHash = dataStructureUtil.randomBytes32();
ForkChoiceUpdatedResult forkChoiceUpdatedResultExpected = createExternalForkChoiceUpdatedResult(ExecutionPayloadStatus.VALID, latestValidHash, payloadId);
tech.pegasys.teku.spec.executionengine.ForkChoiceUpdatedResult internalForkChoiceUpdatedResultExpected = createInternalForkChoiceUpdatedResult(ExecutionPayloadStatus.VALID, Optional.of(latestValidHash), Optional.of(payloadId));
String json = "{\"payloadStatus\": {\"status\": \"VALID\", \"latestValidHash\": \"" + latestValidHash.toHexString() + "\"}, \"payloadId\": \"" + payloadId.toHexString() + "\" }";
ForkChoiceUpdatedResult executeForkChoiceUpdatedResultDeserialized = objectMapper.readValue(json, ForkChoiceUpdatedResult.class);
tech.pegasys.teku.spec.executionengine.ForkChoiceUpdatedResult internalForkChoiceUpdatedResult = executeForkChoiceUpdatedResultDeserialized.asInternalExecutionPayload();
assertThat(executeForkChoiceUpdatedResultDeserialized).isEqualTo(forkChoiceUpdatedResultExpected);
assertThat(internalForkChoiceUpdatedResult).isEqualTo(internalForkChoiceUpdatedResultExpected);
}
Aggregations