From fef5549177c31e35683472a3df6456877e4ea415 Mon Sep 17 00:00:00 2001 From: benesjan Date: Sun, 17 Mar 2024 17:10:17 +0000 Subject: [PATCH] WIP --- l1-contracts/test/Inbox.t.sol | 5 ++--- l1-contracts/test/Rollup.t.sol | 1 - l1-contracts/test/portals/TokenPortal.t.sol | 10 ++++------ l1-contracts/test/portals/UniswapPortal.t.sol | 4 ++-- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/l1-contracts/test/Inbox.t.sol b/l1-contracts/test/Inbox.t.sol index 7e2fa3d7ac77..6bd2ea6c24de 100644 --- a/l1-contracts/test/Inbox.t.sol +++ b/l1-contracts/test/Inbox.t.sol @@ -4,6 +4,7 @@ pragma solidity >=0.8.18; import {Test} from "forge-std/Test.sol"; +import {IInbox} from "../src/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"; @@ -19,8 +20,6 @@ contract InboxTest is Test { uint256 internal version = 0; bytes32 internal emptyTreeRoot; - event LeafInserted(uint256 indexed blockNumber, uint256 index, bytes32 value); - function setUp() public { address rollup = address(this); // We set low depth (5) to ensure we sufficiently test the tree transitions @@ -82,7 +81,7 @@ contract InboxTest is Test { bytes32 leaf = message.sha256ToField(); vm.expectEmit(true, true, true, true); // event we expect - emit LeafInserted(FIRST_REAL_TREE_NUM, 0, leaf); + emit IInbox.LeafInserted(FIRST_REAL_TREE_NUM, 0, leaf); // event we will get bytes32 insertedLeaf = inbox.sendL2Message(message.recipient, message.content, message.secretHash); diff --git a/l1-contracts/test/Rollup.t.sol b/l1-contracts/test/Rollup.t.sol index 540b23d69a81..97865988f557 100644 --- a/l1-contracts/test/Rollup.t.sol +++ b/l1-contracts/test/Rollup.t.sol @@ -137,7 +137,6 @@ contract RollupTest is DecoderBase { assertEq(inbox.toConsume(), toConsume + 1, "Message subtree not consumed"); - (, bytes32[] memory inboxWrites) = vm.accesses(address(inbox)); (, bytes32[] memory outboxWrites) = vm.accesses(address(outbox)); { diff --git a/l1-contracts/test/portals/TokenPortal.t.sol b/l1-contracts/test/portals/TokenPortal.t.sol index 9230214d09dc..6a171b91e4da 100644 --- a/l1-contracts/test/portals/TokenPortal.t.sol +++ b/l1-contracts/test/portals/TokenPortal.t.sol @@ -25,7 +25,6 @@ contract TokenPortalTest is Test { uint256 internal constant FIRST_REAL_TREE_NUM = Constants.INITIAL_L2_BLOCK_NUM + 1; - event LeafInserted(uint256 indexed blockNumber, uint256 index, bytes32 value); event MessageConsumed(bytes32 indexed entryKey, address indexed recipient); Registry internal registry; @@ -69,7 +68,7 @@ contract TokenPortalTest is Test { vm.deal(address(this), 100 ether); } - function _createExpectedMintPrivateL1ToL2Message(address _canceller) + function _createExpectedMintPrivateL1ToL2Message() internal view returns (DataStructures.L1ToL2Msg memory) @@ -105,15 +104,14 @@ contract TokenPortalTest is Test { portalERC20.approve(address(tokenPortal), mintAmount); // Check for the expected message - DataStructures.L1ToL2Msg memory expectedMessage = - _createExpectedMintPrivateL1ToL2Message(address(this)); + DataStructures.L1ToL2Msg memory expectedMessage = _createExpectedMintPrivateL1ToL2Message(); bytes32 expectedLeaf = expectedMessage.sha256ToField(); // Check the event was emitted vm.expectEmit(true, true, true, true); // event we expect - emit LeafInserted(FIRST_REAL_TREE_NUM, 0, expectedLeaf); + emit IInbox.LeafInserted(FIRST_REAL_TREE_NUM, 0, expectedLeaf); // event we will get // Perform op @@ -138,7 +136,7 @@ contract TokenPortalTest is Test { // Check the event was emitted vm.expectEmit(true, true, true, true); // event we expect - emit LeafInserted(FIRST_REAL_TREE_NUM, 0, expectedLeaf); + emit IInbox.LeafInserted(FIRST_REAL_TREE_NUM, 0, expectedLeaf); // Perform op bytes32 leaf = tokenPortal.depositToAztecPublic(to, amount, secretHashForL2MessageConsumption); diff --git a/l1-contracts/test/portals/UniswapPortal.t.sol b/l1-contracts/test/portals/UniswapPortal.t.sol index caf48bf6137a..51caae33470a 100644 --- a/l1-contracts/test/portals/UniswapPortal.t.sol +++ b/l1-contracts/test/portals/UniswapPortal.t.sol @@ -231,7 +231,7 @@ contract UniswapPortalTest is Test { bytes32 swapEntryKey = _createUniswapSwapMessagePublic(aztecRecipient, address(this)); _addMessagesToOutbox(daiWithdrawEntryKey, swapEntryKey); - bytes32 l1ToL2EntryKey = uniswapPortal.swapPublic( + uniswapPortal.swapPublic( address(daiTokenPortal), amount, uniswapFeePool, @@ -260,7 +260,7 @@ contract UniswapPortalTest is Test { _addMessagesToOutbox(daiWithdrawEntryKey, swapEntryKey); vm.prank(_caller); - bytes32 l1ToL2EntryKey = uniswapPortal.swapPublic( + uniswapPortal.swapPublic( address(daiTokenPortal), amount, uniswapFeePool,