diff --git a/noir-projects/aztec-nr/aztec/src/context/private_context.nr b/noir-projects/aztec-nr/aztec/src/context/private_context.nr index 181d5d63e53..8d02ab3db00 100644 --- a/noir-projects/aztec-nr/aztec/src/context/private_context.nr +++ b/noir-projects/aztec-nr/aztec/src/context/private_context.nr @@ -193,10 +193,10 @@ impl PrivateContext { } pub fn end_setup(&mut self) { - dep::protocol_types::debug_log::debug_log_format( - "Ending setup at counter {0}", - [self.side_effect_counter as Field] - ); + // dep::protocol_types::debug_log::debug_log_format( + // "Ending setup at counter {0}", + // [self.side_effect_counter as Field] + // ); self.min_revertible_side_effect_counter = self.side_effect_counter; } diff --git a/yarn-project/circuit-types/src/stats/metrics.ts b/yarn-project/circuit-types/src/stats/metrics.ts index 83f26969ea1..8960a9dd962 100644 --- a/yarn-project/circuit-types/src/stats/metrics.ts +++ b/yarn-project/circuit-types/src/stats/metrics.ts @@ -34,7 +34,13 @@ export const Metrics = [ { name: 'avm_simulation_time_ms', groupBy: 'app-circuit-name', - description: 'Time to simulate an AVM circuit.', + description: 'Time to simulate an AVM program.', + events: ['avm-simulation'], + }, + { + name: 'avm_simulation_bytecode_size_in_bytes', + groupBy: 'app-circuit-name', + description: 'Uncompressed bytecode size for an AVM program.', events: ['avm-simulation'], }, { diff --git a/yarn-project/circuit-types/src/stats/stats.ts b/yarn-project/circuit-types/src/stats/stats.ts index 66d5b48f4eb..0ddb50c7acf 100644 --- a/yarn-project/circuit-types/src/stats/stats.ts +++ b/yarn-project/circuit-types/src/stats/stats.ts @@ -112,6 +112,8 @@ export type AvmSimulationStats = { appCircuitName: string; /** Duration in ms. */ duration: number; + /** Uncompressed bytecode size. */ + bytecodeSize: number; }; /** Stats for witness generation. */ diff --git a/yarn-project/scripts/src/benchmarks/aggregate.ts b/yarn-project/scripts/src/benchmarks/aggregate.ts index 42a5b8d0d62..8e7c8d8cba6 100644 --- a/yarn-project/scripts/src/benchmarks/aggregate.ts +++ b/yarn-project/scripts/src/benchmarks/aggregate.ts @@ -153,6 +153,7 @@ function processCircuitProving(entry: CircuitProvingStats, results: BenchmarkCol function processAvmSimulation(entry: AvmSimulationStats, results: BenchmarkCollectedResults) { append(results, 'avm_simulation_time_ms', entry.appCircuitName, entry.duration); + append(results, 'avm_simulation_bytecode_size_in_bytes', entry.appCircuitName, entry.bytecodeSize); } function processDbAccess(entry: PublicDBAccessStats, results: BenchmarkCollectedResults) { diff --git a/yarn-project/scripts/src/benchmarks/markdown.ts b/yarn-project/scripts/src/benchmarks/markdown.ts index 5c7d55390d2..de306a4434a 100644 --- a/yarn-project/scripts/src/benchmarks/markdown.ts +++ b/yarn-project/scripts/src/benchmarks/markdown.ts @@ -192,6 +192,7 @@ export function getMarkdown(prNumber: number) { const kernelCircuitMetrics = Metrics.filter(m => m.groupBy === 'protocol-circuit-name').map(m => m.name); const appCircuitMetrics = Metrics.filter(m => m.groupBy === 'app-circuit-name') .filter(m => m.name !== 'avm_simulation_time_ms') + .filter(m => m.name !== 'avm_simulation_bytecode_size_in_bytes') .map(m => m.name); const metricsByClassesRegistered = Metrics.filter(m => m.groupBy === 'classes-registered').map(m => m.name); const metricsByFeePaymentMethod = Metrics.filter(m => m.groupBy === 'fee-payment-method').map(m => m.name); @@ -260,7 +261,7 @@ ${getTableContent( Time to simulate various public functions in the AVM. ${getTableContent( - transpose(pick(benchmark, ['avm_simulation_time_ms'])), + transpose(pick(benchmark, ['avm_simulation_time_ms', 'avm_simulation_bytecode_size_in_bytes'])), transpose(baseBenchmark), '', 'Function', diff --git a/yarn-project/simulator/src/public/executor.ts b/yarn-project/simulator/src/public/executor.ts index ae32fde1d18..fde6b655eeb 100644 --- a/yarn-project/simulator/src/public/executor.ts +++ b/yarn-project/simulator/src/public/executor.ts @@ -70,6 +70,7 @@ export class PublicExecutor { const avmContext = new AvmContext(worldStateJournal, executionEnv, machineState); const simulator = new AvmSimulator(avmContext); const avmResult = await simulator.execute(); + const bytecode = simulator.getBytecode(); // Commit the journals state to the DBs since this is a top-level execution. // Observe that this will write all the state changes to the DBs, not only the latest for each slot. @@ -77,11 +78,14 @@ export class PublicExecutor { await avmContext.persistableState.publicStorage.commitToDB(); PublicExecutor.log.verbose( - `[AVM] ${fnName} returned, reverted: ${avmResult.reverted}, reason: ${avmResult.revertReason}.`, + `[AVM] ${fnName} returned, reverted: ${avmResult.reverted}${ + avmResult.reverted ? ', reason: ' + avmResult.revertReason : '' + }.`, { eventName: 'avm-simulation', appCircuitName: fnName ?? 'unknown', duration: timer.ms(), + bytecodeSize: bytecode!.length, } satisfies AvmSimulationStats, ); @@ -91,7 +95,7 @@ export class PublicExecutor { execution, startGas, avmContext, - simulator.getBytecode(), + bytecode, ); // TODO(https://github.com/AztecProtocol/aztec-packages/issues/5818): is this really needed? diff --git a/yarn-project/simulator/src/public/public_db_sources.ts b/yarn-project/simulator/src/public/public_db_sources.ts index cfa3c935170..da99bb02d4e 100644 --- a/yarn-project/simulator/src/public/public_db_sources.ts +++ b/yarn-project/simulator/src/public/public_db_sources.ts @@ -239,7 +239,7 @@ export class WorldStateDB implements CommitmentsDB { return undefined; } - this.log.verbose(`[DB] Fetched nullifier membership`, { + this.log.debug(`[DB] Fetched nullifier membership`, { eventName: 'public-db-access', duration: timer.ms(), operation: 'get-nullifier-membership-witness-at-latest-block', @@ -277,7 +277,7 @@ export class WorldStateDB implements CommitmentsDB { messageIndex, ); - this.log.verbose(`[DB] Fetched L1 to L2 message membership`, { + this.log.debug(`[DB] Fetched L1 to L2 message membership`, { eventName: 'public-db-access', duration: timer.ms(), operation: 'get-l1-to-l2-message-membership-witness', @@ -289,7 +289,7 @@ export class WorldStateDB implements CommitmentsDB { public async getL1ToL2LeafValue(leafIndex: bigint): Promise { const timer = new Timer(); const leafValue = await this.db.getLeafValue(MerkleTreeId.L1_TO_L2_MESSAGE_TREE, leafIndex); - this.log.verbose(`[DB] Fetched L1 to L2 message leaf value`, { + this.log.debug(`[DB] Fetched L1 to L2 message leaf value`, { eventName: 'public-db-access', duration: timer.ms(), operation: 'get-l1-to-l2-message-leaf-value', @@ -300,7 +300,7 @@ export class WorldStateDB implements CommitmentsDB { public async getCommitmentIndex(commitment: Fr): Promise { const timer = new Timer(); const index = await this.db.findLeafIndex(MerkleTreeId.NOTE_HASH_TREE, commitment); - this.log.verbose(`[DB] Fetched commitment index`, { + this.log.debug(`[DB] Fetched commitment index`, { eventName: 'public-db-access', duration: timer.ms(), operation: 'get-commitment-index', @@ -311,7 +311,7 @@ export class WorldStateDB implements CommitmentsDB { public async getNullifierIndex(nullifier: Fr): Promise { const timer = new Timer(); const index = await this.db.findLeafIndex(MerkleTreeId.NULLIFIER_TREE, nullifier.toBuffer()); - this.log.verbose(`[DB] Fetched nullifier index`, { + this.log.debug(`[DB] Fetched nullifier index`, { eventName: 'public-db-access', duration: timer.ms(), operation: 'get-nullifier-index',