Skip to content
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
34 changes: 10 additions & 24 deletions yarn-project/aztec/src/cli/cmds/start_prover_node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
getProverNodeConfigFromEnv,
proverNodeConfigMappings,
} from '@aztec/prover-node';
import { createAztecNodeClient } from '@aztec/stdlib/interfaces/client';
import { P2PApiSchema, ProverNodeApiSchema, type ProvingJobBroker } from '@aztec/stdlib/interfaces/server';
import { initTelemetryClient, makeTracedFetch, telemetryClientConfigMappings } from '@aztec/telemetry-client';
import { getGenesisValues } from '@aztec/world-state/testing';
Expand Down Expand Up @@ -54,31 +53,18 @@ export async function startProverNode(
proverConfig.publisherPrivateKey = `0x${Buffer.from(privKey!).toString('hex')}`;
}

// TODO(palla/prover-node) L1 contract addresses should not silently default to zero,
// they should be undefined if not set and fail loudly.
// Load l1 contract addresses from aztec node if not set.
const isRollupAddressSet =
proverConfig.l1Contracts?.rollupAddress && !proverConfig.l1Contracts.rollupAddress.isZero();
const nodeUrl = proverConfig.nodeUrl ?? proverConfig.proverCoordinationNodeUrl;
if (nodeUrl && !isRollupAddressSet) {
userLog(`Loading L1 contract addresses from aztec node at ${nodeUrl}`);
proverConfig.l1Contracts = await createAztecNodeClient(nodeUrl).getL1ContractAddresses();
if (!proverConfig.l1Contracts.registryAddress || proverConfig.l1Contracts.registryAddress.isZero()) {
throw new Error('L1 registry address is required to start a Prover Node with --archiver option');
}

// If we create an archiver here, validate the L1 config
if (options.archiver) {
if (!proverConfig.l1Contracts.registryAddress || proverConfig.l1Contracts.registryAddress.isZero()) {
throw new Error('L1 registry address is required to start a Prover Node with --archiver option');
}
const { addresses, config } = await getL1Config(
proverConfig.l1Contracts.registryAddress,
proverConfig.l1RpcUrls,
proverConfig.l1ChainId,
proverConfig.rollupVersion,
);
proverConfig.l1Contracts = addresses;
proverConfig = { ...proverConfig, ...config };
}
const { addresses, config } = await getL1Config(
proverConfig.l1Contracts.registryAddress,
proverConfig.l1RpcUrls,
proverConfig.l1ChainId,
proverConfig.rollupVersion,
);
proverConfig.l1Contracts = addresses;
proverConfig = { ...proverConfig, ...config };

const telemetry = initTelemetryClient(extractRelevantOptions(options, telemetryClientConfigMappings, 'tel'));

Expand Down