@Test void succeedsIfDeserializationOfInfinityPublicKeyIsCorrect() { BLSPublicKey infinityPublicKey = BLSPublicKey.fromSSZBytes(InfinityPublicKey); byte[] pointBytes = new byte[48]; pointBytes[0] = (byte) 0xc0; Bytes infinityBytesSsz = SSZ.encode( writer -> { writer.writeFixedBytes(Bytes.wrap(pointBytes)); }); BLSPublicKey deserializedPublicKey = BLSPublicKey.fromSSZBytes(infinityBytesSsz); assertEquals(infinityPublicKey, deserializedPublicKey); }
public static BLSPublicKey fromSSZBytes(Bytes bytes) { checkArgument( bytes.size() == SSZ_BLS_PUBKEY_SIZE, "Expected " + SSZ_BLS_PUBKEY_SIZE + " bytes but received %s.", bytes.size()); return SSZ.decode( bytes, reader -> new BLSPublicKey(Bytes48.wrap(reader.readFixedBytes(SSZ_BLS_PUBKEY_SIZE)))); }
BLSPublicKey implements SimpleOffsetSerializable { public static BLSPublicKey fromSSZBytes(Bytes bytes) { checkArgument( bytes.size() == SSZ_BLS_PUBKEY_SIZE, "Expected " + SSZ_BLS_PUBKEY_SIZE + " bytes but received %s.", bytes.size()); return SSZ.decode( bytes, reader -> new BLSPublicKey(Bytes48.wrap(reader.readFixedBytes(SSZ_BLS_PUBKEY_SIZE)))); } }
BLSPublicKey implements SimpleOffsetSerializable { public static BLSPublicKey fromSSZBytes(Bytes bytes) { checkArgument( bytes.size() == SSZ_BLS_PUBKEY_SIZE, "Expected " + SSZ_BLS_PUBKEY_SIZE + " bytes but received %s.", bytes.size()); return SSZ.decode( bytes, reader -> new BLSPublicKey(Bytes48.wrap(reader.readFixedBytes(SSZ_BLS_PUBKEY_SIZE)))); } BLSPublicKey(BLSSecretKey secretKey);   BLSPublicKey(PublicKey publicKey);   BLSPublicKey(Bytes48 bytesCompressed); private  BLSPublicKey(Supplier<PublicKey> publicKey, Supplier<Bytes48> bytesCompressed); }
BLSPublicKey implements SimpleOffsetSerializable { public static BLSPublicKey fromSSZBytes(Bytes bytes) { checkArgument( bytes.size() == SSZ_BLS_PUBKEY_SIZE, "Expected " + SSZ_BLS_PUBKEY_SIZE + " bytes but received %s.", bytes.size()); return SSZ.decode( bytes, reader -> new BLSPublicKey(Bytes48.wrap(reader.readFixedBytes(SSZ_BLS_PUBKEY_SIZE)))); } BLSPublicKey(BLSSecretKey secretKey);   BLSPublicKey(PublicKey publicKey);   BLSPublicKey(Bytes48 bytesCompressed); private  BLSPublicKey(Supplier<PublicKey> publicKey, Supplier<Bytes48> bytesCompressed); static BLSPublicKey random(int seed); static BLSPublicKey empty(); static BLSPublicKey aggregate(List<BLSPublicKey> publicKeys); @Override int getSSZFieldCount(); @Override List<Bytes> get_fixed_parts(); static BLSPublicKey fromSSZBytes(Bytes bytes); static BLSPublicKey fromBytesCompressed(Bytes48 bytes); static BLSPublicKey fromBytesCompressedValidate(Bytes48 bytes); Bytes toSSZBytes(); Bytes48 toBytesCompressed(); String toAbbreviatedString(); @Override String toString(); @Override boolean equals(Object obj); @Override int hashCode(); }
BLSPublicKey implements SimpleOffsetSerializable { public static BLSPublicKey fromSSZBytes(Bytes bytes) { checkArgument( bytes.size() == SSZ_BLS_PUBKEY_SIZE, "Expected " + SSZ_BLS_PUBKEY_SIZE + " bytes but received %s.", bytes.size()); return SSZ.decode( bytes, reader -> new BLSPublicKey(Bytes48.wrap(reader.readFixedBytes(SSZ_BLS_PUBKEY_SIZE)))); } BLSPublicKey(BLSSecretKey secretKey);   BLSPublicKey(PublicKey publicKey);   BLSPublicKey(Bytes48 bytesCompressed); private  BLSPublicKey(Supplier<PublicKey> publicKey, Supplier<Bytes48> bytesCompressed); static BLSPublicKey random(int seed); static BLSPublicKey empty(); static BLSPublicKey aggregate(List<BLSPublicKey> publicKeys); @Override int getSSZFieldCount(); @Override List<Bytes> get_fixed_parts(); static BLSPublicKey fromSSZBytes(Bytes bytes); static BLSPublicKey fromBytesCompressed(Bytes48 bytes); static BLSPublicKey fromBytesCompressedValidate(Bytes48 bytes); Bytes toSSZBytes(); Bytes48 toBytesCompressed(); String toAbbreviatedString(); @Override String toString(); @Override boolean equals(Object obj); @Override int hashCode(); static final int SSZ_FIELD_COUNT; static final int SSZ_BLS_PUBKEY_SIZE; }