Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
benesjan committed Mar 17, 2024
1 parent 8b58aca commit fef5549
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
5 changes: 2 additions & 3 deletions l1-contracts/test/Inbox.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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
Expand Down Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion l1-contracts/test/Rollup.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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));

{
Expand Down
10 changes: 4 additions & 6 deletions l1-contracts/test/portals/TokenPortal.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions l1-contracts/test/portals/UniswapPortal.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -260,7 +260,7 @@ contract UniswapPortalTest is Test {
_addMessagesToOutbox(daiWithdrawEntryKey, swapEntryKey);

vm.prank(_caller);
bytes32 l1ToL2EntryKey = uniswapPortal.swapPublic(
uniswapPortal.swapPublic(
address(daiTokenPortal),
amount,
uniswapFeePool,
Expand Down

0 comments on commit fef5549

Please sign in to comment.