diff --git a/barretenberg/cpp/src/barretenberg/plonk_honk_shared/arithmetization/mega_arithmetization.hpp b/barretenberg/cpp/src/barretenberg/plonk_honk_shared/arithmetization/mega_arithmetization.hpp index 379602e2463..67a77dfa715 100644 --- a/barretenberg/cpp/src/barretenberg/plonk_honk_shared/arithmetization/mega_arithmetization.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk_honk_shared/arithmetization/mega_arithmetization.hpp @@ -96,8 +96,8 @@ template class MegaArith { this->delta_range = 25000; this->elliptic = 80000; this->aux = 100000; - this->poseidon2_external = 30000; - this->poseidon2_internal = 150000; + this->poseidon2_external = 30128; + this->poseidon2_internal = 172000; this->lookup = 200000; } }; @@ -248,4 +248,4 @@ using MegaArithmetization = MegaArith; template concept HasAdditionalSelectors = IsAnyOf>; -} // namespace bb \ No newline at end of file +} // namespace bb diff --git a/spartan/aztec-network/templates/deploy-l1-verifier.yaml b/spartan/aztec-network/templates/deploy-l1-verifier.yaml new file mode 100644 index 00000000000..90530932fdc --- /dev/null +++ b/spartan/aztec-network/templates/deploy-l1-verifier.yaml @@ -0,0 +1,58 @@ +{{- if .Values.network.setupL2Contracts }} +apiVersion: batch/v1 +kind: Job +metadata: + name: {{ include "aztec-network.fullname" . }}-deploy-l1-verifier + labels: + {{- include "aztec-network.labels" . | nindent 4 }} +spec: + template: + metadata: + labels: + {{- include "aztec-network.selectorLabels" . | nindent 8 }} + app: deploy-l1-verifier + spec: + restartPolicy: OnFailure + containers: + - name: deploy-l1-verifier + image: {{ .Values.images.aztec.image }} + command: + - /bin/bash + - -c + - | + set -e + + [ $ENABLE = "true" ] || exit 0 + + until curl -s -X GET "$AZTEC_NODE_URL/status"; do + echo "Waiting for Aztec node $AZTEC_NODE_URL..." + sleep 5 + done + echo "Boot node is ready!" + + export ROLLUP_CONTRACT_ADDRESS=$(curl -X POST -H 'Content-Type: application/json' \ + -d '{"jsonrpc":"2.0","method":"node_getL1ContractAddresses","params":[],"id":1}' \ + "$AZTEC_NODE_URL" \ + | jq -r '.result.rollupAddress.data') + + echo "Rollup contract address: $ROLLUP_CONTRACT_ADDRESS" + node /usr/src/yarn-project/aztec/dest/bin/index.js deploy-l1-verifier --verifier real + echo "L1 verifier deployed" + env: + - name: ENABLE + value: {{ .Values.jobs.deployL1Verifier.enable | quote }} + - name: NODE_NO_WARNINGS + value: "1" + - name: DEBUG + value: "aztec:*" + - name: LOG_LEVEL + value: "debug" + - name: ETHEREUM_HOST + value: {{ include "aztec-network.ethereumHost" . | quote }} + - name: L1_CHAIN_ID + value: {{ .Values.ethereum.chainId | quote }} + - name: PRIVATE_KEY + value: "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" + - name: AZTEC_NODE_URL + value: {{ include "aztec-network.bootNodeUrl" . | quote }} +{{ end }} diff --git a/spartan/aztec-network/templates/prover-agent.yaml b/spartan/aztec-network/templates/prover-agent.yaml new file mode 100644 index 00000000000..2ded11498ee --- /dev/null +++ b/spartan/aztec-network/templates/prover-agent.yaml @@ -0,0 +1,73 @@ +{{- if .Values.proverAgent.enabled }} +apiVersion: apps/v1 +kind: ReplicaSet +metadata: + name: {{ include "aztec-network.fullname" . }}-prover-agent + labels: + {{- include "aztec-network.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.proverAgent.replicas }} + selector: + matchLabels: + {{- include "aztec-network.selectorLabels" . | nindent 6 }} + app: prover-agent + template: + metadata: + labels: + {{- include "aztec-network.selectorLabels" . | nindent 8 }} + app: prover-agent + spec: + initContainers: + - name: wait-for-prover-node + image: {{ .Values.images.curl.image }} + command: + - /bin/sh + - -c + - | + until curl -s -X POST "$PROVER_JOB_SOURCE_URL/status"; do + echo "Waiting for Prover node $PROVER_JOB_SOURCE_URL ..." + sleep 5 + done + echo "Prover node is ready!" + {{- if .Values.telemetry.enabled }} + until curl --head --silent {{ include "aztec-network.otelCollectorMetricsEndpoint" . }} > /dev/null; do + echo "Waiting for OpenTelemetry collector..." + sleep 5 + done + echo "OpenTelemetry collector is ready!" + {{- end }} + env: + - name: PROVER_JOB_SOURCE_URL + value: http://{{ include "aztec-network.fullname" . }}-prover-node.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.proverNode.service.nodePort }} + containers: + - name: prover-agent + image: "{{ .Values.images.aztec.image }}" + imagePullPolicy: {{ .Values.images.aztec.pullPolicy }} + command: + - "/bin/bash" + - "-c" + - "node --no-warnings /usr/src/yarn-project/aztec/dest/bin/index.js start --prover" + env: + - name: LOG_LEVEL + value: "{{ .Values.proverAgent.logLevel }}" + - name: LOG_JSON + value: "1" + - name: DEBUG + value: "{{ .Values.proverAgent.debug }}" + - name: PROVER_REAL_PROOFS + value: "{{ .Values.proverAgent.realProofs }}" + - name: PROVER_JOB_SOURCE_URL + value: http://{{ include "aztec-network.fullname" . }}-prover-node.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.proverNode.service.nodePort }} + - name: PROVER_AGENT_ENABLED + value: "true" + - name: PROVER_AGENT_CONCURRENCY + value: {{ .Values.proverAgent.concurrency | quote }} + - name: HARDWARE_CONCURRENCY + value: {{ .Values.proverAgent.bb.hardwareConcurrency | quote }} + - name: OTEL_EXPORTER_OTLP_METRICS_ENDPOINT + value: {{ include "aztec-network.otelCollectorMetricsEndpoint" . | quote }} + - name: OTEL_EXPORTER_OTLP_TRACES_ENDPOINT + value: {{ include "aztec-network.otelCollectorTracesEndpoint" . | quote }} + - name: OTEL_EXPORTER_OTLP_LOGS_ENDPOINT + value: {{ include "aztec-network.otelCollectorLogsEndpoint" . | quote }} +{{- end }} diff --git a/spartan/aztec-network/templates/prover-node.yaml b/spartan/aztec-network/templates/prover-node.yaml index 6ec388150d3..3158f3145a5 100644 --- a/spartan/aztec-network/templates/prover-node.yaml +++ b/spartan/aztec-network/templates/prover-node.yaml @@ -67,7 +67,7 @@ spec: command: - "/bin/bash" - "-c" - - "source /shared/contracts.env && env && node --no-warnings /usr/src/yarn-project/aztec/dest/bin/index.js start --prover-node --prover --archiver" + - "source /shared/contracts.env && env && node --no-warnings /usr/src/yarn-project/aztec/dest/bin/index.js start --prover-node --archiver" volumeMounts: - name: shared-volume mountPath: /shared @@ -163,4 +163,4 @@ spec: - port: {{ .Values.proverNode.service.nodePort }} name: node {{ end }} -{{ end }} \ No newline at end of file +{{ end }} diff --git a/spartan/aztec-network/templates/pxe.yaml b/spartan/aztec-network/templates/pxe.yaml index 0ae3702943e..d885313a6f8 100644 --- a/spartan/aztec-network/templates/pxe.yaml +++ b/spartan/aztec-network/templates/pxe.yaml @@ -57,6 +57,8 @@ spec: value: "{{ .Values.pxe.logLevel }}" - name: DEBUG value: "{{ .Values.pxe.debug }}" + - name: PXE_PROVER_ENABLED + value: "{{ .Values.pxe.proverEnabled }}" ports: - name: http containerPort: {{ .Values.pxe.service.port }} @@ -119,4 +121,4 @@ spec: nodePort: {{ .Values.pxe.service.nodePort }} {{- end }} {{ end }} -{{- end }} \ No newline at end of file +{{- end }} diff --git a/spartan/aztec-network/values.yaml b/spartan/aztec-network/values.yaml index 8905fc155eb..30056d43827 100644 --- a/spartan/aztec-network/values.yaml +++ b/spartan/aztec-network/values.yaml @@ -30,7 +30,7 @@ bootNode: p2pUdpPort: 40400 nodePort: 8080 logLevel: "debug" - debug: "aztec:*,-aztec:avm_simulator*,-aztec:libp2p_service*,-aztec:circuits:artifact_hash,-json-rpc*" + debug: "aztec:*,-aztec:avm_simulator*,-aztec:libp2p_service*,-aztec:circuits:artifact_hash,-json-rpc*,-aztec:world-state:database,-aztec:l2_block_stream*" coinbaseAddress: "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" sequencer: maxSecondsBetweenBlocks: 0 @@ -67,7 +67,7 @@ validator: p2pUdpPort: 40400 nodePort: 8080 logLevel: "debug" - debug: "aztec:*,-aztec:avm_simulator*,-aztec:libp2p_service*,-aztec:circuits:artifact_hash,-json-rpc*" + debug: "aztec:*,-aztec:avm_simulator*,-aztec:libp2p_service*,-aztec:circuits:artifact_hash,-json-rpc*,-aztec:world-state:database,-aztec:l2_block_stream*" sequencer: maxSecondsBetweenBlocks: 0 minTxsPerBlock: 1 @@ -88,9 +88,9 @@ proverNode: service: nodePort: 8080 logLevel: "debug" - debug: "aztec:*,-aztec:avm_simulator*,-aztec:libp2p_service*,-aztec:circuits:artifact_hash,-json-rpc*" + debug: "aztec:*,-aztec:avm_simulator*,-aztec:libp2p_service*,-aztec:circuits:artifact_hash,-json-rpc*,-aztec:world-state:database,-aztec:l2_block_stream*" realProofs: false - proverAgentEnabled: true + proverAgentEnabled: false resources: requests: memory: "2Gi" @@ -102,6 +102,7 @@ pxe: externalHost: "" logLevel: "debug" debug: "aztec:*,-aztec:avm_simulator*,-aztec:libp2p_service*,-aztec:circuits:artifact_hash,-json-rpc*" + proverEnable: false replicas: 1 service: port: 8080 @@ -176,3 +177,16 @@ ethereum: memory: "2Gi" cpu: "200m" storage: "8Gi" + +proverAgent: + enabled: true + replicas: 1 + debug: "aztec:*,-aztec:avm_simulator*,-aztec:libp2p_service*,-aztec:circuits:artifact_hash,-json-rpc*,-aztec:world-state:database,-aztec:l2_block_stream*" + realProofs: false + concurrency: 1 + bb: + hardwareConcurrency: "" + +jobs: + deployL1Verifier: + enable: false diff --git a/spartan/aztec-network/values/1-validator-with-proving.yaml b/spartan/aztec-network/values/1-validator-with-proving.yaml new file mode 100644 index 00000000000..ac7ca644a1f --- /dev/null +++ b/spartan/aztec-network/values/1-validator-with-proving.yaml @@ -0,0 +1,37 @@ +validator: + replicas: 1 + validatorKeys: + - 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 + validatorAddresses: + - 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 + validator: + disabled: false + +bootNode: + validator: + disabled: true + +proverNode: + realProofs: true + +proverAgent: + replicas: 6 + realProofs: true + bb: + hardwareConcurrency: 16 + +pxe: + proverEnabled: true + +bot: + enabled: true + pxeProverEnabled: true + txIntervalSeconds: 200 + +jobs: + deployL1Verifier: + enable: true + +telemetry: + enabled: true + otelCollectorEndpoint: http://metrics-opentelemetry-collector.metrics:4318 diff --git a/spartan/aztec-network/values/1-validators.yaml b/spartan/aztec-network/values/1-validators.yaml index 28bb6a0b621..53038895c1f 100644 --- a/spartan/aztec-network/values/1-validators.yaml +++ b/spartan/aztec-network/values/1-validators.yaml @@ -1,5 +1,4 @@ validator: - debug: "aztec:*,-aztec:avm_simulator:*,-aztec:libp2p_service" replicas: 1 validatorKeys: - 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 diff --git a/yarn-project/bot/src/config.ts b/yarn-project/bot/src/config.ts index a4f36f0ab8a..2cd14d0d78c 100644 --- a/yarn-project/bot/src/config.ts +++ b/yarn-project/bot/src/config.ts @@ -122,7 +122,7 @@ export const botConfigMappings: ConfigMappingsType = { description: 'Which chain the bot follows', defaultValue: 'NONE', parseEnv(val) { - if (!botFollowChain.includes(val as any)) { + if (!(botFollowChain as readonly string[]).includes(val.toUpperCase())) { throw new Error(`Invalid value for BOT_FOLLOW_CHAIN: ${val}`); } return val as BotFollowChain; diff --git a/yarn-project/cli/src/cmds/l1/deploy_l1_verifier.ts b/yarn-project/cli/src/cmds/l1/deploy_l1_verifier.ts index ab0ddb2dfcf..4150479fbd6 100644 --- a/yarn-project/cli/src/cmds/l1/deploy_l1_verifier.ts +++ b/yarn-project/cli/src/cmds/l1/deploy_l1_verifier.ts @@ -5,9 +5,10 @@ import { type DebugLogger, type LogFn } from '@aztec/foundation/log'; import { InvalidOptionArgumentError } from 'commander'; // @ts-expect-error solc-js doesn't publish its types https://github.com/ethereum/solc-js/issues/689 import solc from 'solc'; -import { getContract } from 'viem'; +import { type Hex, getContract } from 'viem'; export async function deployUltraHonkVerifier( + rollupAddress: Hex | undefined, ethRpcUrl: string, l1ChainId: string, privateKey: string | undefined, @@ -32,14 +33,21 @@ export async function deployUltraHonkVerifier( createEthereumChain(ethRpcUrl, l1ChainId).chainInfo, ); - const pxe = await createCompatibleClient(pxeRpcUrl, debugLogger); - const { l1ContractAddresses } = await pxe.getNodeInfo(); + if (!rollupAddress && pxeRpcUrl) { + const pxe = await createCompatibleClient(pxeRpcUrl, debugLogger); + const { l1ContractAddresses } = await pxe.getNodeInfo(); + rollupAddress = l1ContractAddresses.rollupAddress.toString(); + } + + if (!rollupAddress) { + throw new InvalidOptionArgumentError('Missing rollup address'); + } const { RollupAbi } = await import('@aztec/l1-artifacts'); const rollup = getContract({ abi: RollupAbi, - address: l1ContractAddresses.rollupAddress.toString(), + address: rollupAddress, client: walletClient, }); @@ -64,6 +72,7 @@ export async function deployUltraHonkVerifier( } export async function deployMockVerifier( + rollupAddress: Hex | undefined, ethRpcUrl: string, l1ChainId: string, privateKey: string | undefined, @@ -87,12 +96,19 @@ export async function deployMockVerifier( ); log(`Deployed MockVerifier at ${mockVerifierAddress.toString()}`); - const pxe = await createCompatibleClient(pxeRpcUrl, debugLogger); - const { l1ContractAddresses } = await pxe.getNodeInfo(); + if (!rollupAddress && pxeRpcUrl) { + const pxe = await createCompatibleClient(pxeRpcUrl, debugLogger); + const { l1ContractAddresses } = await pxe.getNodeInfo(); + rollupAddress = l1ContractAddresses.rollupAddress.toString(); + } + + if (!rollupAddress) { + throw new InvalidOptionArgumentError('Missing rollup address'); + } const rollup = getContract({ abi: RollupAbi, - address: l1ContractAddresses.rollupAddress.toString(), + address: rollupAddress, client: walletClient, }); diff --git a/yarn-project/cli/src/cmds/l1/index.ts b/yarn-project/cli/src/cmds/l1/index.ts index 37cd7a7e7dd..80c0d514c3b 100644 --- a/yarn-project/cli/src/cmds/l1/index.ts +++ b/yarn-project/cli/src/cmds/l1/index.ts @@ -1,12 +1,13 @@ import { EthAddress } from '@aztec/foundation/eth-address'; import { type DebugLogger, type LogFn } from '@aztec/foundation/log'; -import { type Command } from 'commander'; +import { type Command, Option } from 'commander'; import { ETHEREUM_HOST, PRIVATE_KEY, l1ChainIdOption, + makePxeOption, parseAztecAddress, parseBigint, parseEthereumAddress, @@ -207,8 +208,19 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: DebugL 'Url of the ethereum host. Chain identifiers localhost and testnet can be used', ETHEREUM_HOST, ) - .requiredOption('--l1-chain-id ', 'The chain id of the L1 network', '31337') - .addOption(pxeOption) + .addOption( + new Option('--l1-chain-id ', 'The chain id of the L1 network') + .env('L1_CHAIN_ID') + .default('31337') + .makeOptionMandatory(true), + ) + .addOption(makePxeOption(false).conflicts('rollup-address')) + .addOption( + new Option('--rollup-address ', 'The address of the rollup contract') + .env('ROLLUP_CONTRACT_ADDRESS') + .argParser(parseEthereumAddress) + .conflicts('rpc-url'), + ) .option('--l1-private-key ', 'The L1 private key to use for deployment', PRIVATE_KEY) .option( '-m, --mnemonic ', @@ -222,6 +234,7 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: DebugL const { deployMockVerifier, deployUltraHonkVerifier } = await import('./deploy_l1_verifier.js'); if (options.verifier === 'mock') { await deployMockVerifier( + options.rollupAddress?.toString(), options.l1RpcUrl, options.l1ChainId, options.l1PrivateKey, @@ -232,6 +245,7 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: DebugL ); } else { await deployUltraHonkVerifier( + options.rollupAddress?.toString(), options.l1RpcUrl, options.l1ChainId, options.l1PrivateKey, diff --git a/yarn-project/cli/src/utils/commands.ts b/yarn-project/cli/src/utils/commands.ts index 656f07282f8..5bc66a8a5c0 100644 --- a/yarn-project/cli/src/utils/commands.ts +++ b/yarn-project/cli/src/utils/commands.ts @@ -29,10 +29,13 @@ export function addOptions(program: Command, options: Option[]) { return program; } -export const pxeOption = new Option('-u, --rpc-url ', 'URL of the PXE') - .env('PXE_URL') - .default(`http://${LOCALHOST}:8080`) - .makeOptionMandatory(true); +export const makePxeOption = (mandatory: boolean) => + new Option('-u, --rpc-url ', 'URL of the PXE') + .env('PXE_URL') + .default(`http://${LOCALHOST}:8080`) + .makeOptionMandatory(mandatory); + +export const pxeOption = makePxeOption(true); export const l1ChainIdOption = new Option('-c, --l1-chain-id ', 'Chain ID of the ethereum host') .env('L1_CHAIN_ID')