-
Notifications
You must be signed in to change notification settings - Fork 244
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Run block-proving jobs in parallel by forking world-state (#7655)
# Goal We want to be able to kick off more than one `prove(blocknumber)` job in the prover-node at the same time. We currently cannot do it because the prover-node has a single world-state, and building a proof modifies world-state. In particular, preparing the inputs for base rollups modifies state trees, and finalising the block modifies the archive tree. # Why? This'll be needed for the proving integration contest, in case we generate blocks faster than the time it takes to prove them. It may still be useful once we move to epoch proving and sequencer-prover coordination, since the same prover could be picked for generating proofs for two consecutive epochs. # How? ## The easy way Easiest approach is to keep everything as-is today, and clone the world state before kicking off a job. Eventually, once we implement [Phil's world-state](AztecProtocol/engineering-designs#9), we can use the writeable world-state snapshots for this. **This is what we're doing on this PR.** ## The not-so-easy way Another approach is to decouple input-generation from proving. Today the prover-orchestrator is responsible for computing all inputs, but this is not strictly needed. We can have one component that generates all inputs, modifies world-state, and outputs a graph of proving jobs (as Mitch commented [here](https://aztecprotocol.slack.com/archives/C04BTJAA694/p1722195399887399?thread_ts=1722195378.794149&cid=C04BTJAA694)). And then another component that orchestrates the execution of proving jobs exclusively based on their dependencies. Note that this new component would be a good fit for generating a block in the sequencer, which today runs an orchestrator without proving enabled to get to a block header. It's unclear whether this component should run everything serially (like [the old block builder](https://aztecprotocol.slack.com/archives/C04BTJAA694/p1722195399887399?thread_ts=1722195378.794149&cid=C04BTJAA694) did), or it makes more sense to fan out circuit simulation jobs to workers (like the proving orchestrator can do now).
- Loading branch information
1 parent
f0f28fc
commit d3c8237
Showing
34 changed files
with
495 additions
and
370 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { mkdtemp } from 'fs/promises'; | ||
import { tmpdir } from 'os'; | ||
import { join } from 'path'; | ||
|
||
import { AztecLmdbStore } from './store.js'; | ||
|
||
describe('AztecLmdbStore', () => { | ||
const itForks = async (store: AztecLmdbStore) => { | ||
const singleton = store.openSingleton('singleton'); | ||
await singleton.set('foo'); | ||
|
||
const forkedStore = await store.fork(); | ||
const forkedSingleton = forkedStore.openSingleton('singleton'); | ||
expect(forkedSingleton.get()).toEqual('foo'); | ||
await forkedSingleton.set('bar'); | ||
expect(singleton.get()).toEqual('foo'); | ||
}; | ||
|
||
it('forks a persistent store', async () => { | ||
const path = join(await mkdtemp(join(tmpdir(), 'aztec-store-test-')), 'main.mdb'); | ||
const store = AztecLmdbStore.open(path, false); | ||
await itForks(store); | ||
}); | ||
|
||
it('forks an ephemeral store', async () => { | ||
const store = AztecLmdbStore.open(undefined, true); | ||
await itForks(store); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.