Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: deploy L1 contracts before starting node #5969

Merged
merged 1 commit into from
Apr 24, 2024
Merged
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
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
Loading