Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

7013 add types #7146

Merged
merged 10 commits into from
May 17, 2023
Prev Previous commit
Next Next commit
add deserelisers
mehdi-aouadi committed May 16, 2023
commit 19c15e24480bad381682e99e5fa2732af0117aa6

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -28,12 +28,14 @@
@SuppressWarnings("JavaCase")
public class Attestation {
@Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES_SSZ)
public final Bytes aggregation_bits;
public Bytes aggregation_bits;

public final AttestationData data;
public AttestationData data;

@Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES96)
public final BLSSignature signature;
public BLSSignature signature;

public Attestation() {}

public Attestation(tech.pegasys.teku.spec.datastructures.operations.Attestation attestation) {
this.aggregation_bits = attestation.getAggregationBits().sszSerialize();
@@ -51,6 +53,30 @@ public Attestation(
this.signature = signature;
}

public Bytes getAggregationBits() {
return aggregation_bits;
}

public void setAggregationBits(Bytes aggregation_bits) {
this.aggregation_bits = aggregation_bits;
}

public AttestationData getData() {
return data;
}

public void setData(AttestationData data) {
this.data = data;
}

public BLSSignature getSignature() {
return signature;
}

public void setSignature(BLSSignature signature) {
this.signature = signature;
}

public tech.pegasys.teku.spec.datastructures.operations.Attestation asInternalAttestation(
final Spec spec) {
return asInternalAttestation(spec.atSlot(data.slot));
Original file line number Diff line number Diff line change
@@ -25,16 +25,18 @@
@SuppressWarnings("JavaCase")
public class AttestationData {
@Schema(type = "string", format = "uint64")
public final UInt64 slot;
public UInt64 slot;

@Schema(type = "string", format = "uint64")
public final UInt64 index;
public UInt64 index;

@Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES32)
public final Bytes32 beacon_block_root;
public Bytes32 beacon_block_root;

public final Checkpoint source;
public final Checkpoint target;
public Checkpoint source;
public Checkpoint target;

public AttestationData() {}

@JsonCreator
public AttestationData(
@@ -58,6 +60,46 @@ public AttestationData(tech.pegasys.teku.spec.datastructures.operations.Attestat
this.target = new Checkpoint(data.getTarget());
}

public UInt64 getSlot() {
return slot;
}

public void setSlot(UInt64 slot) {
this.slot = slot;
}

public UInt64 getIndex() {
return index;
}

public void setIndex(UInt64 index) {
this.index = index;
}

public Bytes32 getBeaconBlockRoot() {
return beacon_block_root;
}

public void setBeaconBlockRoot(Bytes32 beacon_block_root) {
this.beacon_block_root = beacon_block_root;
}

public Checkpoint getSource() {
return source;
}

public void setSource(Checkpoint source) {
this.source = source;
}

public Checkpoint getTarget() {
return target;
}

public void setTarget(Checkpoint target) {
this.target = target;
}

public tech.pegasys.teku.spec.datastructures.operations.AttestationData
asInternalAttestationData() {
tech.pegasys.teku.spec.datastructures.state.Checkpoint src = source.asInternalCheckpoint();
Original file line number Diff line number Diff line change
@@ -22,8 +22,10 @@

@SuppressWarnings("JavaCase")
public class AttesterSlashing {
public final IndexedAttestation attestation_1;
public final IndexedAttestation attestation_2;
public IndexedAttestation attestation_1;
public IndexedAttestation attestation_2;

public AttesterSlashing() {}

public AttesterSlashing(
tech.pegasys.teku.spec.datastructures.operations.AttesterSlashing attesterSlashing) {
@@ -44,6 +46,22 @@ public AttesterSlashing(
return asInternalAttesterSlashing(spec.atSlot(attestation_1.data.slot));
}

public IndexedAttestation getAttestation1() {
return attestation_1;
}

public void setAttestation1(IndexedAttestation attestation_1) {
this.attestation_1 = attestation_1;
}

public IndexedAttestation getAttestation2() {
return attestation_2;
}

public void setAttestation2(IndexedAttestation attestation_2) {
this.attestation_2 = attestation_2;
}

public tech.pegasys.teku.spec.datastructures.operations.AttesterSlashing
asInternalAttesterSlashing(final SpecVersion spec) {
final AttesterSlashingSchema attesterSlashingSchema =
Original file line number Diff line number Diff line change
@@ -30,22 +30,18 @@
@SuppressWarnings("JavaCase")
public class BeaconBlock implements UnsignedBlock, UnsignedBlindedBlock {
@Schema(type = "string", format = "uint64")
public final UInt64 slot;
public UInt64 slot;

@Schema(type = "string", format = "uint64")
public final UInt64 proposer_index;
public UInt64 proposer_index;

@Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES32)
public final Bytes32 parent_root;
public Bytes32 parent_root;

@Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES32)
public final Bytes32 state_root;
public Bytes32 state_root;

protected final BeaconBlockBody body;

public BeaconBlockBody getBody() {
return body;
}
protected BeaconBlockBody body;

protected BeaconBlock(tech.pegasys.teku.spec.datastructures.blocks.BeaconBlock message) {
this.slot = message.getSlot();
@@ -69,6 +65,48 @@ public BeaconBlock(
this.body = body;
}

public BeaconBlock() {}

public UInt64 getSlot() {
return slot;
}

public UInt64 getProposerIndex() {
return proposer_index;
}

public Bytes32 getParentRoot() {
return parent_root;
}

public Bytes32 getStateRoot() {
return state_root;
}

public BeaconBlockBody getBody() {
return body;
}

public void setSlot(UInt64 slot) {
this.slot = slot;
}

public void setProposerIndex(UInt64 proposer_index) {
this.proposer_index = proposer_index;
}

public void setParentRoot(Bytes32 parent_root) {
this.parent_root = parent_root;
}

public void setStateRoot(Bytes32 state_root) {
this.state_root = state_root;
}

public void setBody(BeaconBlockBody body) {
this.body = body;
}

public BeaconBlockSchema getBeaconBlockSchema(final SpecVersion spec) {
return spec.getSchemaDefinitions().getBeaconBlockSchema();
}
Original file line number Diff line number Diff line change
@@ -32,18 +32,20 @@
@SuppressWarnings("JavaCase")
public class BeaconBlockBody {
@Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES96)
public final BLSSignature randao_reveal;
public BLSSignature randao_reveal;

public final Eth1Data eth1_data;
public Eth1Data eth1_data;

@Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES32)
public final Bytes32 graffiti;
public Bytes32 graffiti;

public final List<ProposerSlashing> proposer_slashings;
public final List<AttesterSlashing> attester_slashings;
public final List<Attestation> attestations;
public final List<Deposit> deposits;
public final List<SignedVoluntaryExit> voluntary_exits;
public List<ProposerSlashing> proposer_slashings;
public List<AttesterSlashing> attester_slashings;
public List<Attestation> attestations;
public List<Deposit> deposits;
public List<SignedVoluntaryExit> voluntary_exits;

public BeaconBlockBody() {}

@JsonCreator
public BeaconBlockBody(
@@ -87,6 +89,70 @@ public BeaconBlockBody(
.collect(Collectors.toList());
}

public BLSSignature getRandaoReveal() {
return randao_reveal;
}

public Eth1Data getEth1Data() {
return eth1_data;
}

public Bytes32 getGraffiti() {
return graffiti;
}

public List<ProposerSlashing> getProposerSlashings() {
return proposer_slashings;
}

public List<AttesterSlashing> getAttesterSlashings() {
return attester_slashings;
}

public List<Attestation> getAttestations() {
return attestations;
}

public List<Deposit> getDeposits() {
return deposits;
}

public List<SignedVoluntaryExit> getVoluntaryExits() {
return voluntary_exits;
}

public void setRandaoReveal(BLSSignature randao_reveal) {
this.randao_reveal = randao_reveal;
}

public void setEth1Data(Eth1Data eth1_data) {
this.eth1_data = eth1_data;
}

public void setGraffiti(Bytes32 graffiti) {
this.graffiti = graffiti;
}

public void setProposerSlashings(List<ProposerSlashing> proposer_slashings) {
this.proposer_slashings = proposer_slashings;
}

public void setAttesterSlashings(List<AttesterSlashing> attester_slashings) {
this.attester_slashings = attester_slashings;
}

public void setAttestations(List<Attestation> attestations) {
this.attestations = attestations;
}

public void setDeposits(List<Deposit> deposits) {
this.deposits = deposits;
}

public void setVoluntaryExits(List<SignedVoluntaryExit> voluntary_exits) {
this.voluntary_exits = voluntary_exits;
}

public tech.pegasys.teku.spec.datastructures.blocks.blockbody.BeaconBlockBody
asInternalBeaconBlockBody(
final SpecVersion spec, Consumer<BeaconBlockBodyBuilder> builderRef) {
Original file line number Diff line number Diff line change
@@ -26,19 +26,21 @@
@SuppressWarnings("JavaCase")
public class BeaconBlockHeader {
@Schema(type = "string", format = "uint64")
public final UInt64 slot;
public UInt64 slot;

@Schema(type = "string", format = "uint64")
public final UInt64 proposer_index;
public UInt64 proposer_index;

@Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES32)
public final Bytes32 parent_root;
public Bytes32 parent_root;

@Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES32)
public final Bytes32 state_root;
public Bytes32 state_root;

@Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES32)
public final Bytes32 body_root;
public Bytes32 body_root;

public BeaconBlockHeader() {}

@JsonCreator
public BeaconBlockHeader(
@@ -63,6 +65,46 @@ public BeaconBlockHeader(
this.body_root = header.getBodyRoot();
}

public UInt64 getSlot() {
return slot;
}

public void setSlot(UInt64 slot) {
this.slot = slot;
}

public UInt64 getProposerIndex() {
return proposer_index;
}

public void setProposerIndex(UInt64 proposer_index) {
this.proposer_index = proposer_index;
}

public Bytes32 getParentRoot() {
return parent_root;
}

public void setParentRoot(Bytes32 parent_root) {
this.parent_root = parent_root;
}

public Bytes32 getStateRoot() {
return state_root;
}

public void setStateRoot(Bytes32 state_root) {
this.state_root = state_root;
}

public Bytes32 getBodyRoot() {
return body_root;
}

public void setBodyRoot(Bytes32 body_root) {
this.body_root = body_root;
}

public tech.pegasys.teku.spec.datastructures.blocks.BeaconBlockHeader
asInternalBeaconBlockHeader() {
return new tech.pegasys.teku.spec.datastructures.blocks.BeaconBlockHeader(
Original file line number Diff line number Diff line change
@@ -27,10 +27,12 @@ public class Checkpoint {
public static final Checkpoint EMPTY = new Checkpoint(UInt64.ZERO, Bytes32.ZERO);

@Schema(type = "string", format = "uint64")
public final UInt64 epoch;
public UInt64 epoch;

@Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES32)
public final Bytes32 root;
public Bytes32 root;

public Checkpoint() {}

public Checkpoint(tech.pegasys.teku.spec.datastructures.state.Checkpoint checkpoint) {
this.epoch = checkpoint.getEpoch();
@@ -44,6 +46,22 @@ public Checkpoint(
this.root = root;
}

public UInt64 getEpoch() {
return epoch;
}

public void setEpoch(UInt64 epoch) {
this.epoch = epoch;
}

public Bytes32 getRoot() {
return root;
}

public void setRoot(Bytes32 root) {
this.root = root;
}

public tech.pegasys.teku.spec.datastructures.state.Checkpoint asInternalCheckpoint() {
return new tech.pegasys.teku.spec.datastructures.state.Checkpoint(epoch, root);
}
Original file line number Diff line number Diff line change
@@ -27,9 +27,11 @@
public class Deposit {
@ArraySchema(
schema = @Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES32))
public final List<Bytes32> proof;
public List<Bytes32> proof;

public final DepositData data;
public DepositData data;

public Deposit() {}

public Deposit(tech.pegasys.teku.spec.datastructures.operations.Deposit deposit) {
this.proof = deposit.getProof().streamUnboxed().collect(Collectors.toList());
@@ -44,6 +46,22 @@ public Deposit(
this.data = data;
}

public List<Bytes32> getProof() {
return proof;
}

public void setProof(List<Bytes32> proof) {
this.proof = proof;
}

public DepositData getData() {
return data;
}

public void setData(DepositData data) {
this.data = data;
}

public tech.pegasys.teku.spec.datastructures.operations.Deposit asInternalDeposit() {
return new tech.pegasys.teku.spec.datastructures.operations.Deposit(
tech.pegasys.teku.spec.datastructures.operations.Deposit.SSZ_SCHEMA
Original file line number Diff line number Diff line change
@@ -27,16 +27,18 @@
@SuppressWarnings("JavaCase")
public class DepositData {
@Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES48)
public final BLSPubKey pubkey;
public BLSPubKey pubkey;

@Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES32)
public final Bytes32 withdrawal_credentials;
public Bytes32 withdrawal_credentials;

@Schema(type = "string", format = "uint64")
public final UInt64 amount;
public UInt64 amount;

@Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES96)
public final BLSSignature signature;
public BLSSignature signature;

public DepositData() {}

public DepositData(tech.pegasys.teku.spec.datastructures.operations.DepositData depositData) {
this.pubkey = new BLSPubKey(depositData.getPubkey().toSSZBytes());
@@ -56,6 +58,38 @@ public DepositData(
this.signature = signature;
}

public BLSPubKey getPubkey() {
return pubkey;
}

public void setPubkey(BLSPubKey pubkey) {
this.pubkey = pubkey;
}

public Bytes32 getWithdrawalCredentials() {
return withdrawal_credentials;
}

public void setWithdrawalCredentials(Bytes32 withdrawal_credentials) {
this.withdrawal_credentials = withdrawal_credentials;
}

public UInt64 getAmount() {
return amount;
}

public void setAmount(UInt64 amount) {
this.amount = amount;
}

public BLSSignature getSignature() {
return signature;
}

public void setSignature(BLSSignature signature) {
this.signature = signature;
}

public tech.pegasys.teku.spec.datastructures.operations.DepositData asInternalDepositData() {
return new tech.pegasys.teku.spec.datastructures.operations.DepositData(
BLSPublicKey.fromSSZBytes(pubkey.toBytes()),
Original file line number Diff line number Diff line change
@@ -25,13 +25,15 @@
@SuppressWarnings("JavaCase")
public class Eth1Data {
@Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES32)
public final Bytes32 deposit_root;
public Bytes32 deposit_root;

@Schema(type = "string", format = "uint64")
public final UInt64 deposit_count;
public UInt64 deposit_count;

@Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES32)
public final Bytes32 block_hash;
public Bytes32 block_hash;

public Eth1Data() {}

public Eth1Data(final tech.pegasys.teku.spec.datastructures.blocks.Eth1Data eth1Data) {
deposit_count = eth1Data.getDepositCount();
@@ -54,6 +56,30 @@ public tech.pegasys.teku.spec.datastructures.blocks.Eth1Data asInternalEth1Data(
deposit_root, deposit_count, block_hash);
}

public Bytes32 getDepositRoot() {
return deposit_root;
}

public UInt64 getDepositCount() {
return deposit_count;
}

public Bytes32 getBlockHash() {
return block_hash;
}

public void setDepositRoot(Bytes32 deposit_root) {
this.deposit_root = deposit_root;
}

public void setDepositCount(UInt64 deposit_count) {
this.deposit_count = deposit_count;
}

public void setBlockHash(Bytes32 block_hash) {
this.block_hash = block_hash;
}

@Override
public boolean equals(Object o) {
if (this == o) {
Original file line number Diff line number Diff line change
@@ -30,12 +30,14 @@
@SuppressWarnings("JavaCase")
public class IndexedAttestation {
@ArraySchema(schema = @Schema(type = "string", format = "uint64"))
public final List<UInt64> attesting_indices;
public List<UInt64> attesting_indices;

public final AttestationData data;
public AttestationData data;

@Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES96)
public final BLSSignature signature;
public BLSSignature signature;

public IndexedAttestation() {}

public IndexedAttestation(
tech.pegasys.teku.spec.datastructures.operations.IndexedAttestation indexedAttestation) {
@@ -55,6 +57,30 @@ public IndexedAttestation(
this.signature = signature;
}

public List<UInt64> getAttestingIndices() {
return attesting_indices;
}

public void setAttestingIndices(List<UInt64> attesting_indices) {
this.attesting_indices = attesting_indices;
}

public AttestationData getData() {
return data;
}

public void setData(AttestationData data) {
this.data = data;
}

public BLSSignature getSignature() {
return signature;
}

public void setSignature(BLSSignature signature) {
this.signature = signature;
}

public tech.pegasys.teku.spec.datastructures.operations.IndexedAttestation
asInternalIndexedAttestation(final Spec spec) {
return asInternalIndexedAttestation(spec.atSlot(data.slot));
Original file line number Diff line number Diff line change
@@ -19,8 +19,10 @@

@SuppressWarnings("JavaCase")
public class ProposerSlashing {
public final SignedBeaconBlockHeader signed_header_1;
public final SignedBeaconBlockHeader signed_header_2;
public SignedBeaconBlockHeader signed_header_1;
public SignedBeaconBlockHeader signed_header_2;

public ProposerSlashing() {}

public ProposerSlashing(
tech.pegasys.teku.spec.datastructures.operations.ProposerSlashing proposerSlashing) {
@@ -36,6 +38,22 @@ public ProposerSlashing(
this.signed_header_2 = header_2;
}

public SignedBeaconBlockHeader getSignedHeader1() {
return signed_header_1;
}

public void setSignedHeader1(SignedBeaconBlockHeader signed_header_1) {
this.signed_header_1 = signed_header_1;
}

public SignedBeaconBlockHeader getSignedHeader2() {
return signed_header_2;
}

public void setSignedHeader2(SignedBeaconBlockHeader signed_header_2) {
this.signed_header_2 = signed_header_2;
}

public tech.pegasys.teku.spec.datastructures.operations.ProposerSlashing
asInternalProposerSlashing() {
return new tech.pegasys.teku.spec.datastructures.operations.ProposerSlashing(
Original file line number Diff line number Diff line change
@@ -61,6 +61,22 @@ public SignedBeaconBlock(

public SignedBeaconBlock() {}

public BeaconBlock getBeaconBlock() {
return this.message;
}

public BLSSignature getSignature() {
return signature;
}

public void setBeaconBlock(BeaconBlock message) {
this.message = message;
}

public void setSignature(BLSSignature signature) {
this.signature = signature;
}

public static SignedBeaconBlock create(
tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock internalBlock) {
tech.pegasys.teku.spec.datastructures.blocks.blockbody.BeaconBlockBody beaconBlock =
Original file line number Diff line number Diff line change
@@ -22,10 +22,12 @@
import java.util.Objects;

public class SignedBeaconBlockHeader {
public final BeaconBlockHeader message;
public BeaconBlockHeader message;

@Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES96)
public final BLSSignature signature;
public BLSSignature signature;

public SignedBeaconBlockHeader() {}

public SignedBeaconBlockHeader(
tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlockHeader signedHeader) {
@@ -41,6 +43,22 @@ public SignedBeaconBlockHeader(
this.signature = signature;
}

public BeaconBlockHeader getMessage() {
return message;
}

public void setMessage(BeaconBlockHeader message) {
this.message = message;
}

public BLSSignature getSignature() {
return signature;
}

public void setSignature(BLSSignature signature) {
this.signature = signature;
}

public tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlockHeader
asInternalSignedBeaconBlockHeader() {
return new tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlockHeader(
Original file line number Diff line number Diff line change
@@ -20,10 +20,12 @@
import java.util.Objects;

public class SignedVoluntaryExit {
public final VoluntaryExit message;
public VoluntaryExit message;

@Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES96)
public final BLSSignature signature;
public BLSSignature signature;

public SignedVoluntaryExit() {}

public SignedVoluntaryExit(
tech.pegasys.teku.spec.datastructures.operations.SignedVoluntaryExit signedVoluntaryExit) {
@@ -45,6 +47,22 @@ public SignedVoluntaryExit(
this.signature = new BLSSignature(signature);
}

public VoluntaryExit getMessage() {
return message;
}

public void setMessage(VoluntaryExit message) {
this.message = message;
}

public BLSSignature getSignature() {
return signature;
}

public void setSignature(BLSSignature signature) {
this.signature = signature;
}

public tech.pegasys.teku.spec.datastructures.operations.SignedVoluntaryExit
asInternalSignedVoluntaryExit() {
return new tech.pegasys.teku.spec.datastructures.operations.SignedVoluntaryExit(
Original file line number Diff line number Diff line change
@@ -22,10 +22,12 @@
@SuppressWarnings("JavaCase")
public class VoluntaryExit {
@Schema(type = "string", format = "uint64")
public final UInt64 epoch;
public UInt64 epoch;

@Schema(type = "string", format = "uint64")
public final UInt64 validator_index;
public UInt64 validator_index;

public VoluntaryExit() {}

public VoluntaryExit(
tech.pegasys.teku.spec.datastructures.operations.VoluntaryExit voluntaryExit) {
@@ -41,6 +43,22 @@ public VoluntaryExit(
this.validator_index = validator_index;
}

public UInt64 getEpoch() {
return epoch;
}

public void setEpoch(UInt64 epoch) {
this.epoch = epoch;
}

public UInt64 getValidatorIndex() {
return validator_index;
}

public void setValidatorIndex(UInt64 validator_index) {
this.validator_index = validator_index;
}

public tech.pegasys.teku.spec.datastructures.operations.VoluntaryExit asInternalVoluntaryExit() {
return new tech.pegasys.teku.spec.datastructures.operations.VoluntaryExit(
epoch, validator_index);
Original file line number Diff line number Diff line change
@@ -26,6 +26,8 @@
@SuppressWarnings("JavaCase")
public class BeaconBlockAltair extends BeaconBlock implements UnsignedBlock {

public BeaconBlockAltair() {}

public BeaconBlockAltair(tech.pegasys.teku.spec.datastructures.blocks.BeaconBlock message) {
super(
message.getSlot(),
Original file line number Diff line number Diff line change
@@ -36,7 +36,9 @@
@SuppressWarnings("JavaCase")
public class BeaconBlockBodyAltair extends BeaconBlockBody {
@JsonProperty("sync_aggregate")
public final SyncAggregate syncAggregate;
public SyncAggregate syncAggregate;

public BeaconBlockBodyAltair() {}

@JsonCreator
public BeaconBlockBodyAltair(
@@ -71,6 +73,14 @@ public BeaconBlockBodyAltair(
checkNotNull(syncAggregate, "Sync Aggregate is required for altair blocks");
}

public SyncAggregate getSyncAggregate() {
return syncAggregate;
}

public void setSyncAggregate(SyncAggregate syncAggregate) {
this.syncAggregate = syncAggregate;
}

@Override
public BeaconBlockBodySchemaAltair<?> getBeaconBlockBodySchema(final SpecVersion spec) {
return (BeaconBlockBodySchemaAltair<?>) spec.getSchemaDefinitions().getBeaconBlockBodySchema();
Original file line number Diff line number Diff line change
@@ -15,6 +15,7 @@

import java.math.BigInteger;
import java.util.function.Function;
import org.apache.tuweni.bytes.Bytes;
import org.apache.tuweni.bytes.Bytes32;
import org.apache.tuweni.units.bigints.UInt256;
import tech.pegasys.teku.infrastructure.bytes.Bytes20;
@@ -39,6 +40,15 @@ public class CoreTypes {
.format("byte")
.build();

public static final StringValueTypeDefinition<Bytes> BYTES_SSZ_TYPE =
DeserializableTypeDefinition.string(Bytes.class)
.formatter(Bytes::toHexString)
.parser(Bytes::fromHexString)
.example("0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2")
.description("Bytes hexadecimal")
.format("byte")
.build();

public static final StringValueTypeDefinition<Bytes20> BYTES20_TYPE =
DeserializableTypeDefinition.string(Bytes20.class)
.formatter(Bytes20::toHexString)
Original file line number Diff line number Diff line change
@@ -34,6 +34,7 @@ public class DeserializableOneOfTypeDefinition<TObject, TBuilder>
this.parserTypes = parserTypes;
}

@SuppressWarnings("unused")
public static <TObject, TBuilder>
DeserializableOneOfTypeDefinitionBuilder<TObject, TBuilder> object(
@SuppressWarnings("unused") final Class<TObject> type,