libethsync/src/interfaces.ts

45 lines
1.2 KiB
TypeScript
Raw Normal View History

2023-07-10 20:44:58 +00:00
import { BeaconConfig } from "@lodestar/config";
import { GenesisData, LightClientUpdate } from "#types.js";
import { ProverRequestCallback } from "#client/index.js";
import BaseClient from "#baseClient.js";
2023-07-10 20:44:58 +00:00
export interface IProver {
get callback(): ProverRequestCallback;
set client(value: BaseClient);
2023-07-10 20:44:58 +00:00
getSyncUpdate(
startPeriod: number,
2023-07-10 20:44:58 +00:00
period: number,
): Promise<LightClientUpdate[]>;
2023-07-10 20:44:58 +00:00
}
export interface IStore {
addUpdate(period: number, update: LightClientUpdate): void;
getUpdate(period: number): Uint8Array;
hasUpdate(period: number): boolean;
2023-07-10 20:44:58 +00:00
}
export interface IVerifyingProvider {
update(blockNumber: number, blockHash: string): void;
}
export type IVerifyingProviderConstructor<
U extends IVerifyingProvider = IVerifyingProvider,
> = new (requestHandler: Function, blockNumber: number, blockHash: string) => U;
export interface ClientConfig {
genesis: GenesisData;
chainConfig: BeaconConfig;
// treeDegree in case of Superlight and batchSize in case of Light and Optimistic
n?: number;
}
export interface ExecutionInfo {
blockHash: string;
blockNumber: number;
}
export interface ConsensusCommitteeUpdateRequest {
2023-07-10 20:44:58 +00:00
start: number;
count: number;
}