-
Notifications
You must be signed in to change notification settings - Fork 234
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR introduces a new proving orhestration system enabling a block to be proven concurrently with simulation. It also creates the `prover-client` package and moves some of the proving functionality to this package from `sequencer-client`.
- Loading branch information
1 parent
8a76068
commit 6a7ccca
Showing
64 changed files
with
2,459 additions
and
1,535 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
24 changes: 24 additions & 0 deletions
24
yarn-project/aztec-node/src/aztec-node/simulator-factory.ts
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,24 @@ | ||
import { DebugLogger } from '@aztec/foundation/log'; | ||
import { NativeACVMSimulator, SimulationProvider, WASMSimulator } from '@aztec/simulator'; | ||
|
||
import * as fs from 'fs/promises'; | ||
|
||
import { AztecNodeConfig } from './config.js'; | ||
|
||
export async function getSimulationProvider( | ||
config: AztecNodeConfig, | ||
logger?: DebugLogger, | ||
): Promise<SimulationProvider> { | ||
if (config.acvmBinaryPath && config.acvmWorkingDirectory) { | ||
try { | ||
await fs.access(config.acvmBinaryPath, fs.constants.R_OK); | ||
await fs.mkdir(config.acvmWorkingDirectory, { recursive: true }); | ||
logger?.(`Using native ACVM at ${config.acvmBinaryPath} and working directory ${config.acvmWorkingDirectory}`); | ||
return new NativeACVMSimulator(config.acvmWorkingDirectory, config.acvmBinaryPath); | ||
} catch { | ||
logger?.(`Failed to access ACVM at ${config.acvmBinaryPath}, falling back to WASM`); | ||
} | ||
} | ||
logger?.('Using WASM ACVM simulation'); | ||
return new WASMSimulator(); | ||
} |
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 |
---|---|---|
|
@@ -95,4 +95,8 @@ export class Body { | |
|
||
return new Body(txEffects); | ||
} | ||
|
||
static empty() { | ||
return new Body([]); | ||
} | ||
} |
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,41 @@ | ||
import { Fr, GlobalVariables, Proof } from '@aztec/circuits.js'; | ||
|
||
import { L2Block } from '../l2_block.js'; | ||
import { ProcessedTx } from '../tx/processed_tx.js'; | ||
|
||
export enum PROVING_STATUS { | ||
SUCCESS, | ||
FAILURE, | ||
} | ||
|
||
export type ProvingSuccess = { | ||
status: PROVING_STATUS.SUCCESS; | ||
block: L2Block; | ||
proof: Proof; | ||
}; | ||
|
||
export type ProvingFailure = { | ||
status: PROVING_STATUS.FAILURE; | ||
reason: string; | ||
}; | ||
|
||
export type ProvingResult = ProvingSuccess | ProvingFailure; | ||
|
||
export type ProvingTicket = { | ||
provingPromise: Promise<ProvingResult>; | ||
}; | ||
|
||
/** | ||
* The interface to the block prover. | ||
* Provides the ability to generate proofs and build rollups. | ||
*/ | ||
export interface BlockProver { | ||
startNewBlock( | ||
numTxs: number, | ||
globalVariables: GlobalVariables, | ||
l1ToL2Messages: Fr[], | ||
emptyTx: ProcessedTx, | ||
): Promise<ProvingTicket>; | ||
|
||
addNewTx(tx: ProcessedTx): Promise<void>; | ||
} |
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
11 changes: 11 additions & 0 deletions
11
yarn-project/circuit-types/src/interfaces/prover-client.ts
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,11 @@ | ||
import { BlockProver } from './block-prover.js'; | ||
|
||
/** | ||
* The interface to the prover client. | ||
* Provides the ability to generate proofs and build rollups. | ||
*/ | ||
export interface ProverClient extends BlockProver { | ||
start(): Promise<void>; | ||
|
||
stop(): Promise<void>; | ||
} |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from './tx.js'; | ||
export * from './tx_hash.js'; | ||
export * from './tx_receipt.js'; | ||
export * from './processed_tx.js'; |
File renamed without changes.
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
Oops, something went wrong.