Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: checkpoint file datastore on docker #7525

Merged
merged 1 commit into from
Mar 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/beacon-node/src/chain/chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ export class BeaconChain implements IBeaconChain {
{
config,
db,
dataDir,
logger,
processShutdownCallback,
clock,
Expand All @@ -197,6 +198,7 @@ export class BeaconChain implements IBeaconChain {
}: {
config: BeaconConfig;
db: IBeaconDb;
dataDir: string;
logger: Logger;
processShutdownCallback: ProcessShutdownCallback;
/** Used for testing to supply fake clock */
Expand Down Expand Up @@ -305,7 +307,7 @@ export class BeaconChain implements IBeaconChain {
bufferPool: this.bufferPool,
datastore: fileDataStore
? // debug option if we want to investigate any issues with the DB
new FileCPStateDatastore()
new FileCPStateDatastore(dataDir)
: // production option
new DbCPStateDatastore(this.db),
},
Expand Down
7 changes: 4 additions & 3 deletions packages/beacon-node/src/chain/stateCache/datastore/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ const CHECKPOINT_FILE_NAME_LENGTH = 82;
export class FileCPStateDatastore implements CPStateDatastore {
private readonly folderPath: string;

constructor(parentDir = ".") {
// by default use the beacon folder `/beacon/checkpoint_states`
this.folderPath = path.join(parentDir, CHECKPOINT_STATES_FOLDER);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh yes, this is definitely wrong, can you re-open this branch against unstable please

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this ever merged on unstable?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not yet, we should make sure to merge changes which are definitely bugs and do not do experimental stuff, I will definitely make sure to confirm we got all important changes from holesky-rescue into unstable once the network is more stable. But generally speaking, a lot of the code changes need more review and consideration to be mergable to unstable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

constructor(dataDir: string) {
// service deployment: `/beacon/checkpoint_states`
// docker deployment: `/data/checkpoint_states`
this.folderPath = path.join(dataDir, CHECKPOINT_STATES_FOLDER);
}

async init(): Promise<void> {
Expand Down
3 changes: 3 additions & 0 deletions packages/beacon-node/src/node/nodejs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export type BeaconNodeInitModules = {
logger: LoggerNode;
processShutdownCallback: ProcessShutdownCallback;
peerId: PeerId;
dataDir: string;
peerStoreDir?: string;
anchorState: BeaconStateAllForks;
wsCheckpoint?: phase0.Checkpoint;
Expand Down Expand Up @@ -149,6 +150,7 @@ export class BeaconNode {
logger,
processShutdownCallback,
peerId,
dataDir,
peerStoreDir,
anchorState,
wsCheckpoint,
Expand Down Expand Up @@ -224,6 +226,7 @@ export class BeaconNode {
const chain = new BeaconChain(opts.chain, {
config,
clock,
dataDir,
db,
logger: logger.child({module: LoggerModule.chain}),
processShutdownCallback,
Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/cmds/beacon/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export async function beaconHandler(args: BeaconArgs & GlobalArgs): Promise<void
logger,
processShutdownCallback,
peerId,
dataDir: beaconPaths.dataDir,
peerStoreDir: beaconPaths.peerStoreDir,
anchorState,
wsCheckpoint,
Expand Down
Loading