diff --git a/l1-contracts/foundry.toml b/l1-contracts/foundry.toml index 012bcf9cf06e..e344d36b14cf 100644 --- a/l1-contracts/foundry.toml +++ b/l1-contracts/foundry.toml @@ -5,7 +5,8 @@ libs = ['lib'] solc = "0.8.23" remappings = [ - "@oz/=lib/openzeppelin-contracts/contracts/" + "@oz/=lib/openzeppelin-contracts/contracts/", + "@aztec/=src" ] # See more config options https://github.com/foundry-rs/foundry/tree/master/config diff --git a/l1-contracts/src/core/FeeJuicePortal.sol b/l1-contracts/src/core/FeeJuicePortal.sol index d315a9f52977..67b40be59297 100644 --- a/l1-contracts/src/core/FeeJuicePortal.sol +++ b/l1-contracts/src/core/FeeJuicePortal.sol @@ -3,17 +3,17 @@ pragma solidity >=0.8.18; import {IERC20} from "@oz/token/ERC20/IERC20.sol"; +import {IFeeJuicePortal} from "@aztec/core/interfaces/IFeeJuicePortal.sol"; +import {IInbox} from "@aztec/core/interfaces/messagebridge/IInbox.sol"; +import {IRegistry} from "@aztec/core/interfaces/messagebridge/IRegistry.sol"; + +import {Constants} from "@aztec/core/libraries/ConstantsGen.sol"; +import {DataStructures} from "@aztec/core/libraries/DataStructures.sol"; +import {Errors} from "@aztec/core/libraries/Errors.sol"; +import {Hash} from "@aztec/core/libraries/crypto/Hash.sol"; import {SafeERC20} from "@oz/token/ERC20/utils/SafeERC20.sol"; -import {Ownable} from "@oz/access/Ownable.sol"; -// Messaging -import {IRegistry} from "./interfaces/messagebridge/IRegistry.sol"; -import {IInbox} from "./interfaces/messagebridge/IInbox.sol"; -import {IFeeJuicePortal} from "./interfaces/IFeeJuicePortal.sol"; -import {DataStructures} from "./libraries/DataStructures.sol"; -import {Errors} from "./libraries/Errors.sol"; -import {Constants} from "./libraries/ConstantsGen.sol"; -import {Hash} from "./libraries/Hash.sol"; +import {Ownable} from "@oz/access/Ownable.sol"; contract FeeJuicePortal is IFeeJuicePortal, Ownable { using SafeERC20 for IERC20; diff --git a/l1-contracts/src/core/sequencer_selection/Leonidas.sol b/l1-contracts/src/core/Leonidas.sol similarity index 97% rename from l1-contracts/src/core/sequencer_selection/Leonidas.sol rename to l1-contracts/src/core/Leonidas.sol index 8a90052500f9..6f5b20b833f2 100644 --- a/l1-contracts/src/core/sequencer_selection/Leonidas.sol +++ b/l1-contracts/src/core/Leonidas.sol @@ -2,16 +2,17 @@ // Copyright 2024 Aztec Labs. pragma solidity >=0.8.18; -import {DataStructures} from "../libraries/DataStructures.sol"; -import {Errors} from "../libraries/Errors.sol"; -import {EnumerableSet} from "@oz/utils/structs/EnumerableSet.sol"; -import {Ownable} from "@oz/access/Ownable.sol"; -import {SampleLib} from "./SampleLib.sol"; -import {SignatureLib} from "../libraries/SignatureLib.sol"; -import {Constants} from "../libraries/ConstantsGen.sol"; +import {ILeonidas} from "@aztec/core/interfaces/ILeonidas.sol"; + +import {Constants} from "@aztec/core/libraries/ConstantsGen.sol"; +import {DataStructures} from "@aztec/core/libraries/DataStructures.sol"; +import {Errors} from "@aztec/core/libraries/Errors.sol"; +import {SampleLib} from "@aztec/core/libraries/crypto/SampleLib.sol"; +import {SignatureLib} from "@aztec/core/libraries/crypto/SignatureLib.sol"; import {MessageHashUtils} from "@oz/utils/cryptography/MessageHashUtils.sol"; +import {EnumerableSet} from "@oz/utils/structs/EnumerableSet.sol"; -import {ILeonidas} from "./ILeonidas.sol"; +import {Ownable} from "@oz/access/Ownable.sol"; /** * @title Leonidas diff --git a/l1-contracts/src/core/Rollup.sol b/l1-contracts/src/core/Rollup.sol index becd52900b08..e163c37e2128 100644 --- a/l1-contracts/src/core/Rollup.sol +++ b/l1-contracts/src/core/Rollup.sol @@ -2,31 +2,28 @@ // Copyright 2023 Aztec Labs. pragma solidity >=0.8.18; -// Interfaces -import {IRollup, ITestRollup} from "./interfaces/IRollup.sol"; -import {IProofCommitmentEscrow} from "./interfaces/IProofCommitmentEscrow.sol"; -import {IInbox} from "./interfaces/messagebridge/IInbox.sol"; -import {IOutbox} from "./interfaces/messagebridge/IOutbox.sol"; -import {IRegistry} from "./interfaces/messagebridge/IRegistry.sol"; -import {IVerifier} from "./interfaces/IVerifier.sol"; -import {IFeeJuicePortal} from "./interfaces/IFeeJuicePortal.sol"; - -// Libraries -import {HeaderLib} from "./libraries/HeaderLib.sol"; -import {Errors} from "./libraries/Errors.sol"; -import {Constants} from "./libraries/ConstantsGen.sol"; -import {MerkleLib} from "./libraries/MerkleLib.sol"; -import {SignatureLib} from "./libraries/SignatureLib.sol"; +import {IProofCommitmentEscrow} from "@aztec/core/interfaces/IProofCommitmentEscrow.sol"; +import {IInbox} from "@aztec/core/interfaces/messagebridge/IInbox.sol"; +import {IOutbox} from "@aztec/core/interfaces/messagebridge/IOutbox.sol"; +import {IFeeJuicePortal} from "@aztec/core/interfaces/IFeeJuicePortal.sol"; +import {IRegistry} from "@aztec/core/interfaces/messagebridge/IRegistry.sol"; +import {IRollup, ITestRollup} from "@aztec/core/interfaces/IRollup.sol"; +import {IVerifier} from "@aztec/core/interfaces/IVerifier.sol"; + +import {Constants} from "@aztec/core/libraries/ConstantsGen.sol"; +import {DataStructures} from "@aztec/core/libraries/DataStructures.sol"; +import {Errors} from "@aztec/core/libraries/Errors.sol"; +import {HeaderLib} from "@aztec/core/libraries/HeaderLib.sol"; +import {TxsDecoder} from "@aztec/core/libraries/TxsDecoder.sol"; +import {MerkleLib} from "@aztec/core/libraries/crypto/MerkleLib.sol"; +import {SignatureLib} from "@aztec/core/libraries/crypto/SignatureLib.sol"; import {SafeCast} from "@oz/utils/math/SafeCast.sol"; -import {DataStructures} from "./libraries/DataStructures.sol"; -import {TxsDecoder} from "./libraries/decoders/TxsDecoder.sol"; -// Contracts -import {MockVerifier} from "../mock/MockVerifier.sol"; -import {MockProofCommitmentEscrow} from "../mock/MockProofCommitmentEscrow.sol"; -import {Inbox} from "./messagebridge/Inbox.sol"; -import {Outbox} from "./messagebridge/Outbox.sol"; -import {Leonidas} from "./sequencer_selection/Leonidas.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 {Outbox} from "@aztec/core/messagebridge/Outbox.sol"; /** * @title Rollup @@ -89,8 +86,8 @@ contract Rollup is Leonidas, IRollup, ITestRollup { REGISTRY = _registry; FEE_JUICE_PORTAL = _fpcJuicePortal; PROOF_COMMITMENT_ESCROW = new MockProofCommitmentEscrow(); - INBOX = new Inbox(address(this), Constants.L1_TO_L2_MSG_SUBTREE_HEIGHT); - OUTBOX = new Outbox(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; VERSION = 1; L1_BLOCK_AT_GENESIS = block.number; @@ -157,7 +154,7 @@ contract Rollup is Leonidas, IRollup, ITestRollup { vkTreeRoot = _vkTreeRoot; } - function claimEpochProofRight(DataStructures.EpochProofQuote calldata _quote) + function claimEpochProofRight(DataStructures.SignedEpochProofQuote calldata _quote) external override(IRollup) { @@ -169,8 +166,8 @@ contract Rollup is Leonidas, IRollup, ITestRollup { revert Errors.Leonidas__InvalidProposer(currentProposer, msg.sender); } - if (_quote.epochToProve != epochToProve) { - revert Errors.Rollup__NotClaimingCorrectEpoch(epochToProve, _quote.epochToProve); + if (_quote.quote.epochToProve != epochToProve) { + revert Errors.Rollup__NotClaimingCorrectEpoch(epochToProve, _quote.quote.epochToProve); } if (currentSlot % Constants.AZTEC_EPOCH_DURATION >= CLAIM_DURATION_IN_L2_SLOTS) { @@ -185,30 +182,32 @@ contract Rollup is Leonidas, IRollup, ITestRollup { revert Errors.Rollup__ProofRightAlreadyClaimed(); } - if (_quote.bondAmount < PROOF_COMMITMENT_MIN_BOND_AMOUNT_IN_TST) { + if (_quote.quote.bondAmount < PROOF_COMMITMENT_MIN_BOND_AMOUNT_IN_TST) { revert Errors.Rollup__InsufficientBondAmount( - PROOF_COMMITMENT_MIN_BOND_AMOUNT_IN_TST, _quote.bondAmount + PROOF_COMMITMENT_MIN_BOND_AMOUNT_IN_TST, _quote.quote.bondAmount ); } - if (_quote.validUntilSlot < currentSlot) { - revert Errors.Rollup__QuoteExpired(currentSlot, _quote.validUntilSlot); + if (_quote.quote.validUntilSlot < currentSlot) { + revert Errors.Rollup__QuoteExpired(currentSlot, _quote.quote.validUntilSlot); } // We don't currently unstake, // but we will as part of https://github.com/AztecProtocol/aztec-packages/issues/8652. // Blocked on submitting epoch proofs to this contract. - PROOF_COMMITMENT_ESCROW.stakeBond(_quote.bondAmount, _quote.prover); + PROOF_COMMITMENT_ESCROW.stakeBond(_quote.quote.bondAmount, _quote.quote.prover); proofClaim = DataStructures.EpochProofClaim({ epochToProve: epochToProve, - basisPointFee: _quote.basisPointFee, - bondAmount: _quote.bondAmount, - bondProvider: _quote.prover, + basisPointFee: _quote.quote.basisPointFee, + bondAmount: _quote.quote.bondAmount, + bondProvider: _quote.quote.prover, proposerClaimant: msg.sender }); - emit ProofRightClaimed(epochToProve, _quote.prover, msg.sender, _quote.bondAmount, currentSlot); + emit ProofRightClaimed( + epochToProve, _quote.quote.prover, msg.sender, _quote.quote.bondAmount, currentSlot + ); } /** diff --git a/l1-contracts/src/core/sequencer_selection/ILeonidas.sol b/l1-contracts/src/core/interfaces/ILeonidas.sol similarity index 100% rename from l1-contracts/src/core/sequencer_selection/ILeonidas.sol rename to l1-contracts/src/core/interfaces/ILeonidas.sol diff --git a/l1-contracts/src/core/interfaces/IProofCommitmentEscrow.sol b/l1-contracts/src/core/interfaces/IProofCommitmentEscrow.sol index 5aa2be81ec83..0613c8b6de93 100644 --- a/l1-contracts/src/core/interfaces/IProofCommitmentEscrow.sol +++ b/l1-contracts/src/core/interfaces/IProofCommitmentEscrow.sol @@ -2,7 +2,7 @@ // Copyright 2024 Aztec Labs. pragma solidity >=0.8.18; -import {SignatureLib} from "../libraries/SignatureLib.sol"; +import {SignatureLib} from "@aztec/core/libraries/crypto/SignatureLib.sol"; interface IProofCommitmentEscrow { function deposit(uint256 _amount) external; diff --git a/l1-contracts/src/core/interfaces/IRollup.sol b/l1-contracts/src/core/interfaces/IRollup.sol index 3aa6b6d8a95c..8c5eea5d8d16 100644 --- a/l1-contracts/src/core/interfaces/IRollup.sol +++ b/l1-contracts/src/core/interfaces/IRollup.sol @@ -2,11 +2,11 @@ // Copyright 2023 Aztec Labs. pragma solidity >=0.8.18; -import {IInbox} from "../interfaces/messagebridge/IInbox.sol"; -import {IOutbox} from "../interfaces/messagebridge/IOutbox.sol"; +import {IInbox} from "@aztec/core/interfaces/messagebridge/IInbox.sol"; +import {IOutbox} from "@aztec/core/interfaces/messagebridge/IOutbox.sol"; -import {SignatureLib} from "../libraries/SignatureLib.sol"; -import {DataStructures} from "../libraries/DataStructures.sol"; +import {SignatureLib} from "@aztec/core/libraries/crypto/SignatureLib.sol"; +import {DataStructures} from "@aztec/core/libraries/DataStructures.sol"; interface ITestRollup { function setVerifier(address _verifier) external; @@ -28,7 +28,7 @@ interface IRollup { function prune() external; - function claimEpochProofRight(DataStructures.EpochProofQuote calldata _quote) external; + function claimEpochProofRight(DataStructures.SignedEpochProofQuote calldata _quote) external; function propose( bytes calldata _header, diff --git a/l1-contracts/src/core/interfaces/messagebridge/IFrontier.sol b/l1-contracts/src/core/interfaces/messagebridge/IFrontier.sol deleted file mode 100644 index 9f158cb02584..000000000000 --- a/l1-contracts/src/core/interfaces/messagebridge/IFrontier.sol +++ /dev/null @@ -1,24 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright 2023 Aztec Labs. -pragma solidity >=0.8.18; - -interface IFrontier { - /** - * @notice Inserts a new leaf into the frontier tree and returns its index - * @param _leaf - The leaf to insert - * @return The index of the leaf in the tree - */ - function insertLeaf(bytes32 _leaf) external returns (uint256); - - /** - * @notice Returns the root of the frontier tree - * @return The root of the tree - */ - function root() external view returns (bytes32); - - /** - * @notice Returns whether the tree is full - * @return True if full, false otherwise - */ - function isFull() external view returns (bool); -} diff --git a/l1-contracts/src/core/libraries/DataStructures.sol b/l1-contracts/src/core/libraries/DataStructures.sol index 8a114ce55c09..0cd2a73ff1c4 100644 --- a/l1-contracts/src/core/libraries/DataStructures.sol +++ b/l1-contracts/src/core/libraries/DataStructures.sol @@ -2,7 +2,7 @@ // Copyright 2023 Aztec Labs. pragma solidity >=0.8.18; -import {SignatureLib} from "./SignatureLib.sol"; +import {SignatureLib} from "@aztec/core/libraries/crypto/SignatureLib.sol"; /** * @title Data Structures Library @@ -77,13 +77,25 @@ library DataStructures { } // docs:end:registry_snapshot + /** + * @notice Struct for storing flags for block header validation + * @param ignoreDA - True will ignore DA check, otherwise checks + * @param ignoreSignature - True will ignore the signatures, otherwise checks + */ struct ExecutionFlags { bool ignoreDA; bool ignoreSignatures; } + /** + * @notice Struct encompassing an epoch proof quote + * @param epochToProve - The epoch number to prove + * @param validUntilSlot - The deadline of the quote, denoted in L2 slots + * @param bondAmount - The size of the bond + * @param prover - The address of the prover + * @param basisPointFee - The fee measured in basis points + */ struct EpochProofQuote { - SignatureLib.Signature signature; uint256 epochToProve; uint256 validUntilSlot; uint256 bondAmount; @@ -91,11 +103,29 @@ library DataStructures { uint32 basisPointFee; } + /** + * @notice A signed quote for the epoch proof + * @param quote - The Epoch Proof Quote + * @param signature - A signature on the quote + */ + struct SignedEpochProofQuote { + EpochProofQuote quote; + SignatureLib.Signature signature; + } + + /** + * @notice Struct containing the Epoch Proof Claim + * @param epochToProve - the epoch that the bond provider is claiming to prove + * @param basisPointFee the fee that the bond provider will receive as a percentage of the block rewards + * @param bondAmount - the size of the bond + * @param bondProvider - the address that put up the bond + * @param proposerClaimant - the address of the proposer that submitted the claim + */ struct EpochProofClaim { - uint256 epochToProve; // the epoch that the bond provider is claiming to prove - uint256 basisPointFee; // the fee that the bond provider will receive as a percentage of the block rewards - uint256 bondAmount; // the amount of escrowed funds that the bond provider will stake. Must be at least PROOF_COMMITMENT_BOND_AMOUNT - address bondProvider; // the address that has deposited funds in the escrow contract - address proposerClaimant; // the address of the proposer that submitted the claim + uint256 epochToProve; + uint256 basisPointFee; + uint256 bondAmount; + address bondProvider; + address proposerClaimant; } } diff --git a/l1-contracts/src/core/libraries/HeaderLib.sol b/l1-contracts/src/core/libraries/HeaderLib.sol index 0f9cb4271822..cc298e39f181 100644 --- a/l1-contracts/src/core/libraries/HeaderLib.sol +++ b/l1-contracts/src/core/libraries/HeaderLib.sol @@ -2,9 +2,8 @@ // Copyright 2023 Aztec Labs. pragma solidity >=0.8.18; -// Libraries -import {Errors} from "./Errors.sol"; -import {Constants} from "./ConstantsGen.sol"; +import {Constants} from "@aztec/core/libraries/ConstantsGen.sol"; +import {Errors} from "@aztec/core/libraries/Errors.sol"; /** * @title Header Library diff --git a/l1-contracts/src/core/libraries/decoders/TxsDecoder.sol b/l1-contracts/src/core/libraries/TxsDecoder.sol similarity index 99% rename from l1-contracts/src/core/libraries/decoders/TxsDecoder.sol rename to l1-contracts/src/core/libraries/TxsDecoder.sol index 7a2c4c632310..466516f1464d 100644 --- a/l1-contracts/src/core/libraries/decoders/TxsDecoder.sol +++ b/l1-contracts/src/core/libraries/TxsDecoder.sol @@ -2,10 +2,9 @@ // Copyright 2023 Aztec Labs. pragma solidity >=0.8.18; -// Libraries -import {Errors} from "../Errors.sol"; -import {Constants} from "../ConstantsGen.sol"; -import {Hash} from "../Hash.sol"; +import {Constants} from "@aztec/core/libraries/ConstantsGen.sol"; +import {Errors} from "@aztec/core/libraries/Errors.sol"; +import {Hash} from "@aztec/core/libraries/crypto/Hash.sol"; /** * @title Txs Decoder Library diff --git a/l1-contracts/src/core/messagebridge/frontier_tree/FrontierLib.sol b/l1-contracts/src/core/libraries/crypto/FrontierLib.sol similarity index 97% rename from l1-contracts/src/core/messagebridge/frontier_tree/FrontierLib.sol rename to l1-contracts/src/core/libraries/crypto/FrontierLib.sol index 74bfb78e215f..e2919e895f3d 100644 --- a/l1-contracts/src/core/messagebridge/frontier_tree/FrontierLib.sol +++ b/l1-contracts/src/core/libraries/crypto/FrontierLib.sol @@ -2,7 +2,7 @@ // Copyright 2023 Aztec Labs. pragma solidity >=0.8.18; -import {Hash} from "../../libraries/Hash.sol"; +import {Hash} from "@aztec/core/libraries/crypto/Hash.sol"; /** * @title FrontierLib diff --git a/l1-contracts/src/core/libraries/Hash.sol b/l1-contracts/src/core/libraries/crypto/Hash.sol similarity index 95% rename from l1-contracts/src/core/libraries/Hash.sol rename to l1-contracts/src/core/libraries/crypto/Hash.sol index eb572b2fc535..84b50a1f4be1 100644 --- a/l1-contracts/src/core/libraries/Hash.sol +++ b/l1-contracts/src/core/libraries/crypto/Hash.sol @@ -2,9 +2,7 @@ // Copyright 2023 Aztec Labs. pragma solidity >=0.8.18; -// Libraries -import {Constants} from "./ConstantsGen.sol"; -import {DataStructures} from "./DataStructures.sol"; +import {DataStructures} from "@aztec/core/libraries/DataStructures.sol"; /** * @title Hash library diff --git a/l1-contracts/src/core/libraries/MerkleLib.sol b/l1-contracts/src/core/libraries/crypto/MerkleLib.sol similarity index 97% rename from l1-contracts/src/core/libraries/MerkleLib.sol rename to l1-contracts/src/core/libraries/crypto/MerkleLib.sol index 89dc020a5a25..3ff573843603 100644 --- a/l1-contracts/src/core/libraries/MerkleLib.sol +++ b/l1-contracts/src/core/libraries/crypto/MerkleLib.sol @@ -2,8 +2,8 @@ // Copyright 2024 Aztec Labs. pragma solidity >=0.8.18; -import {Errors} from "../libraries/Errors.sol"; -import {Hash} from "../libraries/Hash.sol"; +import {Errors} from "@aztec/core/libraries/Errors.sol"; +import {Hash} from "@aztec/core/libraries/crypto/Hash.sol"; /** * @title Merkle Library diff --git a/l1-contracts/src/core/sequencer_selection/SampleLib.sol b/l1-contracts/src/core/libraries/crypto/SampleLib.sol similarity index 99% rename from l1-contracts/src/core/sequencer_selection/SampleLib.sol rename to l1-contracts/src/core/libraries/crypto/SampleLib.sol index 721ed37f23b5..d9b6dc3e3bf1 100644 --- a/l1-contracts/src/core/sequencer_selection/SampleLib.sol +++ b/l1-contracts/src/core/libraries/crypto/SampleLib.sol @@ -2,7 +2,7 @@ // Copyright 2024 Aztec Labs. pragma solidity >=0.8.18; -import {Errors} from "../libraries/Errors.sol"; +import {Errors} from "@aztec/core/libraries/Errors.sol"; /** * @title SampleLib diff --git a/l1-contracts/src/core/libraries/SignatureLib.sol b/l1-contracts/src/core/libraries/crypto/SignatureLib.sol similarity index 93% rename from l1-contracts/src/core/libraries/SignatureLib.sol rename to l1-contracts/src/core/libraries/crypto/SignatureLib.sol index 1bb8d6fb0501..af5cdf8eb30c 100644 --- a/l1-contracts/src/core/libraries/SignatureLib.sol +++ b/l1-contracts/src/core/libraries/crypto/SignatureLib.sol @@ -2,7 +2,7 @@ // Copyright 2024 Aztec Labs. pragma solidity ^0.8.13; -import {Errors} from "./Errors.sol"; +import {Errors} from "@aztec/core/libraries/Errors.sol"; library SignatureLib { struct Signature { diff --git a/l1-contracts/src/core/messagebridge/Inbox.sol b/l1-contracts/src/core/messagebridge/Inbox.sol index babf2f5ec079..09d7d3c3a4e8 100644 --- a/l1-contracts/src/core/messagebridge/Inbox.sol +++ b/l1-contracts/src/core/messagebridge/Inbox.sol @@ -2,16 +2,13 @@ // Copyright 2023 Aztec Labs. pragma solidity >=0.8.18; -// Interfaces -import {IInbox} from "../interfaces/messagebridge/IInbox.sol"; +import {IInbox} from "@aztec/core/interfaces/messagebridge/IInbox.sol"; -// Libraries -import {Constants} from "../libraries/ConstantsGen.sol"; -import {DataStructures} from "../libraries/DataStructures.sol"; -import {Errors} from "../libraries/Errors.sol"; -import {Hash} from "../libraries/Hash.sol"; - -import {FrontierLib} from "./frontier_tree/FrontierLib.sol"; +import {Constants} from "@aztec/core/libraries/ConstantsGen.sol"; +import {DataStructures} from "@aztec/core/libraries/DataStructures.sol"; +import {Errors} from "@aztec/core/libraries/Errors.sol"; +import {Hash} from "@aztec/core/libraries/crypto/Hash.sol"; +import {FrontierLib} from "@aztec/core/libraries/crypto/FrontierLib.sol"; /** * @title Inbox diff --git a/l1-contracts/src/core/messagebridge/Outbox.sol b/l1-contracts/src/core/messagebridge/Outbox.sol index eeb563484501..b7de82d3c2fb 100644 --- a/l1-contracts/src/core/messagebridge/Outbox.sol +++ b/l1-contracts/src/core/messagebridge/Outbox.sol @@ -2,14 +2,14 @@ // Copyright 2024 Aztec Labs. pragma solidity >=0.8.18; -// Libraries -import {DataStructures} from "../libraries/DataStructures.sol"; -import {Errors} from "../libraries/Errors.sol"; -import {MerkleLib} from "../libraries/MerkleLib.sol"; -import {Hash} from "../libraries/Hash.sol"; -import {IOutbox} from "../interfaces/messagebridge/IOutbox.sol"; - -import {Rollup} from "../Rollup.sol"; +import {IOutbox} from "@aztec/core//interfaces/messagebridge/IOutbox.sol"; + +import {DataStructures} from "@aztec/core/libraries/DataStructures.sol"; +import {Errors} from "@aztec/core/libraries/Errors.sol"; +import {MerkleLib} from "@aztec/core/libraries/crypto/MerkleLib.sol"; +import {Hash} from "@aztec/core/libraries/crypto/Hash.sol"; + +import {Rollup} from "@aztec/core/Rollup.sol"; /** * @title Outbox diff --git a/l1-contracts/src/core/messagebridge/Registry.sol b/l1-contracts/src/core/messagebridge/Registry.sol index 013f63df7596..e2dd65b7582d 100644 --- a/l1-contracts/src/core/messagebridge/Registry.sol +++ b/l1-contracts/src/core/messagebridge/Registry.sol @@ -2,15 +2,13 @@ // Copyright 2023 Aztec Labs. pragma solidity >=0.8.18; -import {Ownable} from "@oz/access/Ownable.sol"; +import {IRegistry} from "@aztec/core/interfaces/messagebridge/IRegistry.sol"; +import {IRollup} from "@aztec/core/interfaces/IRollup.sol"; -// Interfaces -import {IRegistry} from "../interfaces/messagebridge/IRegistry.sol"; -import {IRollup} from "../interfaces/IRollup.sol"; +import {DataStructures} from "@aztec/core/libraries/DataStructures.sol"; +import {Errors} from "@aztec/core/libraries/Errors.sol"; -// Libraries -import {DataStructures} from "../libraries/DataStructures.sol"; -import {Errors} from "../libraries/Errors.sol"; +import {Ownable} from "@oz/access/Ownable.sol"; /** * @title Registry diff --git a/l1-contracts/src/mock/MockProofCommitmentEscrow.sol b/l1-contracts/src/mock/MockProofCommitmentEscrow.sol index 89e61d3c2410..461791cee772 100644 --- a/l1-contracts/src/mock/MockProofCommitmentEscrow.sol +++ b/l1-contracts/src/mock/MockProofCommitmentEscrow.sol @@ -2,8 +2,7 @@ // Copyright 2024 Aztec Labs. pragma solidity >=0.8.18; -import {SignatureLib} from "../core/libraries/SignatureLib.sol"; -import {IProofCommitmentEscrow} from "../core/interfaces/IProofCommitmentEscrow.sol"; +import {IProofCommitmentEscrow} from "@aztec/core/interfaces/IProofCommitmentEscrow.sol"; contract MockProofCommitmentEscrow is IProofCommitmentEscrow { function deposit(uint256 _amount) external override { diff --git a/l1-contracts/src/mock/MockVerifier.sol b/l1-contracts/src/mock/MockVerifier.sol index 3ee7139413ab..5c8cdcfc7c3f 100644 --- a/l1-contracts/src/mock/MockVerifier.sol +++ b/l1-contracts/src/mock/MockVerifier.sol @@ -3,7 +3,7 @@ pragma solidity >=0.8.18; // Interfaces -import {IVerifier} from "../core/interfaces/IVerifier.sol"; +import {IVerifier} from "@aztec/core/interfaces/IVerifier.sol"; /** * @title Mock verifier diff --git a/l1-contracts/test/Inbox.t.sol b/l1-contracts/test/Inbox.t.sol index a879cadf67eb..5551cfd30f19 100644 --- a/l1-contracts/test/Inbox.t.sol +++ b/l1-contracts/test/Inbox.t.sol @@ -4,12 +4,12 @@ pragma solidity >=0.8.18; import {Test} from "forge-std/Test.sol"; -import {IInbox} from "../src/core/interfaces/messagebridge/IInbox.sol"; +import {IInbox} from "@aztec/core/interfaces/messagebridge/IInbox.sol"; import {InboxHarness} from "./harnesses/InboxHarness.sol"; -import {Constants} from "../src/core/libraries/ConstantsGen.sol"; -import {Errors} from "../src/core/libraries/Errors.sol"; -import {Hash} from "../src/core/libraries/Hash.sol"; -import {DataStructures} from "../src/core/libraries/DataStructures.sol"; +import {Constants} from "@aztec/core/libraries/ConstantsGen.sol"; +import {Errors} from "@aztec/core/libraries/Errors.sol"; +import {Hash} from "@aztec/core/libraries/crypto/Hash.sol"; +import {DataStructures} from "@aztec/core/libraries/DataStructures.sol"; contract InboxTest is Test { using Hash for DataStructures.L1ToL2Msg; diff --git a/l1-contracts/test/Outbox.t.sol b/l1-contracts/test/Outbox.t.sol index f25bfd2e1b9d..9922ab3afa3f 100644 --- a/l1-contracts/test/Outbox.t.sol +++ b/l1-contracts/test/Outbox.t.sol @@ -3,11 +3,11 @@ pragma solidity >=0.8.18; import {Test} from "forge-std/Test.sol"; -import {Outbox} from "../src/core/messagebridge/Outbox.sol"; -import {IOutbox} from "../src/core/interfaces/messagebridge/IOutbox.sol"; -import {Errors} from "../src/core/libraries/Errors.sol"; -import {DataStructures} from "../src/core/libraries/DataStructures.sol"; -import {Hash} from "../src/core/libraries/Hash.sol"; +import {Outbox} from "@aztec/core/messagebridge/Outbox.sol"; +import {IOutbox} from "@aztec/core/interfaces/messagebridge/IOutbox.sol"; +import {Errors} from "@aztec/core/libraries/Errors.sol"; +import {DataStructures} from "@aztec/core/libraries/DataStructures.sol"; +import {Hash} from "@aztec/core/libraries/crypto/Hash.sol"; import {NaiveMerkle} from "./merkle/Naive.sol"; import {MerkleTestUtil} from "./merkle/TestUtil.sol"; diff --git a/l1-contracts/test/Parity.t.sol b/l1-contracts/test/Parity.t.sol index 38221c75e660..397341225bf4 100644 --- a/l1-contracts/test/Parity.t.sol +++ b/l1-contracts/test/Parity.t.sol @@ -4,8 +4,8 @@ pragma solidity >=0.8.18; import {Test} from "forge-std/Test.sol"; -import {FrontierMerkle} from "./../src/core/messagebridge/frontier_tree/Frontier.sol"; -import {Constants} from "../src/core/libraries/ConstantsGen.sol"; +import {FrontierMerkle} from "./harnesses/Frontier.sol"; +import {Constants} from "@aztec/core/libraries/ConstantsGen.sol"; contract ParityTest is Test { function setUp() public {} diff --git a/l1-contracts/test/Registry.t.sol b/l1-contracts/test/Registry.t.sol index 9935e77040b2..51053cb18411 100644 --- a/l1-contracts/test/Registry.t.sol +++ b/l1-contracts/test/Registry.t.sol @@ -4,10 +4,9 @@ pragma solidity >=0.8.18; import {Test} from "forge-std/Test.sol"; import {Ownable} from "@oz/access/Ownable.sol"; -import {Registry} from "../src/core/messagebridge/Registry.sol"; -import {Errors} from "../src/core/libraries/Errors.sol"; - -import {DataStructures} from "../src/core/libraries/DataStructures.sol"; +import {Registry} from "@aztec/core/messagebridge/Registry.sol"; +import {Errors} from "@aztec/core/libraries/Errors.sol"; +import {DataStructures} from "@aztec/core/libraries/DataStructures.sol"; contract RegistryTest is Test { address internal constant DEAD = address(0xdead); diff --git a/l1-contracts/test/Rollup.t.sol b/l1-contracts/test/Rollup.t.sol index 92465908f9b2..47395f930edb 100644 --- a/l1-contracts/test/Rollup.t.sol +++ b/l1-contracts/test/Rollup.t.sol @@ -4,19 +4,19 @@ pragma solidity >=0.8.18; import {DecoderBase} from "./decoders/Base.sol"; -import {DataStructures} from "../src/core/libraries/DataStructures.sol"; -import {Constants} from "../src/core/libraries/ConstantsGen.sol"; -import {SignatureLib} from "../src/core/libraries/SignatureLib.sol"; - -import {Registry} from "../src/core/messagebridge/Registry.sol"; -import {Inbox} from "../src/core/messagebridge/Inbox.sol"; -import {Outbox} from "../src/core/messagebridge/Outbox.sol"; -import {Errors} from "../src/core/libraries/Errors.sol"; -import {Rollup} from "../src/core/Rollup.sol"; -import {IFeeJuicePortal} from "../src/core/interfaces/IFeeJuicePortal.sol"; -import {IRollup} from "../src/core/interfaces/IRollup.sol"; -import {FeeJuicePortal} from "../src/core/FeeJuicePortal.sol"; -import {Leonidas} from "../src/core/sequencer_selection/Leonidas.sol"; +import {DataStructures} from "@aztec/core/libraries/DataStructures.sol"; +import {Constants} from "@aztec/core/libraries/ConstantsGen.sol"; +import {SignatureLib} from "@aztec/core/libraries/crypto/SignatureLib.sol"; + +import {Registry} from "@aztec/core/messagebridge/Registry.sol"; +import {Inbox} from "@aztec/core/messagebridge/Inbox.sol"; +import {Outbox} from "@aztec/core/messagebridge/Outbox.sol"; +import {Errors} from "@aztec/core/libraries/Errors.sol"; +import {Rollup} from "@aztec/core/Rollup.sol"; +import {IFeeJuicePortal} from "@aztec/core/interfaces/IFeeJuicePortal.sol"; +import {IRollup} from "@aztec/core/interfaces/IRollup.sol"; +import {FeeJuicePortal} from "@aztec/core/FeeJuicePortal.sol"; +import {Leonidas} from "@aztec/core/Leonidas.sol"; import {NaiveMerkle} from "./merkle/Naive.sol"; import {MerkleTestUtil} from "./merkle/TestUtil.sol"; import {PortalERC20} from "./portals/PortalERC20.sol"; @@ -42,6 +42,8 @@ contract RollupTest is DecoderBase { SignatureLib.Signature[] internal signatures; + DataStructures.SignedEpochProofQuote internal quote; + /** * @notice Set up the contracts needed for the tests with time aligned to the provided block name */ @@ -76,6 +78,17 @@ contract RollupTest is DecoderBase { merkleTestUtil = new MerkleTestUtil(); txsHelper = new TxsDecoderHelper(); + + quote = DataStructures.SignedEpochProofQuote({ + quote: DataStructures.EpochProofQuote({ + epochToProve: 0, + validUntilSlot: 1, + bondAmount: rollup.PROOF_COMMITMENT_MIN_BOND_AMOUNT_IN_TST(), + prover: address(0), + basisPointFee: 0 + }), + signature: SignatureLib.Signature({isEmpty: false, v: 27, r: bytes32(0), s: bytes32(0)}) + }); _; } @@ -86,15 +99,6 @@ contract RollupTest is DecoderBase { function testClaimWithNothingToProve() public setUpFor("mixed_block_1") { assertEq(rollup.getCurrentSlot(), 0, "genesis slot should be zero"); - DataStructures.EpochProofQuote memory quote = DataStructures.EpochProofQuote({ - signature: SignatureLib.Signature({isEmpty: false, v: 27, r: bytes32(0), s: bytes32(0)}), - epochToProve: 0, - validUntilSlot: 1, - bondAmount: rollup.PROOF_COMMITMENT_MIN_BOND_AMOUNT_IN_TST(), - prover: address(this), - basisPointFee: 0 - }); - // sanity check that proven/pending tip are at genesis vm.expectRevert(abi.encodeWithSelector(Errors.Rollup__NoEpochToProve.selector)); rollup.claimEpochProofRight(quote); @@ -111,17 +115,12 @@ contract RollupTest is DecoderBase { function testClaimWithWrongEpoch() public setUpFor("mixed_block_1") { _testBlock("mixed_block_1", false, 0); - DataStructures.EpochProofQuote memory quote = DataStructures.EpochProofQuote({ - signature: SignatureLib.Signature({isEmpty: false, v: 27, r: bytes32(0), s: bytes32(0)}), - epochToProve: 1, - validUntilSlot: 1, - bondAmount: rollup.PROOF_COMMITMENT_MIN_BOND_AMOUNT_IN_TST(), - prover: address(this), - basisPointFee: 0 - }); + quote.quote.epochToProve = 1; vm.expectRevert( - abi.encodeWithSelector(Errors.Rollup__NotClaimingCorrectEpoch.selector, 0, quote.epochToProve) + abi.encodeWithSelector( + Errors.Rollup__NotClaimingCorrectEpoch.selector, 0, quote.quote.epochToProve + ) ); rollup.claimEpochProofRight(quote); } @@ -129,20 +128,13 @@ contract RollupTest is DecoderBase { function testClaimWithInsufficientBond() public setUpFor("mixed_block_1") { _testBlock("mixed_block_1", false, 0); - DataStructures.EpochProofQuote memory quote = DataStructures.EpochProofQuote({ - signature: SignatureLib.Signature({isEmpty: false, v: 27, r: bytes32(0), s: bytes32(0)}), - epochToProve: 0, - validUntilSlot: 1, - bondAmount: 0, - prover: address(this), - basisPointFee: 0 - }); + quote.quote.bondAmount = 0; vm.expectRevert( abi.encodeWithSelector( Errors.Rollup__InsufficientBondAmount.selector, rollup.PROOF_COMMITMENT_MIN_BOND_AMOUNT_IN_TST(), - quote.bondAmount + quote.quote.bondAmount ) ); rollup.claimEpochProofRight(quote); @@ -151,19 +143,12 @@ contract RollupTest is DecoderBase { function testClaimPastValidUntil() public setUpFor("mixed_block_1") { _testBlock("mixed_block_1", false, 0); - DataStructures.EpochProofQuote memory quote = DataStructures.EpochProofQuote({ - signature: SignatureLib.Signature({isEmpty: false, v: 27, r: bytes32(0), s: bytes32(0)}), - epochToProve: 0, - validUntilSlot: 0, - bondAmount: rollup.PROOF_COMMITMENT_MIN_BOND_AMOUNT_IN_TST(), - prover: address(this), - basisPointFee: 0 - }); + quote.quote.validUntilSlot = 0; warpToL2Slot(1); vm.expectRevert( - abi.encodeWithSelector(Errors.Rollup__QuoteExpired.selector, 1, quote.validUntilSlot) + abi.encodeWithSelector(Errors.Rollup__QuoteExpired.selector, 1, quote.quote.validUntilSlot) ); rollup.claimEpochProofRight(quote); } @@ -171,20 +156,11 @@ contract RollupTest is DecoderBase { function testClaimSimple() public setUpFor("mixed_block_1") { _testBlock("mixed_block_1", false, 0); - DataStructures.EpochProofQuote memory quote = DataStructures.EpochProofQuote({ - signature: SignatureLib.Signature({isEmpty: false, v: 27, r: bytes32(0), s: bytes32(0)}), - epochToProve: 0, - validUntilSlot: 1, - bondAmount: rollup.PROOF_COMMITMENT_MIN_BOND_AMOUNT_IN_TST(), - prover: address(0), - basisPointFee: 0 - }); - warpToL2Slot(1); vm.expectEmit(true, true, true, true); emit IRollup.ProofRightClaimed( - quote.epochToProve, address(0), address(this), quote.bondAmount, 1 + quote.quote.epochToProve, address(0), address(this), quote.quote.bondAmount, 1 ); rollup.claimEpochProofRight(quote); @@ -195,9 +171,9 @@ contract RollupTest is DecoderBase { address bondProvider, address proposerClaimant ) = rollup.proofClaim(); - assertEq(epochToProve, quote.epochToProve, "Invalid epoch to prove"); - assertEq(basisPointFee, quote.basisPointFee, "Invalid basis point fee"); - assertEq(bondAmount, quote.bondAmount, "Invalid bond amount"); + assertEq(epochToProve, quote.quote.epochToProve, "Invalid epoch to prove"); + assertEq(basisPointFee, quote.quote.basisPointFee, "Invalid basis point fee"); + assertEq(bondAmount, quote.quote.bondAmount, "Invalid bond amount"); // TODO #8573 // This will be fixed with proper escrow assertEq(bondProvider, address(0), "Invalid bond provider"); @@ -207,15 +183,6 @@ contract RollupTest is DecoderBase { function testClaimTwice() public setUpFor("mixed_block_1") { _testBlock("mixed_block_1", false, 0); - DataStructures.EpochProofQuote memory quote = DataStructures.EpochProofQuote({ - signature: SignatureLib.Signature({isEmpty: false, v: 27, r: bytes32(0), s: bytes32(0)}), - epochToProve: 0, - validUntilSlot: 1, - bondAmount: rollup.PROOF_COMMITMENT_MIN_BOND_AMOUNT_IN_TST(), - prover: address(this), - basisPointFee: 0 - }); - warpToL2Slot(1); rollup.claimEpochProofRight(quote); @@ -243,15 +210,6 @@ contract RollupTest is DecoderBase { function testClaimOutsideClaimPhase() public setUpFor("mixed_block_1") { _testBlock("mixed_block_1", false, 0); - DataStructures.EpochProofQuote memory quote = DataStructures.EpochProofQuote({ - signature: SignatureLib.Signature({isEmpty: false, v: 27, r: bytes32(0), s: bytes32(0)}), - epochToProve: 0, - validUntilSlot: 1, - bondAmount: rollup.PROOF_COMMITMENT_MIN_BOND_AMOUNT_IN_TST(), - prover: address(this), - basisPointFee: 0 - }); - warpToL2Slot(Constants.AZTEC_EPOCH_DURATION + rollup.CLAIM_DURATION_IN_L2_SLOTS()); vm.expectRevert( @@ -267,14 +225,7 @@ contract RollupTest is DecoderBase { function testNoPruneWhenClaimExists() public setUpFor("mixed_block_1") { _testBlock("mixed_block_1", false, 0); - DataStructures.EpochProofQuote memory quote = DataStructures.EpochProofQuote({ - signature: SignatureLib.Signature({isEmpty: false, v: 27, r: bytes32(0), s: bytes32(0)}), - epochToProve: 0, - validUntilSlot: 2 * Constants.AZTEC_EPOCH_DURATION, - bondAmount: rollup.PROOF_COMMITMENT_MIN_BOND_AMOUNT_IN_TST(), - prover: address(this), - basisPointFee: 0 - }); + quote.quote.validUntilSlot = 2 * Constants.AZTEC_EPOCH_DURATION; warpToL2Slot(Constants.AZTEC_EPOCH_DURATION + rollup.CLAIM_DURATION_IN_L2_SLOTS() - 1); @@ -289,14 +240,7 @@ contract RollupTest is DecoderBase { function testPruneWhenClaimExpires() public setUpFor("mixed_block_1") { _testBlock("mixed_block_1", false, 0); - DataStructures.EpochProofQuote memory quote = DataStructures.EpochProofQuote({ - signature: SignatureLib.Signature({isEmpty: false, v: 27, r: bytes32(0), s: bytes32(0)}), - epochToProve: 0, - validUntilSlot: 2 * Constants.AZTEC_EPOCH_DURATION, - bondAmount: rollup.PROOF_COMMITMENT_MIN_BOND_AMOUNT_IN_TST(), - prover: address(this), - basisPointFee: 0 - }); + quote.quote.validUntilSlot = 2 * Constants.AZTEC_EPOCH_DURATION; warpToL2Slot(Constants.AZTEC_EPOCH_DURATION + rollup.CLAIM_DURATION_IN_L2_SLOTS() - 1); @@ -317,14 +261,8 @@ contract RollupTest is DecoderBase { function testClaimAfterPrune() public setUpFor("mixed_block_1") { _testBlock("mixed_block_1", false, 0); - DataStructures.EpochProofQuote memory quote = DataStructures.EpochProofQuote({ - signature: SignatureLib.Signature({isEmpty: false, v: 27, r: bytes32(0), s: bytes32(0)}), - epochToProve: 0, - validUntilSlot: 2 * Constants.AZTEC_EPOCH_DURATION, - bondAmount: rollup.PROOF_COMMITMENT_MIN_BOND_AMOUNT_IN_TST(), - prover: address(this), - basisPointFee: 0 - }); + quote.quote.validUntilSlot = 2 * Constants.AZTEC_EPOCH_DURATION; + quote.quote.prover = address(this); warpToL2Slot(Constants.AZTEC_EPOCH_DURATION + rollup.CLAIM_DURATION_IN_L2_SLOTS() - 1); @@ -338,10 +276,10 @@ contract RollupTest is DecoderBase { vm.expectEmit(true, true, true, true); emit IRollup.ProofRightClaimed( - quote.epochToProve, + quote.quote.epochToProve, address(this), address(this), - quote.bondAmount, + quote.quote.bondAmount, Constants.AZTEC_EPOCH_DURATION * 2 ); rollup.claimEpochProofRight(quote); diff --git a/l1-contracts/test/decoders/Decoders.t.sol b/l1-contracts/test/decoders/Decoders.t.sol index 2b4a6f5547fd..fb75f20cbc3c 100644 --- a/l1-contracts/test/decoders/Decoders.t.sol +++ b/l1-contracts/test/decoders/Decoders.t.sol @@ -4,12 +4,12 @@ pragma solidity >=0.8.18; import {DecoderBase} from "./Base.sol"; -import {Hash} from "../../src/core/libraries/Hash.sol"; +import {Hash} from "@aztec/core/libraries/crypto/Hash.sol"; import {HeaderLibHelper} from "./helpers/HeaderLibHelper.sol"; import {TxsDecoderHelper} from "./helpers/TxsDecoderHelper.sol"; -import {HeaderLib} from "../../src/core/libraries/HeaderLib.sol"; -import {Constants} from "../../src/core/libraries/ConstantsGen.sol"; +import {HeaderLib} from "@aztec/core/libraries/HeaderLib.sol"; +import {Constants} from "@aztec/core/libraries/ConstantsGen.sol"; /** * Blocks are generated using the `integration_l1_publisher.test.ts` tests. diff --git a/l1-contracts/test/decoders/helpers/HeaderLibHelper.sol b/l1-contracts/test/decoders/helpers/HeaderLibHelper.sol index 7d839535a744..fbfa8b2c255e 100644 --- a/l1-contracts/test/decoders/helpers/HeaderLibHelper.sol +++ b/l1-contracts/test/decoders/helpers/HeaderLibHelper.sol @@ -2,7 +2,7 @@ // Copyright 2023 Aztec Labs. pragma solidity >=0.8.18; -import {HeaderLib} from "../../../src/core/libraries/HeaderLib.sol"; +import {HeaderLib} from "@aztec/core/libraries/HeaderLib.sol"; contract HeaderLibHelper { // A wrapper used such that we get "calldata" and not memory diff --git a/l1-contracts/test/decoders/helpers/TxsDecoderHelper.sol b/l1-contracts/test/decoders/helpers/TxsDecoderHelper.sol index 23a2f1db5150..4c85dba9d60f 100644 --- a/l1-contracts/test/decoders/helpers/TxsDecoderHelper.sol +++ b/l1-contracts/test/decoders/helpers/TxsDecoderHelper.sol @@ -2,8 +2,8 @@ // Copyright 2023 Aztec Labs. pragma solidity >=0.8.18; -import {TxsDecoder} from "../../../src/core/libraries/decoders/TxsDecoder.sol"; -import {MerkleLib} from "../../../src/core/libraries/MerkleLib.sol"; +import {TxsDecoder} from "@aztec/core/libraries/TxsDecoder.sol"; +import {MerkleLib} from "@aztec/core/libraries/crypto/MerkleLib.sol"; contract TxsDecoderHelper { // A wrapper used such that we get "calldata" and not memory diff --git a/l1-contracts/src/core/messagebridge/frontier_tree/Frontier.sol b/l1-contracts/test/harnesses/Frontier.sol similarity index 71% rename from l1-contracts/src/core/messagebridge/frontier_tree/Frontier.sol rename to l1-contracts/test/harnesses/Frontier.sol index 48582bc47a89..d11f880a463b 100644 --- a/l1-contracts/src/core/messagebridge/frontier_tree/Frontier.sol +++ b/l1-contracts/test/harnesses/Frontier.sol @@ -2,16 +2,15 @@ // Copyright 2023 Aztec Labs. pragma solidity >=0.8.18; -import {FrontierLib} from "./FrontierLib.sol"; +import {FrontierLib} from "@aztec/core/libraries/crypto/FrontierLib.sol"; -import {IFrontier} from "../../interfaces/messagebridge/IFrontier.sol"; import {Ownable} from "@oz/access/Ownable.sol"; // This truncates each hash and hash preimage to 31 bytes to follow Noir. // It follows the logic in /noir-protocol-circuits/crates/parity-lib/src/utils/sha256_merkle_tree.nr // TODO(Miranda): Possibly nuke this contract, and use a generic version which can either use // regular sha256 or sha256ToField when emulating circuits -contract FrontierMerkle is IFrontier, Ownable { +contract FrontierMerkle is Ownable { using FrontierLib for FrontierLib.Tree; using FrontierLib for FrontierLib.Forest; @@ -29,15 +28,15 @@ contract FrontierMerkle is IFrontier, Ownable { forest.initialize(_height); } - function insertLeaf(bytes32 _leaf) external override(IFrontier) onlyOwner returns (uint256) { + function insertLeaf(bytes32 _leaf) external onlyOwner returns (uint256) { return tree.insertLeaf(_leaf); } - function root() external view override(IFrontier) returns (bytes32) { + function root() external view returns (bytes32) { return tree.root(forest, HEIGHT, SIZE); } - function isFull() external view override(IFrontier) returns (bool) { + function isFull() external view returns (bool) { return tree.isFull(SIZE); } } diff --git a/l1-contracts/test/harnesses/InboxHarness.sol b/l1-contracts/test/harnesses/InboxHarness.sol index d0152d137af2..40c51eadec5f 100644 --- a/l1-contracts/test/harnesses/InboxHarness.sol +++ b/l1-contracts/test/harnesses/InboxHarness.sol @@ -2,11 +2,10 @@ // Copyright 2023 Aztec Labs. pragma solidity >=0.8.18; -import {Inbox} from "../../src/core/messagebridge/Inbox.sol"; -import {FrontierLib} from "../../src/core/messagebridge/frontier_tree/FrontierLib.sol"; +import {Inbox} from "@aztec/core/messagebridge/Inbox.sol"; -// Libraries -import {Constants} from "../../src/core/libraries/ConstantsGen.sol"; +import {Constants} from "@aztec/core/libraries/ConstantsGen.sol"; +import {FrontierLib} from "@aztec/core/libraries/crypto/FrontierLib.sol"; contract InboxHarness is Inbox { using FrontierLib for FrontierLib.Tree; diff --git a/l1-contracts/test/merkle/Frontier.t.sol b/l1-contracts/test/merkle/Frontier.t.sol index fa4cb85956e3..b6ead98ec231 100644 --- a/l1-contracts/test/merkle/Frontier.t.sol +++ b/l1-contracts/test/merkle/Frontier.t.sol @@ -5,7 +5,7 @@ pragma solidity >=0.8.18; import {Test} from "forge-std/Test.sol"; import {NaiveMerkle} from "./Naive.sol"; -import {FrontierMerkle} from "./../../src/core/messagebridge/frontier_tree/Frontier.sol"; +import {FrontierMerkle} from "../harnesses/Frontier.sol"; contract FrontierTest is Test { function setUp() public {} diff --git a/l1-contracts/test/merkle/Naive.sol b/l1-contracts/test/merkle/Naive.sol index 9d9fcbf84b2c..a1fb839b3c97 100644 --- a/l1-contracts/test/merkle/Naive.sol +++ b/l1-contracts/test/merkle/Naive.sol @@ -2,7 +2,7 @@ // Copyright 2024 Aztec Labs. pragma solidity >=0.8.18; -import {Hash} from "../../src/core/libraries/Hash.sol"; +import {Hash} from "@aztec/core/libraries/crypto/Hash.sol"; contract NaiveMerkle { uint256 public immutable DEPTH; diff --git a/l1-contracts/test/merkle/Naive.t.sol b/l1-contracts/test/merkle/Naive.t.sol index d3f056781ecf..8b5983cce0e0 100644 --- a/l1-contracts/test/merkle/Naive.t.sol +++ b/l1-contracts/test/merkle/Naive.t.sol @@ -4,7 +4,7 @@ pragma solidity >=0.8.18; import {Test} from "forge-std/Test.sol"; -import {Hash} from "../../src/core/libraries/Hash.sol"; +import {Hash} from "@aztec/core/libraries/crypto/Hash.sol"; import {NaiveMerkle} from "./Naive.sol"; contract NaiveTest is Test { diff --git a/l1-contracts/test/merkle/UnbalancedMerkle.t.sol b/l1-contracts/test/merkle/UnbalancedMerkle.t.sol index ce3604351ab0..3baae24c2569 100644 --- a/l1-contracts/test/merkle/UnbalancedMerkle.t.sol +++ b/l1-contracts/test/merkle/UnbalancedMerkle.t.sol @@ -3,7 +3,7 @@ pragma solidity >=0.8.18; import {Test} from "forge-std/Test.sol"; -import {Hash} from "../../src/core/libraries/Hash.sol"; +import {Hash} from "@aztec/core/libraries/crypto/Hash.sol"; import {TxsDecoderHelper} from "../decoders/helpers/TxsDecoderHelper.sol"; /** diff --git a/l1-contracts/test/merkle/helpers/MerkleLibHelper.sol b/l1-contracts/test/merkle/helpers/MerkleLibHelper.sol index be8234ea023f..36f0a6088dbe 100644 --- a/l1-contracts/test/merkle/helpers/MerkleLibHelper.sol +++ b/l1-contracts/test/merkle/helpers/MerkleLibHelper.sol @@ -2,7 +2,7 @@ // Copyright 2024 Aztec Labs. pragma solidity >=0.8.18; -import {MerkleLib} from "../../../src/core/libraries/MerkleLib.sol"; +import {MerkleLib} from "@aztec/core/libraries/crypto/MerkleLib.sol"; // A wrapper used to be able to "call" library functions, instead of "jumping" to them, allowing forge to catch the reverts contract MerkleLibHelper { diff --git a/l1-contracts/test/portals/TokenPortal.sol b/l1-contracts/test/portals/TokenPortal.sol index ce9f4408b52d..c8c7d2c8d812 100644 --- a/l1-contracts/test/portals/TokenPortal.sol +++ b/l1-contracts/test/portals/TokenPortal.sol @@ -4,12 +4,12 @@ import {IERC20} from "@oz/token/ERC20/IERC20.sol"; import {SafeERC20} from "@oz/token/ERC20/utils/SafeERC20.sol"; // Messaging -import {IRegistry} from "../../src/core/interfaces/messagebridge/IRegistry.sol"; -import {IInbox} from "../../src/core/interfaces/messagebridge/IInbox.sol"; -import {IOutbox} from "../../src/core/interfaces/messagebridge/IOutbox.sol"; -import {DataStructures} from "../../src/core/libraries/DataStructures.sol"; +import {IRegistry} from "@aztec/core/interfaces/messagebridge/IRegistry.sol"; +import {IInbox} from "@aztec/core/interfaces/messagebridge/IInbox.sol"; +import {IOutbox} from "@aztec/core/interfaces/messagebridge/IOutbox.sol"; +import {DataStructures} from "@aztec/core/libraries/DataStructures.sol"; // docs:start:content_hash_sol_import -import {Hash} from "../../src/core/libraries/Hash.sol"; +import {Hash} from "@aztec/core/libraries/crypto/Hash.sol"; // docs:end:content_hash_sol_import // docs:start:init diff --git a/l1-contracts/test/portals/TokenPortal.t.sol b/l1-contracts/test/portals/TokenPortal.t.sol index 5832c5444374..db14a01f77c4 100644 --- a/l1-contracts/test/portals/TokenPortal.t.sol +++ b/l1-contracts/test/portals/TokenPortal.t.sol @@ -3,17 +3,17 @@ pragma solidity >=0.8.18; import "forge-std/Test.sol"; // Rollup Processor -import {Rollup} from "../../src/core/Rollup.sol"; -import {Constants} from "../../src/core/libraries/ConstantsGen.sol"; -import {Registry} from "../../src/core/messagebridge/Registry.sol"; -import {DataStructures} from "../../src/core/libraries/DataStructures.sol"; -import {Hash} from "../../src/core/libraries/Hash.sol"; -import {Errors} from "../../src/core/libraries/Errors.sol"; +import {Rollup} from "@aztec/core/Rollup.sol"; +import {Constants} from "@aztec/core/libraries/ConstantsGen.sol"; +import {Registry} from "@aztec/core/messagebridge/Registry.sol"; +import {DataStructures} from "@aztec/core/libraries/DataStructures.sol"; +import {Errors} from "@aztec/core/libraries/Errors.sol"; +import {Hash} from "@aztec/core/libraries/crypto/Hash.sol"; // Interfaces -import {IInbox} from "../../src/core/interfaces/messagebridge/IInbox.sol"; -import {IOutbox} from "../../src/core/interfaces/messagebridge/IOutbox.sol"; -import {IFeeJuicePortal} from "../../src/core/interfaces/IFeeJuicePortal.sol"; +import {IInbox} from "@aztec/core/interfaces/messagebridge/IInbox.sol"; +import {IOutbox} from "@aztec/core/interfaces/messagebridge/IOutbox.sol"; +import {IFeeJuicePortal} from "@aztec/core/interfaces/IFeeJuicePortal.sol"; // Portal tokens import {TokenPortal} from "./TokenPortal.sol"; diff --git a/l1-contracts/test/portals/UniswapPortal.sol b/l1-contracts/test/portals/UniswapPortal.sol index 26ba79b78dca..5bf85ee374d2 100644 --- a/l1-contracts/test/portals/UniswapPortal.sol +++ b/l1-contracts/test/portals/UniswapPortal.sol @@ -2,11 +2,11 @@ pragma solidity >=0.8.18; import {IERC20} from "@oz/token/ERC20/IERC20.sol"; -import {IRegistry} from "../../src/core/interfaces/messagebridge/IRegistry.sol"; -import {IOutbox} from "../../src/core/interfaces/messagebridge/IOutbox.sol"; -import {DataStructures} from "../../src/core/libraries/DataStructures.sol"; +import {IRegistry} from "@aztec/core/interfaces/messagebridge/IRegistry.sol"; +import {IOutbox} from "@aztec/core/interfaces/messagebridge/IOutbox.sol"; +import {DataStructures} from "@aztec/core/libraries/DataStructures.sol"; import {DataStructures as PortalDataStructures} from "./DataStructures.sol"; -import {Hash} from "../../src/core/libraries/Hash.sol"; +import {Hash} from "@aztec/core/libraries/crypto/Hash.sol"; // docs:start:setup import {TokenPortal} from "./TokenPortal.sol"; diff --git a/l1-contracts/test/portals/UniswapPortal.t.sol b/l1-contracts/test/portals/UniswapPortal.t.sol index f0710fa9c3b6..2a6b54c818ee 100644 --- a/l1-contracts/test/portals/UniswapPortal.t.sol +++ b/l1-contracts/test/portals/UniswapPortal.t.sol @@ -3,18 +3,18 @@ pragma solidity >=0.8.18; import "forge-std/Test.sol"; // Rollup Processor -import {Rollup} from "../../src/core/Rollup.sol"; -import {Registry} from "../../src/core/messagebridge/Registry.sol"; -import {DataStructures} from "../../src/core/libraries/DataStructures.sol"; +import {Rollup} from "@aztec/core/Rollup.sol"; +import {Registry} from "@aztec/core/messagebridge/Registry.sol"; +import {DataStructures} from "@aztec/core/libraries/DataStructures.sol"; import {DataStructures as PortalDataStructures} from "./DataStructures.sol"; -import {Hash} from "../../src/core/libraries/Hash.sol"; -import {Errors} from "../../src/core/libraries/Errors.sol"; +import {Hash} from "@aztec/core/libraries/crypto/Hash.sol"; +import {Errors} from "@aztec/core/libraries/Errors.sol"; // Interfaces import {IERC20} from "@oz/token/ERC20/IERC20.sol"; -import {IOutbox} from "../../src/core/interfaces/messagebridge/IOutbox.sol"; +import {IOutbox} from "@aztec/core/interfaces/messagebridge/IOutbox.sol"; import {NaiveMerkle} from "../merkle/Naive.sol"; -import {IFeeJuicePortal} from "../../src/core/interfaces/IFeeJuicePortal.sol"; +import {IFeeJuicePortal} from "@aztec/core/interfaces/IFeeJuicePortal.sol"; // Portals import {TokenPortal} from "./TokenPortal.sol"; diff --git a/l1-contracts/test/sparta/Sampling.t.sol b/l1-contracts/test/sparta/Sampling.t.sol index 35c349ad7464..69b47484d0d5 100644 --- a/l1-contracts/test/sparta/Sampling.t.sol +++ b/l1-contracts/test/sparta/Sampling.t.sol @@ -4,7 +4,7 @@ pragma solidity >=0.8.18; import {Test} from "forge-std/Test.sol"; -import {SampleLib} from "../../src/core/sequencer_selection/SampleLib.sol"; +import {SampleLib} from "@aztec/core/libraries/crypto/SampleLib.sol"; // Adding a contract to get some gas-numbers out. contract Sampler { diff --git a/l1-contracts/test/sparta/Sparta.t.sol b/l1-contracts/test/sparta/Sparta.t.sol index 44700b1e4f54..472d4bd4f797 100644 --- a/l1-contracts/test/sparta/Sparta.t.sol +++ b/l1-contracts/test/sparta/Sparta.t.sol @@ -4,21 +4,21 @@ pragma solidity >=0.8.18; import {DecoderBase} from "../decoders/Base.sol"; -import {DataStructures} from "../../src/core/libraries/DataStructures.sol"; -import {Constants} from "../../src/core/libraries/ConstantsGen.sol"; -import {SignatureLib} from "../../src/core/libraries/SignatureLib.sol"; - -import {Registry} from "../../src/core/messagebridge/Registry.sol"; -import {Inbox} from "../../src/core/messagebridge/Inbox.sol"; -import {Outbox} from "../../src/core/messagebridge/Outbox.sol"; -import {Errors} from "../../src/core/libraries/Errors.sol"; -import {Rollup} from "../../src/core/Rollup.sol"; -import {Leonidas} from "../../src/core/sequencer_selection/Leonidas.sol"; +import {DataStructures} from "@aztec/core/libraries/DataStructures.sol"; +import {Constants} from "@aztec/core/libraries/ConstantsGen.sol"; +import {SignatureLib} from "@aztec/core/libraries/crypto/SignatureLib.sol"; + +import {Registry} from "@aztec/core/messagebridge/Registry.sol"; +import {Inbox} from "@aztec/core/messagebridge/Inbox.sol"; +import {Outbox} from "@aztec/core/messagebridge/Outbox.sol"; +import {Errors} from "@aztec/core/libraries/Errors.sol"; +import {Rollup} from "@aztec/core/Rollup.sol"; +import {Leonidas} from "@aztec/core/Leonidas.sol"; import {NaiveMerkle} from "../merkle/Naive.sol"; import {MerkleTestUtil} from "../merkle/TestUtil.sol"; import {PortalERC20} from "../portals/PortalERC20.sol"; import {TxsDecoderHelper} from "../decoders/helpers/TxsDecoderHelper.sol"; -import {IFeeJuicePortal} from "../../src/core/interfaces/IFeeJuicePortal.sol"; +import {IFeeJuicePortal} from "@aztec/core/interfaces/IFeeJuicePortal.sol"; import {MessageHashUtils} from "@oz/utils/cryptography/MessageHashUtils.sol"; // solhint-disable comprehensive-interface