import { ForkSeq } from "@lodestar/params"; import { Bytes32, DomainType, Epoch, ValidatorIndex } from "@lodestar/types"; import { EffectiveBalanceIncrements } from "../cache/effectiveBalanceIncrements.js"; import { BeaconStateAllForks, BeaconStateGloas, CachedBeaconStateAllForks } from "../types.js"; /** * Compute proposer indices for an epoch */ export declare function computeProposers(fork: ForkSeq, epochSeed: Uint8Array, shuffling: { epoch: Epoch; activeIndices: Uint32Array; }, effectiveBalanceIncrements: EffectiveBalanceIncrements): number[]; /** * Return from ``indices`` a random index sampled by effective balance. * This is just to make sure lodestar follows the spec, this is not for production. * * SLOW CODE - 🐢 */ export declare function naiveComputeProposerIndex(fork: ForkSeq, effectiveBalanceIncrements: EffectiveBalanceIncrements, indices: ArrayLike, seed: Uint8Array): ValidatorIndex; /** * Optimized version of `naiveComputeProposerIndex`. * It shows > 3x speedup according to the perf test. */ export declare function computeProposerIndex(fork: ForkSeq, effectiveBalanceIncrements: EffectiveBalanceIncrements, indices: Uint32Array, seed: Uint8Array): ValidatorIndex; /** * Return the proposer indices for the given `epoch`. * A more generic version of `computeProposers` */ export declare function computeProposerIndices(fork: ForkSeq, state: CachedBeaconStateAllForks, shuffling: { activeIndices: Uint32Array; }, epoch: Epoch): ValidatorIndex[]; /** * Naive version, this is not supposed to be used in production. * See `computeProposerIndex` for the optimized version. * * Return the sync committee indices for a given state and epoch. * Aligns `epoch` to `baseEpoch` so the result is the same with any `epoch` within a sync period. * Note: This function should only be called at sync committee period boundaries, as * ``get_sync_committee_indices`` is not stable within a given period. * * SLOW CODE - 🐢 */ export declare function naiveGetNextSyncCommitteeIndices(fork: ForkSeq, state: BeaconStateAllForks, activeValidatorIndices: ArrayLike, effectiveBalanceIncrements: EffectiveBalanceIncrements): ValidatorIndex[]; /** * Optmized version of `naiveGetNextSyncCommitteeIndices`. * * In the worse case scenario, this could be >1000x speedup according to the perf test. */ export declare function getNextSyncCommitteeIndices(fork: ForkSeq, state: BeaconStateAllForks, activeValidatorIndices: Uint32Array, effectiveBalanceIncrements: EffectiveBalanceIncrements): Uint32Array; export declare function naiveGetPayloadTimlinessCommitteeIndices(state: BeaconStateGloas, shuffling: { committees: Uint32Array[][]; }, effectiveBalanceIncrements: EffectiveBalanceIncrements, epoch: Epoch): ValidatorIndex[][]; export declare function naiveComputePayloadTimelinessCommitteeIndices(effectiveBalanceIncrements: EffectiveBalanceIncrements, indices: ArrayLike, seed: Uint8Array): ValidatorIndex[]; /** * Return the shuffled validator index corresponding to ``seed`` (and ``index_count``). * * Swap or not * https://link.springer.com/content/pdf/10.1007%2F978-3-642-32009-5_1.pdf * * See the 'generalized domain' algorithm on page 3. * This is the naive implementation just to make sure lodestar follows the spec, this is not for production. * The optimized version is in `getComputeShuffledIndexFn`. */ export declare function computeShuffledIndex(index: number, indexCount: number, seed: Bytes32): number; type ComputeShuffledIndexFn = (index: number) => number; /** * An optimized version of `computeShuffledIndex`, this is for production. */ export declare function getComputeShuffledIndexFn(indexCount: number, seed: Bytes32): ComputeShuffledIndexFn; /** * Return the randao mix at a recent [[epoch]]. */ export declare function getRandaoMix(state: BeaconStateAllForks, epoch: Epoch): Bytes32; /** * Return the seed at [[epoch]]. */ export declare function getSeed(state: BeaconStateAllForks, epoch: Epoch, domainType: DomainType): Uint8Array; export {}; //# sourceMappingURL=seed.d.ts.map