Skip to content
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
3 changes: 2 additions & 1 deletion bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ function test {
# and also that half the cpus are logical, not physical.
echo "Gathering tests to run..."
tests=$(test_cmds $@)

# Note: Capturing strips last newline. The echo re-adds it.
local num
[ -z "$tests" ] && num=0 || num=$(echo "$tests" | wc -l)
Expand Down Expand Up @@ -229,7 +230,6 @@ function build {
release-image/bootstrap.sh
spartan/bootstrap.sh
aztec-up/bootstrap.sh
build_bench
)

for project in "${serial_projects[@]}"; do
Expand Down Expand Up @@ -274,6 +274,7 @@ function bench {
return
fi
echo_header "bench all"
build_bench
find . -type d -iname bench-out | xargs rm -rf
bench_cmds | STRICT_SCHEDULING=1 parallelise
rm -rf bench-out
Expand Down
2 changes: 2 additions & 0 deletions yarn-project/bb-prover/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
"@aztec/world-state": "workspace:^",
"commander": "^12.1.0",
"pako": "^2.1.0",
"pidusage": "^4.0.1",
"source-map-support": "^0.5.21",
"tslib": "^2.4.0"
},
Expand All @@ -90,6 +91,7 @@
"@jest/globals": "^29.5.0",
"@types/jest": "^29.5.0",
"@types/node": "^22.15.17",
"@types/pidusage": "^2.0.5",
"@types/source-map-support": "^0.5.10",
"jest": "^29.5.0",
"jest-mock-extended": "^3.0.3",
Expand Down
17 changes: 15 additions & 2 deletions yarn-project/bb-prover/src/bb/execute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import type { AvmCircuitInputs, AvmCircuitPublicInputs } from '@aztec/stdlib/avm
import * as proc from 'child_process';
import { promises as fs } from 'fs';
import { basename, dirname, join } from 'path';
import pidusage from 'pidusage';

import type { UltraHonkFlavor } from '../honk.js';

Expand Down Expand Up @@ -97,11 +98,23 @@ export function executeBB(

bb.stdout.on('data', data => {
const message = data.toString('utf-8').replace(/\n$/, '');
logger(message);
pidusage(bb.pid!, (err, stats) => {
if (err) {
logger(message);
} else {
logger(`${message} (mem: ${(stats.memory / 1024 / 1024).toFixed(2)}MiB)`);
}
});
});
bb.stderr.on('data', data => {
const message = data.toString('utf-8').replace(/\n$/, '');
logger(message);
pidusage(bb.pid!, (err, stats) => {
if (err) {
logger(message);
} else {
logger(`${message} (mem: ${(stats.memory / 1024 / 1024).toFixed(2)}MiB)`);
}
});
});
bb.on('close', (exitCode: number, signal?: string) => {
if (timeoutId) {
Expand Down
6 changes: 6 additions & 0 deletions yarn-project/end-to-end/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ function test {

function bench_cmds {
echo "$hash:ISOLATE=1:NAME=bench_build_block BENCH_OUTPUT=bench-out/build-block.bench.json yarn-project/end-to-end/scripts/run_test.sh simple bench_build_block"

for client_flow in client_flows/bridging client_flows/deployments client_flows/amm client_flows/account_deployments client_flows/transfers; do
echo "$hash:ISOLATE=1:CPUS=8:NAME=$client_flow BENCHMARK_CONFIG=key_flows LOG_LEVEL=error BENCH_OUTPUT=bench-out/ yarn-project/end-to-end/scripts/run_test.sh simple $client_flow"
done

for dir in $bench_fixtures_dir/*; do
for runtime in native wasm; do
echo "$hash:CPUS=8 barretenberg/cpp/scripts/ci_benchmark_ivc_flows.sh $runtime ../../yarn-project/end-to-end/$dir"
Expand All @@ -82,6 +87,7 @@ function build_bench {
exit 1
fi
parallel --tag --line-buffer --halt now,fail=1 'docker_isolate "scripts/run_test.sh simple {}"' ::: \
client_flows/account_deployments \
client_flows/deployments \
client_flows/bridging \
client_flows/transfers \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { EcdsaRAccountContractArtifact } from '@aztec/accounts/ecdsa';
import { AccountWallet, type DeployOptions, Fr, registerContractClass } from '@aztec/aztec.js';
import { AccountWallet, type DeployOptions, Fr, type PXE, registerContractClass } from '@aztec/aztec.js';
import type { SponsoredFPCContract } from '@aztec/noir-contracts.js/SponsoredFPC';

import { jest } from '@jest/globals';

import { capturePrivateExecutionStepsIfEnvSet } from '../../shared/capture_private_execution_steps.js';
import { captureProfile } from './benchmark.js';
import { type AccountType, type BenchmarkingFeePaymentMethod, ClientFlowsBenchmark } from './client_flows_benchmark.js';

jest.setTimeout(300_000);
Expand All @@ -17,11 +17,13 @@ describe('Deployment benchmark', () => {
let sponsoredFPC: SponsoredFPCContract;
// Benchmarking configuration
const config = t.config.accountDeployments;
// Benchmarking user's PXE
let userPXE: PXE;

beforeAll(async () => {
await t.applyBaseSnapshots();
await t.applyDeploySponsoredFPCSnapshot();
({ adminWallet, sponsoredFPC } = await t.setup());
({ adminWallet, sponsoredFPC, userPXE } = await t.setup());
// Ensure the ECDSAR1 contract is already registered, to avoid benchmarking an extra call to the ContractClassRegisterer
// The typical interaction would be for a user to deploy an account contract that is already registered in the
// network.
Expand All @@ -41,7 +43,7 @@ describe('Deployment benchmark', () => {
return describe(`Deployment benchmark for ${accountType}`, () => {
function deploymentTest(benchmarkingPaymentMethod: BenchmarkingFeePaymentMethod) {
return it(`Deploys a ${accountType} account contract, pays using ${benchmarkingPaymentMethod}`, async () => {
const benchysAccountManager = await t.createBenchmarkingAccountManager(accountType);
const benchysAccountManager = await t.createBenchmarkingAccountManager(userPXE, accountType);
const benchysWallet = await benchysAccountManager.getWallet();

if (benchmarkingPaymentMethod === 'sponsored_fpc') {
Expand All @@ -66,7 +68,7 @@ describe('Deployment benchmark', () => {
contractAddressSalt: new Fr(benchysAccountManager.salt),
};

await capturePrivateExecutionStepsIfEnvSet(
await captureProfile(
`deploy_${accountType}+${benchmarkingPaymentMethod}`,
deploymentInteraction,
options,
Expand All @@ -81,9 +83,11 @@ describe('Deployment benchmark', () => {
1, // Kernel tail
);

// Ensure we paid a fee
const tx = await deploymentInteraction.send(options).wait();
expect(tx.transactionFee!).toBeGreaterThan(0n);
if (process.env.SANITY_CHECKS) {
// Ensure we paid a fee
const tx = await deploymentInteraction.send(options).wait();
expect(tx.transactionFee!).toBeGreaterThan(0n);
}
});
}

Expand Down
10 changes: 6 additions & 4 deletions yarn-project/end-to-end/src/bench/client_flows/amm.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { TokenContract } from '@aztec/noir-contracts.js/Token';
import { jest } from '@jest/globals';

import { mintNotes } from '../../fixtures/token_utils.js';
import { capturePrivateExecutionStepsIfEnvSet } from '../../shared/capture_private_execution_steps.js';
import { captureProfile } from './benchmark.js';
import { type AccountType, type BenchmarkingFeePaymentMethod, ClientFlowsBenchmark } from './client_flows_benchmark.js';

jest.setTimeout(900_000);
Expand Down Expand Up @@ -132,7 +132,7 @@ describe('AMM benchmark', () => {
.methods.add_liquidity(amountToSend, amountToSend, amountToSend, amountToSend, nonceForAuthwits)
.with({ authWitnesses: [token0Authwit, token1Authwit] });

await capturePrivateExecutionStepsIfEnvSet(
await captureProfile(
`${accountType}+amm_add_liquidity_1_recursions+${benchmarkingPaymentMethod}`,
addLiquidityInteraction,
options,
Expand All @@ -151,8 +151,10 @@ describe('AMM benchmark', () => {
1, // Kernel tail
);

const tx = await addLiquidityInteraction.send().wait();
expect(tx.transactionFee!).toBeGreaterThan(0n);
if (process.env.SANITY_CHECKS) {
const tx = await addLiquidityInteraction.send().wait();
expect(tx.transactionFee!).toBeGreaterThan(0n);
}
});
});
}
Expand Down
Loading