refactor: make optimisticUpdateCallback a dedicated type

This commit is contained in:
Derrick Hammer 2023-07-13 02:53:00 -04:00
parent 4b9aca2086
commit 977d33b768
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
2 changed files with 5 additions and 3 deletions

View File

@ -2,8 +2,8 @@ import { ClientConfig, ExecutionInfo, IProver, IStore } from "#interfaces.js";
import { POLLING_DELAY } from "#constants.js"; import { POLLING_DELAY } from "#constants.js";
import { import {
computeSyncPeriodAtSlot, computeSyncPeriodAtSlot,
getCurrentSlot,
deserializeSyncCommittee, deserializeSyncCommittee,
getCurrentSlot,
} from "@lodestar/light-client/utils"; } from "@lodestar/light-client/utils";
import bls, { init } from "@chainsafe/bls/switchable"; import bls, { init } from "@chainsafe/bls/switchable";
import { Mutex } from "async-mutex"; import { Mutex } from "async-mutex";
@ -13,13 +13,13 @@ import {
getDefaultClientConfig, getDefaultClientConfig,
optimisticUpdateVerify, optimisticUpdateVerify,
} from "#util.js"; } from "#util.js";
import { capella, LightClientUpdate, OptimisticUpdate } from "#types.js"; import { LightClientUpdate, OptimisticUpdateCallback } from "#types.js";
import { assertValidLightClientUpdate } from "@lodestar/light-client/validation"; import { assertValidLightClientUpdate } from "@lodestar/light-client/validation";
export interface BaseClientOptions { export interface BaseClientOptions {
prover: IProver; prover: IProver;
store: IStore; store: IStore;
optimisticUpdateCallback: () => Promise<OptimisticUpdate>; optimisticUpdateCallback: OptimisticUpdateCallback;
} }
export default abstract class BaseClient { export default abstract class BaseClient {

View File

@ -18,3 +18,5 @@ export type VerifyWithReason =
| { correct: false; reason: string }; | { correct: false; reason: string };
export { capella, phase0 }; export { capella, phase0 };
export type OptimisticUpdateCallback = () => Promise<OptimisticUpdate>;