From be1695e4aebdf20785f4c2d6e3621f604be99ee8 Mon Sep 17 00:00:00 2001 From: Santiago Palladino Date: Thu, 3 Oct 2024 16:08:53 -0300 Subject: [PATCH] chore: Remove mock proof commitment escrow Simplifies deployment of L1 contracts all across the board. --- l1-contracts/src/core/FeeJuicePortal.sol | 35 +++++------ .../src/core/ProofCommitmentEscrow.sol | 10 +-- l1-contracts/src/core/Rollup.sol | 5 +- .../src/core/interfaces/IFeeJuicePortal.sol | 5 +- l1-contracts/src/mock/MockFeeJuicePortal.sol | 23 +++++++ .../src/mock/MockProofCommitmentEscrow.sol | 42 ------------- l1-contracts/test/Rollup.t.sol | 15 +++-- l1-contracts/test/portals/TokenPortal.t.sol | 9 +-- l1-contracts/test/portals/UniswapPortal.t.sol | 10 +-- .../ProofCommitmentEscrow.t.sol | 3 +- l1-contracts/test/sparta/Sparta.t.sol | 9 +-- yarn-project/aztec/src/sandbox.ts | 6 -- yarn-project/cli/src/utils/aztec.ts | 6 -- .../src/e2e_prover/e2e_prover_test.ts | 2 +- .../src/fixtures/setup_l1_contracts.ts | 12 +--- yarn-project/end-to-end/src/fixtures/utils.ts | 11 ---- .../ethereum/src/deploy_l1_contracts.ts | 61 ++++--------------- .../scripts/generate-artifacts.sh | 1 - 18 files changed, 76 insertions(+), 189 deletions(-) create mode 100644 l1-contracts/src/mock/MockFeeJuicePortal.sol delete mode 100644 l1-contracts/src/mock/MockProofCommitmentEscrow.sol diff --git a/l1-contracts/src/core/FeeJuicePortal.sol b/l1-contracts/src/core/FeeJuicePortal.sol index f6a13e429e4..dee322c6a81 100644 --- a/l1-contracts/src/core/FeeJuicePortal.sol +++ b/l1-contracts/src/core/FeeJuicePortal.sol @@ -23,7 +23,18 @@ contract FeeJuicePortal is IFeeJuicePortal, Ownable { IERC20 public underlying; bytes32 public l2TokenAddress; - constructor(address owner) Ownable(owner) {} + constructor(address _owner, address _registry, address _underlying, bytes32 _l2TokenAddress) + Ownable(_owner) + { + require( + _registry != address(0) && _underlying != address(0) && _l2TokenAddress != 0, + Errors.FeeJuicePortal__InvalidInitialization() + ); + + registry = IRegistry(_registry); + underlying = IERC20(_underlying); + l2TokenAddress = _l2TokenAddress; + } /** * @notice Initialize the FeeJuicePortal @@ -32,28 +43,10 @@ contract FeeJuicePortal is IFeeJuicePortal, Ownable { * * @dev Must be funded with FEE_JUICE_INITIAL_MINT tokens before initialization to * ensure that the L2 contract is funded and able to pay for its deployment. - * - * @param _registry - The address of the registry contract - * @param _underlying - The address of the underlying token - * @param _l2TokenAddress - The address of the L2 token */ - function initialize(address _registry, address _underlying, bytes32 _l2TokenAddress) - external - override(IFeeJuicePortal) - onlyOwner - { - require( - address(registry) == address(0) && address(underlying) == address(0) && l2TokenAddress == 0, - Errors.FeeJuicePortal__AlreadyInitialized() - ); - require( - _registry != address(0) && _underlying != address(0) && _l2TokenAddress != 0, - Errors.FeeJuicePortal__InvalidInitialization() - ); + function initialize() external override(IFeeJuicePortal) onlyOwner { + require(owner() != address(0), Errors.FeeJuicePortal__AlreadyInitialized()); - registry = IRegistry(_registry); - underlying = IERC20(_underlying); - l2TokenAddress = _l2TokenAddress; uint256 balance = underlying.balanceOf(address(this)); if (balance < Constants.FEE_JUICE_INITIAL_MINT) { underlying.safeTransferFrom( diff --git a/l1-contracts/src/core/ProofCommitmentEscrow.sol b/l1-contracts/src/core/ProofCommitmentEscrow.sol index 654a74d2124..c6cc900d81d 100644 --- a/l1-contracts/src/core/ProofCommitmentEscrow.sol +++ b/l1-contracts/src/core/ProofCommitmentEscrow.sol @@ -18,7 +18,7 @@ contract ProofCommitmentEscrow is IProofCommitmentEscrow { Timestamp executableAt; } - address public ROLLUP; + address public immutable ROLLUP; uint256 public constant WITHDRAW_DELAY = Constants.ETHEREUM_SLOT_DURATION * Constants.AZTEC_EPOCH_DURATION * 3; mapping(address => uint256) public deposits; @@ -30,13 +30,9 @@ contract ProofCommitmentEscrow is IProofCommitmentEscrow { _; } - constructor(IERC20 _token) { - token = _token; - } - - function initialize(address _rollup) external { - require(ROLLUP == address(0)); + constructor(IERC20 _token, address _rollup) { ROLLUP = _rollup; + token = _token; } /** diff --git a/l1-contracts/src/core/Rollup.sol b/l1-contracts/src/core/Rollup.sol index 33da46e58cb..e1600ec0dd4 100644 --- a/l1-contracts/src/core/Rollup.sol +++ b/l1-contracts/src/core/Rollup.sol @@ -25,7 +25,7 @@ import {SafeCast} from "@oz/utils/math/SafeCast.sol"; import {Inbox} from "@aztec/core/messagebridge/Inbox.sol"; import {Leonidas} from "@aztec/core/Leonidas.sol"; import {MockVerifier} from "@aztec/mock/MockVerifier.sol"; -import {MockProofCommitmentEscrow} from "@aztec/mock/MockProofCommitmentEscrow.sol"; +import {ProofCommitmentEscrow} from "@aztec/core/ProofCommitmentEscrow.sol"; import {Outbox} from "@aztec/core/messagebridge/Outbox.sol"; import {Timestamp, Slot, Epoch, SlotLib, EpochLib} from "@aztec/core/libraries/TimeMath.sol"; @@ -83,14 +83,13 @@ contract Rollup is EIP712("Aztec Rollup", "1"), Leonidas, IRollup, ITestRollup { constructor( IFeeJuicePortal _fpcJuicePortal, - IProofCommitmentEscrow _proofCommitmentEscrow, // We should create a new instance instead of accepting one, once we remove the Mock version bytes32 _vkTreeRoot, address _ares, address[] memory _validators ) Leonidas(_ares) { epochProofVerifier = new MockVerifier(); FEE_JUICE_PORTAL = _fpcJuicePortal; - PROOF_COMMITMENT_ESCROW = _proofCommitmentEscrow; + PROOF_COMMITMENT_ESCROW = new ProofCommitmentEscrow(_fpcJuicePortal.underlying(), address(this)); INBOX = IInbox(address(new Inbox(address(this), Constants.L1_TO_L2_MSG_SUBTREE_HEIGHT))); OUTBOX = IOutbox(address(new Outbox(address(this)))); vkTreeRoot = _vkTreeRoot; diff --git a/l1-contracts/src/core/interfaces/IFeeJuicePortal.sol b/l1-contracts/src/core/interfaces/IFeeJuicePortal.sol index 0d72524ddea..5f5a7c0d440 100644 --- a/l1-contracts/src/core/interfaces/IFeeJuicePortal.sol +++ b/l1-contracts/src/core/interfaces/IFeeJuicePortal.sol @@ -2,10 +2,13 @@ // Copyright 2024 Aztec Labs. pragma solidity >=0.8.27; +import {IERC20} from "@oz/token/ERC20/IERC20.sol"; + interface IFeeJuicePortal { - function initialize(address _registry, address _underlying, bytes32 _l2TokenAddress) external; + function initialize() external; function distributeFees(address _to, uint256 _amount) external; function depositToAztecPublic(bytes32 _to, uint256 _amount, bytes32 _secretHash) external returns (bytes32); + function underlying() external view returns (IERC20); } diff --git a/l1-contracts/src/mock/MockFeeJuicePortal.sol b/l1-contracts/src/mock/MockFeeJuicePortal.sol new file mode 100644 index 00000000000..75580af598e --- /dev/null +++ b/l1-contracts/src/mock/MockFeeJuicePortal.sol @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2024 Aztec Labs. +pragma solidity >=0.8.27; + +import {IERC20} from "@oz/token/ERC20/IERC20.sol"; +import {IFeeJuicePortal} from "@aztec/core/interfaces/IFeeJuicePortal.sol"; +import {TestERC20} from "@aztec/mock/TestERC20.sol"; + +contract MockFeeJuicePortal is IFeeJuicePortal { + IERC20 public underlying; + + constructor() { + underlying = new TestERC20(); + } + + function initialize() external override {} + + function distributeFees(address, uint256) external override {} + + function depositToAztecPublic(bytes32, uint256, bytes32) external pure override returns (bytes32) { + return bytes32(0); + } +} diff --git a/l1-contracts/src/mock/MockProofCommitmentEscrow.sol b/l1-contracts/src/mock/MockProofCommitmentEscrow.sol deleted file mode 100644 index f556f787901..00000000000 --- a/l1-contracts/src/mock/MockProofCommitmentEscrow.sol +++ /dev/null @@ -1,42 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright 2024 Aztec Labs. -pragma solidity >=0.8.27; - -import {IProofCommitmentEscrow} from "@aztec/core/interfaces/IProofCommitmentEscrow.sol"; -import {Timestamp} from "@aztec/core/libraries/TimeMath.sol"; -import {IERC20} from "@oz/token/ERC20/IERC20.sol"; -import {TestERC20} from "@aztec/mock/TestERC20.sol"; - -contract MockProofCommitmentEscrow is IProofCommitmentEscrow { - mapping(address => uint256) public deposits; - - IERC20 public immutable token; - - constructor() { - token = new TestERC20(); - } - - function deposit(uint256 _amount) external override { - deposits[msg.sender] += _amount; - } - - function startWithdraw(uint256 _amount) external override { - // do nothing - } - - function executeWithdraw() external override { - // do nothing - } - - function unstakeBond(address _prover, uint256 _amount) external override { - // do nothing - } - - function stakeBond(address _prover, uint256 _amount) external override { - // do nothing - } - - function minBalanceAtTime(Timestamp, address _who) external view override returns (uint256) { - return deposits[_who]; - } -} diff --git a/l1-contracts/test/Rollup.t.sol b/l1-contracts/test/Rollup.t.sol index 424a9360043..150b0c1030d 100644 --- a/l1-contracts/test/Rollup.t.sol +++ b/l1-contracts/test/Rollup.t.sol @@ -21,7 +21,6 @@ import {Leonidas} from "@aztec/core/Leonidas.sol"; import {NaiveMerkle} from "./merkle/Naive.sol"; import {MerkleTestUtil} from "./merkle/TestUtil.sol"; import {TestERC20} from "@aztec/mock/TestERC20.sol"; -import {MockProofCommitmentEscrow} from "@aztec/mock/MockProofCommitmentEscrow.sol"; import {TxsDecoderHelper} from "./decoders/helpers/TxsDecoderHelper.sol"; import {IERC20Errors} from "@oz/interfaces/draft-IERC6093.sol"; @@ -68,16 +67,14 @@ contract RollupTest is DecoderBase { registry = new Registry(address(this)); testERC20 = new TestERC20(); - feeJuicePortal = new FeeJuicePortal(address(this)); - testERC20.mint(address(feeJuicePortal), Constants.FEE_JUICE_INITIAL_MINT); - feeJuicePortal.initialize( - address(registry), address(testERC20), bytes32(Constants.FEE_JUICE_ADDRESS) + feeJuicePortal = new FeeJuicePortal( + address(this), address(registry), address(testERC20), bytes32(Constants.FEE_JUICE_ADDRESS) ); - proofCommitmentEscrow = new MockProofCommitmentEscrow(); - rollup = - new Rollup(feeJuicePortal, proofCommitmentEscrow, bytes32(0), address(this), new address[](0)); + testERC20.mint(address(feeJuicePortal), Constants.FEE_JUICE_INITIAL_MINT); + rollup = new Rollup(feeJuicePortal, bytes32(0), address(this), new address[](0)); inbox = Inbox(address(rollup.INBOX())); outbox = Outbox(address(rollup.OUTBOX())); + proofCommitmentEscrow = IProofCommitmentEscrow(address(rollup.PROOF_COMMITMENT_ESCROW())); registry.upgrade(address(rollup)); @@ -98,6 +95,8 @@ contract RollupTest is DecoderBase { testERC20.mint(signer, bond * 10); vm.prank(signer); + testERC20.approve(address(proofCommitmentEscrow), bond * 10); + vm.prank(signer); proofCommitmentEscrow.deposit(bond * 10); _; diff --git a/l1-contracts/test/portals/TokenPortal.t.sol b/l1-contracts/test/portals/TokenPortal.t.sol index d2dde1af4aa..5350187e1b5 100644 --- a/l1-contracts/test/portals/TokenPortal.t.sol +++ b/l1-contracts/test/portals/TokenPortal.t.sol @@ -21,6 +21,7 @@ import {TokenPortal} from "./TokenPortal.sol"; import {TestERC20} from "@aztec/mock/TestERC20.sol"; import {NaiveMerkle} from "../merkle/Naive.sol"; +import {MockFeeJuicePortal} from "@aztec/mock/MockFeeJuicePortal.sol"; contract TokenPortalTest is Test { using Hash for DataStructures.L1ToL2Msg; @@ -61,13 +62,7 @@ contract TokenPortalTest is Test { function setUp() public { registry = new Registry(address(this)); testERC20 = new TestERC20(); - rollup = new Rollup( - IFeeJuicePortal(address(0)), - IProofCommitmentEscrow(address(0)), - bytes32(0), - address(this), - new address[](0) - ); + rollup = new Rollup(new MockFeeJuicePortal(), bytes32(0), address(this), new address[](0)); inbox = rollup.INBOX(); outbox = rollup.OUTBOX(); diff --git a/l1-contracts/test/portals/UniswapPortal.t.sol b/l1-contracts/test/portals/UniswapPortal.t.sol index ce692130c8b..fb717d8f4b1 100644 --- a/l1-contracts/test/portals/UniswapPortal.t.sol +++ b/l1-contracts/test/portals/UniswapPortal.t.sol @@ -21,6 +21,8 @@ import {IProofCommitmentEscrow} from "@aztec/core/interfaces/IProofCommitmentEsc import {TokenPortal} from "./TokenPortal.sol"; import {UniswapPortal} from "./UniswapPortal.sol"; +import {MockFeeJuicePortal} from "@aztec/mock/MockFeeJuicePortal.sol"; + contract UniswapPortalTest is Test { using Hash for DataStructures.L2ToL1Msg; @@ -53,13 +55,7 @@ contract UniswapPortalTest is Test { vm.selectFork(forkId); registry = new Registry(address(this)); - rollup = new Rollup( - IFeeJuicePortal(address(0)), - IProofCommitmentEscrow(address(0)), - bytes32(0), - address(this), - new address[](0) - ); + rollup = new Rollup(new MockFeeJuicePortal(), bytes32(0), address(this), new address[](0)); registry.upgrade(address(rollup)); daiTokenPortal = new TokenPortal(); diff --git a/l1-contracts/test/prover-coordination/ProofCommitmentEscrow.t.sol b/l1-contracts/test/prover-coordination/ProofCommitmentEscrow.t.sol index b986b7182d9..3d0bdc529e4 100644 --- a/l1-contracts/test/prover-coordination/ProofCommitmentEscrow.t.sol +++ b/l1-contracts/test/prover-coordination/ProofCommitmentEscrow.t.sol @@ -32,8 +32,7 @@ contract TestProofCommitmentEscrow is Test { function setUp() public { TOKEN = new TestERC20(); - ESCROW = new ProofCommitmentEscrow(TOKEN); - ESCROW.initialize(address(this)); + ESCROW = new ProofCommitmentEscrow(TOKEN, address(this)); } function testDeposit() public setupWithApproval(address(42), 100) { diff --git a/l1-contracts/test/sparta/Sparta.t.sol b/l1-contracts/test/sparta/Sparta.t.sol index b222961537a..64e2b951e78 100644 --- a/l1-contracts/test/sparta/Sparta.t.sol +++ b/l1-contracts/test/sparta/Sparta.t.sol @@ -20,6 +20,7 @@ import {TxsDecoderHelper} from "../decoders/helpers/TxsDecoderHelper.sol"; import {IFeeJuicePortal} from "@aztec/core/interfaces/IFeeJuicePortal.sol"; import {IProofCommitmentEscrow} from "@aztec/core/interfaces/IProofCommitmentEscrow.sol"; import {MessageHashUtils} from "@oz/utils/cryptography/MessageHashUtils.sol"; +import {MockFeeJuicePortal} from "@aztec/mock/MockFeeJuicePortal.sol"; import {Slot, Epoch, SlotLib, EpochLib} from "@aztec/core/libraries/TimeMath.sol"; @@ -75,13 +76,7 @@ contract SpartaTest is DecoderBase { } testERC20 = new TestERC20(); - rollup = new Rollup( - IFeeJuicePortal(address(0)), - IProofCommitmentEscrow(address(0)), - bytes32(0), - address(this), - initialValidators - ); + rollup = new Rollup(new MockFeeJuicePortal(), bytes32(0), address(this), initialValidators); inbox = Inbox(address(rollup.INBOX())); outbox = Outbox(address(rollup.OUTBOX())); diff --git a/yarn-project/aztec/src/sandbox.ts b/yarn-project/aztec/src/sandbox.ts index 121875bdf3a..9e508647a4b 100644 --- a/yarn-project/aztec/src/sandbox.ts +++ b/yarn-project/aztec/src/sandbox.ts @@ -18,8 +18,6 @@ import { FeeJuicePortalBytecode, InboxAbi, InboxBytecode, - MockProofCommitmentEscrowAbi, - MockProofCommitmentEscrowBytecode, OutboxAbi, OutboxBytecode, RegistryAbi, @@ -117,10 +115,6 @@ export async function deployContractsToL1( contractAbi: FeeJuicePortalAbi, contractBytecode: FeeJuicePortalBytecode, }, - proofCommitmentEscrow: { - contractAbi: MockProofCommitmentEscrowAbi, - contractBytecode: MockProofCommitmentEscrowBytecode, - }, }; const chain = aztecNodeConfig.l1RpcUrl diff --git a/yarn-project/cli/src/utils/aztec.ts b/yarn-project/cli/src/utils/aztec.ts index da0260c88b6..0ae1f59ac0b 100644 --- a/yarn-project/cli/src/utils/aztec.ts +++ b/yarn-project/cli/src/utils/aztec.ts @@ -69,8 +69,6 @@ export async function deployAztecContracts( RegistryBytecode, RollupAbi, RollupBytecode, - MockProofCommitmentEscrowAbi, - MockProofCommitmentEscrowBytecode, FeeJuicePortalAbi, FeeJuicePortalBytecode, TestERC20Abi, @@ -108,10 +106,6 @@ export async function deployAztecContracts( contractAbi: FeeJuicePortalAbi, contractBytecode: FeeJuicePortalBytecode, }, - proofCommitmentEscrow: { - contractAbi: MockProofCommitmentEscrowAbi, - contractBytecode: MockProofCommitmentEscrowBytecode, - }, }; const { getVKTreeRoot } = await import('@aztec/noir-protocol-circuits-types'); diff --git a/yarn-project/end-to-end/src/e2e_prover/e2e_prover_test.ts b/yarn-project/end-to-end/src/e2e_prover/e2e_prover_test.ts index 5b5831f686f..9e720994d52 100644 --- a/yarn-project/end-to-end/src/e2e_prover/e2e_prover_test.ts +++ b/yarn-project/end-to-end/src/e2e_prover/e2e_prover_test.ts @@ -96,7 +96,7 @@ export class FullProverTest { `full_prover_integration/${testName}`, dataPath, { startProverNode: true }, - { assumeProvenThrough: undefined, useRealProofCommitmentEscrow: true }, + { assumeProvenThrough: undefined }, ); } 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 8ac08664c4c..c62950d85cb 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 @@ -5,12 +5,8 @@ import { FeeJuicePortalBytecode, InboxAbi, InboxBytecode, - MockProofCommitmentEscrowAbi, - MockProofCommitmentEscrowBytecode, OutboxAbi, OutboxBytecode, - ProofCommitmentEscrowAbi, - ProofCommitmentEscrowBytecode, RegistryAbi, RegistryBytecode, RollupAbi, @@ -30,7 +26,7 @@ export const setupL1Contracts = async ( l1RpcUrl: string, account: HDAccount | PrivateKeyAccount, logger: DebugLogger, - args: Pick, + args: Pick, ) => { const l1Artifacts: L1ContractArtifactsForDeployment = { registry: { @@ -57,12 +53,6 @@ export const setupL1Contracts = async ( contractAbi: FeeJuicePortalAbi, contractBytecode: FeeJuicePortalBytecode, }, - proofCommitmentEscrow: { - contractAbi: args.useRealProofCommitmentEscrow ? ProofCommitmentEscrowAbi : MockProofCommitmentEscrowAbi, - contractBytecode: args.useRealProofCommitmentEscrow - ? ProofCommitmentEscrowBytecode - : MockProofCommitmentEscrowBytecode, - }, }; const l1Data = await deployL1Contracts(l1RpcUrl, account, foundry, logger, l1Artifacts, { diff --git a/yarn-project/end-to-end/src/fixtures/utils.ts b/yarn-project/end-to-end/src/fixtures/utils.ts index 4c93ebfeb04..9d5c0061710 100644 --- a/yarn-project/end-to-end/src/fixtures/utils.ts +++ b/yarn-project/end-to-end/src/fixtures/utils.ts @@ -47,12 +47,8 @@ import { FeeJuicePortalBytecode, InboxAbi, InboxBytecode, - MockProofCommitmentEscrowAbi, - MockProofCommitmentEscrowBytecode, OutboxAbi, OutboxBytecode, - ProofCommitmentEscrowAbi, - ProofCommitmentEscrowBytecode, RegistryAbi, RegistryBytecode, RollupAbi, @@ -121,7 +117,6 @@ export const setupL1Contracts = async ( salt?: number; initialValidators?: EthAddress[]; assumeProvenThrough?: number; - useRealProofCommitmentEscrow?: boolean; } = { assumeProvenThrough: Number.MAX_SAFE_INTEGER, }, @@ -152,12 +147,6 @@ export const setupL1Contracts = async ( contractAbi: FeeJuicePortalAbi, contractBytecode: FeeJuicePortalBytecode, }, - proofCommitmentEscrow: { - contractAbi: args.useRealProofCommitmentEscrow ? ProofCommitmentEscrowAbi : MockProofCommitmentEscrowAbi, - contractBytecode: args.useRealProofCommitmentEscrow - ? ProofCommitmentEscrowBytecode - : MockProofCommitmentEscrowBytecode, - }, }; const l1Data = await deployL1Contracts(l1RpcUrl, account, chain, logger, l1Artifacts, { diff --git a/yarn-project/ethereum/src/deploy_l1_contracts.ts b/yarn-project/ethereum/src/deploy_l1_contracts.ts index 87c874d60f9..5a030716b5e 100644 --- a/yarn-project/ethereum/src/deploy_l1_contracts.ts +++ b/yarn-project/ethereum/src/deploy_l1_contracts.ts @@ -3,9 +3,8 @@ import { EthAddress } from '@aztec/foundation/eth-address'; import { type Fr } from '@aztec/foundation/fields'; import { type DebugLogger } from '@aztec/foundation/log'; -import type { Abi, AbiConstructor, Narrow } from 'abitype'; +import type { Abi, Narrow } from 'abitype'; import { - type AbiFunction, type Account, type Chain, type Hex, @@ -90,10 +89,6 @@ export interface L1ContractArtifactsForDeployment { * Fee juice portal contract artifacts. Optional for now as gas is not strictly enforced */ feeJuicePortal: ContractArtifacts; - /** - * Proof commitment escrow. Either mock or actual implementation. - */ - proofCommitmentEscrow: ContractArtifacts; } export interface DeployL1ContractsArgs { @@ -117,10 +112,6 @@ export interface DeployL1ContractsArgs { * The initial validators for the rollup contract. */ initialValidators?: EthAddress[]; - /** - * Whether to deploy the real proof commitment escrow as opposed to the mock. - */ - useRealProofCommitmentEscrow?: boolean; } export type L1Clients = { @@ -209,26 +200,18 @@ export const deployL1Contracts = async ( logger.info(`Deployed Registry at ${registryAddress}`); const feeJuiceAddress = await deployer.deploy(contractsToDeploy.feeJuice); - logger.info(`Deployed Fee Juice at ${feeJuiceAddress}`); - const feeJuicePortalAddress = await deployer.deploy(contractsToDeploy.feeJuicePortal, [account.address.toString()]); - - logger.info(`Deployed Gas Portal at ${feeJuicePortalAddress}`); - - // Mock implementation of escrow takes no arguments - const proofCommitmentEscrow = await deployer.deploy( - contractsToDeploy.proofCommitmentEscrow, - (contractsToDeploy.proofCommitmentEscrow.contractAbi as Abi).find( - (fn): fn is AbiConstructor => fn.type === 'constructor', - )?.inputs.length === 0 - ? [] - : [feeJuiceAddress.toString()], - ); + const feeJuicePortalAddress = await deployer.deploy(contractsToDeploy.feeJuicePortal, [ + account.address.toString(), + registryAddress.toString(), + feeJuiceAddress.toString(), + args.l2FeeJuiceAddress.toString(), + ]); + logger.info(`Deployed Fee Juice Portal at ${feeJuicePortalAddress}`); const rollupAddress = await deployer.deploy(contractsToDeploy.rollup, [ - getAddress(feeJuicePortalAddress.toString()), - proofCommitmentEscrow.toString(), + feeJuicePortalAddress.toString(), args.vkTreeRoot.toString(), account.address.toString(), args.initialValidators?.map(v => v.toString()) ?? [], @@ -259,18 +242,6 @@ export const deployL1Contracts = async ( // Transaction hashes to await const txHashes: Hex[] = []; - // Remove this conditional once we dump the MockProofCommitmentEscrow - if ( - (contractsToDeploy.proofCommitmentEscrow.contractAbi as Abi).find(fn => (fn as AbiFunction).name === 'initialize') - ) { - const proofCommitmentEscrowContract = getContract({ - address: proofCommitmentEscrow.toString(), - abi: contractsToDeploy.proofCommitmentEscrow.contractAbi, - client: walletClient, - }); - txHashes.push(await proofCommitmentEscrowContract.write.initialize([rollupAddress.toString()])); - } - // @note This value MUST match what is in `constants.nr`. It is currently specified here instead of just importing // because there is circular dependency hell. This is a temporary solution. #3342 // @todo #8084 @@ -283,22 +254,16 @@ export const deployL1Contracts = async ( await publicClient.waitForTransactionReceipt({ hash: mintTxHash }); logger.info(`Funding fee juice portal contract with fee juice in ${mintTxHash}`); - if ((await feeJuicePortal.read.registry([])) === zeroAddress) { - const initPortalTxHash = await feeJuicePortal.write.initialize([ - registryAddress.toString(), - feeJuiceAddress.toString(), - args.l2FeeJuiceAddress.toString(), - ]); + if ((await feeJuicePortal.read.owner([])) !== zeroAddress) { + const initPortalTxHash = await feeJuicePortal.write.initialize([]); txHashes.push(initPortalTxHash); - logger.verbose( - `Fee juice portal initializing with registry ${registryAddress.toString()} in tx ${initPortalTxHash}`, - ); + logger.verbose(`Fee juice portal initializing in tx ${initPortalTxHash}`); } else { logger.verbose(`Fee juice portal is already initialized`); } logger.info( - `Initialized Gas Portal at ${feeJuicePortalAddress} to bridge between L1 ${feeJuiceAddress} to L2 ${args.l2FeeJuiceAddress}`, + `Initialized Fee Juice Portal at ${feeJuicePortalAddress} to bridge between L1 ${feeJuiceAddress} to L2 ${args.l2FeeJuiceAddress}`, ); if (isAnvilTestChain(chain.id)) { diff --git a/yarn-project/l1-artifacts/scripts/generate-artifacts.sh b/yarn-project/l1-artifacts/scripts/generate-artifacts.sh index 6728a894d1d..331996442cd 100755 --- a/yarn-project/l1-artifacts/scripts/generate-artifacts.sh +++ b/yarn-project/l1-artifacts/scripts/generate-artifacts.sh @@ -23,7 +23,6 @@ CONTRACTS=( "l1-contracts:IVerifier" "l1-contracts:IProofCommitmentEscrow" "l1-contracts:ProofCommitmentEscrow" - "l1-contracts:MockProofCommitmentEscrow" )