Skip to content

Commit

Permalink
feat: enable profiling with local PXE in cli-wallet
Browse files Browse the repository at this point in the history
  • Loading branch information
saleel committed Dec 13, 2024
1 parent 52b541a commit 9defad0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
9 changes: 8 additions & 1 deletion yarn-project/cli-wallet/src/bin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,16 @@ async function main() {
)
.hook('preSubcommand', async command => {
const { dataDir, remotePxe, nodeUrl } = command.optsWithGlobals();

if (!remotePxe) {
debugLogger.info('Using local PXE service');
await pxeWrapper.init(nodeUrl, join(dataDir, 'pxe'));
const subcommand = command.args[0];
const isProfiling = command.args.includes('--profile');
const enableProving = subcommand === 'simulate' && isProfiling;

await pxeWrapper.init(nodeUrl, join(dataDir, 'pxe'), {
proverEnabled: enableProving,
});
}
db.init(AztecLmdbStore.open(dataDir));
});
Expand Down
6 changes: 3 additions & 3 deletions yarn-project/cli-wallet/src/utils/pxe_wrapper.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { type PXE, createAztecNodeClient } from '@aztec/circuit-types';
import { createPXEService, getPXEServiceConfig } from '@aztec/pxe';
import { type PXEServiceConfig, createPXEService, getPXEServiceConfig } from '@aztec/pxe';

/*
* Wrapper class for PXE service, avoids initialization issues due to
Expand All @@ -12,9 +12,9 @@ export class PXEWrapper {
return PXEWrapper.pxe;
}

async init(nodeUrl: string, dataDir: string) {
async init(nodeUrl: string, dataDir: string, overridePXEServiceConfig?: Partial<PXEServiceConfig>) {
const aztecNode = createAztecNodeClient(nodeUrl);
const pxeConfig = getPXEServiceConfig();
const pxeConfig = Object.assign(getPXEServiceConfig(), overridePXEServiceConfig);
pxeConfig.dataDirectory = dataDir;
PXEWrapper.pxe = await createPXEService(aztecNode, pxeConfig);
}
Expand Down

0 comments on commit 9defad0

Please sign in to comment.