Search in sources :

Example 1 with Bytes20

use of tech.pegasys.teku.infrastructure.bytes.Bytes20 in project teku by ConsenSys.

the class ForkChoiceNotifierTest method getExpectedPayloadAttributes.

private PayloadAttributes getExpectedPayloadAttributes(final BeaconState headState, final UInt64 blockSlot, final Optional<Bytes20> overrideFeeRecipient) {
    final Bytes20 feeRecipient = overrideFeeRecipient.orElse(dataStructureUtil.randomBytes20());
    final UInt64 timestamp = spec.computeTimeAtSlot(headState, blockSlot);
    final Bytes32 random = spec.getRandaoMix(headState, UInt64.ZERO);
    return new PayloadAttributes(timestamp, random, feeRecipient);
}
Also used : PayloadAttributes(tech.pegasys.teku.spec.executionengine.PayloadAttributes) UInt64(tech.pegasys.teku.infrastructure.unsigned.UInt64) Bytes32(org.apache.tuweni.bytes.Bytes32) Bytes20(tech.pegasys.teku.infrastructure.bytes.Bytes20)

Example 2 with Bytes20

use of tech.pegasys.teku.infrastructure.bytes.Bytes20 in project teku by ConsenSys.

the class Web3JExecutionEngineClientTest method shouldSerializeDeserializeBytes20.

@TestTemplate
void shouldSerializeDeserializeBytes20() throws IOException {
    Bytes20 originalBytes20 = dataStructureUtil.randomBytes20();
    new Bytes20Serializer().serialize(originalBytes20, jsonGenerator, serializerProvider);
    jsonGenerator.flush();
    JsonParser parser = prepareDeserializationContext(jsonWriter.toString());
    Bytes20Deserializer deserializer = new Bytes20Deserializer();
    Bytes20 result = deserializer.deserialize(parser, objectMapper.getDeserializationContext());
    assertThat(originalBytes20).isEqualTo(result);
}
Also used : Bytes20Deserializer(tech.pegasys.teku.ethereum.executionlayer.client.serialization.Bytes20Deserializer) Bytes20Serializer(tech.pegasys.teku.ethereum.executionlayer.client.serialization.Bytes20Serializer) Bytes20(tech.pegasys.teku.infrastructure.bytes.Bytes20) JsonParser(com.fasterxml.jackson.core.JsonParser) TestTemplate(org.junit.jupiter.api.TestTemplate)

Aggregations

Bytes20 (tech.pegasys.teku.infrastructure.bytes.Bytes20)2 JsonParser (com.fasterxml.jackson.core.JsonParser)1 Bytes32 (org.apache.tuweni.bytes.Bytes32)1 TestTemplate (org.junit.jupiter.api.TestTemplate)1 Bytes20Deserializer (tech.pegasys.teku.ethereum.executionlayer.client.serialization.Bytes20Deserializer)1 Bytes20Serializer (tech.pegasys.teku.ethereum.executionlayer.client.serialization.Bytes20Serializer)1 UInt64 (tech.pegasys.teku.infrastructure.unsigned.UInt64)1 PayloadAttributes (tech.pegasys.teku.spec.executionengine.PayloadAttributes)1