Skip to content

Commit

Permalink
Merge pull request #114 from 1inch/fix/zksync-tests
Browse files Browse the repository at this point in the history
[SC-1223] fix zksync tests
  • Loading branch information
byshape authored Aug 30, 2024
2 parents 45ce384 + 34d93b3 commit 30cb5aa
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 34 deletions.
36 changes: 18 additions & 18 deletions .gas-snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -12,66 +12,66 @@ EscrowTest:test_CancelDstWithNativeToken() (gas: 93670)
EscrowTest:test_CancelPublicSrc() (gas: 170900)
EscrowTest:test_CancelResolverSrc() (gas: 168607)
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_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_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)
EscrowTest:test_RescueFundsSrc() (gas: 195453)
EscrowTest:test_RescueFundsSrcNative() (gas: 197742)
EscrowTest:test_WithdrawByAnyoneDst() (gas: 146701)
EscrowTest:test_WithdrawByResolverDst() (gas: 142374)
EscrowTest:test_WithdrawByResolverDstNative() (gas: 97859)
EscrowTest:test_WithdrawByResolverPublicDst() (gas: 141720)
EscrowTest:test_WithdrawSrc() (gas: 186522)
EscrowTest:test_WithdrawSrcTo() (gas: 191335)
EscrowTest:test_WithdrawSrcTo() (gas: 191352)
IntegrationEscrowFactoryTest:test_DeployCloneForMakerNonWhitelistedResolverInt() (gas: 510255)
IntegrationEscrowFactoryTest:test_NoInsufficientBalanceDeploymentForMakerInt() (gas: 341345)
IntegrationEscrowFactoryTest:test_NoResolverReentrancy() (gas: 2065268)
IntegrationResolverMockTest:test_MockCancelDst() (gas: 157134)
IntegrationResolverMockTest:test_MockCancelSrc() (gas: 354038)
IntegrationResolverMockTest:test_MockDeployDst() (gas: 151470)
IntegrationResolverMockTest:test_MockDeploySrc() (gas: 364984)
IntegrationResolverMockTest:test_MockDeploySrc() (gas: 365135)
IntegrationResolverMockTest:test_MockPublicCancelSrc() (gas: 397961)
IntegrationResolverMockTest:test_MockPublicWithdrawDst() (gas: 170216)
IntegrationResolverMockTest:test_MockRescueFundsDst() (gas: 161053)
IntegrationResolverMockTest:test_MockRescueFundsSrc() (gas: 382664)
IntegrationResolverMockTest:test_MockRescueFundsSrc() (gas: 382703)
IntegrationResolverMockTest:test_MockWithdrawDst() (gas: 182875)
IntegrationResolverMockTest:test_MockWithdrawToSrc() (gas: 354920)
MerkleStorageInvalidatorIntTest:test_MultipleFillsFillAllExtra() (gas: 923635)
MerkleStorageInvalidatorIntTest:test_MultipleFillsFillAllFromLast() (gas: 922417)
MerkleStorageInvalidatorIntTest:test_MultipleFillsFillAllFromLast() (gas: 922419)
MerkleStorageInvalidatorIntTest:test_MultipleFillsFillAllTwoFills() (gas: 922239)
MerkleStorageInvalidatorIntTest:test_MultipleFillsFillFirst() (gas: 707710)
MerkleStorageInvalidatorIntTest:test_MultipleFillsFillFirstTwoFills() (gas: 933041)
MerkleStorageInvalidatorIntTest:test_MultipleFillsFillLast() (gas: 707378)
MerkleStorageInvalidatorIntTest:test_MultipleFillsNoDeploymentWithoutValidation() (gas: 301424)
MerkleStorageInvalidatorIntTest:test_MultipleFillsNoDeploymentWithoutValidation() (gas: 301537)
MerkleStorageInvalidatorIntTest:test_MultipleFillsNoReuseOfSecrets() (gas: 1068098)
MerkleStorageInvalidatorIntTest:test_MultipleFillsNoSecondDeploymentWithTheSameIndex() (gas: 786092)
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: 230634)
TimelocksLibTest:test_NoTimelocksOverflow() (gas: 193707)
TimelocksLibTest:test_getStartTimestamps() (gas: 16207)
TimelocksLibTest:test_setDeployedAt() (gas: 5741)
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ 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
steps:
Expand All @@ -52,7 +52,7 @@ jobs:

- name: Install Foundry for zksync
run: cd foundry-zksync && ./install-foundry-zksync

- name: Run tests
run: FOUNDRY_PROFILE=zksync forge test -vvv --zksync

Expand Down
27 changes: 13 additions & 14 deletions test/utils/BaseSetup.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -80,10 +79,11 @@ 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(alice.addr, "Alice");
vm.label(bob.addr, "Bob");
vm.label(charlie.addr, "Charlie");

resolvers = new address[](1);
Expand All @@ -110,12 +110,13 @@ 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(dai), "DAI");
vm.label(address(usdc), "USDC");
vm.label(address(inch), "1INCH");
vm.label(address(accessToken), "ACCESS");
}

Expand All @@ -133,13 +134,11 @@ 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");
vm.label(address(escrowDst), "EscrowDst");
vm.label(address(feeBank), "FeeBank");
}

vm.label(address(escrowFactory), "EscrowFactory");
vm.label(address(escrowSrc), "EscrowSrc");
vm.label(address(escrowDst), "EscrowDst");
vm.label(address(feeBank), "FeeBank");
}

function _prepareDataSrc(bool fakeOrder, bool allowMultipleFills) internal returns(CrossChainTestLib.SwapData memory) {
Expand All @@ -157,7 +156,7 @@ contract BaseSetup is Test, Utils {

function _prepareDataSrcHashlock(
bytes32 hashlock,
bool fakeOrder,
bool fakeOrder,
bool allowMultipleFills
) internal returns(CrossChainTestLib.SwapData memory) {
return _prepareDataSrcCustom(
Expand Down

0 comments on commit 30cb5aa

Please sign in to comment.