Skip to content

Commit

Permalink
fix: deploy L1 contracts before starting node (#5969)
Browse files Browse the repository at this point in the history
First deploy L1 contracts before starting node/archiver/pxe
  • Loading branch information
alexghr authored Apr 24, 2024
1 parent 3a10e5e commit 1908139
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions yarn-project/aztec/src/cli/cmds/start_node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@ export const startNode = async (
// merge env vars and cli options
let nodeConfig = mergeEnvVarsAndCliOptions<AztecNodeConfig>(aztecNodeConfigEnvVars, nodeCliOptions);

// Deploy contracts if needed
if (nodeCliOptions.deployAztecContracts || DEPLOY_AZTEC_CONTRACTS === 'true') {
let account;
if (nodeConfig.publisherPrivateKey === NULL_KEY) {
account = mnemonicToAccount(MNEMONIC);
} else {
account = privateKeyToAccount(nodeConfig.publisherPrivateKey);
}
await deployContractsToL1(nodeConfig, account);
}

// if no publisher private key, then use MNEMONIC
if (!options.archiver) {
// expect archiver url in node config
Expand All @@ -40,18 +51,7 @@ export const startNode = async (
nodeConfig.archiverUrl = archiverUrl;
} else {
const archiverCliOptions = parseModuleOptions(options.archiver);
nodeConfig = mergeEnvVarsAndCliOptions<AztecNodeConfig>(aztecNodeConfigEnvVars, archiverCliOptions, true);
}

// Deploy contracts if needed
if (nodeCliOptions.deployAztecContracts || DEPLOY_AZTEC_CONTRACTS === 'true') {
let account;
if (nodeConfig.publisherPrivateKey === NULL_KEY) {
account = mnemonicToAccount(MNEMONIC);
} else {
account = privateKeyToAccount(nodeConfig.publisherPrivateKey);
}
await deployContractsToL1(nodeConfig, account);
nodeConfig = mergeEnvVarsAndCliOptions<AztecNodeConfig>(nodeConfig, archiverCliOptions, true);
}

if (!options.sequencer) {
Expand Down

0 comments on commit 1908139

Please sign in to comment.