From c1afaa21658861c2eecba5d7f5a665f2a192a749 Mon Sep 17 00:00:00 2001 From: byshape Date: Tue, 13 Aug 2024 17:42:40 +0100 Subject: [PATCH] Rollback changes --- .gas-snapshot | 44 +++++++++++++++++++------------------- .github/workflows/test.yml | 4 ++-- test/unit/Escrow.t.sol | 10 +-------- test/utils/BaseSetup.sol | 2 +- 4 files changed, 26 insertions(+), 34 deletions(-) diff --git a/.gas-snapshot b/.gas-snapshot index e089257..a43c5bb 100644 --- a/.gas-snapshot +++ b/.gas-snapshot @@ -10,48 +10,48 @@ EscrowTest:test_CancelDst() (gas: 116126) EscrowTest:test_CancelDstDifferentTarget() (gas: 143384) EscrowTest:test_CancelDstWithNativeToken() (gas: 93710) EscrowTest:test_CancelPublicSrc() (gas: 165464) -EscrowTest:test_CancelResolverSrc() (gas: 168624) +EscrowTest:test_CancelResolverSrc() (gas: 168607) EscrowTest:test_CancelResolverSrcReceiver() (gas: 179361) -EscrowTest:test_NoAnyoneCancelDuringResolverCancelSrc() (gas: 163836) +EscrowTest:test_NoAnyoneCancelDuringResolverCancelSrc() (gas: 163856) EscrowTest:test_NoCallsWithInvalidImmutables() (gas: 286516) EscrowTest:test_NoCancelByAnyoneDst() (gas: 121726) EscrowTest:test_NoCancelDuringWithdrawalDst() (gas: 121486) -EscrowTest:test_NoCancelDuringWithdrawalSrc() (gas: 163959) -EscrowTest:test_NoFailedNativeTokenTransferCancelSrc() (gas: 179302) +EscrowTest:test_NoCancelDuringWithdrawalSrc() (gas: 164001) +EscrowTest:test_NoFailedNativeTokenTransferCancelSrc() (gas: 179339) EscrowTest:test_NoFailedNativeTokenTransferWithdrawalDst() (gas: 154544) -EscrowTest:test_NoFailedNativeTokenTransferWithdrawalSrc() (gas: 312369) +EscrowTest:test_NoFailedNativeTokenTransferWithdrawalSrc() (gas: 312329) EscrowTest:test_NoPublicCancelDuringPrivateCancellationSrc() (gas: 163146) EscrowTest:test_NoPublicWithdrawOutsideOfAllowedPeriodDst() (gas: 126910) -EscrowTest:test_NoPublicWithdrawalOutsideOfAllowedPeriodSrc() (gas: 169083) +EscrowTest:test_NoPublicWithdrawalOutsideOfAllowedPeriodSrc() (gas: 169085) EscrowTest:test_NoRescueFundsByAnyoneDst() (gas: 176370) EscrowTest:test_NoRescueFundsByAnyoneSrc() (gas: 209064) EscrowTest:test_NoRescueFundsEarlierDst() (gas: 175780) -EscrowTest:test_NoRescueFundsEarlierSrc() (gas: 208981) +EscrowTest:test_NoRescueFundsEarlierSrc() (gas: 209041) EscrowTest:test_NoRevertFailedNativeTokenTransferWithdrawalDstNative() (gas: 91111) -EscrowTest:test_NoWithdrawalByAnyoneSrc() (gas: 160853) +EscrowTest:test_NoWithdrawalByAnyoneSrc() (gas: 160873) EscrowTest:test_NoWithdrawalByNonResolverDst() (gas: 121439) EscrowTest:test_NoWithdrawalOutsideOfAllowedPeriodDst() (gas: 126326) EscrowTest:test_NoWithdrawalOutsideOfAllowedPeriodSrc() (gas: 169636) EscrowTest:test_NoWithdrawalWithWrongSecretDst() (gas: 122776) -EscrowTest:test_NoWithdrawalWithWrongSecretSrc() (gas: 164448) +EscrowTest:test_NoWithdrawalWithWrongSecretSrc() (gas: 164478) EscrowTest:test_PublicWithdrawSrc() (gas: 181761) EscrowTest:test_RescueFundsDst() (gas: 158304) EscrowTest:test_RescueFundsDstNative() (gas: 186735) -EscrowTest:test_RescueFundsSrc() (gas: 195453) -EscrowTest:test_RescueFundsSrcNative() (gas: 197742) +EscrowTest:test_RescueFundsSrc() (gas: 195445) +EscrowTest:test_RescueFundsSrcNative() (gas: 197743) EscrowTest:test_WithdrawByAnyoneDst() (gas: 141326) EscrowTest:test_WithdrawByResolverDst() (gas: 142389) EscrowTest:test_WithdrawByResolverDstNative() (gas: 97831) EscrowTest:test_WithdrawByResolverPublicDst() (gas: 141757) -EscrowTest:test_WithdrawSrc() (gas: 186522) -EscrowTest:test_WithdrawSrcTo() (gas: 191335) +EscrowTest:test_WithdrawSrc() (gas: 186505) +EscrowTest:test_WithdrawSrcTo() (gas: 191352) IntegrationEscrowFactoryTest:test_DeployCloneForMakerNonWhitelistedResolverInt() (gas: 473542) IntegrationEscrowFactoryTest:test_NoInsufficientBalanceDeploymentForMakerInt() (gas: 341264) IntegrationEscrowFactoryTest:test_NoResolverReentrancy() (gas: 2065184) IntegrationResolverMockTest:test_MockCancelDst() (gas: 157184) -IntegrationResolverMockTest:test_MockCancelSrc() (gas: 353957) +IntegrationResolverMockTest:test_MockCancelSrc() (gas: 353972) IntegrationResolverMockTest:test_MockDeployDst() (gas: 151470) -IntegrationResolverMockTest:test_MockDeploySrc() (gas: 365054) +IntegrationResolverMockTest:test_MockDeploySrc() (gas: 364921) IntegrationResolverMockTest:test_MockPublicCancelSrc() (gas: 392471) IntegrationResolverMockTest:test_MockPublicWithdrawDst() (gas: 164841) IntegrationResolverMockTest:test_MockRescueFundsDst() (gas: 161103) @@ -60,17 +60,17 @@ IntegrationResolverMockTest:test_MockWithdrawDst() (gas: 182912) IntegrationResolverMockTest:test_MockWithdrawToSrc() (gas: 354839) MerkleStorageInvalidatorIntTest:test_MultipleFillsFillAllExtra() (gas: 923554) MerkleStorageInvalidatorIntTest:test_MultipleFillsFillAllFromLast() (gas: 922336) -MerkleStorageInvalidatorIntTest:test_MultipleFillsFillAllTwoFills() (gas: 922158) +MerkleStorageInvalidatorIntTest:test_MultipleFillsFillAllTwoFills() (gas: 922148) MerkleStorageInvalidatorIntTest:test_MultipleFillsFillFirst() (gas: 707638) -MerkleStorageInvalidatorIntTest:test_MultipleFillsFillFirstTwoFills() (gas: 932982) -MerkleStorageInvalidatorIntTest:test_MultipleFillsFillLast() (gas: 707218) -MerkleStorageInvalidatorIntTest:test_MultipleFillsNoDeploymentWithoutValidation() (gas: 301343) -MerkleStorageInvalidatorIntTest:test_MultipleFillsNoReuseOfSecrets() (gas: 1068017) +MerkleStorageInvalidatorIntTest:test_MultipleFillsFillFirstTwoFills() (gas: 932969) +MerkleStorageInvalidatorIntTest:test_MultipleFillsFillLast() (gas: 707297) +MerkleStorageInvalidatorIntTest:test_MultipleFillsNoDeploymentWithoutValidation() (gas: 301456) +MerkleStorageInvalidatorIntTest:test_MultipleFillsNoReuseOfSecrets() (gas: 1069228) MerkleStorageInvalidatorIntTest:test_MultipleFillsNoSecondDeploymentWithTheSameIndex() (gas: 786011) MerkleStorageInvalidatorIntTest:test_MultipleFillsOddDivision() (gas: 444783) -MerkleStorageInvalidatorIntTest:test_MultipleFillsOneFill() (gas: 707615) +MerkleStorageInvalidatorIntTest:test_MultipleFillsOneFill() (gas: 707645) MerkleStorageInvalidatorIntTest:test_MultipleFillsTwoFills() (gas: 921433) -MerkleStorageInvalidatorTest:test_ShortenedProofIsNotValid() (gas: 230552) +MerkleStorageInvalidatorTest:test_ShortenedProofIsNotValid() (gas: 230605) TimelocksLibTest:test_NoTimelocksOverflow() (gas: 156200) 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 2e9935d..c32796c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -39,7 +39,7 @@ jobs: run: FOUNDRY_PROFILE=default forge test -vvv --gas-report test-zksync: - runs-on: macos-13 + runs-on: macos-13 steps: - uses: actions/checkout@v4 with: @@ -71,7 +71,7 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} coverage-zksync: - runs-on: ubuntu-latest + runs-on: macos-13 steps: - uses: actions/checkout@v4 with: diff --git a/test/unit/Escrow.t.sol b/test/unit/Escrow.t.sol index 80e980a..da778d3 100644 --- a/test/unit/Escrow.t.sol +++ b/test/unit/Escrow.t.sol @@ -201,17 +201,9 @@ contract EscrowTest is BaseSetup { swapData.srcClone.publicWithdraw(SECRET, swapData.immutables); } - function _keccakBytes32(bytes32 secret) private pure returns (bytes32 ret) { - assembly ("memory-safe") { - mstore(0, secret) - ret := keccak256(0, 0x20) - } - } - function test_PublicWithdrawSrc() public { - bytes32 hashlock = _keccakBytes32(SECRET); // deploy escrow - CrossChainTestLib.SwapData memory swapData = _prepareDataSrcHashlock(hashlock, true, false); + CrossChainTestLib.SwapData memory swapData = _prepareDataSrc(true, false); (bool success,) = address(swapData.srcClone).call{ value: SRC_SAFETY_DEPOSIT }(""); assertEq(success, true); diff --git a/test/utils/BaseSetup.sol b/test/utils/BaseSetup.sol index e269993..6b3b132 100644 --- a/test/utils/BaseSetup.sol +++ b/test/utils/BaseSetup.sol @@ -21,7 +21,7 @@ import { Timelocks } from "./libraries/TimelocksSettersLib.sol"; /* solhint-disable max-states-count */ contract BaseSetup is Test, Utils { /* solhint-disable private-vars-leading-underscore */ - bytes32 internal constant SECRET = keccak256(abi.encodePacked(uint256(123))); + bytes32 internal constant SECRET = keccak256(abi.encodePacked("secret")); bytes32 internal constant HASHED_SECRET = keccak256(abi.encodePacked(SECRET)); uint256 internal constant MAKING_AMOUNT = 0.3 ether; uint256 internal constant TAKING_AMOUNT = 0.5 ether;