From 02397b5aaba3081904bdbba30d4eac1251cade12 Mon Sep 17 00:00:00 2001 From: Alex Gherghisan Date: Tue, 23 Apr 2024 11:31:26 +0000 Subject: [PATCH] fix: deploy L1 contracts before starting node --- yarn-project/aztec/src/cli/cmds/start_node.ts | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/yarn-project/aztec/src/cli/cmds/start_node.ts b/yarn-project/aztec/src/cli/cmds/start_node.ts index d9a28ced7a2..3b29bb8ee4b 100644 --- a/yarn-project/aztec/src/cli/cmds/start_node.ts +++ b/yarn-project/aztec/src/cli/cmds/start_node.ts @@ -29,6 +29,17 @@ export const startNode = async ( // merge env vars and cli options let nodeConfig = mergeEnvVarsAndCliOptions(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 @@ -40,18 +51,7 @@ export const startNode = async ( nodeConfig.archiverUrl = archiverUrl; } else { const archiverCliOptions = parseModuleOptions(options.archiver); - nodeConfig = mergeEnvVarsAndCliOptions(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(nodeConfig, archiverCliOptions, true); } if (!options.sequencer) {