diff --git a/.github/scripts/wait_for_fork.sh b/.github/scripts/wait_for_fork.sh new file mode 100755 index 000000000000..c6952e9fbab4 --- /dev/null +++ b/.github/scripts/wait_for_fork.sh @@ -0,0 +1,17 @@ +#!/bin/bash +set -e + +DEPLOY_TAG=$1 +TEST_FORK_API_KEY=$2 + +# When destroying and applying mainnet fork terraform, it may not be +# ready for a while, as it must register with DNS etc. +# This script waits on a healthy status from the fork - a valid response to the chainid request +# We retry every 20 seconds, and wait for a total of 5 minutes (15 times) +export ETHEREUM_HOST="https://$DEPLOY_TAG-mainnet-fork.aztec.network:8545/$TEST_FORK_API_KEY" + +curl -H "Content-Type: application/json" -X POST --data '{"method":"eth_chainId","params":[],"id":49,"jsonrpc":"2.0"}' \ + --connect-timeout 30 \ + --retry 15 \ + --retry-delay 20 \ + $ETHEREUM_HOST diff --git a/.github/workflows/devnet-deploys.yml b/.github/workflows/devnet-deploys.yml index b425c7330ca7..fa3cab4637e0 100644 --- a/.github/workflows/devnet-deploys.yml +++ b/.github/workflows/devnet-deploys.yml @@ -12,15 +12,20 @@ env: GIT_COMMIT: ${{ github.sha }} DEPLOY_TAG: devnet FILE_PATH: ./l1-contracts/addresses.txt + L1_CHAIN_ID: 677692 + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} # TF Vars TF_VAR_DOCKERHUB_ACCOUNT: aztecprotocol - TF_VAR_CHAIN_ID: 31337 + TF_VAR_L1_CHAIN_ID: 677692 TF_VAR_BOOTNODE_1_PRIVATE_KEY: ${{ secrets.BOOTNODE_1_PRIVATE_KEY }} TF_VAR_BOOTNODE_2_PRIVATE_KEY: ${{ secrets.BOOTNODE_2_PRIVATE_KEY }} TF_VAR_SEQ_1_PUBLISHER_PRIVATE_KEY: ${{ secrets.SEQ_1_PUBLISHER_PRIVATE_KEY }} TF_VAR_SEQ_2_PUBLISHER_PRIVATE_KEY: ${{ secrets.SEQ_2_PUBLISHER_PRIVATE_KEY }} TF_VAR_DEPLOY_TAG: devnet TF_VAR_API_KEY: ${{ secrets.FORK_API_KEY }} + TF_VAR_FORK_MNEMONIC: ${{ secrets.FORK_MNEMONIC }} + TF_VAR_INFURA_API_KEY: ${{ secrets.INFURA_API_KEY }} jobs: setup: @@ -33,6 +38,9 @@ jobs: build: needs: setup runs-on: ${{ github.actor }}-x86 + outputs: + l1_contracts_changed: ${{ steps.check_l1_changes.outputs.result }} + mainnet_fork_changed: ${{ steps.check_fork_changes.outputs.result }} steps: - uses: actions/checkout@v4 with: @@ -46,10 +54,11 @@ jobs: timeout-minutes: 40 # Run the build steps for each image with version and arch, push to dockerhub run: | - earthly-ci --no-output --push ./yarn-project+export-aztec-arch --DIST_TAG=${{ env.DEPLOY_TAG }} + earthly-ci \ + --no-output --push ./yarn-project+export-aztec-arch --DIST_TAG=${{ env.DEPLOY_TAG }} - name: Check if L1 contracts need deployment - id: check_changes_build + id: check_l1_changes uses: actions/github-script@v7 with: script: | @@ -58,6 +67,16 @@ jobs: const fileChanged = changedFiles.includes('l1-contracts/REDEPLOY'); return fileChanged + - name: Check if mainnet fork needs deployment + id: check_fork_changes + uses: actions/github-script@v7 + with: + script: | + const { execSync } = require('child_process'); + const changedFiles = execSync('git diff --name-only ${{ github.event.before }} ${{ github.sha }}').toString().split('\n'); + const fileChanged = changedFiles.some(file => file.startsWith('iac/mainnet-fork')); + return fileChanged + terraform_deploy: runs-on: ubuntu-latest needs: build @@ -76,29 +95,33 @@ jobs: with: aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: us-west-2 + aws-region: eu-west-2 + + - name: Deploy mainnet fork + if: needs.build.outputs.mainnet_fork_changed == 'true' + working-directory: ./iac/mainnet-fork/terraform + run: | + terraform init -input=false -backend-config="key=${{ env.DEPLOY_TAG }}/mainnet-fork" + terraform apply -input=false -auto-approve -replace="aws_ecs_service.aztec_mainnet_fork" -replace="aws_efs_file_system.aztec_mainnet_fork_data_store" + + - name: Wait for mainnet fork deployment + if: needs.build.outputs.mainnet_fork_changed == 'true' + run: | + ./.github/scripts/wait_for_fork.sh ${{ env.DEPLOY_TAG }} ${{ secrets.FORK_API_KEY }} - - name: Check if L1 contracts need deployment - id: check_changes_release - uses: actions/github-script@v7 - with: - script: | - const { execSync } = require('child_process'); - const changedFiles = execSync('git diff --name-only ${{ github.event.before }} ${{ github.sha }}').toString().split('\n'); - const fileChanged = changedFiles.includes('l1-contracts/REDEPLOY'); - return fileChanged - name: Deploy L1 Contracts - if: steps.check_changes_release.outputs.result == 'true' + if: needs.build.outputs.l1_contracts_changed == 'true' || needs.build.outputs.mainnet_fork_changed == 'true' run: | docker pull aztecprotocol/aztec:${{ env.DEPLOY_TAG }} - docker run aztecprotocol/aztec:${{ env.DEPLOY_TAG }} \ - deploy-l1-contracts -p ${{ secrets.SEQ_1_PUBLISHER_PRIVATE_KEY }} \ - -u https://${{ env.DEPLOY_TAG }}-mainnet-fork.aztec.network:8545/${{ secrets.FORK_API_KEY }} \ + docker run aztecprotocol/aztec:${{ env.DEPLOY_TAG }} deploy-l1-contracts \ + --private-key ${{ secrets.SEQ_1_PUBLISHER_PRIVATE_KEY }} \ + --rpc-url https://${{ env.DEPLOY_TAG }}-mainnet-fork.aztec.network:8545/${{ secrets.FORK_API_KEY }} \ + --chain-id ${{ env.L1_CHAIN_ID }} \ | tee ${{ env.FILE_PATH }} ./.github/scripts/extract_l1_addresses.sh ${{ env.FILE_PATH }} - name: Apply l1-contracts Terraform - if: steps.check_changes_release.outputs.result == 'true' + if: needs.build.outputs.l1_contracts_changed == 'true' || needs.build.outputs.mainnet_fork_changed == 'true' working-directory: ./l1-contracts/terraform run: | terraform init -input=false -backend-config="key=${{ env.DEPLOY_TAG }}/l1-contracts" @@ -116,10 +139,10 @@ jobs: terraform init -input=false -backend-config="key=${{ env.DEPLOY_TAG }}/aztec-node" - name: Taint node filesystem if L1 contracts are redeployed - if: steps.check_changes_release.outputs.result == 'true' + if: needs.build.outputs.l1_contracts_changed == 'true' working-directory: ./yarn-project/aztec/terraform/node run: | - terraform state list | grep 'aws_efs_file_system.node_data_store' | xargs -n1 terraform taint + terraform taint aws_efs_file_system.node_data_store - name: Deploy Aztec Nodes working-directory: ./yarn-project/aztec/terraform/node diff --git a/.gitignore b/.gitignore index 464d5e0ba9d8..71f1e37b5e27 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,6 @@ cmake-build-debug .arg .secret .bb_tmp + +# Terraform +*.tfvars \ No newline at end of file diff --git a/aztec-up/bin/docker-compose.sandbox.yml b/aztec-up/bin/docker-compose.sandbox.yml index 2f856a751f04..7d5cc6ebe6cb 100644 --- a/aztec-up/bin/docker-compose.sandbox.yml +++ b/aztec-up/bin/docker-compose.sandbox.yml @@ -23,7 +23,7 @@ services: DEBUG: # Loaded from the user shell if explicitly set HOST_WORKDIR: "${PWD}" # Loaded from the user shell to show log files absolute path in host ETHEREUM_HOST: ${ETHEREUM_HOST:-http://ethereum:${ANVIL_PORT:-8545}} - CHAIN_ID: 31337 + L1_CHAIN_ID: 31337 ARCHIVER_POLLING_INTERVAL_MS: 50 P2P_BLOCK_CHECK_INTERVAL_MS: 50 SEQ_TX_POLLING_INTERVAL_MS: 50 @@ -31,10 +31,10 @@ services: PXE_BLOCK_POLLING_INTERVAL_MS: 50 ARCHIVER_VIEM_POLLING_INTERVAL_MS: 500 PXE_PORT: ${PXE_PORT:-8080} - PORT: ${AZTEC_NODE_PORT:-8080} + PORT: ${AZTEC_NODE_PORT:-8080} TEST_ACCOUNTS: ${TEST_ACCOUNTS:-true} volumes: - ./log:/usr/src/yarn-project/aztec/log:rw depends_on: - ethereum - command: "start --sandbox" \ No newline at end of file + command: "start --sandbox" diff --git a/boxes/docker-compose.yml b/boxes/docker-compose.yml index c42e6dbd5d23..2ac3069334eb 100644 --- a/boxes/docker-compose.yml +++ b/boxes/docker-compose.yml @@ -6,10 +6,10 @@ services: aztec: image: aztecprotocol/aztec:${AZTEC_DOCKER_TAG:-latest} - command: 'start --sandbox' + command: "start --sandbox" environment: ETHEREUM_HOST: http://ethereum:8545 - CHAIN_ID: 31337 + L1_CHAIN_ID: 31337 ARCHIVER_POLLING_INTERVAL_MS: 50 P2P_BLOCK_CHECK_INTERVAL_MS: 50 SEQ_TX_POLLING_INTERVAL_MS: 50 @@ -29,7 +29,7 @@ services: DEBUG: "aztec:*" DEBUG_COLORS: "true" ETHEREUM_HOST: http://ethereum:8545 - CHAIN_ID: 31337 + L1_CHAIN_ID: 31337 PXE_URL: http://aztec:8080 BOX: ${BOX:-vanilla} CI: ${CI:-} diff --git a/build-system/scripts/deploy_terraform b/build-system/scripts/deploy_terraform index 5312bdec1d77..aa11408fb67a 100755 --- a/build-system/scripts/deploy_terraform +++ b/build-system/scripts/deploy_terraform @@ -29,7 +29,7 @@ export TF_VAR_DOCKERHUB_ACCOUNT=$DOCKERHUB_ACCOUNT export TF_VAR_FORK_MNEMONIC=$FORK_MNEMONIC export TF_VAR_INFURA_API_KEY=$INFURA_API_KEY export TF_VAR_API_KEY=$FORK_API_KEY -export TF_VAR_CHAIN_ID=$CHAIN_ID +export TF_VAR_L1_CHAIN_ID=$CHAIN_ID # If given a repository name, use it to construct and set/override the backend key. # Otherwise use the key as specified in the terraform. diff --git a/docker-compose.yml b/docker-compose.yml index b65e980c58d5..9a031f37e47e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,7 +8,7 @@ services: LOG_LEVEL: ${LOG_LEVEL:-info} DEBUG: ${DEBUG:-aztec:*,-json-rpc:*,-aztec:circuits:artifact_hash,-aztec:randomness_singleton} DEBUG_COLORS: 1 - CHAIN_ID: 31337 + L1_CHAIN_ID: 31337 VERSION: 1 PXE_PROVER_ENABLED: ${PXE_PROVER_ENABLED:-1} PXE_DATA_DIRECTORY: /var/lib/aztec/pxe @@ -39,7 +39,7 @@ services: LOG_LEVEL: ${LOG_LEVEL:-info} DEBUG: ${DEBUG:-aztec:*,-json-rpc:*,-aztec:circuits:artifact_hash,-aztec:randomness_singleton,-aztec:avm_simulator:*} DEBUG_COLORS: 1 - CHAIN_ID: 31337 + L1_CHAIN_ID: 31337 VERSION: 1 NODE_NO_WARNINGS: 1 PROVER_REAL_PROOFS: ${PROVER_REAL_PROOFS:-1} diff --git a/docs/docs/reference/sandbox_reference/sandbox-reference.md b/docs/docs/reference/sandbox_reference/sandbox-reference.md index 5e9ef0fbfbd9..ff16d411ad96 100644 --- a/docs/docs/reference/sandbox_reference/sandbox-reference.md +++ b/docs/docs/reference/sandbox_reference/sandbox-reference.md @@ -20,7 +20,7 @@ To change them, you can open `~/.aztec/docker-compose.yml` and edit them directl DEBUG=aztec:* # The level of debugging logs to be displayed. using "aztec:*" will log everything. HOST_WORKDIR='${PWD}' # The location to store log outpus. Will use ~/.aztec where the docker-compose.yml file is stored by default. ETHEREUM_HOST=http://ethereum:8545 # The Ethereum JSON RPC URL. We use an anvil instance that runs in parallel to the sandbox on docker by default. -CHAIN_ID=31337 # The Chain ID that the Ethereum host is using. +L1_CHAIN_ID=31337 # The Chain ID that the Ethereum host is using. TEST_ACCOUNTS='true' # Option to deploy 3 test account when sandbox starts. (default: true) MODE='sandbox' # Option to start the sandbox or a standalone part of the system. (default: sandbox) PXE_PORT=8080 # The port that the PXE will be listening to (default: 8080) diff --git a/iac/mainnet-fork/Earthfile b/iac/mainnet-fork/Earthfile index fb480d1801de..29370d327e86 100644 --- a/iac/mainnet-fork/Earthfile +++ b/iac/mainnet-fork/Earthfile @@ -19,11 +19,11 @@ build: # Expose port 80 EXPOSE 80 - # Set entrypoint + # Set entrypoint. ENTRYPOINT ["sh", "-c", "./scripts/run_nginx_anvil.sh"] export-mainnet-fork: FROM +build ARG DIST_TAG="aztec-dev" ARG ARCH - SAVE IMAGE --push spypsy/mainnet-fork:${DIST_TAG}${ARCH:+-$ARCH} + SAVE IMAGE --push aztecprotocol/mainnet-fork:${DIST_TAG}${ARCH:+-$ARCH} diff --git a/iac/mainnet-fork/scripts/run_nginx_anvil.sh b/iac/mainnet-fork/scripts/run_nginx_anvil.sh index 38788424ed74..d73fb885f6cc 100755 --- a/iac/mainnet-fork/scripts/run_nginx_anvil.sh +++ b/iac/mainnet-fork/scripts/run_nginx_anvil.sh @@ -13,12 +13,16 @@ trap 'kill $(jobs -p)' SIGTERM HOST="0.0.0.0" PORT=8544 ETHEREUM_HOST=$HOST:$PORT +# Stripping double quotations from the mnemonic seed phrase +echo "stripping double quotations from the mnemonic seed phrase: ${MNEMONIC:0:10}..." +MNEMONIC_STRIPPED=${MNEMONIC//\"/} +echo "result: ${MNEMONIC_STRIPPED:0:10}..." # Data directory for anvil state mkdir -p /data # Run anvil silently -.foundry/bin/anvil --silent --host $HOST -p $PORT -m "$MNEMONIC" -f=https://mainnet.infura.io/v3/$INFURA_API_KEY --chain-id=$CHAIN_ID --fork-block-number=15918000 --block-base-fee-per-gas=10 -s=$SNAPSHOT_FREQUENCY --state=./data/state --balance=1000000000000000000 >/dev/null & +.foundry/bin/anvil --silent --host $HOST -p $PORT -m "$MNEMONIC_STRIPPED" -f=https://mainnet.infura.io/v3/$INFURA_API_KEY --chain-id=$L1_CHAIN_ID --fork-block-number=15918000 --block-base-fee-per-gas=10 -s=$SNAPSHOT_FREQUENCY --state=./data/state --balance=1000000000000000000 >/dev/null & echo "Waiting for ethereum host at $ETHEREUM_HOST..." while ! curl -s $ETHEREUM_HOST >/dev/null; do sleep 1; done diff --git a/iac/mainnet-fork/terraform/main.tf b/iac/mainnet-fork/terraform/main.tf index 026469d3920b..daee91393ae5 100644 --- a/iac/mainnet-fork/terraform/main.tf +++ b/iac/mainnet-fork/terraform/main.tf @@ -113,57 +113,55 @@ resource "aws_ecs_task_definition" "aztec_mainnet_fork" { } } - container_definitions = <, + nodeInfo: Pick, ) { this.entrypoint = new DefaultAccountEntrypoint( address.address, authWitnessProvider, - nodeInfo.chainId, + nodeInfo.l1ChainId, nodeInfo.protocolVersion, ); - this.chainId = new Fr(nodeInfo.chainId); + this.chainId = new Fr(nodeInfo.l1ChainId); this.version = new Fr(nodeInfo.protocolVersion); } diff --git a/yarn-project/archiver/src/archiver/archiver.ts b/yarn-project/archiver/src/archiver/archiver.ts index b35cd83dcdf1..d599e1c1e19d 100644 --- a/yarn-project/archiver/src/archiver/archiver.ts +++ b/yarn-project/archiver/src/archiver/archiver.ts @@ -109,7 +109,7 @@ export class Archiver implements ArchiveSource { telemetry: TelemetryClient, blockUntilSynced = true, ): Promise { - const chain = createEthereumChain(config.rpcUrl, config.apiKey); + const chain = createEthereumChain(config.rpcUrl); const publicClient = createPublicClient({ chain: chain.chainInfo, transport: http(chain.rpcUrl), diff --git a/yarn-project/archiver/src/archiver/config.ts b/yarn-project/archiver/src/archiver/config.ts index 6badf1a7dc8d..e9f306b03740 100644 --- a/yarn-project/archiver/src/archiver/config.ts +++ b/yarn-project/archiver/src/archiver/config.ts @@ -22,6 +22,11 @@ export interface ArchiverConfig { */ apiKey?: string; + /** + * The L1 chain's ID + */ + l1ChainId?: number; + /** * The polling interval in ms for retrieving new L2 blocks and encrypted logs. */ @@ -54,6 +59,7 @@ export interface ArchiverConfig { export function getConfigEnvVars(): ArchiverConfig { const { ETHEREUM_HOST, + L1_CHAIN_ID, ARCHIVER_POLLING_INTERVAL_MS, ARCHIVER_VIEM_POLLING_INTERVAL_MS, AVAILABILITY_ORACLE_CONTRACT_ADDRESS, @@ -82,6 +88,7 @@ export function getConfigEnvVars(): ArchiverConfig { }; return { rpcUrl: ETHEREUM_HOST || '', + l1ChainId: L1_CHAIN_ID ? +L1_CHAIN_ID : 31337, // 31337 is the default chain id for anvil archiverPollingIntervalMS: ARCHIVER_POLLING_INTERVAL_MS ? +ARCHIVER_POLLING_INTERVAL_MS : 1_000, viemPollingIntervalMS: ARCHIVER_VIEM_POLLING_INTERVAL_MS ? +ARCHIVER_VIEM_POLLING_INTERVAL_MS : 1_000, apiKey: API_KEY, diff --git a/yarn-project/aztec-faucet/src/bin/index.ts b/yarn-project/aztec-faucet/src/bin/index.ts index ad96b2839b6d..5a787b8cf36a 100644 --- a/yarn-project/aztec-faucet/src/bin/index.ts +++ b/yarn-project/aztec-faucet/src/bin/index.ts @@ -13,9 +13,8 @@ import { privateKeyToAccount } from 'viem/accounts'; const { FAUCET_PORT = 8082, API_PREFIX = '', - API_KEY = '', RPC_URL = '', - CHAIN_ID = '', + L1_CHAIN_ID = '', PRIVATE_KEY = '', INTERVAL = '', ETH_AMOUNT = '', @@ -24,8 +23,7 @@ const { const logger = createDebugLogger('aztec:faucet'); const rpcUrl = RPC_URL; -const apiKey = API_KEY; -const chainId = +CHAIN_ID; +const l1ChainId = +L1_CHAIN_ID; const privateKey: Hex = PRIVATE_KEY ? createHex(PRIVATE_KEY) : NULL_KEY; const interval = +INTERVAL; const mapping: { [key: Hex]: Date } = {}; @@ -60,7 +58,7 @@ function checkThrottle(address: Hex) { * @param address - Address to receive some ETH */ async function transferEth(address: string) { - const chain = createEthereumChain(rpcUrl, apiKey); + const chain = createEthereumChain(rpcUrl, l1ChainId); const account = privateKeyToAccount(privateKey); const walletClient = createWalletClient({ @@ -114,8 +112,8 @@ function createRouter(apiPrefix: string) { async function main() { logger.info(`Setting up Aztec Faucet...`); - const chain = createEthereumChain(rpcUrl, apiKey); - if (chain.chainInfo.id !== chainId) { + const chain = createEthereumChain(rpcUrl, l1ChainId); + if (chain.chainInfo.id !== l1ChainId) { throw new Error(`Incorrect chain id, expected ${chain.chainInfo.id}`); } diff --git a/yarn-project/aztec-faucet/terraform/main.tf b/yarn-project/aztec-faucet/terraform/main.tf index 2610b4a6d057..8f2bf84f8a95 100644 --- a/yarn-project/aztec-faucet/terraform/main.tf +++ b/yarn-project/aztec-faucet/terraform/main.tf @@ -36,7 +36,7 @@ data "terraform_remote_state" "aztec2_iac" { locals { api_prefix = "/${var.DEPLOY_TAG}/aztec-faucet/${var.API_KEY}" - rpc_url = "https://${var.DEPLOY_TAG}-mainnet-fork.aztec.network:8545/${var.API_KEY}" + rpc_url = "https://${var.DEPLOY_TAG}-mainnet-fork.aztec.network:8545/${var.API_KEY}" } @@ -118,8 +118,8 @@ resource "aws_ecs_task_definition" "aztec-faucet" { "value": "${local.api_prefix}" }, { - "name": "CHAIN_ID", - "value": "${var.CHAIN_ID}" + "name": "L1_CHAIN_ID", + "value": "${var.L1_CHAIN_ID}" }, { "name": "PRIVATE_KEY", diff --git a/yarn-project/aztec-faucet/terraform/variables.tf b/yarn-project/aztec-faucet/terraform/variables.tf index b8e5cc7a24b5..94ad959012bf 100644 --- a/yarn-project/aztec-faucet/terraform/variables.tf +++ b/yarn-project/aztec-faucet/terraform/variables.tf @@ -6,8 +6,8 @@ variable "API_KEY" { type = string } -variable "CHAIN_ID" { - type = string +variable "L1_CHAIN_ID" { + type = string } variable "FAUCET_PRIVATE_KEY" { diff --git a/yarn-project/aztec-node/src/aztec-node/server.test.ts b/yarn-project/aztec-node/src/aztec-node/server.test.ts deleted file mode 100644 index a1d559bf498a..000000000000 --- a/yarn-project/aztec-node/src/aztec-node/server.test.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { createEthereumChain } from '@aztec/ethereum'; -import { NoopTelemetryClient } from '@aztec/telemetry-client/noop'; - -import { type AztecNodeConfig, AztecNodeService } from '../index.js'; - -describe('aztec node service', () => { - it('fails to create Aztec Node if given incorrect chain id', async () => { - const config: Partial = { - rpcUrl: 'testnet', - apiKey: '12345', - chainId: 12345, // not the testnet chain id - }; - const ethereumChain = createEthereumChain(config.rpcUrl!, config.apiKey); - await expect(() => - AztecNodeService.createAndSync(config as AztecNodeConfig, new NoopTelemetryClient()), - ).rejects.toThrow( - `RPC URL configured for chain id ${ethereumChain.chainInfo.id} but expected id ${config.chainId}`, - ); - }); -}); diff --git a/yarn-project/aztec-node/src/aztec-node/server.ts b/yarn-project/aztec-node/src/aztec-node/server.ts index 7a2e8a8ba045..f069de3afbd9 100644 --- a/yarn-project/aztec-node/src/aztec-node/server.ts +++ b/yarn-project/aztec-node/src/aztec-node/server.ts @@ -100,7 +100,7 @@ export class AztecNodeService implements AztecNode { protected readonly l1ToL2MessageSource: L1ToL2MessageSource, protected readonly worldStateSynchronizer: WorldStateSynchronizer, protected readonly sequencer: SequencerClient | undefined, - protected readonly chainId: number, + protected readonly l1ChainId: number, protected readonly version: number, protected readonly globalVariableBuilder: GlobalVariableBuilder, protected readonly merkleTreesDb: AztecKVStore, @@ -111,7 +111,7 @@ export class AztecNodeService implements AztecNode { ) { this.packageVersion = getPackageInfo().version; const message = - `Started Aztec Node against chain 0x${chainId.toString(16)} with contracts - \n` + + `Started Aztec Node against chain 0x${l1ChainId.toString(16)} with contracts - \n` + `Rollup: ${config.l1Contracts.rollupAddress.toString()}\n` + `Registry: ${config.l1Contracts.registryAddress.toString()}\n` + `Inbox: ${config.l1Contracts.inboxAddress.toString()}\n` + @@ -132,11 +132,11 @@ export class AztecNodeService implements AztecNode { storeLog = createDebugLogger('aztec:node:lmdb'), ): Promise { telemetry ??= new NoopTelemetryClient(); - const ethereumChain = createEthereumChain(config.rpcUrl, config.apiKey); + const ethereumChain = createEthereumChain(config.rpcUrl, config.l1ChainId); //validate that the actual chain id matches that specified in configuration - if (config.chainId !== ethereumChain.chainInfo.id) { + if (config.l1ChainId !== ethereumChain.chainInfo.id) { throw new Error( - `RPC URL configured for chain id ${ethereumChain.chainInfo.id} but expected id ${config.chainId}`, + `RPC URL configured for chain id ${ethereumChain.chainInfo.id} but expected id ${config.l1ChainId}`, ); } @@ -172,7 +172,7 @@ export class AztecNodeService implements AztecNode { const proofVerifier = config.realProofs ? await BBCircuitVerifier.new(config) : new TestCircuitVerifier(); const txValidator = new AggregateTxValidator( - new MetadataTxValidator(config.chainId), + new MetadataTxValidator(config.l1ChainId), new TxProofValidator(proofVerifier), ); @@ -305,7 +305,7 @@ export class AztecNodeService implements AztecNode { * @returns The chain id. */ public getChainId(): Promise { - return Promise.resolve(this.chainId); + return Promise.resolve(this.l1ChainId); } public getContractClass(id: Fr): Promise { @@ -791,7 +791,7 @@ export class AztecNodeService implements AztecNode { const proofVerifier = config.realProofs ? await BBCircuitVerifier.new(newConfig) : new TestCircuitVerifier(); this.txValidator = new AggregateTxValidator( - new MetadataTxValidator(this.chainId), + new MetadataTxValidator(this.l1ChainId), new TxProofValidator(proofVerifier), ); } diff --git a/yarn-project/aztec-node/src/aztec-node/tx_validator/tx_metadata_validator.test.ts b/yarn-project/aztec-node/src/aztec-node/tx_validator/tx_metadata_validator.test.ts index 9fe4555b76d8..58f40185eff0 100644 --- a/yarn-project/aztec-node/src/aztec-node/tx_validator/tx_metadata_validator.test.ts +++ b/yarn-project/aztec-node/src/aztec-node/tx_validator/tx_metadata_validator.test.ts @@ -4,12 +4,12 @@ import { Fr } from '@aztec/circuits.js'; import { MetadataTxValidator } from './tx_metadata_validator.js'; describe('MetadataTxValidator', () => { - let chainId: Fr; + let l1ChainId: Fr; let validator: MetadataTxValidator; beforeEach(() => { - chainId = new Fr(123); - validator = new MetadataTxValidator(chainId); + l1ChainId = new Fr(123); + validator = new MetadataTxValidator(l1ChainId); }); it('allows only transactions for the right chain', async () => { @@ -17,11 +17,11 @@ describe('MetadataTxValidator', () => { const badTxs = [mockTx(3), mockTxForRollup(4)]; goodTxs.forEach(tx => { - tx.data.constants.txContext.chainId = chainId; + tx.data.constants.txContext.chainId = l1ChainId; }); badTxs.forEach(tx => { - tx.data.constants.txContext.chainId = chainId.add(new Fr(1)); + tx.data.constants.txContext.chainId = l1ChainId.add(new Fr(1)); }); await expect(validator.validateTxs([...goodTxs, ...badTxs])).resolves.toEqual([goodTxs, badTxs]); diff --git a/yarn-project/aztec-node/src/aztec-node/tx_validator/tx_metadata_validator.ts b/yarn-project/aztec-node/src/aztec-node/tx_validator/tx_metadata_validator.ts index 46c6ae0ed2fd..d6b5795722ea 100644 --- a/yarn-project/aztec-node/src/aztec-node/tx_validator/tx_metadata_validator.ts +++ b/yarn-project/aztec-node/src/aztec-node/tx_validator/tx_metadata_validator.ts @@ -4,10 +4,10 @@ import { createDebugLogger } from '@aztec/foundation/log'; export class MetadataTxValidator implements TxValidator { #log = createDebugLogger('aztec:sequencer:tx_validator:tx_metadata'); - #chainId: Fr; + #l1ChainId: Fr; - constructor(chainId: number | Fr) { - this.#chainId = new Fr(chainId); + constructor(l1ChainId: number | Fr) { + this.#l1ChainId = new Fr(l1ChainId); } validateTxs(txs: Tx[]): Promise<[validTxs: Tx[], invalidTxs: Tx[]]> { @@ -26,11 +26,11 @@ export class MetadataTxValidator implements TxValidator { } #hasCorrectChainId(tx: Tx): boolean { - if (!tx.data.constants.txContext.chainId.equals(this.#chainId)) { + if (!tx.data.constants.txContext.chainId.equals(this.#l1ChainId)) { this.#log.warn( `Rejecting tx ${Tx.getHash( tx, - )} because of incorrect chain ${tx.data.constants.txContext.chainId.toNumber()} != ${this.#chainId.toNumber()}`, + )} because of incorrect chain ${tx.data.constants.txContext.chainId.toNumber()} != ${this.#l1ChainId.toNumber()}`, ); return false; } else { diff --git a/yarn-project/aztec.js/src/account_manager/index.ts b/yarn-project/aztec.js/src/account_manager/index.ts index c33e20aa2197..7f149e8165d5 100644 --- a/yarn-project/aztec.js/src/account_manager/index.ts +++ b/yarn-project/aztec.js/src/account_manager/index.ts @@ -131,7 +131,7 @@ export class AccountManager { await this.pxe.registerAccount(this.secretKey, this.getCompleteAddress().partialAddress); - const { chainId, protocolVersion } = await this.pxe.getNodeInfo(); + const { l1ChainId: chainId, protocolVersion } = await this.pxe.getNodeInfo(); const deployWallet = new SignerlessWallet(this.pxe, new DefaultMultiCallEntrypoint(chainId, protocolVersion)); // We use a signerless wallet with the multi call entrypoint in order to make multiple calls in one go diff --git a/yarn-project/aztec.js/src/contract/contract.test.ts b/yarn-project/aztec.js/src/contract/contract.test.ts index 5d7413523ac2..f6801fe4ec2f 100644 --- a/yarn-project/aztec.js/src/contract/contract.test.ts +++ b/yarn-project/aztec.js/src/contract/contract.test.ts @@ -32,7 +32,7 @@ describe('Contract Class', () => { }; const mockNodeInfo: NodeInfo = { nodeVersion: 'vx.x.x', - chainId: 1, + l1ChainId: 1, protocolVersion: 2, l1ContractAddresses: l1Addresses, protocolContractAddresses: { diff --git a/yarn-project/aztec.js/src/wallet/signerless_wallet.ts b/yarn-project/aztec.js/src/wallet/signerless_wallet.ts index f69c78d5f335..2f73cca8c270 100644 --- a/yarn-project/aztec.js/src/wallet/signerless_wallet.ts +++ b/yarn-project/aztec.js/src/wallet/signerless_wallet.ts @@ -16,7 +16,7 @@ export class SignerlessWallet extends BaseWallet { async createTxExecutionRequest(execution: ExecutionRequestInit): Promise { let entrypoint = this.entrypoint; if (!entrypoint) { - const { chainId, protocolVersion } = await this.pxe.getNodeInfo(); + const { l1ChainId: chainId, protocolVersion } = await this.pxe.getNodeInfo(); entrypoint = new DefaultEntrypoint(chainId, protocolVersion); } diff --git a/yarn-project/aztec/docker-compose.yml b/yarn-project/aztec/docker-compose.yml index 5ff460fca8ec..c6074ecff61b 100644 --- a/yarn-project/aztec/docker-compose.yml +++ b/yarn-project/aztec/docker-compose.yml @@ -22,7 +22,7 @@ services: DEBUG: # Loaded from the user shell if explicitly set HOST_WORKDIR: '${PWD}' # Loaded from the user shell to show log files absolute path in host ETHEREUM_HOST: http://ethereum:8545 - CHAIN_ID: 31337 + L1_CHAIN_ID: 31337 ARCHIVER_POLLING_INTERVAL_MS: 50 P2P_BLOCK_CHECK_INTERVAL_MS: 50 SEQ_TX_POLLING_INTERVAL_MS: 50 diff --git a/yarn-project/aztec/src/cli/texts.ts b/yarn-project/aztec/src/cli/texts.ts index e3a677dfd9cc..77f775b373d7 100644 --- a/yarn-project/aztec/src/cli/texts.ts +++ b/yarn-project/aztec/src/cli/texts.ts @@ -49,10 +49,10 @@ export const cliTexts = { 'Starts an Archiver with options. If started additionally to --node, the Archiver will attach to that node.' + 'Available options are listed below as cliProperty:ENV_VARIABLE_NAME.\n' + 'rcpUrl:ETHEREUM_HOST - string - The host of the Ethereum node to connect to. Default: http://localhost:8545\n' + - 'apiKey:API_KEY - string - The key for the ethereum node if necessary.\n' + 'archiverPollingIntervalMS:ARCHIVER_POLLING_INTERVAL_MS - number - The polling interval in ms for retrieving new L2 blocks and encrypted logs. Default: 1000\n' + 'viemPollingIntervalMS:ARCHIVER_VIEM_POLLING_INTERVAL_MS - number - The polling interval viem uses in ms. Default: 1000\n' + 'dataDirectory:DATA_DIRECTORY - string - Optional dir to store data. If omitted will store temporarily.\n\n' + + 'l1ChainId:L1_CHAIN_ID - number - The chain id of the ethereum host. Default: 31337\n' + contractAddresses, sequencer: 'Starts a Sequencer with options. If started additionally to --node, the Sequencer will attach to that node.\n' + @@ -60,8 +60,7 @@ export const cliTexts = { 'rcpUrl:ETHEREUM_HOST - string - The host of the Ethereum node to connect to. Default: http://localhost:8545\n' + 'minTxsPerBlock:SEQ_MIN_TXS_PER_BLOCK - number - The minimum number of transactions to include in a block. Default: 1\n' + 'maxTxsPerBlock:SEQ_MAX_TXS_PER_BLOCK - number - The maximum number of transactions to include in a block. Default: 32\n' + - 'apiKey:API_KEY - string - The key for the ethereum node if necessary.\n' + - 'chainId:CHAIN_ID - number - The chain id of the ethereum host. Default: 31337\n' + + 'l1ChainId:L1_CHAIN_ID - number - The chain id of the ethereum host. Default: 31337\n' + 'version:VERSION - number - The version of the Aztec rollup. Default: 1\n' + 'publisherPrivateKey:SEQ_PUBLISHER_PRIVATE_KEY - string - The private key of the publisher. If not provided, will try to infer from default foundry test accounts.\n' + 'requiredConfirmations:SEQ_REQUIRED_CONFIRMATIONS - number - The number of confirmations required before publishing a block. Default: 1\n' + diff --git a/yarn-project/aztec/src/sandbox.ts b/yarn-project/aztec/src/sandbox.ts index 437dbb99baac..570b4a620ec3 100644 --- a/yarn-project/aztec/src/sandbox.ts +++ b/yarn-project/aztec/src/sandbox.ts @@ -54,13 +54,13 @@ const localAnvil = foundry; * Helper function that waits for the Ethereum RPC server to respond before deploying L1 contracts. */ async function waitThenDeploy(config: AztecNodeConfig, deployFunction: () => Promise) { - const chain = createEthereumChain(config.rpcUrl, config.apiKey); + const chain = createEthereumChain(config.rpcUrl, config.l1ChainId); // wait for ETH RPC to respond to a request. const publicClient = createPublicClient({ chain: chain.chainInfo, transport: httpViemTransport(chain.rpcUrl), }); - const chainID = await retryUntil( + const l1ChainID = await retryUntil( async () => { let chainId = 0; try { @@ -75,7 +75,7 @@ async function waitThenDeploy(config: AztecNodeConfig, deployFunction: () => Pro 1, ); - if (!chainID) { + if (!l1ChainID) { throw Error(`Ethereum node unresponsive at ${chain.rpcUrl}.`); } @@ -260,15 +260,15 @@ export async function createSandbox(config: Partial = {}) { const pxe = await createAztecPXE(node); await deployCanonicalKeyRegistry( - new SignerlessWallet(pxe, new DefaultMultiCallEntrypoint(aztecNodeConfig.chainId, aztecNodeConfig.version)), + new SignerlessWallet(pxe, new DefaultMultiCallEntrypoint(aztecNodeConfig.l1ChainId, aztecNodeConfig.version)), ); await deployCanonicalAuthRegistry( - new SignerlessWallet(pxe, new DefaultMultiCallEntrypoint(aztecNodeConfig.chainId, aztecNodeConfig.version)), + new SignerlessWallet(pxe, new DefaultMultiCallEntrypoint(aztecNodeConfig.l1ChainId, aztecNodeConfig.version)), ); if (config.enableGas) { await deployCanonicalL2GasToken( - new SignerlessWallet(pxe, new DefaultMultiCallEntrypoint(aztecNodeConfig.chainId, aztecNodeConfig.version)), + new SignerlessWallet(pxe, new DefaultMultiCallEntrypoint(aztecNodeConfig.l1ChainId, aztecNodeConfig.version)), aztecNodeConfig.l1Contracts, ); } diff --git a/yarn-project/aztec/terraform/node/main.tf b/yarn-project/aztec/terraform/node/main.tf index d446d334c89e..383871baadc6 100644 --- a/yarn-project/aztec/terraform/node/main.tf +++ b/yarn-project/aztec/terraform/node/main.tf @@ -57,7 +57,7 @@ locals { publisher_private_keys = [var.SEQ_1_PUBLISHER_PRIVATE_KEY, var.SEQ_2_PUBLISHER_PRIVATE_KEY] node_p2p_private_keys = [var.NODE_1_PRIVATE_KEY, var.NODE_2_PRIVATE_KEY] node_count = length(local.publisher_private_keys) - data_dir = "/usr/src/yarn-project/aztec/data" + data_dir = "/usr/src/yarn-project/aztec" } output "node_count" { @@ -103,13 +103,12 @@ resource "aws_service_discovery_service" "aztec-node" { # Configure an EFS filesystem. resource "aws_efs_file_system" "node_data_store" { - count = local.node_count - creation_token = "${var.DEPLOY_TAG}-node-${count.index + 1}-data" + creation_token = "${var.DEPLOY_TAG}-node-data" throughput_mode = "provisioned" provisioned_throughput_in_mibps = 20 tags = { - Name = "${var.DEPLOY_TAG}-node-${count.index + 1}-data" + Name = "${var.DEPLOY_TAG}-node-data" } lifecycle_policy { @@ -118,15 +117,13 @@ resource "aws_efs_file_system" "node_data_store" { } resource "aws_efs_mount_target" "public_az1" { - count = local.node_count - file_system_id = aws_efs_file_system.node_data_store[count.index].id + file_system_id = aws_efs_file_system.node_data_store.id subnet_id = data.terraform_remote_state.setup_iac.outputs.subnet_az1_id security_groups = [data.terraform_remote_state.setup_iac.outputs.security_group_public_id] } resource "aws_efs_mount_target" "public_az2" { - count = local.node_count - file_system_id = aws_efs_file_system.node_data_store[count.index].id + file_system_id = aws_efs_file_system.node_data_store.id subnet_id = data.terraform_remote_state.setup_iac.outputs.subnet_az2_id security_groups = [data.terraform_remote_state.setup_iac.outputs.security_group_public_id] } @@ -145,195 +142,210 @@ resource "aws_ecs_task_definition" "aztec-node" { volume { name = "efs-data-store" efs_volume_configuration { - file_system_id = aws_efs_file_system.node_data_store[count.index].id + root_directory = "/" + file_system_id = aws_efs_file_system.node_data_store.id } } - container_definitions = < `-k, --private-key` for all commands that require a private key. - `PUBLIC_KEY` -> `-k, --public-key` for all commands that require a public key. - `PXE_URL` -> `-u, --rpc-url` for commands that require a PXE -- `API_KEY` -> `a, --api-key` for `deploy-l1-contracts`. - `ETHEREUM_RPC_HOST` -> `-u, --rpc-url` for `deploy-l1-contracts`. So if for example you are running your Private eXecution Environment (PXE) remotely you can do: @@ -70,7 +69,7 @@ aztec-cli deploy-l1-contracts [rpcUrl] [options] Options: -- `-a, --api-key `: API key for the Ethereum host. +- `-a, --chain-id `: Chain ID for the Ethereum host. - `-p, --private-key `: The private key to use for deployment. - `-m, --mnemonic `: The mnemonic to use in deployment. Default: `test test test test test test test test test test test junk`. diff --git a/yarn-project/cli/package.json b/yarn-project/cli/package.json index cb1ada4c7f08..e6b974f500c4 100644 --- a/yarn-project/cli/package.json +++ b/yarn-project/cli/package.json @@ -112,4 +112,4 @@ "engines": { "node": ">=18" } -} +} \ No newline at end of file diff --git a/yarn-project/cli/src/cmds/infrastructure/index.ts b/yarn-project/cli/src/cmds/infrastructure/index.ts index 1bb9dfc9a028..be831e98a6ce 100644 --- a/yarn-project/cli/src/cmds/infrastructure/index.ts +++ b/yarn-project/cli/src/cmds/infrastructure/index.ts @@ -2,7 +2,7 @@ import { type DebugLogger, type LogFn } from '@aztec/foundation/log'; import { type Command } from 'commander'; -import { API_KEY, ETHEREUM_HOST, parseOptionalInteger, pxeOption } from '../../utils/commands.js'; +import { ETHEREUM_HOST, chainIdOption, parseOptionalInteger, pxeOption } from '../../utils/commands.js'; export function injectCommands(program: Command, log: LogFn, debugLogger: DebugLogger) { program @@ -24,7 +24,6 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: DebugL 'Url of the ethereum host. Chain identifiers localhost and testnet can be used', ETHEREUM_HOST, ) - .option('-a, --api-key ', 'Api key for the ethereum host', API_KEY) .option( '-m, --mnemonic ', 'The mnemonic for the sender of the tx', @@ -32,6 +31,7 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: DebugL ) .option('--block-number ', 'Block number to query next sequencer for', parseOptionalInteger) .addOption(pxeOption) + .addOption(chainIdOption) .action(async (command, who, options) => { const { sequencers } = await import('./sequencers.js'); await sequencers({ @@ -40,7 +40,7 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: DebugL mnemonic: options.mnemonic, rpcUrl: options.rpcUrl, l1RpcUrl: options.l1RpcUrl, - apiKey: options.apiKey ?? '', + chainId: options.chainId ?? '', blockNumber: options.blockNumber, log, debugLogger, diff --git a/yarn-project/cli/src/cmds/infrastructure/sequencers.ts b/yarn-project/cli/src/cmds/infrastructure/sequencers.ts index 473d08207e2d..685661809530 100644 --- a/yarn-project/cli/src/cmds/infrastructure/sequencers.ts +++ b/yarn-project/cli/src/cmds/infrastructure/sequencers.ts @@ -13,7 +13,7 @@ export async function sequencers(opts: { mnemonic?: string; rpcUrl: string; l1RpcUrl: string; - apiKey: string; + chainId: number; blockNumber?: number; log: LogFn; debugLogger: DebugLogger; @@ -25,14 +25,14 @@ export async function sequencers(opts: { mnemonic, rpcUrl, l1RpcUrl, - apiKey, + chainId, log, debugLogger, } = opts; const client = await createCompatibleClient(rpcUrl, debugLogger); const { l1ContractAddresses } = await client.getNodeInfo(); - const chain = createEthereumChain(l1RpcUrl, apiKey); + const chain = createEthereumChain(l1RpcUrl, chainId); const publicClient = createPublicClient({ chain: chain.chainInfo, transport: http(chain.rpcUrl) }); const walletClient = mnemonic diff --git a/yarn-project/cli/src/cmds/l1/bridge_l1_gas.ts b/yarn-project/cli/src/cmds/l1/bridge_l1_gas.ts index 6c944954adf5..080d461519c6 100644 --- a/yarn-project/cli/src/cmds/l1/bridge_l1_gas.ts +++ b/yarn-project/cli/src/cmds/l1/bridge_l1_gas.ts @@ -10,13 +10,13 @@ export async function bridgeL1Gas( recipient: AztecAddress, rpcUrl: string, l1RpcUrl: string, - apiKey: string, + chainId: number, mnemonic: string, log: LogFn, debugLogger: DebugLogger, ) { // Prepare L1 client - const chain = createEthereumChain(l1RpcUrl, apiKey); + const chain = createEthereumChain(l1RpcUrl, chainId); const { publicClient, walletClient } = createL1Clients(chain.rpcUrl, mnemonic, chain.chainInfo); // Prepare L2 client 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 8541cf380c99..7da0bb450e8a 100644 --- a/yarn-project/cli/src/cmds/l1/deploy_l1_contracts.ts +++ b/yarn-project/cli/src/cmds/l1/deploy_l1_contracts.ts @@ -4,13 +4,13 @@ import { deployAztecContracts } from '../../utils/aztec.js'; export async function deployL1Contracts( rpcUrl: string, - apiKey: string, + chainId: number, privateKey: string, mnemonic: string, log: LogFn, debugLogger: DebugLogger, ) { - const { l1ContractAddresses } = await deployAztecContracts(rpcUrl, apiKey, privateKey, mnemonic, debugLogger); + const { l1ContractAddresses } = await deployAztecContracts(rpcUrl, chainId, privateKey, mnemonic, debugLogger); log('\n'); log(`Rollup Address: ${l1ContractAddresses.rollupAddress.toString()}`); diff --git a/yarn-project/cli/src/cmds/l1/get_l1_balance.ts b/yarn-project/cli/src/cmds/l1/get_l1_balance.ts index 85e216acc4e4..3f67cf9d6e17 100644 --- a/yarn-project/cli/src/cmds/l1/get_l1_balance.ts +++ b/yarn-project/cli/src/cmds/l1/get_l1_balance.ts @@ -11,14 +11,14 @@ export async function getL1Balance( who: EthAddress, rpcUrl: string, l1RpcUrl: string, - apiKey: string, + chainId: number, log: LogFn, debugLogger: DebugLogger, ) { const client = await createCompatibleClient(rpcUrl, debugLogger); const { l1ContractAddresses } = await client.getNodeInfo(); - const chain = createEthereumChain(l1RpcUrl, apiKey); + const chain = createEthereumChain(l1RpcUrl, chainId); const publicClient = createPublicClient({ chain: chain.chainInfo, transport: http(chain.rpcUrl) }); const gasL1 = getContract({ diff --git a/yarn-project/cli/src/cmds/l1/index.ts b/yarn-project/cli/src/cmds/l1/index.ts index 67fb0bc06a11..a7acb5de8ccf 100644 --- a/yarn-project/cli/src/cmds/l1/index.ts +++ b/yarn-project/cli/src/cmds/l1/index.ts @@ -3,9 +3,9 @@ import { type DebugLogger, type LogFn } from '@aztec/foundation/log'; import { type Command } from 'commander'; import { - API_KEY, ETHEREUM_HOST, PRIVATE_KEY, + chainIdOption, parseAztecAddress, parseBigint, parseEthereumAddress, @@ -21,23 +21,16 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: DebugL 'Url of the ethereum host. Chain identifiers localhost and testnet can be used', ETHEREUM_HOST, ) - .option('-a, --api-key ', 'Api key for the ethereum host', API_KEY) .requiredOption('-p, --private-key ', 'The private key to use for deployment', PRIVATE_KEY) .option( '-m, --mnemonic ', 'The mnemonic to use in deployment', 'test test test test test test test test test test test junk', ) + .addOption(chainIdOption) .action(async options => { const { deployL1Contracts } = await import('./deploy_l1_contracts.js'); - await deployL1Contracts( - options.rpcUrl, - options.apiKey ?? '', - options.privateKey, - options.mnemonic, - log, - debugLogger, - ); + await deployL1Contracts(options.rpcUrl, options.chainId, options.privateKey, options.mnemonic, log, debugLogger); }); program @@ -93,13 +86,13 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: DebugL 'Url of the ethereum host. Chain identifiers localhost and testnet can be used', ETHEREUM_HOST, ) - .option('-a, --api-key ', 'Api key for the ethereum host', API_KEY) .option( '-m, --mnemonic ', 'The mnemonic to use for deriving the Ethereum address that will mint and bridge', 'test test test test test test test test test test test junk', ) .addOption(pxeOption) + .addOption(chainIdOption) .action(async (amount, recipient, options) => { const { bridgeL1Gas } = await import('./bridge_l1_gas.js'); await bridgeL1Gas( @@ -107,7 +100,7 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: DebugL recipient, options.rpcUrl, options.l1RpcUrl, - options.apiKey ?? '', + options.chainId, options.mnemonic, log, debugLogger, @@ -123,11 +116,11 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: DebugL 'Url of the ethereum host. Chain identifiers localhost and testnet can be used', ETHEREUM_HOST, ) - .option('-a, --api-key ', 'Api key for the ethereum host', API_KEY) .addOption(pxeOption) + .addOption(chainIdOption) .action(async (who, options) => { const { getL1Balance } = await import('./get_l1_balance.js'); - await getL1Balance(who, options.rpcUrl, options.l1RpcUrl, options.apiKey ?? '', log, debugLogger); + await getL1Balance(who, options.rpcUrl, options.l1RpcUrl, options.chainId, log, debugLogger); }); return program; diff --git a/yarn-project/cli/src/cmds/pxe/call.ts b/yarn-project/cli/src/cmds/pxe/call.ts index dcc9eb750dd6..5daca1d7b27c 100644 --- a/yarn-project/cli/src/cmds/pxe/call.ts +++ b/yarn-project/cli/src/cmds/pxe/call.ts @@ -28,7 +28,7 @@ export async function call( } const client = await createCompatibleClient(rpcUrl, debugLogger); - const { chainId, protocolVersion } = await client.getNodeInfo(); + const { l1ChainId: chainId, protocolVersion } = await client.getNodeInfo(); const call = new ContractFunctionInteraction( new SignerlessWallet(client, new DefaultMultiCallEntrypoint(chainId, protocolVersion)), contractAddress, diff --git a/yarn-project/cli/src/cmds/pxe/get_node_info.ts b/yarn-project/cli/src/cmds/pxe/get_node_info.ts index 3cf45c689d65..9081d0184f7e 100644 --- a/yarn-project/cli/src/cmds/pxe/get_node_info.ts +++ b/yarn-project/cli/src/cmds/pxe/get_node_info.ts @@ -6,7 +6,7 @@ export async function getNodeInfo(rpcUrl: string, debugLogger: DebugLogger, log: const client = await createCompatibleClient(rpcUrl, debugLogger); const info = await client.getNodeInfo(); log(`Node Version: ${info.nodeVersion}`); - log(`Chain Id: ${info.chainId}`); + log(`Chain Id: ${info.l1ChainId}`); log(`Protocol Version: ${info.protocolVersion}`); log(`Rollup Address: ${info.l1ContractAddresses.rollupAddress.toString()}`); log(`Protocol Contract Addresses:`); diff --git a/yarn-project/cli/src/utils/aztec.ts b/yarn-project/cli/src/utils/aztec.ts index 6a7c22f1c836..7a97deb07dea 100644 --- a/yarn-project/cli/src/utils/aztec.ts +++ b/yarn-project/cli/src/utils/aztec.ts @@ -33,13 +33,13 @@ export function getFunctionArtifact(artifact: ContractArtifact, fnName: string): /** * Function to execute the 'deployRollupContracts' command. * @param rpcUrl - The RPC URL of the ethereum node. - * @param apiKey - The api key of the ethereum node endpoint. + * @param chainId - The chain ID of the L1 host. * @param privateKey - The private key to be used in contract deployment. * @param mnemonic - The mnemonic to be used in contract deployment. */ export async function deployAztecContracts( rpcUrl: string, - apiKey: string, + chainId: number, privateKey: string, mnemonic: string, debugLogger: DebugLogger, @@ -66,7 +66,7 @@ export async function deployAztecContracts( const account = !privateKey ? mnemonicToAccount(mnemonic!) : privateKeyToAccount(`${privateKey.startsWith('0x') ? '' : '0x'}${privateKey}` as `0x${string}`); - const chain = createEthereumChain(rpcUrl, apiKey); + const chain = createEthereumChain(rpcUrl, chainId); const l1Artifacts: L1ContractArtifactsForDeployment = { registry: { contractAbi: RegistryAbi, diff --git a/yarn-project/cli/src/utils/commands.ts b/yarn-project/cli/src/utils/commands.ts index 52f191c9e6c9..bee6e68e9994 100644 --- a/yarn-project/cli/src/utils/commands.ts +++ b/yarn-project/cli/src/utils/commands.ts @@ -34,6 +34,17 @@ export const pxeOption = new Option('-u, --rpc-url ', 'URL of the PXE') .default(`http://${LOCALHOST}:8080`) .makeOptionMandatory(true); +export const chainIdOption = new Option('-c, --l1-chain-id ', 'Chain ID of the ethereum host') + .env('L1_CHAIN_ID') + .default('31337') + .argParser(value => { + const parsedValue = Number(value); + if (isNaN(parsedValue)) { + throw new Error('Chain ID must be a number.'); + } + return parsedValue; + }); + export const createPrivateKeyOption = (description: string, mandatory: boolean) => new Option('-e, --private-key ', description) .env('PRIVATE_KEY') diff --git a/yarn-project/end-to-end/scripts/docker-compose-no-sandbox.yml b/yarn-project/end-to-end/scripts/docker-compose-no-sandbox.yml index 221e8273b389..23353de37dce 100644 --- a/yarn-project/end-to-end/scripts/docker-compose-no-sandbox.yml +++ b/yarn-project/end-to-end/scripts/docker-compose-no-sandbox.yml @@ -20,7 +20,7 @@ services: DEBUG: ${DEBUG:-'aztec:*'} DEBUG_COLORS: 1 ETHEREUM_HOST: http://fork:8545 - CHAIN_ID: 31337 + L1_CHAIN_ID: 31337 ARCHIVER_POLLING_INTERVAL_MS: 50 P2P_BLOCK_CHECK_INTERVAL_MS: 50 SEQ_TX_POLLING_INTERVAL_MS: 50 diff --git a/yarn-project/end-to-end/scripts/docker-compose-p2p.yml b/yarn-project/end-to-end/scripts/docker-compose-p2p.yml index 369a8eca675c..788a5ad02f1e 100644 --- a/yarn-project/end-to-end/scripts/docker-compose-p2p.yml +++ b/yarn-project/end-to-end/scripts/docker-compose-p2p.yml @@ -28,7 +28,7 @@ services: DEBUG: ${DEBUG:-'aztec:*'} DEBUG_COLORS: 1 ETHEREUM_HOST: http://fork:8545 - CHAIN_ID: 31337 + L1_CHAIN_ID: 31337 ARCHIVER_POLLING_INTERVAL: 500 P2P_CHECK_INTERVAL: 50 SEQ_TX_POLLING_INTERVAL: 50 diff --git a/yarn-project/end-to-end/scripts/docker-compose.yml b/yarn-project/end-to-end/scripts/docker-compose.yml index 06f72f221c41..3c9e447afbbf 100644 --- a/yarn-project/end-to-end/scripts/docker-compose.yml +++ b/yarn-project/end-to-end/scripts/docker-compose.yml @@ -20,7 +20,7 @@ services: DEBUG: 'aztec:*' DEBUG_COLORS: 1 ETHEREUM_HOST: http://fork:8545 - CHAIN_ID: 31337 + L1_CHAIN_ID: 31337 ARCHIVER_POLLING_INTERVAL_MS: 50 P2P_BLOCK_CHECK_INTERVAL_MS: 50 SEQ_TX_POLLING_INTERVAL_MS: 50 @@ -39,7 +39,7 @@ services: DEBUG: ${DEBUG:-aztec:*} DEBUG_COLORS: 1 ETHEREUM_HOST: http://fork:8545 - CHAIN_ID: 31337 + L1_CHAIN_ID: 31337 PXE_URL: http://sandbox:8080 entrypoint: > sh -c ' diff --git a/yarn-project/end-to-end/src/composed/e2e_sandbox_example.test.ts b/yarn-project/end-to-end/src/composed/e2e_sandbox_example.test.ts index 9489dcd9dafc..5ffd66872bb7 100644 --- a/yarn-project/end-to-end/src/composed/e2e_sandbox_example.test.ts +++ b/yarn-project/end-to-end/src/composed/e2e_sandbox_example.test.ts @@ -36,7 +36,7 @@ describe('e2e_sandbox_example', () => { // docs:end:setup expect(typeof nodeInfo.protocolVersion).toBe('number'); - expect(typeof nodeInfo.chainId).toBe('number'); + expect(typeof nodeInfo.l1ChainId).toBe('number'); expect(typeof nodeInfo.l1ContractAddresses.rollupAddress).toBe('object'); // For the sandbox quickstart we just want to show them preloaded accounts (since it is a quickstart) diff --git a/yarn-project/end-to-end/src/composed/integration_l1_publisher.test.ts b/yarn-project/end-to-end/src/composed/integration_l1_publisher.test.ts index 49d1d01888a4..edf4586c2f4d 100644 --- a/yarn-project/end-to-end/src/composed/integration_l1_publisher.test.ts +++ b/yarn-project/end-to-end/src/composed/integration_l1_publisher.test.ts @@ -96,7 +96,7 @@ describe('L1Publisher integration', () => { let blockSource: MockProxy; - const chainId = createEthereumChain(config.rpcUrl, config.apiKey).chainInfo.id; + const chainId = createEthereumChain(config.rpcUrl, config.l1ChainId).chainInfo.id; let coinbase: EthAddress; let feeRecipient: AztecAddress; @@ -148,7 +148,6 @@ describe('L1Publisher integration', () => { publisher = getL1Publisher({ rpcUrl: config.rpcUrl, - apiKey: '', requiredConfirmations: 1, l1Contracts: l1ContractAddresses, publisherPrivateKey: sequencerPK, diff --git a/yarn-project/end-to-end/src/e2e_authwit.test.ts b/yarn-project/end-to-end/src/e2e_authwit.test.ts index ee4748632cec..a32af7b0e66b 100644 --- a/yarn-project/end-to-end/src/e2e_authwit.test.ts +++ b/yarn-project/end-to-end/src/e2e_authwit.test.ts @@ -25,7 +25,7 @@ describe('e2e_authwit_tests', () => { // docs:end:public_deploy_accounts const nodeInfo = await wallets[0].getNodeInfo(); - chainId = new Fr(nodeInfo.chainId); + chainId = new Fr(nodeInfo.l1ChainId); version = new Fr(nodeInfo.protocolVersion); auth = await AuthWitTestContract.deploy(wallets[0]).send().deployed(); diff --git a/yarn-project/end-to-end/src/e2e_fees/fees_test.ts b/yarn-project/end-to-end/src/e2e_fees/fees_test.ts index ead26d72734e..ef1dce54c360 100644 --- a/yarn-project/end-to-end/src/e2e_fees/fees_test.ts +++ b/yarn-project/end-to-end/src/e2e_fees/fees_test.ts @@ -203,7 +203,7 @@ export class FeesTest { await deployCanonicalGasToken( new SignerlessWallet( context.pxe, - new DefaultMultiCallEntrypoint(context.aztecNodeConfig.chainId, context.aztecNodeConfig.version), + new DefaultMultiCallEntrypoint(context.aztecNodeConfig.l1ChainId, context.aztecNodeConfig.version), ), ); }, diff --git a/yarn-project/end-to-end/src/fixtures/snapshot_manager.ts b/yarn-project/end-to-end/src/fixtures/snapshot_manager.ts index 8e982733c990..9b61cc6fdc2f 100644 --- a/yarn-project/end-to-end/src/fixtures/snapshot_manager.ts +++ b/yarn-project/end-to-end/src/fixtures/snapshot_manager.ts @@ -282,11 +282,11 @@ async function setupFromFresh(statePath: string | undefined, logger: Logger): Pr logger.verbose('Deploying key registry...'); await deployCanonicalKeyRegistry( - new SignerlessWallet(pxe, new DefaultMultiCallEntrypoint(aztecNodeConfig.chainId, aztecNodeConfig.version)), + new SignerlessWallet(pxe, new DefaultMultiCallEntrypoint(aztecNodeConfig.l1ChainId, aztecNodeConfig.version)), ); logger.verbose('Deploying auth registry...'); await deployCanonicalAuthRegistry( - new SignerlessWallet(pxe, new DefaultMultiCallEntrypoint(aztecNodeConfig.chainId, aztecNodeConfig.version)), + new SignerlessWallet(pxe, new DefaultMultiCallEntrypoint(aztecNodeConfig.l1ChainId, aztecNodeConfig.version)), ); if (statePath) { diff --git a/yarn-project/end-to-end/src/fixtures/utils.ts b/yarn-project/end-to-end/src/fixtures/utils.ts index 9c086c800449..243bd18ad930 100644 --- a/yarn-project/end-to-end/src/fixtures/utils.ts +++ b/yarn-project/end-to-end/src/fixtures/utils.ts @@ -234,14 +234,14 @@ async function setupWithRemoteEnvironment( const cheatCodes = CheatCodes.create(config.rpcUrl, pxeClient!); const teardown = () => Promise.resolve(); - const { chainId, protocolVersion } = await pxeClient.getNodeInfo(); + const { l1ChainId: chainId, protocolVersion } = await pxeClient.getNodeInfo(); // this contract might already have been deployed // the following deploying functions are idempotent await deployCanonicalKeyRegistry( new SignerlessWallet(pxeClient, new DefaultMultiCallEntrypoint(chainId, protocolVersion)), ); await deployCanonicalAuthRegistry( - new SignerlessWallet(pxeClient, new DefaultMultiCallEntrypoint(config.chainId, config.version)), + new SignerlessWallet(pxeClient, new DefaultMultiCallEntrypoint(config.l1ChainId, config.version)), ); if (enableGas) { @@ -389,18 +389,18 @@ export async function setup( logger.verbose('Deploying key registry...'); await deployCanonicalKeyRegistry( - new SignerlessWallet(pxe, new DefaultMultiCallEntrypoint(config.chainId, config.version)), + new SignerlessWallet(pxe, new DefaultMultiCallEntrypoint(config.l1ChainId, config.version)), ); logger.verbose('Deploying auth registry...'); await deployCanonicalAuthRegistry( - new SignerlessWallet(pxe, new DefaultMultiCallEntrypoint(config.chainId, config.version)), + new SignerlessWallet(pxe, new DefaultMultiCallEntrypoint(config.l1ChainId, config.version)), ); if (enableGas) { logger.verbose('Deploying gas token...'); await deployCanonicalGasToken( - new SignerlessWallet(pxe, new DefaultMultiCallEntrypoint(config.chainId, config.version)), + new SignerlessWallet(pxe, new DefaultMultiCallEntrypoint(config.l1ChainId, config.version)), ); } diff --git a/yarn-project/ethereum/src/index.ts b/yarn-project/ethereum/src/index.ts index 8ef2db852366..d8d15d71ae6d 100644 --- a/yarn-project/ethereum/src/index.ts +++ b/yarn-project/ethereum/src/index.ts @@ -1,9 +1,7 @@ import { foundry } from 'viem/chains'; import { type EthereumChain } from './ethereum_chain.js'; -import { createTestnetChain } from './testnet.js'; -export * from './testnet.js'; export * from './deploy_l1_contracts.js'; export * from './l1_contract_addresses.js'; export * from './constants.js'; @@ -13,15 +11,23 @@ export * from './constants.js'; * @param rpcUrl - The rpc url of the chain or a chain identifier (e.g. 'testnet') * @param apiKey - An optional API key for the chain client. */ -export function createEthereumChain(rpcUrl: string, apiKey?: string) { - if (rpcUrl === 'testnet') { - if (apiKey === undefined || apiKey === '') { - throw new Error('API Key must be provided for aztec testnet'); - } - return createTestnetChain(apiKey!); +export function createEthereumChain(rpcUrl: string, chainId?: number) { + if (chainId) { + return { + chainInfo: { + id: chainId, + nativeCurrency: { + decimals: 18, + name: 'Ether', + symbol: 'ETH', + }, + }, + rpcUrl, + } as EthereumChain; + } else { + return { + chainInfo: foundry, + rpcUrl, + } as EthereumChain; } - return { - chainInfo: foundry, - rpcUrl, - } as EthereumChain; } diff --git a/yarn-project/ethereum/src/testnet.ts b/yarn-project/ethereum/src/testnet.ts deleted file mode 100644 index c6e28871a3ef..000000000000 --- a/yarn-project/ethereum/src/testnet.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { type Chain } from 'viem'; - -import { type EthereumChain } from './ethereum_chain.js'; - -const { DEPLOY_TAG = 'aztec-dev', CHAIN_ID = 31337 } = process.env; - -export const createTestnetChain = (apiKey: string) => { - const chain: Chain = { - id: +CHAIN_ID, - name: 'testnet', - testnet: true, - nativeCurrency: { - name: 'Ether', - symbol: 'ETH', - decimals: 18, - }, - rpcUrls: { - default: { - http: [`https://${DEPLOY_TAG}-mainnet-fork.aztec.network:8545/${apiKey}`], - }, - public: { - http: [`https://${DEPLOY_TAG}-mainnet-fork.aztec.network:8545/${apiKey}`], - }, - }, - }; - return { - chainInfo: chain, - rpcUrl: chain.rpcUrls.default.http[0], - } as EthereumChain; -}; diff --git a/yarn-project/pxe/src/pxe_service/pxe_service.ts b/yarn-project/pxe/src/pxe_service/pxe_service.ts index 0891f5f84d79..1d38298b6fdf 100644 --- a/yarn-project/pxe/src/pxe_service/pxe_service.ts +++ b/yarn-project/pxe/src/pxe_service/pxe_service.ts @@ -118,7 +118,7 @@ export class PXEService implements PXE { await this.synchronizer.start(1, l2BlockPollingIntervalMS); await this.restoreNoteProcessors(); const info = await this.getNodeInfo(); - this.log.info(`Started PXE connected to chain ${info.chainId} version ${info.protocolVersion}`); + this.log.info(`Started PXE connected to chain ${info.l1ChainId} version ${info.protocolVersion}`); } private async restoreNoteProcessors() { @@ -616,7 +616,7 @@ export class PXEService implements PXE { const nodeInfo: NodeInfo = { nodeVersion, - chainId, + l1ChainId: chainId, protocolVersion, l1ContractAddresses: contractAddresses, protocolContractAddresses: protocolContractAddresses, diff --git a/yarn-project/pxe/src/pxe_service/test/pxe_test_suite.ts b/yarn-project/pxe/src/pxe_service/test/pxe_test_suite.ts index 8a9e8bc99b35..938bf246a5e0 100644 --- a/yarn-project/pxe/src/pxe_service/test/pxe_test_suite.ts +++ b/yarn-project/pxe/src/pxe_service/test/pxe_test_suite.ts @@ -144,7 +144,7 @@ export const pxeTestSuite = (testName: string, pxeSetup: () => Promise) => it('successfully gets node info', async () => { const nodeInfo = await pxe.getNodeInfo(); expect(typeof nodeInfo.protocolVersion).toEqual('number'); - expect(typeof nodeInfo.chainId).toEqual('number'); + expect(typeof nodeInfo.l1ChainId).toEqual('number'); expect(nodeInfo.l1ContractAddresses.rollupAddress.toString()).toMatch(/0x[a-fA-F0-9]+/); }); diff --git a/yarn-project/sequencer-client/src/config.ts b/yarn-project/sequencer-client/src/config.ts index bcf7b95c06c2..c75517c3938a 100644 --- a/yarn-project/sequencer-client/src/config.ts +++ b/yarn-project/sequencer-client/src/config.ts @@ -16,7 +16,7 @@ import { type SequencerConfig } from './sequencer/config.js'; /** Chain configuration. */ type ChainConfig = { /** The chain id of the ethereum host. */ - chainId: number; + l1ChainId: number; /** The version of the rollup. */ version: number; }; @@ -37,9 +37,8 @@ export function getConfigEnvVars(): SequencerClientConfig { const { SEQ_PUBLISHER_PRIVATE_KEY, ETHEREUM_HOST, - CHAIN_ID, + L1_CHAIN_ID, VERSION, - API_KEY, SEQ_REQUIRED_CONFIRMATIONS, SEQ_PUBLISH_RETRY_INTERVAL_MS, SEQ_TX_POLLING_INTERVAL_MS, @@ -83,9 +82,8 @@ export function getConfigEnvVars(): SequencerClientConfig { return { enforceFees: ['1', 'true'].includes(ENFORCE_FEES), rpcUrl: ETHEREUM_HOST ? ETHEREUM_HOST : '', - chainId: CHAIN_ID ? +CHAIN_ID : 31337, // 31337 is the default chain id for anvil + l1ChainId: L1_CHAIN_ID ? +L1_CHAIN_ID : 31337, // 31337 is the default chain id for anvil version: VERSION ? +VERSION : 1, // 1 is our default version - apiKey: API_KEY, requiredConfirmations: SEQ_REQUIRED_CONFIRMATIONS ? +SEQ_REQUIRED_CONFIRMATIONS : 1, l1BlockPublishRetryIntervalMS: SEQ_PUBLISH_RETRY_INTERVAL_MS ? +SEQ_PUBLISH_RETRY_INTERVAL_MS : 1_000, transactionPollingIntervalMS: SEQ_TX_POLLING_INTERVAL_MS ? +SEQ_TX_POLLING_INTERVAL_MS : 1_000, diff --git a/yarn-project/sequencer-client/src/global_variable_builder/config.ts b/yarn-project/sequencer-client/src/global_variable_builder/config.ts index 156b0c38c939..dcc75143eab2 100644 --- a/yarn-project/sequencer-client/src/global_variable_builder/config.ts +++ b/yarn-project/sequencer-client/src/global_variable_builder/config.ts @@ -9,9 +9,9 @@ export interface GlobalReaderConfig { */ rpcUrl: string; /** - * The API key of the ethereum host. + * The chain ID of the ethereum host. */ - apiKey?: string; + l1ChainId: number; /** * The deployed l1 contract addresses diff --git a/yarn-project/sequencer-client/src/global_variable_builder/viem-reader.ts b/yarn-project/sequencer-client/src/global_variable_builder/viem-reader.ts index bb1acd8720c8..fb134089e957 100644 --- a/yarn-project/sequencer-client/src/global_variable_builder/viem-reader.ts +++ b/yarn-project/sequencer-client/src/global_variable_builder/viem-reader.ts @@ -23,9 +23,9 @@ export class ViemReader implements L1GlobalReader { private publicClient: PublicClient; constructor(config: GlobalReaderConfig) { - const { rpcUrl, apiKey, l1Contracts } = config; + const { rpcUrl, l1ChainId: chainId, l1Contracts } = config; - const chain = createEthereumChain(rpcUrl, apiKey); + const chain = createEthereumChain(rpcUrl, chainId); this.publicClient = createPublicClient({ chain: chain.chainInfo, diff --git a/yarn-project/sequencer-client/src/publisher/config.ts b/yarn-project/sequencer-client/src/publisher/config.ts index e78fa7c2d19d..b88c2df2285a 100644 --- a/yarn-project/sequencer-client/src/publisher/config.ts +++ b/yarn-project/sequencer-client/src/publisher/config.ts @@ -15,9 +15,9 @@ export interface TxSenderConfig { rpcUrl: string; /** - * The API key of the ethereum host. + * The chain ID of the ethereum host. */ - apiKey?: string; + l1ChainId?: number; /** * The number of confirmations required. diff --git a/yarn-project/sequencer-client/src/publisher/viem-tx-sender.ts b/yarn-project/sequencer-client/src/publisher/viem-tx-sender.ts index 75853b780e62..241fad9ef511 100644 --- a/yarn-project/sequencer-client/src/publisher/viem-tx-sender.ts +++ b/yarn-project/sequencer-client/src/publisher/viem-tx-sender.ts @@ -47,8 +47,8 @@ export class ViemTxSender implements L1PublisherTxSender { private account: PrivateKeyAccount; constructor(config: TxSenderConfig) { - const { rpcUrl, apiKey, publisherPrivateKey, l1Contracts } = config; - const chain = createEthereumChain(rpcUrl, apiKey); + const { rpcUrl, l1ChainId: chainId, publisherPrivateKey, l1Contracts } = config; + const chain = createEthereumChain(rpcUrl, chainId); this.account = privateKeyToAccount(publisherPrivateKey); const walletClient = createWalletClient({ account: this.account, diff --git a/yarn-project/types/src/interfaces/node-info.ts b/yarn-project/types/src/interfaces/node-info.ts index 0c4250a724be..60edf9e8c6a2 100644 --- a/yarn-project/types/src/interfaces/node-info.ts +++ b/yarn-project/types/src/interfaces/node-info.ts @@ -13,7 +13,7 @@ export interface NodeInfo { /** * L1 chain id. */ - chainId: number; + l1ChainId: number; /** * Protocol version. */