import { Lightclient } from '@lodestar/light-client'; import { BaseNetwork } from '../network.js'; import { NetworkId } from '../types.js'; import { BeaconLightClientNetworkContentType, SyncStrategy } from './types.js'; import type { PortalNetwork } from '../../client/client.js'; import type { FindContentMessage, OfferMessage } from '../../wire/types.js'; import type { INodeAddress } from '@chainsafe/discv5/lib/session/nodeInfo.js'; import type { NodeId } from '@chainsafe/enr'; import type { Union } from '@chainsafe/ssz/lib/interface.js'; import type { BeaconConfig } from '@lodestar/config'; import type { Debugger } from 'debug'; export declare class BeaconLightClientNetwork extends BaseNetwork { networkId: NetworkId.BeaconLightClientNetwork; beaconConfig: BeaconConfig; networkName: string; logger: Debugger; lightClient: Lightclient | undefined; bootstrapFinder: Map; syncStrategy: SyncStrategy; trustedBlockRoot: string | undefined; constructor(client: PortalNetwork, nodeRadius?: bigint, trustedBlockRoot?: string, sync?: SyncStrategy); /** * This is the private method employed by the sync strategy whereby we try to find * the `LightClientBootstrap` corresponding to the `trustedBlockRoot` provided when the * BeaconLightClientNetwork was instantiated * @param nodeId NodeId for a peer that was just discovered by the Portal Network `client` * @param network the network ID for the node just discovered */ private getBootstrap; /** * This is the private method employed by the sync strategy whereby we try to identify a * reliable starting point for starting our CL Light Client sync by polling newly found * Portal Network nodes for their last three Light Client updates (corresponding to the * 3 most recent sync periods). Once we reach a minimum number of acceptable of votes, we * determine a trusted block root based on the finalized header root with the most "votes" * (i.e. appearances in peer responses) and try to start our sync from that point. * @param nodeId NodeId for a peer that was just discovered by the Portal Network `client` * @param network the network ID for the node just discovered */ private getBootStrapVote; /** * Initializes a Lodestar light client using a trusted beacon block root * @param blockRoot trusted beacon block root within the weak subjectivity period for retrieving * the `lightClientBootStrap` */ initializeLightClient: (blockRoot: string) => Promise; findContentLocally: (contentKey: Uint8Array) => Promise; sendFindContent: (dstId: string, key: Uint8Array) => Promise | undefined>; protected handleFindContent: (src: INodeAddress, requestId: bigint, network: Uint8Array, decodedContentMessage: FindContentMessage) => Promise; /** * The generalized `store` method used to put data into the DB * @param contentType the content type being stored (defined in @link { BeaconLightClientNetworkContentType }) * @param contentKey the network level content key formatted as a prefixed hex string * @param value the Uint8Array corresponding to the SSZ serialized value being stored */ store: (contentType: BeaconLightClientNetworkContentType, contentKey: string, value: Uint8Array) => Promise; /** * Specialized store method for the LightClientUpdatesByRange object since this object is not stored * directly in the DB but constructed from one or more Light Client Updates which are stored directly * @param range - an SSZ serialized LightClientUpdatesByRange object as defined in the Portal Network Specs */ storeUpdateRange: (range: Uint8Array) => Promise; /** * This is a helper method for computing the key used to store individual LightClientUpdates in the DB * @param update An ssz serialized LightClientUpdate as a Uint8Array for a given sync period * or the number corresponding to the sync period update desired * @returns the hex prefixed string version of the Light Client Update storage key * (0x04 + hexidecimal representation of the sync committee period) */ computeLightClientUpdateKey: (input: Uint8Array | number) => string; /** * Internal helper called by `findContentLocally` to construct the LightClientUpdatesByRange object as defined in the * Portal Network Specs * @param contentKey a raw LightClientUpdatesByRange key as defined in the Portal Network Specs (not the content key prefixed with * the content type of 1) * @returns an SSZ serialized LightClientUpdatesByRange object as a Uint8Array */ private constructLightClientRange; /** * Offers content corresponding to `contentKeys` to peer corresponding to `dstId` * @param dstId node ID of a peer * @param contentKeys content keys being offered as specified by the subnetwork */ sendOffer: (dstId: string, contentKeys: Uint8Array[]) => Promise; /** * We override the BaseNetwork `handleOffer` since content gossip for the Beacon Light client network * assumes that all node have all of hthe * @param src OFFERing node's address * @param requestId request ID passed in OFFER message * @param msg OFFER message containing a list of offered content keys */ handleOffer: (src: INodeAddress, requestId: bigint, msg: OfferMessage) => Promise; } //# sourceMappingURL=beacon.d.ts.map