import { CompactMultiProof } from "@chainsafe/persistent-merkle-tree"; import { BitArray, ByteViews } from "@chainsafe/ssz"; import type { BeaconConfig } from "@lodestar/config"; import { ForkName, ForkSeq } from "@lodestar/params"; import { BeaconBlock, BeaconState, BlindedBeaconBlock, BuilderIndex, Bytes32, CommitteeIndex, Epoch, ExecutionPayloadBid, ExecutionPayloadHeader, Root, RootHex, Slot, ValidatorIndex, altair, capella, electra, fulu, gloas, phase0, rewards } from "@lodestar/types"; import { Checkpoint, Fork } from "@lodestar/types/phase0"; import { VoluntaryExitValidity } from "../block/processVoluntaryExit.js"; import { EffectiveBalanceIncrements } from "../cache/effectiveBalanceIncrements.js"; import { RewardCache } from "../cache/rewardCache.js"; import { SyncCommitteeCache } from "../cache/syncCommitteeCache.js"; import { SyncCommitteeWitness } from "../lightClient/types.js"; import { StateTransitionModules, StateTransitionOpts } from "../stateTransition.js"; import { EpochShuffling } from "../util/epochShuffling.js"; import { PreVerifyBuilderDepositsResult } from "../util/preVerifyBuilderDeposits.js"; import { BlockSTFInput, ComputeNewStateRootResult, IBeaconStateView, IBeaconStateViewGloas, IBeaconStateViewLatestFork, IBeaconStateViewNative } from "./interface.js"; /** * Wraps a native binding (the auto-generated JS interface produced by a `.node` * file) and exposes it as a fully-conformant `IBeaconStateViewLatestFork`. * * The binding is typed `IBeaconStateViewNative`. This type models FFI-specific * inputs and outputs, such as serialized blocks and typed arrays. The wrapper * converts those values to the forms used by `IBeaconStateViewLatestFork`. * * Every getter that returns a value stable for the view's lifetime is cached so * the binding is hit at most once per field per view. Only mutable counters * (`proposerRewards`, `clonedCount`, `clonedCountWithTransferCache`) stay * pass-through. Methods with arguments are pass-through too — caching them * would need a per-arg map and isn't worth it without a hot-path signal. */ export declare class NativeBeaconStateView implements IBeaconStateViewLatestFork { private readonly config; readonly binding: IBeaconStateViewNative; private cachedForkName; private cachedForkSeq; private cachedSlot; private cachedFork; private cachedEpoch; private cachedGenesisTime; private cachedGenesisValidatorsRoot; private cachedEth1Data; private cachedLatestBlockHeader; private cachedPreviousJustifiedCheckpoint; private cachedCurrentJustifiedCheckpoint; private cachedFinalizedCheckpoint; private cachedPreviousDecisionRoot; private cachedCurrentDecisionRoot; private cachedNextDecisionRoot; private cachedPreviousProposers; private cachedCurrentProposers; private cachedNextProposers; private cachedEffectiveBalanceIncrements; private cachedValidatorCount; private cachedActiveValidatorCount; private cachedCreatedWithTransferCache; private cachedCurrentSyncCommittee; private cachedNextSyncCommittee; private cachedPreviousEpochParticipation; private cachedCurrentEpochParticipation; private cachedCurrentSyncCommitteeIndexed; private cachedSyncProposerReward; private cachedLatestExecutionPayloadHeader; private cachedPayloadBlockNumber; private cachedIsExecutionStateType; private cachedIsMergeTransitionComplete; private cachedHistoricalSummaries; private cachedPendingPartialWithdrawals; private cachedPendingConsolidations; private cachedPendingDeposits; private cachedPendingDepositsCount; private cachedPendingPartialWithdrawalsCount; private cachedPendingConsolidationsCount; private cachedProposerLookahead; private readonly cachedBlockRootAtSlot; private readonly cachedBlockRootAtEpoch; private readonly cachedStateRootAtSlot; private readonly cachedRandaoMix; private readonly cachedShufflingAtEpoch; private readonly cachedBeaconCommittee; private readonly cachedBeaconCommitteeCountPerSlot; private readonly cachedShufflingDecisionRoot; private readonly cachedBeaconProposer; private readonly cachedValidator; private readonly cachedBalance; private readonly cachedIndexedSyncCommitteeAtEpoch; private readonly cachedIndexedSyncCommittee; private readonly cachedSingleProof; private cachedPreviousShuffling; private cachedCurrentShuffling; private cachedNextShuffling; private cachedEffectiveBalanceIncrementsZeroInactive; private cachedAllValidators; private cachedAllBalances; private cachedLatestWeakSubjectivityCheckpointEpoch; private cachedFinalizedRootProof; private cachedUnrealizedCheckpoints; private cachedAnchorCheckpoint; private cachedIsStateValidatorsNodesPopulated; private cachedValue; private cachedSerialized; private cachedSerializedSize; private cachedSerializedValidators; private cachedSerializedValidatorsSize; private cachedHashTreeRoot; private cachedSyncCommitteesWitness; private cachedExpectedWithdrawals; constructor(config: BeaconConfig, binding: IBeaconStateViewNative); release(): void; get executionPayloadAvailability(): BitArray; get forkName(): ForkName; get forkSeq(): ForkSeq; get slot(): Slot; get fork(): Fork; get epoch(): Epoch; get genesisTime(): number; get genesisValidatorsRoot(): Root; get eth1Data(): phase0.Eth1Data; get latestBlockHeader(): phase0.BeaconBlockHeader; get previousJustifiedCheckpoint(): Checkpoint; get currentJustifiedCheckpoint(): Checkpoint; get finalizedCheckpoint(): Checkpoint; getBlockRootAtSlot(slot: Slot): Root; getBlockRootAtEpoch(epoch: Epoch): Root; getStateRootAtSlot(slot: Slot): Root; getRandaoMix(epoch: Epoch): Bytes32; getShufflingAtEpoch(epoch: Epoch): EpochShuffling; getBeaconCommittee(slot: Slot, index: CommitteeIndex): Uint32Array; getBeaconCommitteeCountPerSlot(epoch: Epoch): number; get previousDecisionRoot(): RootHex; get currentDecisionRoot(): RootHex; get nextDecisionRoot(): RootHex; getShufflingDecisionRoot(epoch: Epoch): RootHex; getPreviousShuffling(): EpochShuffling; getCurrentShuffling(): EpochShuffling; getNextShuffling(): EpochShuffling; get previousProposers(): ValidatorIndex[] | null; get currentProposers(): ValidatorIndex[]; get nextProposers(): ValidatorIndex[]; getBeaconProposer(slot: Slot): ValidatorIndex; get effectiveBalanceIncrements(): EffectiveBalanceIncrements; getEffectiveBalanceIncrementsZeroInactive(): EffectiveBalanceIncrements; getBalance(index: number): number; getValidator(index: ValidatorIndex): phase0.Validator; getValidatorsByStatus(statuses: Set, currentEpoch: Epoch): phase0.Validator[]; get validatorCount(): number; get activeValidatorCount(): number; getAllValidators(): phase0.Validator[]; getAllBalances(): number[]; get proposerRewards(): RewardCache; computeBlockRewards(block: BeaconBlock, proposerRewards?: RewardCache): Promise; computeAttestationsRewards(validatorIds?: (ValidatorIndex | string)[]): Promise; getLatestWeakSubjectivityCheckpointEpoch(): Epoch; getVoluntaryExitValidity(signedVoluntaryExit: phase0.SignedVoluntaryExit, verifySignature: boolean): VoluntaryExitValidity; isValidVoluntaryExit(signedVoluntaryExit: phase0.SignedVoluntaryExit, verifySignature: boolean): boolean; getFinalizedRootProof(): Uint8Array[]; getSingleProof(gindex: bigint): Uint8Array[]; createMultiProof(descriptor: Uint8Array): CompactMultiProof; computeUnrealizedCheckpoints(): { justifiedCheckpoint: phase0.Checkpoint; finalizedCheckpoint: phase0.Checkpoint; }; computeAnchorCheckpoint(): { checkpoint: phase0.Checkpoint; blockHeader: phase0.BeaconBlockHeader; }; get clonedCount(): number; get clonedCountWithTransferCache(): number; get createdWithTransferCache(): boolean; isStateValidatorsNodesPopulated(): boolean; loadOtherState(stateBytes: Uint8Array, seedValidatorsBytes?: Uint8Array, opts?: { preloadValidatorsAndBalances?: boolean; }): IBeaconStateView; toValue(): BeaconState; serialize(): Uint8Array; serializedSize(): number; serializeToBytes(output: ByteViews, offset: number): number; serializeValidators(): Uint8Array; serializedValidatorsSize(): number; serializeValidatorsToBytes(output: ByteViews, offset: number): number; hashTreeRoot(): Uint8Array; computeNewStateRoot(input: BlockSTFInput, modules: StateTransitionModules): ComputeNewStateRootResult; stateTransition({ block, ssz }: BlockSTFInput, options: StateTransitionOpts, _modules: StateTransitionModules): IBeaconStateView; processSlots(slot: Slot, opts?: { dontTransferCache?: boolean; }, _modules?: StateTransitionModules): IBeaconStateView; get previousEpochParticipation(): Uint8Array; get currentEpochParticipation(): Uint8Array; getPreviousEpochParticipation(validatorIndex: ValidatorIndex): number; getCurrentEpochParticipation(validatorIndex: ValidatorIndex): number; get currentSyncCommittee(): altair.SyncCommittee; get nextSyncCommittee(): altair.SyncCommittee; get currentSyncCommitteeIndexed(): SyncCommitteeCache; get syncProposerReward(): number; getIndexedSyncCommitteeAtEpoch(epoch: Epoch): SyncCommitteeCache; getIndexedSyncCommittee(slot: Slot): SyncCommitteeCache; computeSyncCommitteeRewards(block: BeaconBlock, validatorIds: (ValidatorIndex | string)[]): Promise; getSyncCommitteesWitness(): SyncCommitteeWitness; get latestExecutionPayloadHeader(): ExecutionPayloadHeader; get payloadBlockNumber(): number; get isExecutionStateType(): boolean; get isMergeTransitionComplete(): boolean; isExecutionEnabled(block: BeaconBlock | BlindedBeaconBlock): boolean; get historicalSummaries(): capella.HistoricalSummaries; getExpectedWithdrawals(): { expectedWithdrawals: capella.Withdrawal[]; processedBuilderWithdrawalsCount: number; processedPartialWithdrawalsCount: number; processedBuildersSweepCount: number; processedValidatorSweepCount: number; }; get pendingDeposits(): electra.PendingDeposits; get pendingDepositsCount(): number; get pendingPartialWithdrawals(): electra.PendingPartialWithdrawals; get pendingPartialWithdrawalsCount(): number; get pendingConsolidations(): electra.PendingConsolidations; get pendingConsolidationsCount(): number; get proposerLookahead(): fulu.ProposerLookahead; preVerifyBuilderDepositsPreGloas(_maxBuilderDeposits: number, _maxDurationMs: number): PreVerifyBuilderDepositsResult; clearPreGloasBuilderDepositCache(): void; get latestBlockHash(): Bytes32; get latestExecutionPayloadBid(): ExecutionPayloadBid; get payloadExpectedWithdrawals(): capella.Withdrawal[]; get builderPendingPayments(): gloas.BuilderPendingPayments; get builderPendingWithdrawals(): gloas.BuilderPendingWithdrawals; getBuilder(_index: BuilderIndex): gloas.Builder; getBuildersLength(): number; canBuilderCoverBid(_builderIndex: BuilderIndex, _bidAmount: number): boolean; getEpochPTCs(_epoch: Epoch): Uint32Array[]; getPayloadTimelinessCommittee(_slot: Slot): Uint32Array; getIndicesInPayloadTimelinessCommittee(_validatorIndex: ValidatorIndex, _slot: Slot): number[]; withParentPayloadApplied(_executionRequests: gloas.ExecutionRequests): IBeaconStateViewGloas; } //# sourceMappingURL=nativeBeaconStateView.d.ts.map