diff --git a/crates/forge/tests/fixtures/zk/MyPaymaster.sol b/crates/forge/tests/fixtures/zk/MyPaymaster.sol index 509977a34..add4b3a4d 100644 --- a/crates/forge/tests/fixtures/zk/MyPaymaster.sol +++ b/crates/forge/tests/fixtures/zk/MyPaymaster.sol @@ -1,24 +1,26 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import "../lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol"; +import "openzeppelin-contracts/contracts/token/ERC20/IERC20.sol"; import "forge-std/console2.sol"; import { IPaymaster, ExecutionResult, PAYMASTER_VALIDATION_SUCCESS_MAGIC -} from "../lib/zksync-contracts/zksync-contracts/l2/system-contracts/interfaces/IPaymaster.sol"; +} from "era-contracts/system-contracts/contracts/interfaces/IPaymaster.sol"; import {IPaymasterFlow} from - "../lib/zksync-contracts/zksync-contracts/l2/system-contracts/interfaces/IPaymasterFlow.sol"; + "era-contracts/system-contracts/contracts/interfaces/IPaymasterFlow.sol"; import { TransactionHelper, Transaction -} from "../lib/zksync-contracts/zksync-contracts/l2/system-contracts/libraries/TransactionHelper.sol"; -import "../lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol"; -import "../lib/zksync-contracts/zksync-contracts/l2/system-contracts/Constants.sol"; +} from "era-contracts/system-contracts/contracts/libraries/TransactionHelper.sol"; +import "openzeppelin-contracts/contracts/token/ERC20/ERC20.sol"; contract MyPaymaster is IPaymaster { + // TODO: Replace this once the following issue is fixed: + // https://github.com/matter-labs/era-contracts/issues/802 + address payable constant BOOTLOADER_FORMAL_ADDRESS = payable(address(0x8000 + 0x01)); uint256 constant PRICE_FOR_PAYING_FEES = 1; address public allowedToken; diff --git a/crates/forge/tests/fixtures/zk/Paymaster.t.sol b/crates/forge/tests/fixtures/zk/Paymaster.t.sol index abdd46ff8..96edae5b3 100644 --- a/crates/forge/tests/fixtures/zk/Paymaster.t.sol +++ b/crates/forge/tests/fixtures/zk/Paymaster.t.sol @@ -2,7 +2,6 @@ pragma solidity ^0.8.13; import {Test, console} from "forge-std/Test.sol"; -import "../lib/zksync-contracts/zksync-contracts/l2/system-contracts/Constants.sol"; import {MyPaymaster, MyERC20} from "./MyPaymaster.sol"; contract TestPaymasterFlow is Test { @@ -80,6 +79,7 @@ contract TestPaymasterFlow is Test { } contract DoStuff { + address payable constant BOOTLOADER_FORMAL_ADDRESS = payable(address(0x8000 + 0x01)); function do_stuff() public { (bool success,) = payable(BOOTLOADER_FORMAL_ADDRESS).call{value: address(this).balance}(""); require(success, "Failed to transfer tx fee to the bootloader. Paymaster balance might not be enough."); diff --git a/crates/forge/tests/it/zk/paymaster.rs b/crates/forge/tests/it/zk/paymaster.rs index 6f168d098..fae3bebbe 100644 --- a/crates/forge/tests/it/zk/paymaster.rs +++ b/crates/forge/tests/it/zk/paymaster.rs @@ -3,6 +3,8 @@ use foundry_config::fs_permissions::PathPermission; use foundry_test_utils::util; +use std::fs; + #[tokio::test(flavor = "multi_thread")] async fn test_zk_contract_paymaster() { let (prj, mut cmd) = util::setup_forge( @@ -14,13 +16,19 @@ async fn test_zk_contract_paymaster() { cmd.args([ "install", "OpenZeppelin/openzeppelin-contracts", - "cyfrin/zksync-contracts", + "matter-labs/era-contracts", "--no-commit", "--shallow", ]) .ensure_execute_success() .expect("able to install dependencies"); + //ls the lib/era-contracts/system-contracts folder + let entries = fs::read_dir(prj.root().join("lib").join("era-contracts").join("system-contracts").join("contracts").join("interfaces")).unwrap(); + for entry in entries { + println!("Found in lib: {:?}", entry.unwrap().path().to_str().unwrap()); + } + cmd.forge_fuse(); let mut config = cmd.config(); @@ -30,6 +38,9 @@ async fn test_zk_contract_paymaster() { prj.add_source("MyPaymaster.sol", include_str!("../../fixtures/zk/MyPaymaster.sol")).unwrap(); prj.add_source("Paymaster.t.sol", include_str!("../../fixtures/zk/Paymaster.t.sol")).unwrap(); + + + //add mc to the command cmd.args(["test", "--zk-startup", "--evm-version", "shanghai", "--via-ir"]); assert!(cmd.stdout_lossy().contains("Suite result: ok")); }