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 08c7e3156171..f1569b872b09 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 @@ -126,6 +126,7 @@ describe('L1Publisher integration', () => { config.l1RpcUrl, deployerAccount, logger, + { assumeProvenThrough: undefined }, )); ethCheatCodes = new EthCheatCodes(config.l1RpcUrl); diff --git a/yarn-project/end-to-end/src/composed/integration_proof_verification.test.ts b/yarn-project/end-to-end/src/composed/integration_proof_verification.test.ts index 402cfe3fe819..84ccd686e449 100644 --- a/yarn-project/end-to-end/src/composed/integration_proof_verification.test.ts +++ b/yarn-project/end-to-end/src/composed/integration_proof_verification.test.ts @@ -59,6 +59,7 @@ describe('proof_verification', () => { rpcUrl, mnemonicToAccount(MNEMONIC), logger, + { assumeProvenThrough: undefined }, )); logger.info('l1 contracts done'); diff --git a/yarn-project/end-to-end/src/e2e_prover_node.test.ts b/yarn-project/end-to-end/src/e2e_prover_node.test.ts index efab32e13fda..d4683ad294c1 100644 --- a/yarn-project/end-to-end/src/e2e_prover_node.test.ts +++ b/yarn-project/end-to-end/src/e2e_prover_node.test.ts @@ -42,7 +42,9 @@ describe('e2e_prover_node', () => { beforeAll(async () => { logger = createDebugLogger('aztec:e2e_prover_node'); - snapshotManager = createSnapshotManager(`e2e_prover_node`, process.env.E2E_DATA_PATH); + snapshotManager = createSnapshotManager(`e2e_prover_node`, process.env.E2E_DATA_PATH, undefined, { + assumeProvenThrough: undefined, + }); const testContractOpts = { contractAddressSalt: Fr.ONE, universalDeploy: true }; await snapshotManager.snapshot( diff --git a/yarn-project/end-to-end/src/fixtures/setup_l1_contracts.ts b/yarn-project/end-to-end/src/fixtures/setup_l1_contracts.ts index 62099e72a14c..6f622272b8fb 100644 --- a/yarn-project/end-to-end/src/fixtures/setup_l1_contracts.ts +++ b/yarn-project/end-to-end/src/fixtures/setup_l1_contracts.ts @@ -1,4 +1,5 @@ import { type DebugLogger, type L1ContractArtifactsForDeployment, deployL1Contracts } from '@aztec/aztec.js'; +import { type DeployL1ContractsArgs } from '@aztec/ethereum'; import { FeeJuicePortalAbi, FeeJuicePortalBytecode, @@ -25,6 +26,7 @@ export const setupL1Contracts = async ( l1RpcUrl: string, account: HDAccount | PrivateKeyAccount, logger: DebugLogger, + args: Pick, ) => { const l1Artifacts: L1ContractArtifactsForDeployment = { registry: { @@ -57,6 +59,7 @@ export const setupL1Contracts = async ( l2FeeJuiceAddress: FeeJuiceAddress, vkTreeRoot: getVKTreeRoot(), salt: undefined, + ...args, }); return l1Data; 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 bb1af6a9da5f..4a30b4859f0f 100644 --- a/yarn-project/end-to-end/src/fixtures/snapshot_manager.ts +++ b/yarn-project/end-to-end/src/fixtures/snapshot_manager.ts @@ -18,7 +18,7 @@ import { } from '@aztec/aztec.js'; import { deployInstance, registerContractClass } from '@aztec/aztec.js/deployment'; import { DefaultMultiCallEntrypoint } from '@aztec/aztec.js/entrypoint'; -import { createL1Clients } from '@aztec/ethereum'; +import { type DeployL1ContractsArgs, createL1Clients } from '@aztec/ethereum'; import { asyncMap } from '@aztec/foundation/async-map'; import { type Logger, createDebugLogger } from '@aztec/foundation/log'; import { makeBackoff, retry } from '@aztec/foundation/retry'; @@ -60,8 +60,15 @@ type SnapshotEntry = { snapshotPath: string; }; -export function createSnapshotManager(testName: string, dataPath?: string, config: Partial = {}) { - return dataPath ? new SnapshotManager(testName, dataPath, config) : new MockSnapshotManager(testName, config); +export function createSnapshotManager( + testName: string, + dataPath?: string, + config: Partial = {}, + deployL1ContractsArgs: Partial = { assumeProvenThrough: Number.MAX_SAFE_INTEGER }, +) { + return dataPath + ? new SnapshotManager(testName, dataPath, config, deployL1ContractsArgs) + : new MockSnapshotManager(testName, config, deployL1ContractsArgs); } export interface ISnapshotManager { @@ -81,7 +88,11 @@ class MockSnapshotManager implements ISnapshotManager { private context?: SubsystemsContext; private logger: DebugLogger; - constructor(testName: string, private config: Partial = {}) { + constructor( + testName: string, + private config: Partial = {}, + private deployL1ContractsArgs: Partial = { assumeProvenThrough: Number.MAX_SAFE_INTEGER }, + ) { this.logger = createDebugLogger(`aztec:snapshot_manager:${testName}`); this.logger.warn(`No data path given, will not persist any snapshots.`); } @@ -103,7 +114,7 @@ class MockSnapshotManager implements ISnapshotManager { public async setup() { if (!this.context) { - this.context = await setupFromFresh(undefined, this.logger, this.config); + this.context = await setupFromFresh(undefined, this.logger, this.config, this.deployL1ContractsArgs); } return this.context; } @@ -124,7 +135,12 @@ class SnapshotManager implements ISnapshotManager { private livePath: string; private logger: DebugLogger; - constructor(testName: string, private dataPath: string, private config: Partial = {}) { + constructor( + testName: string, + private dataPath: string, + private config: Partial = {}, + private deployL1ContractsArgs: Partial = { assumeProvenThrough: Number.MAX_SAFE_INTEGER }, + ) { this.livePath = join(this.dataPath, 'live', testName); this.logger = createDebugLogger(`aztec:snapshot_manager:${testName}`); } @@ -201,7 +217,7 @@ class SnapshotManager implements ISnapshotManager { this.logger.verbose(`Restoration of ${e.name} complete.`); }); } else { - this.context = await setupFromFresh(this.livePath, this.logger, this.config); + this.context = await setupFromFresh(this.livePath, this.logger, this.config, this.deployL1ContractsArgs); } } return this.context; @@ -269,6 +285,9 @@ async function setupFromFresh( statePath: string | undefined, logger: Logger, config: Partial = {}, + deployL1ContractsArgs: Partial = { + assumeProvenThrough: Number.MAX_SAFE_INTEGER, + }, ): Promise { logger.verbose(`Initializing state...`); @@ -303,7 +322,12 @@ async function setupFromFresh( aztecNodeConfig.publisherPrivateKey = `0x${publisherPrivKey!.toString('hex')}`; aztecNodeConfig.validatorPrivateKey = `0x${validatorPrivKey!.toString('hex')}`; - const deployL1ContractsValues = await setupL1Contracts(aztecNodeConfig.l1RpcUrl, hdAccount, logger); + const deployL1ContractsValues = await setupL1Contracts( + aztecNodeConfig.l1RpcUrl, + hdAccount, + logger, + deployL1ContractsArgs, + ); aztecNodeConfig.l1Contracts = deployL1ContractsValues.l1ContractAddresses; aztecNodeConfig.l1PublishRetryIntervalMS = 100; diff --git a/yarn-project/end-to-end/src/fixtures/utils.ts b/yarn-project/end-to-end/src/fixtures/utils.ts index c7308bf8826f..7d456587d345 100644 --- a/yarn-project/end-to-end/src/fixtures/utils.ts +++ b/yarn-project/end-to-end/src/fixtures/utils.ts @@ -113,7 +113,9 @@ export const setupL1Contracts = async ( l1RpcUrl: string, account: HDAccount | PrivateKeyAccount, logger: DebugLogger, - args: { salt?: number; initialValidators?: EthAddress[] } = {}, + args: { salt?: number; initialValidators?: EthAddress[]; assumeProvenThrough?: number } = { + assumeProvenThrough: Number.MAX_SAFE_INTEGER, + }, chain: Chain = foundry, ) => { const l1Artifacts: L1ContractArtifactsForDeployment = { @@ -148,6 +150,7 @@ export const setupL1Contracts = async ( vkTreeRoot: getVKTreeRoot(), salt: args.salt, initialValidators: args.initialValidators, + assumeProvenThrough: args.assumeProvenThrough, }); return l1Data; diff --git a/yarn-project/ethereum/src/deploy_l1_contracts.ts b/yarn-project/ethereum/src/deploy_l1_contracts.ts index 966bb00224f9..455dcbbc0a79 100644 --- a/yarn-project/ethereum/src/deploy_l1_contracts.ts +++ b/yarn-project/ethereum/src/deploy_l1_contracts.ts @@ -91,6 +91,29 @@ export interface L1ContractArtifactsForDeployment { feeJuicePortal: ContractArtifacts; } +export interface DeployL1ContractsArgs { + /** + * The address of the L2 Fee Juice contract. + */ + l2FeeJuiceAddress: AztecAddress; + /** + * The vk tree root. + */ + vkTreeRoot: Fr; + /** + * The block number to assume proven through. + */ + assumeProvenThrough?: number; + /** + * The salt for CREATE2 deployment. + */ + salt: number | undefined; + /** + * The initial validators for the rollup contract. + */ + initialValidators?: EthAddress[]; +} + export type L1Clients = { publicClient: PublicClient; walletClient: WalletClient; @@ -144,13 +167,7 @@ export const deployL1Contracts = async ( chain: Chain, logger: DebugLogger, contractsToDeploy: L1ContractArtifactsForDeployment, - args: { - l2FeeJuiceAddress: AztecAddress; - vkTreeRoot: Fr; - assumeProvenThrough?: number; - salt: number | undefined; - initialValidators?: EthAddress[]; - }, + args: DeployL1ContractsArgs, ): Promise => { // We are assuming that you are running this on a local anvil node which have 1s block times // To align better with actual deployment, we update the block interval to 12s