diff --git a/boxes/package.json b/boxes/package.json index 9b0417032dee..a8e1c4ed9a96 100644 --- a/boxes/package.json +++ b/boxes/package.json @@ -19,6 +19,7 @@ "@aztec/bb.js": "portal:../barretenberg/ts", "@aztec/circuit-types": "portal:../yarn-project/circuit-types", "@aztec/ethereum": "portal:../yarn-project/ethereum", + "@aztec/l1-artifacts": "portal:../yarn-project/l1-artifacts", "@aztec/types": "portal:../yarn-project/types" } } diff --git a/boxes/yarn.lock b/boxes/yarn.lock index 5719e430a8d2..f8fd0466acd6 100644 --- a/boxes/yarn.lock +++ b/boxes/yarn.lock @@ -255,7 +255,6 @@ __metadata: "@aztec/foundation": "workspace:^" eslint: "npm:^8.35.0" lodash.chunk: "npm:^4.2.0" - lodash.times: "npm:^4.3.2" tslib: "npm:^2.4.0" languageName: node linkType: soft @@ -265,6 +264,7 @@ __metadata: resolution: "@aztec/ethereum@portal:../yarn-project/ethereum::locator=%40aztec%2Fboxes%40workspace%3A." dependencies: "@aztec/foundation": "workspace:^" + "@aztec/l1-artifacts": "workspace:^" dotenv: "npm:^16.0.3" tslib: "npm:^2.4.0" viem: "npm:^1.2.5" @@ -297,11 +297,20 @@ __metadata: languageName: node linkType: soft +"@aztec/l1-artifacts@portal:../yarn-project/l1-artifacts::locator=%40aztec%2Fboxes%40workspace%3A.": + version: 0.0.0-use.local + resolution: "@aztec/l1-artifacts@portal:../yarn-project/l1-artifacts::locator=%40aztec%2Fboxes%40workspace%3A." + dependencies: + tslib: "npm:^2.4.0" + languageName: node + linkType: soft + "@aztec/types@portal:../yarn-project/types::locator=%40aztec%2Fboxes%40workspace%3A.": version: 0.0.0-use.local resolution: "@aztec/types@portal:../yarn-project/types::locator=%40aztec%2Fboxes%40workspace%3A." dependencies: "@aztec/ethereum": "workspace:^" + "@aztec/foundation": "workspace:^" languageName: node linkType: soft diff --git a/yarn-project/aztec-node/package.json b/yarn-project/aztec-node/package.json index a2e602a03fff..991f378f57e7 100644 --- a/yarn-project/aztec-node/package.json +++ b/yarn-project/aztec-node/package.json @@ -39,7 +39,6 @@ "@aztec/ethereum": "workspace:^", "@aztec/foundation": "workspace:^", "@aztec/kv-store": "workspace:^", - "@aztec/l1-artifacts": "workspace:^", "@aztec/merkle-tree": "workspace:^", "@aztec/p2p": "workspace:^", "@aztec/sequencer-client": "workspace:^", diff --git a/yarn-project/aztec-node/tsconfig.json b/yarn-project/aztec-node/tsconfig.json index 9979b01f137a..47545e975009 100644 --- a/yarn-project/aztec-node/tsconfig.json +++ b/yarn-project/aztec-node/tsconfig.json @@ -24,9 +24,6 @@ { "path": "../kv-store" }, - { - "path": "../l1-artifacts" - }, { "path": "../merkle-tree" }, diff --git a/yarn-project/aztec-sandbox/package.json b/yarn-project/aztec-sandbox/package.json index 30d0f41da34d..83a274f8fbdf 100644 --- a/yarn-project/aztec-sandbox/package.json +++ b/yarn-project/aztec-sandbox/package.json @@ -34,7 +34,6 @@ "@aztec/circuits.js": "workspace:^", "@aztec/ethereum": "workspace:^", "@aztec/foundation": "workspace:^", - "@aztec/l1-artifacts": "workspace:^", "@aztec/noir-compiler": "workspace:^", "@aztec/noir-contracts": "workspace:^", "@aztec/p2p": "workspace:^", diff --git a/yarn-project/aztec-sandbox/src/bin/index.ts b/yarn-project/aztec-sandbox/src/bin/index.ts index 97aa2d790ea1..f113624e34fc 100644 --- a/yarn-project/aztec-sandbox/src/bin/index.ts +++ b/yarn-project/aztec-sandbox/src/bin/index.ts @@ -17,7 +17,7 @@ import { dirname, resolve } from 'path'; import { mnemonicToAccount } from 'viem/accounts'; import { setupFileDebugLog } from '../logging.js'; -import { MNEMONIC, createAztecNode, createAztecPXE, createSandbox, deployContractsToL1 } from '../sandbox.js'; +import { MNEMONIC, createAztecNode, createAztecPXE, createSandbox, waitThenDeployL1Contracts } from '../sandbox.js'; import { github, splash } from '../splash.js'; /** @@ -146,7 +146,7 @@ async function main() { // Deploy L1 Aztec Contracts if needed if (deployAztecContracts) { - await deployContractsToL1(nodeConfig, hdAccount); + await waitThenDeployL1Contracts(nodeConfig, hdAccount); if (nodeConfig.publisherPrivateKey === NULL_KEY) { const privKey = hdAccount.getHdKey().privateKey; nodeConfig.publisherPrivateKey = `0x${Buffer.from(privKey!).toString('hex')}`; diff --git a/yarn-project/aztec-sandbox/src/sandbox.ts b/yarn-project/aztec-sandbox/src/sandbox.ts index acb868e4bca4..6ab05a950acf 100644 --- a/yarn-project/aztec-sandbox/src/sandbox.ts +++ b/yarn-project/aztec-sandbox/src/sandbox.ts @@ -1,29 +1,9 @@ #!/usr/bin/env -S node --no-warnings import { AztecNodeConfig, AztecNodeService, getConfigEnvVars } from '@aztec/aztec-node'; import { AztecNode } from '@aztec/circuit-types'; -import { - DeployL1Contracts, - L1ContractArtifactsForDeployment, - NULL_KEY, - createEthereumChain, - deployL1Contracts, -} from '@aztec/ethereum'; +import { NULL_KEY, createEthereumChain, deployL1Contracts } from '@aztec/ethereum'; import { createDebugLogger } from '@aztec/foundation/log'; import { retryUntil } from '@aztec/foundation/retry'; -import { - AvailabilityOracleAbi, - AvailabilityOracleBytecode, - ContractDeploymentEmitterAbi, - ContractDeploymentEmitterBytecode, - InboxAbi, - InboxBytecode, - OutboxAbi, - OutboxBytecode, - RegistryAbi, - RegistryBytecode, - RollupAbi, - RollupBytecode, -} from '@aztec/l1-artifacts'; import { PXEServiceConfig, createPXEService, getPXEServiceConfig } from '@aztec/pxe'; import { HDAccount, createPublicClient, http as httpViemTransport } from 'viem'; @@ -37,9 +17,11 @@ const logger = createDebugLogger('aztec:sandbox'); const localAnvil = foundry; /** - * Helper function that waits for the Ethereum RPC server to respond before deploying L1 contracts. + * Waits then deploys L1 contracts. + * @param config - The Aztec Node Config. + * @param hdAccount - Account for publishing L1 contracts. */ -async function waitThenDeploy(config: AztecNodeConfig, deployFunction: () => Promise) { +export async function waitThenDeployL1Contracts(config: AztecNodeConfig, hdAccount: HDAccount) { const chain = createEthereumChain(config.rpcUrl, config.apiKey); // wait for ETH RPC to respond to a request. const publicClient = createPublicClient({ @@ -66,49 +48,9 @@ async function waitThenDeploy(config: AztecNodeConfig, deployFunction: () => Pro } // Deploy L1 contracts - return await deployFunction(); -} - -/** - * Function to deploy our L1 contracts to the sandbox L1 - * @param aztecNodeConfig - The Aztec Node Config - * @param hdAccount - Account for publishing L1 contracts - */ -export async function deployContractsToL1(aztecNodeConfig: AztecNodeConfig, hdAccount: HDAccount) { - const l1Artifacts: L1ContractArtifactsForDeployment = { - contractDeploymentEmitter: { - contractAbi: ContractDeploymentEmitterAbi, - contractBytecode: ContractDeploymentEmitterBytecode, - }, - registry: { - contractAbi: RegistryAbi, - contractBytecode: RegistryBytecode, - }, - inbox: { - contractAbi: InboxAbi, - contractBytecode: InboxBytecode, - }, - outbox: { - contractAbi: OutboxAbi, - contractBytecode: OutboxBytecode, - }, - availabilityOracle: { - contractAbi: AvailabilityOracleAbi, - contractBytecode: AvailabilityOracleBytecode, - }, - rollup: { - contractAbi: RollupAbi, - contractBytecode: RollupBytecode, - }, - }; - - aztecNodeConfig.l1Contracts = ( - await waitThenDeploy(aztecNodeConfig, () => - deployL1Contracts(aztecNodeConfig.rpcUrl, hdAccount, localAnvil, logger, l1Artifacts), - ) - ).l1ContractAddresses; + config.l1Contracts = (await deployL1Contracts(config.rpcUrl, hdAccount, localAnvil, logger)).l1ContractAddresses; - return aztecNodeConfig.l1Contracts; + return config.l1Contracts; } /** Sandbox settings. */ @@ -131,7 +73,7 @@ export async function createSandbox(config: Partial = {}) { } if (!aztecNodeConfig.p2pEnabled) { - await deployContractsToL1(aztecNodeConfig, hdAccount); + await waitThenDeployL1Contracts(aztecNodeConfig, hdAccount); } const node = await createAztecNode(aztecNodeConfig); diff --git a/yarn-project/aztec-sandbox/tsconfig.json b/yarn-project/aztec-sandbox/tsconfig.json index 7b9c2ea9188d..7c81d796b3da 100644 --- a/yarn-project/aztec-sandbox/tsconfig.json +++ b/yarn-project/aztec-sandbox/tsconfig.json @@ -27,9 +27,6 @@ { "path": "../foundation" }, - { - "path": "../l1-artifacts" - }, { "path": "../noir-compiler" }, diff --git a/yarn-project/aztec.js/src/api/ethereum.ts b/yarn-project/aztec.js/src/api/ethereum.ts index 5be2a7ac37dc..fef9478c29f5 100644 --- a/yarn-project/aztec.js/src/api/ethereum.ts +++ b/yarn-project/aztec.js/src/api/ethereum.ts @@ -1,6 +1 @@ -export { - deployL1Contract, - deployL1Contracts, - DeployL1Contracts, - L1ContractArtifactsForDeployment, -} from '@aztec/ethereum'; +export { deployL1Contract, deployL1Contracts, DeployL1Contracts } from '@aztec/ethereum'; diff --git a/yarn-project/aztec.js/src/index.ts b/yarn-project/aztec.js/src/index.ts index ff2378a23bf7..f3a8feab10f1 100644 --- a/yarn-project/aztec.js/src/index.ts +++ b/yarn-project/aztec.js/src/index.ts @@ -125,12 +125,7 @@ export { toBigIntBE } from '@aztec/foundation/bigint-buffer'; export { makeFetch } from '@aztec/foundation/json-rpc/client'; export { FieldsOf } from '@aztec/foundation/types'; -export { - DeployL1Contracts, - L1ContractArtifactsForDeployment, - deployL1Contract, - deployL1Contracts, -} from '@aztec/ethereum'; +export { DeployL1Contracts, deployL1Contract, deployL1Contracts } from '@aztec/ethereum'; // Start of section that exports public api via granular api. // Here you *can* do `export *` as the granular api defacto exports things explicitly. diff --git a/yarn-project/cli/package.json b/yarn-project/cli/package.json index 25d262383576..364a14d8c02f 100644 --- a/yarn-project/cli/package.json +++ b/yarn-project/cli/package.json @@ -39,7 +39,6 @@ "@aztec/circuit-types": "workspace:^", "@aztec/ethereum": "workspace:^", "@aztec/foundation": "workspace:^", - "@aztec/l1-artifacts": "workspace:^", "@aztec/noir-compiler": "workspace:^", "@aztec/noir-contracts": "workspace:^", "@aztec/types": "workspace:^", diff --git a/yarn-project/cli/src/cmds/deploy_l1_contracts.ts b/yarn-project/cli/src/cmds/deploy_l1_contracts.ts index 3b45537d88a6..5c1b1cd3534b 100644 --- a/yarn-project/cli/src/cmds/deploy_l1_contracts.ts +++ b/yarn-project/cli/src/cmds/deploy_l1_contracts.ts @@ -1,9 +1,13 @@ import { DebugLogger, LogFn } from '@aztec/foundation/log'; -import { deployAztecContracts } from '../utils.js'; - /** - * + * 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 privateKey - The private key to be used in contract deployment. + * @param mnemonic - The mnemonic to be used in contract deployment. + * @param log - The log function used to print out addresses. + * @param debugLogger - The debug logger passed to original deploy function. */ export async function deployL1Contracts( rpcUrl: string, @@ -13,7 +17,12 @@ export async function deployL1Contracts( log: LogFn, debugLogger: DebugLogger, ) { - const { l1ContractAddresses } = await deployAztecContracts(rpcUrl, apiKey, privateKey, mnemonic, debugLogger); + const { createEthereumChain, deployL1Contracts: deployL1ContractOriginal } = await import('@aztec/ethereum'); + const { mnemonicToAccount, privateKeyToAccount } = await import('viem/accounts'); + + const account = !privateKey ? mnemonicToAccount(mnemonic!) : privateKeyToAccount(`0x${privateKey}`); + const chain = createEthereumChain(rpcUrl, apiKey); + const { l1ContractAddresses } = await deployL1ContractOriginal(chain.rpcUrl, account, chain.chainInfo, debugLogger); log('\n'); log(`Rollup Address: ${l1ContractAddresses.rollupAddress.toString()}`); @@ -21,5 +30,6 @@ export async function deployL1Contracts( log(`L1 -> L2 Inbox Address: ${l1ContractAddresses.inboxAddress.toString()}`); log(`L2 -> L1 Outbox address: ${l1ContractAddresses.outboxAddress.toString()}`); log(`Contract Deployment Emitter Address: ${l1ContractAddresses.contractDeploymentEmitterAddress.toString()}`); + log(`Availability Oracle Address: ${l1ContractAddresses.availabilityOracleAddress.toString()}`); log('\n'); } diff --git a/yarn-project/cli/src/utils.ts b/yarn-project/cli/src/utils.ts index a3926ae67502..fd48adcd109f 100644 --- a/yarn-project/cli/src/utils.ts +++ b/yarn-project/cli/src/utils.ts @@ -1,10 +1,8 @@ import { type ContractArtifact, type FunctionArtifact } from '@aztec/aztec.js/abi'; import { AztecAddress } from '@aztec/aztec.js/aztec_address'; -import { type L1ContractArtifactsForDeployment } from '@aztec/aztec.js/ethereum'; import { type PXE } from '@aztec/aztec.js/interfaces/pxe'; -import { DebugLogger, LogFn } from '@aztec/foundation/log'; +import { LogFn } from '@aztec/foundation/log'; import { NoirPackageConfig } from '@aztec/foundation/noir'; -import { AvailabilityOracleAbi, AvailabilityOracleBytecode } from '@aztec/l1-artifacts'; import TOML from '@iarna/toml'; import { CommanderError, InvalidArgumentError } from 'commander'; @@ -33,66 +31,6 @@ export function getFunctionArtifact(artifact: ContractArtifact, fnName: string): return fn; } -/** - * 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 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, - privateKey: string, - mnemonic: string, - debugLogger: DebugLogger, -) { - const { - ContractDeploymentEmitterAbi, - ContractDeploymentEmitterBytecode, - InboxAbi, - InboxBytecode, - OutboxAbi, - OutboxBytecode, - RegistryAbi, - RegistryBytecode, - RollupAbi, - RollupBytecode, - } = await import('@aztec/l1-artifacts'); - const { createEthereumChain, deployL1Contracts } = await import('@aztec/ethereum'); - const { mnemonicToAccount, privateKeyToAccount } = await import('viem/accounts'); - - const account = !privateKey ? mnemonicToAccount(mnemonic!) : privateKeyToAccount(`0x${privateKey}`); - const chain = createEthereumChain(rpcUrl, apiKey); - const l1Artifacts: L1ContractArtifactsForDeployment = { - contractDeploymentEmitter: { - contractAbi: ContractDeploymentEmitterAbi, - contractBytecode: ContractDeploymentEmitterBytecode, - }, - registry: { - contractAbi: RegistryAbi, - contractBytecode: RegistryBytecode, - }, - inbox: { - contractAbi: InboxAbi, - contractBytecode: InboxBytecode, - }, - outbox: { - contractAbi: OutboxAbi, - contractBytecode: OutboxBytecode, - }, - availabilityOracle: { - contractAbi: AvailabilityOracleAbi, - contractBytecode: AvailabilityOracleBytecode, - }, - rollup: { - contractAbi: RollupAbi, - contractBytecode: RollupBytecode, - }, - }; - return await deployL1Contracts(chain.rpcUrl, account, chain.chainInfo, debugLogger, l1Artifacts); -} - /** * Gets all contracts available in \@aztec/noir-contracts. * @returns The contract ABIs. diff --git a/yarn-project/cli/tsconfig.json b/yarn-project/cli/tsconfig.json index d90429154452..d00ac690eed9 100644 --- a/yarn-project/cli/tsconfig.json +++ b/yarn-project/cli/tsconfig.json @@ -21,9 +21,6 @@ { "path": "../foundation" }, - { - "path": "../l1-artifacts" - }, { "path": "../noir-compiler" }, diff --git a/yarn-project/end-to-end/src/fixtures/utils.ts b/yarn-project/end-to-end/src/fixtures/utils.ts index 8942bded2971..a187d00a975f 100644 --- a/yarn-project/end-to-end/src/fixtures/utils.ts +++ b/yarn-project/end-to-end/src/fixtures/utils.ts @@ -8,7 +8,6 @@ import { DebugLogger, DeployL1Contracts, EthCheatCodes, - L1ContractArtifactsForDeployment, L2BlockL2Logs, LogType, PXE, @@ -19,34 +18,11 @@ import { deployL1Contracts, waitForPXE, } from '@aztec/aztec.js'; -import { - AvailabilityOracleAbi, - AvailabilityOracleBytecode, - ContractDeploymentEmitterAbi, - ContractDeploymentEmitterBytecode, - InboxAbi, - InboxBytecode, - OutboxAbi, - OutboxBytecode, - RegistryAbi, - RegistryBytecode, - RollupAbi, - RollupBytecode, -} from '@aztec/l1-artifacts'; import { PXEService, PXEServiceConfig, createPXEService, getPXEServiceConfig } from '@aztec/pxe'; import { SequencerClient } from '@aztec/sequencer-client'; import * as path from 'path'; -import { - Account, - Chain, - HDAccount, - HttpTransport, - PrivateKeyAccount, - createPublicClient, - createWalletClient, - http, -} from 'viem'; +import { Account, Chain, HDAccount, HttpTransport, createPublicClient, createWalletClient, http } from 'viem'; import { mnemonicToAccount } from 'viem/accounts'; import { MNEMONIC, localAnvil } from './fixtures.js'; @@ -67,40 +43,6 @@ const getAztecNodeUrl = () => { return url.toString(); }; -export const setupL1Contracts = async ( - l1RpcUrl: string, - account: HDAccount | PrivateKeyAccount, - logger: DebugLogger, -) => { - const l1Artifacts: L1ContractArtifactsForDeployment = { - contractDeploymentEmitter: { - contractAbi: ContractDeploymentEmitterAbi, - contractBytecode: ContractDeploymentEmitterBytecode, - }, - registry: { - contractAbi: RegistryAbi, - contractBytecode: RegistryBytecode, - }, - inbox: { - contractAbi: InboxAbi, - contractBytecode: InboxBytecode, - }, - outbox: { - contractAbi: OutboxAbi, - contractBytecode: OutboxBytecode, - }, - availabilityOracle: { - contractAbi: AvailabilityOracleAbi, - contractBytecode: AvailabilityOracleBytecode, - }, - rollup: { - contractAbi: RollupAbi, - contractBytecode: RollupBytecode, - }, - }; - return await deployL1Contracts(l1RpcUrl, account, localAnvil, logger, l1Artifacts); -}; - /** * Sets up Private eXecution Environment (PXE). * @param numberOfAccounts - The number of new accounts to be created once the PXE is initiated. @@ -282,7 +224,7 @@ export async function setup( } const deployL1ContractsValues = - opts.deployL1ContractsValues ?? (await setupL1Contracts(config.rpcUrl, hdAccount, logger)); + opts.deployL1ContractsValues ?? (await deployL1Contracts(config.rpcUrl, hdAccount, localAnvil, logger)); config.publisherPrivateKey = `0x${publisherPrivKey!.toString('hex')}`; config.l1Contracts = deployL1ContractsValues.l1ContractAddresses; diff --git a/yarn-project/end-to-end/src/integration_l1_publisher.test.ts b/yarn-project/end-to-end/src/integration_l1_publisher.test.ts index be9d3ddad02c..3c94f0f43f30 100644 --- a/yarn-project/end-to-end/src/integration_l1_publisher.test.ts +++ b/yarn-project/end-to-end/src/integration_l1_publisher.test.ts @@ -26,7 +26,7 @@ import { makeNewSideEffectLinkedToNoteHash, makeProof, } from '@aztec/circuits.js/factories'; -import { createEthereumChain } from '@aztec/ethereum'; +import { createEthereumChain, deployL1Contracts } from '@aztec/ethereum'; import { makeTuple, range } from '@aztec/foundation/array'; import { InboxAbi, OutboxAbi, RollupAbi } from '@aztec/l1-artifacts'; import { @@ -60,7 +60,7 @@ import { } from 'viem'; import { PrivateKeyAccount, privateKeyToAccount } from 'viem/accounts'; -import { setupL1Contracts } from './fixtures/utils.js'; +import { localAnvil } from './fixtures/fixtures.js'; // Accounts 4 and 5 of Anvil default startup with mnemonic: 'test test test test test test test test test test test junk' const sequencerPK = '0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a'; @@ -105,10 +105,10 @@ describe('L1Publisher integration', () => { beforeEach(async () => { deployerAccount = privateKeyToAccount(deployerPK); const { - l1ContractAddresses, walletClient, publicClient: publicClient_, - } = await setupL1Contracts(config.rpcUrl, deployerAccount, logger); + l1ContractAddresses, + } = await deployL1Contracts(config.rpcUrl, deployerAccount, localAnvil, logger); publicClient = publicClient_; rollupAddress = getAddress(l1ContractAddresses.rollupAddress.toString()); diff --git a/yarn-project/ethereum/package.json b/yarn-project/ethereum/package.json index 6e381965005f..a0d8c31d58d3 100644 --- a/yarn-project/ethereum/package.json +++ b/yarn-project/ethereum/package.json @@ -25,6 +25,7 @@ ], "dependencies": { "@aztec/foundation": "workspace:^", + "@aztec/l1-artifacts": "workspace:^", "dotenv": "^16.0.3", "tslib": "^2.4.0", "viem": "^1.2.5" diff --git a/yarn-project/ethereum/src/deploy_l1_contracts.ts b/yarn-project/ethereum/src/deploy_l1_contracts.ts index 689423cf8346..b26b84f3031b 100644 --- a/yarn-project/ethereum/src/deploy_l1_contracts.ts +++ b/yarn-project/ethereum/src/deploy_l1_contracts.ts @@ -1,5 +1,19 @@ import { EthAddress } from '@aztec/foundation/eth-address'; import { DebugLogger } from '@aztec/foundation/log'; +import { + AvailabilityOracleAbi, + AvailabilityOracleBytecode, + ContractDeploymentEmitterAbi, + ContractDeploymentEmitterBytecode, + InboxAbi, + InboxBytecode, + OutboxAbi, + OutboxBytecode, + RegistryAbi, + RegistryBytecode, + RollupAbi, + RollupBytecode, +} from '@aztec/l1-artifacts'; import type { Abi, Narrow } from 'abitype'; import { @@ -52,43 +66,12 @@ export interface ContractArtifacts { contractBytecode: Hex; } -/** - * All L1 Contract Artifacts for deployment - */ -export interface L1ContractArtifactsForDeployment { - /** - * Contract deployment emitter artifacts - */ - contractDeploymentEmitter: ContractArtifacts; - /** - * Inbox contract artifacts - */ - inbox: ContractArtifacts; - /** - * Outbox contract artifacts - */ - outbox: ContractArtifacts; - /** - * Availability Oracle contract artifacts - */ - availabilityOracle: ContractArtifacts; - /** - * Registry contract artifacts - */ - registry: ContractArtifacts; - /** - * Rollup contract artifacts - */ - rollup: ContractArtifacts; -} - /** * Deploys the aztec L1 contracts; Rollup, Contract Deployment Emitter & (optionally) Decoder Helper. * @param rpcUrl - URL of the ETH RPC to use for deployment. * @param account - Private Key or HD Account that will deploy the contracts. * @param chain - The chain instance to deploy to. * @param logger - A logger object. - * @param contractsToDeploy - The set of L1 artifacts to be deployed * @returns A list of ETH addresses of the deployed contracts. */ export const deployL1Contracts = async ( @@ -96,7 +79,6 @@ export const deployL1Contracts = async ( account: HDAccount | PrivateKeyAccount, chain: Chain, logger: DebugLogger, - contractsToDeploy: L1ContractArtifactsForDeployment, ): Promise => { logger('Deploying contracts...'); @@ -110,53 +92,37 @@ export const deployL1Contracts = async ( transport: http(rpcUrl), }); - const registryAddress = await deployL1Contract( - walletClient, - publicClient, - contractsToDeploy.registry.contractAbi, - contractsToDeploy.registry.contractBytecode, - ); + const registryAddress = await deployL1Contract(walletClient, publicClient, RegistryAbi, RegistryBytecode); logger(`Deployed Registry at ${registryAddress}`); - const inboxAddress = await deployL1Contract( - walletClient, - publicClient, - contractsToDeploy.inbox.contractAbi, - contractsToDeploy.inbox.contractBytecode, - [getAddress(registryAddress.toString())], - ); + const inboxAddress = await deployL1Contract(walletClient, publicClient, InboxAbi, InboxBytecode, [ + getAddress(registryAddress.toString()), + ]); logger(`Deployed Inbox at ${inboxAddress}`); - const outboxAddress = await deployL1Contract( - walletClient, - publicClient, - contractsToDeploy.outbox.contractAbi, - contractsToDeploy.outbox.contractBytecode, - [getAddress(registryAddress.toString())], - ); + const outboxAddress = await deployL1Contract(walletClient, publicClient, OutboxAbi, OutboxBytecode, [ + getAddress(registryAddress.toString()), + ]); logger(`Deployed Outbox at ${outboxAddress}`); const availabilityOracleAddress = await deployL1Contract( walletClient, publicClient, - contractsToDeploy.availabilityOracle.contractAbi, - contractsToDeploy.availabilityOracle.contractBytecode, + AvailabilityOracleAbi, + AvailabilityOracleBytecode, ); logger(`Deployed AvailabilityOracle at ${availabilityOracleAddress}`); - const rollupAddress = await deployL1Contract( - walletClient, - publicClient, - contractsToDeploy.rollup.contractAbi, - contractsToDeploy.rollup.contractBytecode, - [getAddress(registryAddress.toString()), getAddress(availabilityOracleAddress.toString())], - ); + const rollupAddress = await deployL1Contract(walletClient, publicClient, RollupAbi, RollupBytecode, [ + getAddress(registryAddress.toString()), + getAddress(availabilityOracleAddress.toString()), + ]); logger(`Deployed Rollup at ${rollupAddress}`); // We need to call a function on the registry to set the various contract addresses. const registryContract = getContract({ address: getAddress(registryAddress.toString()), - abi: contractsToDeploy.registry.contractAbi, + abi: RegistryAbi, publicClient, walletClient, }); @@ -168,12 +134,12 @@ export const deployL1Contracts = async ( const contractDeploymentEmitterAddress = await deployL1Contract( walletClient, publicClient, - contractsToDeploy.contractDeploymentEmitter.contractAbi, - contractsToDeploy.contractDeploymentEmitter.contractBytecode, + ContractDeploymentEmitterAbi, + ContractDeploymentEmitterBytecode, ); logger(`Deployed contract deployment emitter at ${contractDeploymentEmitterAddress}`); - const l1Contracts: L1ContractAddresses = { + const l1ContractAddresses: L1ContractAddresses = { availabilityOracleAddress, rollupAddress, registryAddress, @@ -185,7 +151,7 @@ export const deployL1Contracts = async ( return { walletClient, publicClient, - l1ContractAddresses: l1Contracts, + l1ContractAddresses, }; }; diff --git a/yarn-project/ethereum/tsconfig.json b/yarn-project/ethereum/tsconfig.json index e92b3fa25626..b12e902b9463 100644 --- a/yarn-project/ethereum/tsconfig.json +++ b/yarn-project/ethereum/tsconfig.json @@ -9,6 +9,9 @@ "references": [ { "path": "../foundation" + }, + { + "path": "../l1-artifacts" } ] } diff --git a/yarn-project/yarn.lock b/yarn-project/yarn.lock index 5e7bbb294741..11d7c25dcf6f 100644 --- a/yarn-project/yarn.lock +++ b/yarn-project/yarn.lock @@ -171,7 +171,6 @@ __metadata: "@aztec/ethereum": "workspace:^" "@aztec/foundation": "workspace:^" "@aztec/kv-store": "workspace:^" - "@aztec/l1-artifacts": "workspace:^" "@aztec/merkle-tree": "workspace:^" "@aztec/p2p": "workspace:^" "@aztec/sequencer-client": "workspace:^" @@ -209,7 +208,6 @@ __metadata: "@aztec/circuits.js": "workspace:^" "@aztec/ethereum": "workspace:^" "@aztec/foundation": "workspace:^" - "@aztec/l1-artifacts": "workspace:^" "@aztec/noir-compiler": "workspace:^" "@aztec/noir-contracts": "workspace:^" "@aztec/p2p": "workspace:^" @@ -349,7 +347,6 @@ __metadata: "@aztec/circuit-types": "workspace:^" "@aztec/ethereum": "workspace:^" "@aztec/foundation": "workspace:^" - "@aztec/l1-artifacts": "workspace:^" "@aztec/noir-compiler": "workspace:^" "@aztec/noir-contracts": "workspace:^" "@aztec/types": "workspace:^" @@ -454,6 +451,7 @@ __metadata: resolution: "@aztec/ethereum@workspace:ethereum" dependencies: "@aztec/foundation": "workspace:^" + "@aztec/l1-artifacts": "workspace:^" "@jest/globals": ^29.5.0 "@types/jest": ^29.5.0 "@types/node": ^18.14.6