Skip to content

Commit

Permalink
fix: archive finalized state when shutting down beacon node (#7221)
Browse files Browse the repository at this point in the history
  • Loading branch information
nflaig authored Nov 8, 2024
1 parent 10d15dc commit 0d404f8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/beacon-node/src/chain/archiver/archiver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export class Archiver {

/** Archive latest finalized state */
async persistToDisk(): Promise<void> {
return this.statesArchiverStrategy.maybeArchiveState(this.chain.forkChoice.getFinalizedCheckpoint());
return this.statesArchiverStrategy.archiveState(this.chain.forkChoice.getFinalizedCheckpoint());
}

private onFinalizedCheckpoint = async (finalized: CheckpointWithHex): Promise<void> => {
Expand Down
1 change: 1 addition & 0 deletions packages/beacon-node/src/chain/archiver/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,5 @@ export interface StateArchiveStrategy {
onCheckpoint(stateRoot: RootHex, metrics?: Metrics | null): Promise<void>;
onFinalizedCheckpoint(finalized: CheckpointWithHex, metrics?: Metrics | null): Promise<void>;
maybeArchiveState(finalized: CheckpointWithHex, metrics?: Metrics | null): Promise<void>;
archiveState(finalized: CheckpointWithHex, metrics?: Metrics | null): Promise<void>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export class FrequencyStateArchiveStrategy implements StateArchiveStrategy {
* Archives finalized states from active bucket to archive bucket.
* Only the new finalized state is stored to disk
*/
private async archiveState(finalized: CheckpointWithHex, metrics?: Metrics | null): Promise<void> {
async archiveState(finalized: CheckpointWithHex, metrics?: Metrics | null): Promise<void> {
// starting from Mar 2024, the finalized state could be from disk or in memory
const finalizedStateOrBytes = await this.regen.getCheckpointStateOrBytes(finalized);
const {rootHex} = finalized;
Expand Down

0 comments on commit 0d404f8

Please sign in to comment.