UNPKG

@lodestar/beacon-node

Version:

A Typescript implementation of the beacon chain

138 lines 7.84 kB
import { BitArray } from "@chainsafe/ssz"; import { ChainForkConfig } from "@lodestar/config"; import { ForkName } from "@lodestar/params"; import { BLSSignature, CommitteeIndex, RootHex, Slot, ValidatorIndex } from "@lodestar/types"; export type BlockRootHex = RootHex; export type AttDataBase64 = string; export type CommitteeBitsBase64 = string; /** `attestation.data.index` from gossip-serialized attestations / aggregates */ export type AttDataIndex = number; export declare const ROOT_SIZE = 32; /** * Extract slot from attestation serialized bytes. * Return null if data is not long enough to extract slot. */ export declare function getSlotFromAttestationSerialized(data: Uint8Array): Slot | null; /** * Extract block root from attestation serialized bytes. * Return null if data is not long enough to extract block root. */ export declare function getBlockRootFromAttestationSerialized(data: Uint8Array): BlockRootHex | null; /** * Extract attestation data base64 from all forks' attestation serialized bytes. * Return null if data is not long enough to extract attestation data. */ export declare function getAttDataFromAttestationSerialized(data: Uint8Array): AttDataBase64 | null; /** * Extract AttDataBase64 from `beacon_attestation` gossip message serialized bytes. * This is used for GossipQueue. */ export declare function getBeaconAttestationGossipIndex(fork: ForkName, data: Uint8Array): AttDataBase64 | null; /** * Extract slot from `beacon_attestation` gossip message serialized bytes. */ export declare function getSlotFromBeaconAttestationSerialized(fork: ForkName, data: Uint8Array): Slot | null; /** * Extract block root from `beacon_attestation` gossip message serialized bytes. */ export declare function getBlockRootFromBeaconAttestationSerialized(fork: ForkName, data: Uint8Array): BlockRootHex | null; /** * Extract aggregation bits from attestation serialized bytes. * Return null if data is not long enough to extract aggregation bits. * Pre-electra attestation only */ export declare function getAggregationBitsFromAttestationSerialized(data: Uint8Array): BitArray | null; /** * Extract signature from attestation serialized bytes. * Return null if data is not long enough to extract signature. */ export declare function getSignatureFromAttestationSerialized(data: Uint8Array): BLSSignature | null; /** * Extract slot from SingleAttestation serialized bytes. * Return null if data is not long enough to extract slot. */ export declare function getSlotFromSingleAttestationSerialized(data: Uint8Array): Slot | null; /** * Extract committee index from SingleAttestation serialized bytes. * Return null if data is not long enough to extract the committee index. */ export declare function getCommitteeIndexFromSingleAttestationSerialized(fork: ForkName, data: Uint8Array): CommitteeIndex | null; /** * Extract data index from SingleAttestation serialized bytes. * Post-gloas, `data.index` field is repurposed: * - 0 - payload was not available (or attestation is same-slot, where availability is not yet known) * - 1 - payload was available * Return null if data is not long enough to extract the index. */ export declare function getDataIndexFromSingleAttestationSerialized(fork: ForkName, data: Uint8Array): AttDataIndex | null; /** * Extract attester index from SingleAttestation serialized bytes. * Return null if data is not long enough to extract index. */ export declare function getAttesterIndexFromSingleAttestationSerialized(data: Uint8Array): ValidatorIndex | null; /** * Extract block root from SingleAttestation serialized bytes. * Return null if data is not long enough to extract block root. */ export declare function getBlockRootFromSingleAttestationSerialized(data: Uint8Array): BlockRootHex | null; /** * Extract attestation data base64 from SingleAttestation serialized bytes. * Return null if data is not long enough to extract attestation data. */ export declare function getAttDataFromSingleAttestationSerialized(data: Uint8Array): AttDataBase64 | null; /** * Extract signature from SingleAttestation serialized bytes. * Return null if data is not long enough to extract signature. */ export declare function getSignatureFromSingleAttestationSerialized(data: Uint8Array): BLSSignature | null; /** * Extract slot from signed aggregate and proof serialized bytes * Return null if data is not long enough to extract slot * This works for both phase + electra */ export declare function getSlotFromSignedAggregateAndProofSerialized(data: Uint8Array): Slot | null; /** * Extract block root from signed aggregate and proof serialized bytes * Return null if data is not long enough to extract block root * This works for both phase + electra */ export declare function getBlockRootFromSignedAggregateAndProofSerialized(data: Uint8Array): BlockRootHex | null; /** * Extract data index from signed aggregate and proof serialized bytes. * Return null if data is not long enough to extract the index. * This works for both phase0 + electra (index is in attestation data at the same offset). */ export declare function getDataIndexFromSignedAggregateAndProofSerialized(data: Uint8Array): AttDataIndex | null; /** * Extract AttestationData base64 from SignedAggregateAndProof for electra * Return null if data is not long enough */ export declare function getAttDataFromSignedAggregateAndProofElectra(data: Uint8Array): AttDataBase64 | null; /** * Extract CommitteeBits base64 from SignedAggregateAndProof for electra * Return null if data is not long enough */ export declare function getCommitteeBitsFromSignedAggregateAndProofElectra(data: Uint8Array): CommitteeBitsBase64 | null; /** * Extract attestation data base64 from signed aggregate and proof serialized bytes. * Return null if data is not long enough to extract attestation data. */ export declare function getAttDataFromSignedAggregateAndProofPhase0(data: Uint8Array): AttDataBase64 | null; export declare function getSlotFromSignedBeaconBlockSerialized(data: Uint8Array): Slot | null; export declare function getParentRootFromSignedBeaconBlockSerialized(data: Uint8Array): RootHex | null; export declare function getParentBlockHashFromGloasSignedBeaconBlockSerialized(data: Uint8Array): RootHex | null; export declare function getSlotFromBlobSidecarSerialized(data: Uint8Array): Slot | null; export declare function getSlotFromDataColumnSidecarSerialized(data: Uint8Array, fork: ForkName): Slot | null; export declare function getBeaconBlockRootFromDataColumnSidecarSerialized(data: Uint8Array): RootHex | null; export declare function getSlotFromExecutionPayloadEnvelopeSerialized(data: Uint8Array): Slot | null; export declare function getBeaconBlockRootFromExecutionPayloadEnvelopeSerialized(data: Uint8Array): RootHex | null; export declare function getLastProcessedSlotFromBeaconStateSerialized(data: Uint8Array): Slot | null; export declare function getSlotFromBeaconStateSerialized(data: Uint8Array): Slot | null; export declare function getSlotFromPayloadAttestationMessageSerialized(data: Uint8Array): Slot | null; export declare function getPayloadPresentFromPayloadAttestationMessageSerialized(data: Uint8Array): boolean | null; export declare function getBlockRootFromPayloadAttestationMessageSerialized(data: Uint8Array): RootHex | null; export declare function getSlotFromSignedExecutionPayloadBidSerialized(data: Uint8Array): Slot | null; export declare function getParentBlockHashFromSignedExecutionPayloadBidSerialized(data: Uint8Array): RootHex | null; export declare function getParentBlockRootFromSignedExecutionPayloadBidSerialized(data: Uint8Array): RootHex | null; export declare function getBlobKzgCommitmentsCountFromSignedBeaconBlockSerialized(config: ChainForkConfig, blockBytes: Uint8Array): number; //# sourceMappingURL=sszBytes.d.ts.map