diff --git a/spartan/aztec-network/files/config/config-validator-env.sh b/spartan/aztec-network/files/config/config-validator-env.sh index f25834ad54d..3e14a36048d 100644 --- a/spartan/aztec-network/files/config/config-validator-env.sh +++ b/spartan/aztec-network/files/config/config-validator-env.sh @@ -17,16 +17,11 @@ outbox_address=$(echo "$output" | grep -oP 'L2 -> L1 Outbox Address: \K0x[a-fA-F fee_juice_address=$(echo "$output" | grep -oP 'Fee Juice Address: \K0x[a-fA-F0-9]{40}') fee_juice_portal_address=$(echo "$output" | grep -oP 'Fee Juice Portal Address: \K0x[a-fA-F0-9]{40}') -# Generate a private key for the validator -json_account=$(aztec generate-l1-account) +# We assume that there is an env var set for validator keys from the config map +# We get the index in the config map from the pod name, which will have the validator index within it -echo "$json_account" -address=$(echo $json_account | jq -r '.address') -private_key=$(echo $json_account | jq -r '.privateKey') - -aztec add-l1-validator --validator $address --rollup $rollup_address - -aztec fast-forward-epochs --rollup $rollup_address --count 1 +INDEX=$(echo $POD_NAME | awk -F'-' '{print $NF}') +private_key=$(jq -r ".[$INDEX]" /app/config/keys.json) # Write the addresses to a file in the shared volume diff --git a/spartan/aztec-network/templates/_helpers.tpl b/spartan/aztec-network/templates/_helpers.tpl index cae1bdbf528..087d8403356 100644 --- a/spartan/aztec-network/templates/_helpers.tpl +++ b/spartan/aztec-network/templates/_helpers.tpl @@ -82,10 +82,10 @@ http://metrics-opentelemetry-collector.metrics:4318/v1/traces {{- if $value -}} {{- if kindIs "string" $value -}} {{- if ne $value "" -}} ---{{ $name }} {{ $value }} +--{{ $name }} {{ $value }}{{ " " }} {{- end -}} {{- else -}} ---{{ $name }} {{ $value }} +--{{ $name }} {{ $value }}{{ " " }} {{- end -}} {{- end -}} {{- end -}} diff --git a/spartan/aztec-network/templates/anvil.yaml b/spartan/aztec-network/templates/anvil.yaml index bdaea56bdec..918b1c1ac0f 100644 --- a/spartan/aztec-network/templates/anvil.yaml +++ b/spartan/aztec-network/templates/anvil.yaml @@ -23,13 +23,13 @@ spec: command: ["/bin/sh", "-c"] args: - >- - anvil - --host 0.0.0.0 - {{ include "helpers.flag" (list "block-time" .Values.ethereum.blockTime) }} - {{ include "helpers.flag" (list "chain-id" .Values.ethereum.chainId) }} - {{ include "helpers.flag" (list "gas-limit" .Values.ethereum.gasLimit) }} - {{ include "helpers.flag" (list "fork-url" .Values.ethereum.forkUrl) }} - {{ include "helpers.flag" (list "fork-block-number" .Values.ethereum.forkBlockNumber) }} + anvil {{ include "helpers.flag" (list "host" "0.0.0.0") }} + {{- include "helpers.flag" (list "block-time" .Values.ethereum.blockTime) }} + {{- include "helpers.flag" (list "chain-id" .Values.ethereum.chainId) }} + {{- include "helpers.flag" (list "gas-limit" .Values.ethereum.gasLimit) }} + {{- include "helpers.flag" (list "fork-url" .Values.ethereum.forkUrl) }} + {{- include "helpers.flag" (list "fork-block-number" .Values.ethereum.forkBlockNumber) }} + {{- include "helpers.flag" (list "accounts" .Values.validator.replicas) }} -p {{ .Values.ethereum.service.port }} ports: - containerPort: {{ .Values.ethereum.service.port }} diff --git a/spartan/aztec-network/templates/configmap.yaml b/spartan/aztec-network/templates/configmap.yaml new file mode 100644 index 00000000000..4f7e84d02ae --- /dev/null +++ b/spartan/aztec-network/templates/configmap.yaml @@ -0,0 +1,10 @@ +# Config map that stores the validator keys for this cluster +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "aztec-network.fullname" . }}-validator-keys + labels: + {{- include "aztec-network.labels" . | nindent 4 }} +data: + keys.json: | + {{ .Values.validator.validatorKeys | toJson | nindent 4 }} diff --git a/spartan/aztec-network/templates/l2-contracts.yaml b/spartan/aztec-network/templates/l2-contracts.yaml index d4ba521e985..59e85ef713e 100644 --- a/spartan/aztec-network/templates/l2-contracts.yaml +++ b/spartan/aztec-network/templates/l2-contracts.yaml @@ -49,7 +49,7 @@ data: set -e # Run the deploy-l1-contracts command and capture the output - output=$(node --no-warnings /usr/src/yarn-project/aztec/dest/bin/index.js deploy-l1-contracts) + output=$(node --no-warnings /usr/src/yarn-project/aztec/dest/bin/index.js deploy-l1-contracts --validators {{ join "," .Values.validator.validatorAddresses | quote }}) echo "$output" diff --git a/spartan/aztec-network/templates/validator.yaml b/spartan/aztec-network/templates/validator.yaml index ee8c3c99e34..c1382fd41a3 100644 --- a/spartan/aztec-network/templates/validator.yaml +++ b/spartan/aztec-network/templates/validator.yaml @@ -17,6 +17,8 @@ spec: {{- include "aztec-network.selectorLabels" . | nindent 8 }} app: validator spec: + # We expect the validators to have already been added to the smart contract by this point - but this container still needs + # to be run in order to get the values initContainers: - name: configure-validator-env image: "{{ .Values.images.aztec.image }}" @@ -30,9 +32,16 @@ spec: mountPath: /shared - name: scripts mountPath: /scripts + - name: validator-keys + mountPath: /app/config + readOnly: true env: - name: ETHEREUM_HOST value: {{ include "aztec-network.ethereumHost" . | quote }} + - name: POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name containers: - name: validator image: "{{ .Values.images.aztec.image }}" @@ -94,6 +103,9 @@ spec: - name: scripts configMap: name: {{ include "aztec-network.fullname" . }}-configure-validator-env + - name: validator-keys + configMap: + name: {{ include "aztec-network.fullname" . }}-validator-keys volumeClaimTemplates: - metadata: name: shared-volume diff --git a/spartan/aztec-network/values/1-validators.yaml b/spartan/aztec-network/values/1-validators.yaml new file mode 100644 index 00000000000..28bb6a0b621 --- /dev/null +++ b/spartan/aztec-network/values/1-validators.yaml @@ -0,0 +1,13 @@ +validator: + debug: "aztec:*,-aztec:avm_simulator:*,-aztec:libp2p_service" + replicas: 1 + validatorKeys: + - 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 + validatorAddresses: + - 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 + validator: + disabled: false + +bootNode: + validator: + disabled: true diff --git a/spartan/aztec-network/values/16-validators.yaml b/spartan/aztec-network/values/16-validators.yaml index 0fd3faed552..090a0ede15a 100644 --- a/spartan/aztec-network/values/16-validators.yaml +++ b/spartan/aztec-network/values/16-validators.yaml @@ -1,12 +1,55 @@ +bootNode: + sequencer: + minTxsPerBlock: 4 + validator: debug: "aztec:*,-aztec:avm_simulator:*,-aztec:libp2p_service" replicas: 16 + sequencer: + minTxsPerBlock: 4 + validatorKeys: + - 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 + - 0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d + - 0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a + - 0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6 + - 0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a + - 0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba + - 0x92db14e403b83dfe3df233f83dfa3a0d7096f21ca9b0d6d6b8d88b2b4ec1564e + - 0x4bbbf85ce3377467afe5d46f804f221813b2bb87f24d81f60f1fcdbf7cbf4356 + - 0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97 + - 0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6 + - 0xf214f2b2cd398c806f84e317254e0f0b801d0643303237d97a22a48e01628897 + - 0x701b615bbdfb9de65240bc28bd21bbc0d996645a3dd57e7b12bc2bdf6f192c82 + - 0xa267530f49f8280200edf313ee7af6b827f2a8bce2897751d06a843f644967b1 + - 0x47c99abed3324a2707c28affff1267e45918ec8c3f20b8aa892e8b065d2942dd + - 0xc526ee95bf44d8fc405a158bb884d9d1238d99f0612e9f33d006bb0789009aaa + - 0x8166f546bab6da521a8369cab06c5d2b9e46670292d85c875ee9ec20e84ffb61 + validatorAddresses: + - 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 + - 0x70997970C51812dc3A010C7d01b50e0d17dc79C8 + - 0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC + - 0x90F79bf6EB2c4f870365E785982E1f101E93b906 + - 0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65 + - 0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc + - 0x976EA74026E726554dB657fA54763abd0C3a0aa9 + - 0x14dC79964da2C08b23698B3D3cc7Ca32193d9955 + - 0x23618e81E3f5cdF7f54C3d65f7FBc0aBf5B21E8f + - 0xa0Ee7A142d267C1f36714E4a8F75612F20a79720 + - 0xBcd4042DE499D14e55001CcbB24a551F3b954096 + - 0x71bE63f3384f5fb98995898A86B02Fb2426c5788 + - 0xFABB0ac9d68B0B445fB7357272Ff202C5651694a + - 0x1CBd3b2770909D4e10f157cABC84C7264073C9Ec + - 0xdF3e18d64BC6A983f673Ab319CCaE4f1a57C7097 + - 0xcd3B766CCDd6AE721141F452C550Ca635964ce71 resources: requests: memory: "512Mi" validator: disabled: false +bot: + txIntervalSeconds: 2 + bootNode: validator: disabled: true diff --git a/spartan/aztec-network/values/3-validators.yaml b/spartan/aztec-network/values/3-validators.yaml index 54c33daf0c4..073c82bdf5e 100644 --- a/spartan/aztec-network/values/3-validators.yaml +++ b/spartan/aztec-network/values/3-validators.yaml @@ -1,9 +1,18 @@ validator: debug: "aztec:*,-aztec:avm_simulator:*,-aztec:libp2p_service" replicas: 3 + validatorKeys: + - 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 + - 0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d + - 0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a + validatorAddresses: + - 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 + - 0x70997970C51812dc3A010C7d01b50e0d17dc79C8 + - 0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC validator: disabled: false + bootNode: validator: disabled: true diff --git a/yarn-project/cli/src/cmds/l1/deploy_l1_contracts.ts b/yarn-project/cli/src/cmds/l1/deploy_l1_contracts.ts index 08a4cc2cbf5..7242b5a8934 100644 --- a/yarn-project/cli/src/cmds/l1/deploy_l1_contracts.ts +++ b/yarn-project/cli/src/cmds/l1/deploy_l1_contracts.ts @@ -1,3 +1,4 @@ +import { type EthAddress } from '@aztec/foundation/eth-address'; import { type DebugLogger, type LogFn } from '@aztec/foundation/log'; import { deployAztecContracts } from '../../utils/aztec.js'; @@ -9,10 +10,19 @@ export async function deployL1Contracts( mnemonic: string, salt: number | undefined, json: boolean, + initialValidators: EthAddress[], log: LogFn, debugLogger: DebugLogger, ) { - const { l1ContractAddresses } = await deployAztecContracts(rpcUrl, chainId, privateKey, mnemonic, salt, debugLogger); + const { l1ContractAddresses } = await deployAztecContracts( + rpcUrl, + chainId, + privateKey, + mnemonic, + salt, + initialValidators, + debugLogger, + ); if (json) { log( diff --git a/yarn-project/cli/src/cmds/l1/index.ts b/yarn-project/cli/src/cmds/l1/index.ts index ae33f3e3f79..612dcd3b79c 100644 --- a/yarn-project/cli/src/cmds/l1/index.ts +++ b/yarn-project/cli/src/cmds/l1/index.ts @@ -1,3 +1,4 @@ +import { EthAddress } from '@aztec/foundation/eth-address'; import { type DebugLogger, type LogFn } from '@aztec/foundation/log'; import { type Command } from 'commander'; @@ -24,6 +25,7 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: DebugL ETHEREUM_HOST, ) .option('-pk, --private-key ', 'The private key to use for deployment', PRIVATE_KEY) + .option('--validators ', 'Comma separated list of validators') .option( '-m, --mnemonic ', 'The mnemonic to use in deployment', @@ -34,6 +36,9 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: DebugL .option('--json', 'Output the contract addresses in JSON format') .action(async options => { const { deployL1Contracts } = await import('./deploy_l1_contracts.js'); + + const initialValidators = + options.validators?.split(',').map((validator: string) => EthAddress.fromString(validator)) || []; await deployL1Contracts( options.rpcUrl, options.l1ChainId, @@ -41,6 +46,7 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: DebugL options.mnemonic, options.salt, options.json, + initialValidators, log, debugLogger, ); diff --git a/yarn-project/cli/src/utils/aztec.ts b/yarn-project/cli/src/utils/aztec.ts index 0ae1f59ac0b..dcc3f71f921 100644 --- a/yarn-project/cli/src/utils/aztec.ts +++ b/yarn-project/cli/src/utils/aztec.ts @@ -58,6 +58,7 @@ export async function deployAztecContracts( privateKey: string | undefined, mnemonic: string, salt: number | undefined, + initialValidators: EthAddress[], debugLogger: DebugLogger, ): Promise { const { @@ -113,6 +114,7 @@ export async function deployAztecContracts( l2FeeJuiceAddress: FeeJuiceAddress, vkTreeRoot: getVKTreeRoot(), salt, + initialValidators, }); }