diff --git a/.gas-snapshot b/.gas-snapshot index b145798..890cd0b 100644 --- a/.gas-snapshot +++ b/.gas-snapshot @@ -10,32 +10,32 @@ EscrowTest:test_CancelDst() (gas: 116076) EscrowTest:test_CancelDstDifferentTarget() (gas: 143334) EscrowTest:test_CancelDstWithNativeToken() (gas: 93670) EscrowTest:test_CancelPublicSrc() (gas: 170900) -EscrowTest:test_CancelResolverSrc() (gas: 168607) +EscrowTest:test_CancelResolverSrc() (gas: 168624) EscrowTest:test_CancelResolverSrcReceiver() (gas: 179361) -EscrowTest:test_NoAnyoneCancelDuringResolverCancelSrc() (gas: 163856) -EscrowTest:test_NoCallsWithInvalidImmutables() (gas: 286518) +EscrowTest:test_NoAnyoneCancelDuringResolverCancelSrc() (gas: 163836) +EscrowTest:test_NoCallsWithInvalidImmutables() (gas: 286516) EscrowTest:test_NoCancelByAnyoneDst() (gas: 121726) EscrowTest:test_NoCancelDuringWithdrawalDst() (gas: 121486) -EscrowTest:test_NoCancelDuringWithdrawalSrc() (gas: 164001) +EscrowTest:test_NoCancelDuringWithdrawalSrc() (gas: 163959) EscrowTest:test_NoFailedNativeTokenTransferCancelSrc() (gas: 216919) EscrowTest:test_NoFailedNativeTokenTransferWithdrawalDst() (gas: 192056) EscrowTest:test_NoFailedNativeTokenTransferWithdrawalDstNative() (gas: 84157) -EscrowTest:test_NoFailedNativeTokenTransferWithdrawalSrc() (gas: 349820) +EscrowTest:test_NoFailedNativeTokenTransferWithdrawalSrc() (gas: 349798) EscrowTest:test_NoPublicCallsByAnyone() (gas: 287575) -EscrowTest:test_NoPublicCancelDuringPrivateCancellationSrc() (gas: 168572) +EscrowTest:test_NoPublicCancelDuringPrivateCancellationSrc() (gas: 168592) EscrowTest:test_NoPublicWithdrawOutsideOfAllowedPeriodDst() (gas: 137737) -EscrowTest:test_NoPublicWithdrawalOutsideOfAllowedPeriodSrc() (gas: 179920) +EscrowTest:test_NoPublicWithdrawalOutsideOfAllowedPeriodSrc() (gas: 179922) EscrowTest:test_NoRescueFundsByAnyoneDst() (gas: 176333) EscrowTest:test_NoRescueFundsByAnyoneSrc() (gas: 209079) EscrowTest:test_NoRescueFundsEarlierDst() (gas: 175721) -EscrowTest:test_NoRescueFundsEarlierSrc() (gas: 208959) -EscrowTest:test_NoWithdrawalByAnyoneSrc() (gas: 160853) +EscrowTest:test_NoRescueFundsEarlierSrc() (gas: 209019) +EscrowTest:test_NoWithdrawalByAnyoneSrc() (gas: 160873) EscrowTest:test_NoWithdrawalByNonResolverDst() (gas: 121439) EscrowTest:test_NoWithdrawalOutsideOfAllowedPeriodDst() (gas: 126326) -EscrowTest:test_NoWithdrawalOutsideOfAllowedPeriodSrc() (gas: 169627) +EscrowTest:test_NoWithdrawalOutsideOfAllowedPeriodSrc() (gas: 169636) EscrowTest:test_NoWithdrawalWithWrongSecretDst() (gas: 122798) -EscrowTest:test_NoWithdrawalWithWrongSecretSrc() (gas: 164448) -EscrowTest:test_PublicWithdrawSrc() (gas: 187154) +EscrowTest:test_NoWithdrawalWithWrongSecretSrc() (gas: 164478) +EscrowTest:test_PublicWithdrawSrc() (gas: 187170) EscrowTest:test_RescueFundsDst() (gas: 158237) EscrowTest:test_RescueFundsDstNative() (gas: 186700) EscrowTest:test_RescueFundsSrc() (gas: 195445) @@ -50,10 +50,10 @@ IntegrationEscrowFactoryTest:test_DeployCloneForMakerNonWhitelistedResolverInt() IntegrationEscrowFactoryTest:test_NoInsufficientBalanceDeploymentForMakerInt() (gas: 341345) IntegrationEscrowFactoryTest:test_NoResolverReentrancy() (gas: 2065268) IntegrationResolverMockTest:test_MockCancelDst() (gas: 157134) -IntegrationResolverMockTest:test_MockCancelSrc() (gas: 354038) +IntegrationResolverMockTest:test_MockCancelSrc() (gas: 354053) IntegrationResolverMockTest:test_MockDeployDst() (gas: 151470) IntegrationResolverMockTest:test_MockDeploySrc() (gas: 364984) -IntegrationResolverMockTest:test_MockPublicCancelSrc() (gas: 397961) +IntegrationResolverMockTest:test_MockPublicCancelSrc() (gas: 398004) IntegrationResolverMockTest:test_MockPublicWithdrawDst() (gas: 170216) IntegrationResolverMockTest:test_MockRescueFundsDst() (gas: 161053) IntegrationResolverMockTest:test_MockRescueFundsSrc() (gas: 382664) @@ -61,17 +61,17 @@ IntegrationResolverMockTest:test_MockWithdrawDst() (gas: 182875) IntegrationResolverMockTest:test_MockWithdrawToSrc() (gas: 354920) MerkleStorageInvalidatorIntTest:test_MultipleFillsFillAllExtra() (gas: 923635) MerkleStorageInvalidatorIntTest:test_MultipleFillsFillAllFromLast() (gas: 922417) -MerkleStorageInvalidatorIntTest:test_MultipleFillsFillAllTwoFills() (gas: 922239) -MerkleStorageInvalidatorIntTest:test_MultipleFillsFillFirst() (gas: 707710) -MerkleStorageInvalidatorIntTest:test_MultipleFillsFillFirstTwoFills() (gas: 933041) -MerkleStorageInvalidatorIntTest:test_MultipleFillsFillLast() (gas: 707378) +MerkleStorageInvalidatorIntTest:test_MultipleFillsFillAllTwoFills() (gas: 922238) +MerkleStorageInvalidatorIntTest:test_MultipleFillsFillFirst() (gas: 707719) +MerkleStorageInvalidatorIntTest:test_MultipleFillsFillFirstTwoFills() (gas: 933063) +MerkleStorageInvalidatorIntTest:test_MultipleFillsFillLast() (gas: 707290) MerkleStorageInvalidatorIntTest:test_MultipleFillsNoDeploymentWithoutValidation() (gas: 301424) -MerkleStorageInvalidatorIntTest:test_MultipleFillsNoReuseOfSecrets() (gas: 1068098) -MerkleStorageInvalidatorIntTest:test_MultipleFillsNoSecondDeploymentWithTheSameIndex() (gas: 786092) +MerkleStorageInvalidatorIntTest:test_MultipleFillsNoReuseOfSecrets() (gas: 1069309) +MerkleStorageInvalidatorIntTest:test_MultipleFillsNoSecondDeploymentWithTheSameIndex() (gas: 786059) MerkleStorageInvalidatorIntTest:test_MultipleFillsOddDivision() (gas: 444873) MerkleStorageInvalidatorIntTest:test_MultipleFillsOneFill() (gas: 707726) -MerkleStorageInvalidatorIntTest:test_MultipleFillsTwoFills() (gas: 921505) -MerkleStorageInvalidatorTest:test_ShortenedProofIsNotValid() (gas: 230686) +MerkleStorageInvalidatorIntTest:test_MultipleFillsTwoFills() (gas: 921521) +MerkleStorageInvalidatorTest:test_ShortenedProofIsNotValid() (gas: 230633) TimelocksLibTest:test_NoTimelocksOverflow() (gas: 193707) TimelocksLibTest:test_getStartTimestamps() (gas: 16207) TimelocksLibTest:test_setDeployedAt() (gas: 5741) \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9a55f90..b4b380c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -37,9 +37,9 @@ jobs: uses: foundry-rs/foundry-toolchain@v1 - name: Run tests run: FOUNDRY_PROFILE=default forge test -vvv --gas-report - + test-zksync: - runs-on: ubuntu-latest + runs-on: macos-latest steps: - uses: actions/checkout@v4 with: @@ -47,12 +47,12 @@ jobs: - uses: actions/checkout@v4 with: repository: matter-labs/foundry-zksync - ref: 'main' + ref: '${{ vars.FOUNDRY_ZKSYNC_COMMIT }}' path: 'foundry-zksync' - name: Install Foundry for zksync run: cd foundry-zksync && ./install-foundry-zksync - + - name: Run tests run: FOUNDRY_PROFILE=zksync forge test -vvv --zksync @@ -71,7 +71,7 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} coverage-zksync: - runs-on: ubuntu-latest + runs-on: macos-latest steps: - uses: actions/checkout@v4 with: @@ -79,7 +79,7 @@ jobs: - uses: actions/checkout@v4 with: repository: matter-labs/foundry-zksync - ref: 'main' + ref: '${{ vars.FOUNDRY_ZKSYNC_COMMIT }}' path: 'foundry-zksync' - name: Install Foundry for zksync diff --git a/test/utils/BaseSetup.sol b/test/utils/BaseSetup.sol index 987819c..0879ea6 100644 --- a/test/utils/BaseSetup.sol +++ b/test/utils/BaseSetup.sol @@ -18,7 +18,6 @@ import { Utils } from "./Utils.sol"; import { CrossChainTestLib } from "./libraries/CrossChainTestLib.sol"; import { Timelocks } from "./libraries/TimelocksSettersLib.sol"; - /* solhint-disable max-states-count */ contract BaseSetup is Test, Utils { /* solhint-disable private-vars-leading-underscore */ @@ -80,11 +79,13 @@ contract BaseSetup is Test, Utils { _createUsers(3); alice = users[0]; - vm.label(alice.addr, "Alice"); bob = users[1]; - vm.label(bob.addr, "Bob"); charlie = users[2]; - vm.label(charlie.addr, "Charlie"); + if (isZkSync) { + vm.label(alice.addr, "Alice"); + vm.label(bob.addr, "Bob"); + vm.label(charlie.addr, "Charlie"); + } resolvers = new address[](1); resolvers[0] = bob.addr; @@ -110,13 +111,16 @@ contract BaseSetup is Test, Utils { function _deployTokens() internal { dai = new TokenMock("DAI", "DAI"); - vm.label(address(dai), "DAI"); usdc = new TokenCustomDecimalsMock("USDC", "USDC", 1000 ether, 6); - vm.label(address(usdc), "USDC"); inch = new TokenMock("1INCH", "1INCH"); - vm.label(address(inch), "1INCH"); accessToken = new TokenMock("ACCESS", "ACCESS"); - vm.label(address(accessToken), "ACCESS"); + + if (!isZkSync) { + vm.label(address(dai), "DAI"); + vm.label(address(usdc), "USDC"); + vm.label(address(inch), "1INCH"); + vm.label(address(accessToken), "ACCESS"); + } } function _deployContracts() internal { @@ -133,7 +137,7 @@ contract BaseSetup is Test, Utils { escrowDst = EscrowDst(escrowFactory.ESCROW_DST_IMPLEMENTATION()); feeBank = IFeeBank(escrowFactory.FEE_BANK()); - + if (!isZkSync) { vm.label(address(escrowFactory), "EscrowFactory"); vm.label(address(escrowSrc), "EscrowSrc"); @@ -157,7 +161,7 @@ contract BaseSetup is Test, Utils { function _prepareDataSrcHashlock( bytes32 hashlock, - bool fakeOrder, + bool fakeOrder, bool allowMultipleFills ) internal returns(CrossChainTestLib.SwapData memory) { return _prepareDataSrcCustom(