mirror of
https://github.com/ChainSafe/lodestar.git
synced 2026-01-09 15:48:08 -05:00
update utils to accept the metrics
This commit is contained in:
@@ -23,7 +23,7 @@ export async function regenerateState(
|
||||
|
||||
try {
|
||||
const plan = buildStateRegenPlan(ctx.layers, target);
|
||||
const artifacts = await fetchStateRegenArtifacts(ctx.db, plan, opts);
|
||||
const artifacts = await fetchStateRegenArtifacts({db: ctx.db, metrics: ctx.metrics}, plan, opts);
|
||||
const finalState = await applyStateRegenPlan(ctx, plan, artifacts);
|
||||
const state = snapshotToBeaconState(ctx, finalState);
|
||||
|
||||
@@ -65,10 +65,10 @@ export async function storeDifferentialState(
|
||||
|
||||
const lastDiffSlot = plan.diffSlots.at(-1);
|
||||
if (slot === lastDiffSlot) {
|
||||
const artifacts = await fetchStateRegenArtifacts(db, plan);
|
||||
const artifacts = await fetchStateRegenArtifacts({db: ctx.db, metrics: ctx.metrics}, plan);
|
||||
const finalState = await applyStateRegenPlan(ctx, plan, artifacts);
|
||||
const diffState = await computeStateDifferential(
|
||||
{codec, config},
|
||||
{codec, config, metrics: ctx.metrics},
|
||||
config.getForkTypes(slot).BeaconState.deserialize(stateBytes),
|
||||
finalState
|
||||
);
|
||||
|
||||
@@ -10,7 +10,7 @@ import {BeaconStateDifferential, BeaconStateSnapshot} from "./ssz.js";
|
||||
* Compute the differential state between a base state and a target state view
|
||||
*/
|
||||
export function computeStateDifferential(
|
||||
modules: {codec: IStateDiffCodec; config: ChainForkConfig; metrics?: DifferentialStateRegenMetrics},
|
||||
modules: {codec: IStateDiffCodec; config: ChainForkConfig; metrics?: DifferentialStateRegenMetrics | null},
|
||||
base: BeaconState,
|
||||
target: BeaconStateSnapshot
|
||||
): BeaconStateDifferential {
|
||||
@@ -40,7 +40,7 @@ export function computeStateDifferential(
|
||||
* Apply a differential state to a base state view
|
||||
*/
|
||||
export function applyStateDifferential(
|
||||
modules: {codec: IStateDiffCodec; logger?: Logger; metrics?: DifferentialStateRegenMetrics},
|
||||
modules: {codec: IStateDiffCodec; logger?: Logger; metrics?: DifferentialStateRegenMetrics | null},
|
||||
base: BeaconStateSnapshot,
|
||||
diff: BeaconStateDifferential
|
||||
): BeaconStateSnapshot {
|
||||
@@ -77,7 +77,7 @@ export function applyStateDifferential(
|
||||
}
|
||||
|
||||
export async function replayStateDifferentials(
|
||||
modules: {codec: IStateDiffCodec; logger?: Logger},
|
||||
modules: {codec: IStateDiffCodec; logger?: Logger; metrics?: DifferentialStateRegenMetrics | null},
|
||||
{
|
||||
stateDifferentials,
|
||||
stateSnapshot,
|
||||
@@ -102,7 +102,7 @@ export async function getStateDifferential(
|
||||
}
|
||||
|
||||
export async function getStateDifferentials(
|
||||
modules: {db: IBeaconDb},
|
||||
modules: {db: IBeaconDb; metrics?: DifferentialStateRegenMetrics | null},
|
||||
{slots}: {slots: Slot[]}
|
||||
): Promise<BeaconStateDifferential[]> {
|
||||
const result: BeaconStateDifferential[] = [];
|
||||
|
||||
Reference in New Issue
Block a user