use of tech.pegasys.teku.ethereum.executionlayer.client.schema.TransitionConfigurationV1 in project teku by ConsenSys.
the class Web3JExecutionEngineClientTest method shouldSerializeTransitionConfigurationV1.
@TestTemplate
void shouldSerializeTransitionConfigurationV1() throws IOException {
final TransitionConfigurationV1 externalTransitionConfiguration = new TransitionConfigurationV1(dataStructureUtil.randomUInt256(), dataStructureUtil.randomBytes32(), dataStructureUtil.randomUInt64());
String serialized = objectMapper.writeValueAsString(externalTransitionConfiguration);
assertThat(serialized).isNotEmpty();
}
use of tech.pegasys.teku.ethereum.executionlayer.client.schema.TransitionConfigurationV1 in project teku by ConsenSys.
the class Web3JExecutionEngineClientTest method shouldTransitionConfigurationRoundtrip.
@TestTemplate
void shouldTransitionConfigurationRoundtrip() {
final TransitionConfigurationV1 externalTransitionConfiguration = new TransitionConfigurationV1(dataStructureUtil.randomUInt256(), dataStructureUtil.randomBytes32(), dataStructureUtil.randomUInt64());
final TransitionConfiguration internalTransitionConfiguration = externalTransitionConfiguration.asInternalTransitionConfiguration();
assertThat(internalTransitionConfiguration.getTerminalBlockHash()).isEqualTo(externalTransitionConfiguration.terminalBlockHash);
assertThat(internalTransitionConfiguration.getTerminalBlockNumber()).isEqualTo(externalTransitionConfiguration.terminalBlockNumber);
assertThat(internalTransitionConfiguration.getTerminalTotalDifficulty()).isEqualTo(externalTransitionConfiguration.terminalTotalDifficulty);
final TransitionConfigurationV1 externalTransitionConfiguration2 = TransitionConfigurationV1.fromInternalTransitionConfiguration(internalTransitionConfiguration);
assertThat(externalTransitionConfiguration2).isEqualTo(externalTransitionConfiguration);
}
use of tech.pegasys.teku.ethereum.executionlayer.client.schema.TransitionConfigurationV1 in project teku by ConsenSys.
the class Web3JExecutionEngineClientTest method shouldSerializeDeserializeTransitionConfigurationV1.
@TestTemplate
void shouldSerializeDeserializeTransitionConfigurationV1() throws IOException {
final TransitionConfigurationV1 externalTransitionConfiguration = new TransitionConfigurationV1(dataStructureUtil.randomUInt256(), dataStructureUtil.randomBytes32(), dataStructureUtil.randomUInt64());
String serialized = objectMapper.writeValueAsString(externalTransitionConfiguration);
assertThat(serialized).isNotEmpty();
TransitionConfigurationV1 externalTransitionConfiguration2 = objectMapper.readValue(serialized, TransitionConfigurationV1.class);
assertThat(externalTransitionConfiguration).isEqualTo(externalTransitionConfiguration2);
}
use of tech.pegasys.teku.ethereum.executionlayer.client.schema.TransitionConfigurationV1 in project teku by ConsenSys.
the class Web3JExecutionEngineClientTest method shouldDeserializeTransitionConfigurationV1.
@TestTemplate
void shouldDeserializeTransitionConfigurationV1() throws IOException {
final String json = "{\"terminalTotalDifficulty\": \"0xF123657934589000000000000000001\", " + "\"terminalBlockHash\": \"0x95b8e2ba063ab62f68ebe7db0a9669ab9e7906aa4e060e1cc0b67b294ce8c5e4\", " + "\"terminalBlockNumber\": \"0xa79345890\" }";
final TransitionConfigurationV1 externalTransitionConfiguration = objectMapper.readValue(json, TransitionConfigurationV1.class);
assertThat(externalTransitionConfiguration.terminalTotalDifficulty).isEqualTo(UInt256.fromHexString("0xF123657934589000000000000000001"));
assertThat(externalTransitionConfiguration.terminalBlockHash).isEqualTo(Bytes32.fromHexString("0x95b8e2ba063ab62f68ebe7db0a9669ab9e7906aa4e060e1cc0b67b294ce8c5e4"));
assertThat(externalTransitionConfiguration.terminalBlockNumber).isEqualTo(UInt64.valueOf(Bytes.fromHexStringLenient("0xa79345890").toUnsignedBigInteger()));
}
Aggregations