Skip to content

Commit

Permalink
fix: Forking world state in prover-node (#7995)
Browse files Browse the repository at this point in the history
Attempt to fix the `Error in prover node work: Error No such file or
directory` error in prover-node when forking. Tested by connecting to
the container, modifying the js, and running prover-node manually.

---------

Co-authored-by: PhilWindle <philip.windle@gmail.com>
  • Loading branch information
spalladino and PhilWindle authored Aug 15, 2024
1 parent 3d61bdf commit ebffe96
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 6 additions & 1 deletion yarn-project/kv-store/src/lmdb/store.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,16 @@ describe('AztecLmdbStore', () => {
};

it('forks a persistent store', async () => {
const path = join(await mkdtemp(join(tmpdir(), 'aztec-store-test-')), 'main.mdb');
const path = await mkdtemp(join(tmpdir(), 'aztec-store-test-'));
const store = AztecLmdbStore.open(path, false);
await itForks(store);
});

it('forks a persistent store with no path', async () => {
const store = AztecLmdbStore.open(undefined, false);
await itForks(store);
});

it('forks an ephemeral store', async () => {
const store = AztecLmdbStore.open(undefined, true);
await itForks(store);
Expand Down
3 changes: 2 additions & 1 deletion yarn-project/kv-store/src/lmdb/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ export class AztecLmdbStore implements AztecKVStore {
async fork() {
const baseDir = this.path ? dirname(this.path) : tmpdir();
this.#log.debug(`Forking store with basedir ${baseDir}`);
const forkPath = join(await mkdtemp(join(baseDir, 'aztec-store-fork-')), 'root.mdb');
const forkPath =
(await mkdtemp(join(baseDir, 'aztec-store-fork-'))) + (this.isEphemeral || !this.path ? '/data.mdb' : '');
this.#log.verbose(`Forking store to ${forkPath}`);
await this.#rootDb.backup(forkPath, false);
const forkDb = open(forkPath, { noSync: this.isEphemeral });
Expand Down

0 comments on commit ebffe96

Please sign in to comment.