From 399ece0adae4ddcdba49768de14adb1be73af8e7 Mon Sep 17 00:00:00 2001 From: MathisGD Date: Sat, 6 Aug 2022 11:46:58 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=85=20fix:=20testSafeTransferFrom=20to=20?= =?UTF-8?q?same=20address=20(#302)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gas-snapshot | 212 +++++++++++++++++++++++++++++++++++++++++ src/test/ERC1155.t.sol | 40 ++++++-- 2 files changed, 242 insertions(+), 10 deletions(-) diff --git a/.gas-snapshot b/.gas-snapshot index b890d19b..ac115ddc 100644 --- a/.gas-snapshot +++ b/.gas-snapshot @@ -1,79 +1,152 @@ AuthTest:testCallFunctionAsOwner() (gas: 29871) AuthTest:testCallFunctionWithPermissiveAuthority() (gas: 124249) +AuthTest:testCallFunctionWithPermissiveAuthority(address) (runs: 256, μ: 129082, ~: 129214) AuthTest:testFailCallFunctionAsNonOwner() (gas: 15491) +AuthTest:testFailCallFunctionAsNonOwner(address) (runs: 256, μ: 15631, ~: 15631) AuthTest:testFailCallFunctionAsOwnerWithOutOfOrderAuthority() (gas: 136021) AuthTest:testFailCallFunctionWithRestrictiveAuthority() (gas: 129201) +AuthTest:testFailCallFunctionWithRestrictiveAuthority(address) (runs: 256, μ: 129319, ~: 129319) AuthTest:testFailSetAuthorityAsNonOwner() (gas: 18260) +AuthTest:testFailSetAuthorityAsNonOwner(address,address) (runs: 256, μ: 18551, ~: 18551) AuthTest:testFailSetAuthorityWithRestrictiveAuthority() (gas: 129078) +AuthTest:testFailSetAuthorityWithRestrictiveAuthority(address,address) (runs: 256, μ: 129410, ~: 129410) AuthTest:testFailSetOwnerAsNonOwner() (gas: 15609) +AuthTest:testFailSetOwnerAsNonOwner(address,address) (runs: 256, μ: 15835, ~: 15835) AuthTest:testFailSetOwnerAsOwnerWithOutOfOrderAuthority() (gas: 136161) +AuthTest:testFailSetOwnerAsOwnerWithOutOfOrderAuthority(address) (runs: 256, μ: 136323, ~: 136323) AuthTest:testFailSetOwnerWithRestrictiveAuthority() (gas: 129242) +AuthTest:testFailSetOwnerWithRestrictiveAuthority(address,address) (runs: 256, μ: 129546, ~: 129546) AuthTest:testSetAuthorityAsOwner() (gas: 32302) +AuthTest:testSetAuthorityAsOwner(address) (runs: 256, μ: 31917, ~: 32384) AuthTest:testSetAuthorityAsOwnerWithOutOfOrderAuthority() (gas: 226396) AuthTest:testSetAuthorityWithPermissiveAuthority() (gas: 125963) +AuthTest:testSetAuthorityWithPermissiveAuthority(address,address) (runs: 256, μ: 129929, ~: 131012) AuthTest:testSetOwnerAsOwner() (gas: 15298) +AuthTest:testSetOwnerAsOwner(address) (runs: 256, μ: 15368, ~: 15492) AuthTest:testSetOwnerWithPermissiveAuthority() (gas: 127884) +AuthTest:testSetOwnerWithPermissiveAuthority(address,address) (runs: 256, μ: 130724, ~: 130949) Bytes32AddressLibTest:testFillLast12Bytes() (gas: 223) Bytes32AddressLibTest:testFromLast20Bytes() (gas: 191) CREATE3Test:testDeployERC20() (gas: 853111) +CREATE3Test:testDeployERC20(bytes32,string,string,uint8) (runs: 256, μ: 915690, ~: 899717) CREATE3Test:testFailDoubleDeployDifferentBytecode() (gas: 9079256848778914174) +CREATE3Test:testFailDoubleDeployDifferentBytecode(bytes32,bytes,bytes) (runs: 256, μ: 5969899538079555937, ~: 8937393460516727759) CREATE3Test:testFailDoubleDeploySameBytecode() (gas: 9079256848778906218) +CREATE3Test:testFailDoubleDeploySameBytecode(bytes32,bytes) (runs: 256, μ: 6109546310900129377, ~: 8937393460516728921) DSTestPlusTest:testBound() (gas: 14214) +DSTestPlusTest:testBound(uint256,uint256,uint256) (runs: 256, μ: 2778, ~: 2793) DSTestPlusTest:testBrutalizeMemory() (gas: 823) DSTestPlusTest:testFailBoundMinBiggerThanMax() (gas: 309) +DSTestPlusTest:testFailBoundMinBiggerThanMax(uint256,uint256,uint256) (runs: 256, μ: 461, ~: 462) DSTestPlusTest:testRelApproxEqBothZeroesPasses() (gas: 425) ERC1155Test:testApproveAll() (gas: 31009) +ERC1155Test:testApproveAll(address,bool) (runs: 256, μ: 17260, ~: 11440) ERC1155Test:testBatchBalanceOf() (gas: 157631) +ERC1155Test:testBatchBalanceOf(address[],uint256[],uint256[],bytes) (runs: 256, μ: 3098537, ~: 2426997) ERC1155Test:testBatchBurn() (gas: 151074) +ERC1155Test:testBatchBurn(address,uint256[],uint256[],uint256[],bytes) (runs: 256, μ: 1969270, ~: 1379608) ERC1155Test:testBatchMintToEOA() (gas: 137337) +ERC1155Test:testBatchMintToEOA(address,uint256[],uint256[],bytes) (runs: 256, μ: 1859025, ~: 1067140) ERC1155Test:testBatchMintToERC1155Recipient() (gas: 995703) +ERC1155Test:testBatchMintToERC1155Recipient(uint256[],uint256[],bytes) (runs: 256, μ: 5740927, ~: 4874889) ERC1155Test:testBurn() (gas: 38598) +ERC1155Test:testBurn(address,uint256,uint256,bytes,uint256) (runs: 256, μ: 31869, ~: 42105) ERC1155Test:testFailBalanceOfBatchWithArrayMismatch() (gas: 7933) +ERC1155Test:testFailBalanceOfBatchWithArrayMismatch(address[],uint256[]) (runs: 256, μ: 53386, ~: 54066) ERC1155Test:testFailBatchBurnInsufficientBalance() (gas: 136156) +ERC1155Test:testFailBatchBurnInsufficientBalance(address,uint256[],uint256[],uint256[],bytes) (runs: 256, μ: 597024, ~: 431964) ERC1155Test:testFailBatchBurnWithArrayLengthMismatch() (gas: 135542) +ERC1155Test:testFailBatchBurnWithArrayLengthMismatch(address,uint256[],uint256[],uint256[],bytes) (runs: 256, μ: 77137, ~: 78751) ERC1155Test:testFailBatchMintToNonERC1155Recipient() (gas: 167292) +ERC1155Test:testFailBatchMintToNonERC1155Recipient(uint256[],uint256[],bytes) (runs: 256, μ: 1663699, ~: 1182723) ERC1155Test:testFailBatchMintToRevertingERC1155Recipient() (gas: 358811) +ERC1155Test:testFailBatchMintToRevertingERC1155Recipient(uint256[],uint256[],bytes) (runs: 256, μ: 1855237, ~: 1374259) ERC1155Test:testFailBatchMintToWrongReturnDataERC1155Recipient() (gas: 310743) +ERC1155Test:testFailBatchMintToWrongReturnDataERC1155Recipient(uint256[],uint256[],bytes) (runs: 256, μ: 1807195, ~: 1326218) ERC1155Test:testFailBatchMintToZero() (gas: 131737) +ERC1155Test:testFailBatchMintToZero(uint256[],uint256[],bytes) (runs: 256, μ: 1604199, ~: 1115533) ERC1155Test:testFailBatchMintWithArrayMismatch() (gas: 9600) +ERC1155Test:testFailBatchMintWithArrayMismatch(address,uint256[],uint256[],bytes) (runs: 256, μ: 69252, ~: 68809) ERC1155Test:testFailBurnInsufficientBalance() (gas: 34852) +ERC1155Test:testFailBurnInsufficientBalance(address,uint256,uint256,uint256,bytes) (runs: 256, μ: 34761, ~: 38209) ERC1155Test:testFailMintToNonERC155Recipient() (gas: 68191) +ERC1155Test:testFailMintToNonERC155Recipient(uint256,uint256,bytes) (runs: 256, μ: 68041, ~: 69197) ERC1155Test:testFailMintToRevertingERC155Recipient() (gas: 259435) +ERC1155Test:testFailMintToRevertingERC155Recipient(uint256,uint256,bytes) (runs: 256, μ: 259215, ~: 260373) ERC1155Test:testFailMintToWrongReturnDataERC155Recipient() (gas: 259389) +ERC1155Test:testFailMintToWrongReturnDataERC155Recipient(uint256,uint256,bytes) (runs: 256, μ: 259239, ~: 260397) ERC1155Test:testFailMintToZero() (gas: 33705) +ERC1155Test:testFailMintToZero(uint256,uint256,bytes) (runs: 256, μ: 33349, ~: 34546) ERC1155Test:testFailSafeBatchTransferFromToNonERC1155Recipient() (gas: 321377) +ERC1155Test:testFailSafeBatchTransferFromToNonERC1155Recipient(uint256[],uint256[],uint256[],bytes,bytes) (runs: 256, μ: 2160842, ~: 1791165) ERC1155Test:testFailSafeBatchTransferFromToRevertingERC1155Recipient() (gas: 512956) +ERC1155Test:testFailSafeBatchTransferFromToRevertingERC1155Recipient(uint256[],uint256[],uint256[],bytes,bytes) (runs: 256, μ: 2352379, ~: 1982696) ERC1155Test:testFailSafeBatchTransferFromToWrongReturnDataERC1155Recipient() (gas: 464847) +ERC1155Test:testFailSafeBatchTransferFromToWrongReturnDataERC1155Recipient(uint256[],uint256[],uint256[],bytes,bytes) (runs: 256, μ: 2304296, ~: 1934617) ERC1155Test:testFailSafeBatchTransferFromToZero() (gas: 286556) +ERC1155Test:testFailSafeBatchTransferFromToZero(uint256[],uint256[],uint256[],bytes,bytes) (runs: 256, μ: 2125662, ~: 1755807) ERC1155Test:testFailSafeBatchTransferFromWithArrayLengthMismatch() (gas: 162674) +ERC1155Test:testFailSafeBatchTransferFromWithArrayLengthMismatch(address,uint256[],uint256[],uint256[],bytes,bytes) (runs: 256, μ: 81184, ~: 82042) ERC1155Test:testFailSafeBatchTransferInsufficientBalance() (gas: 163555) +ERC1155Test:testFailSafeBatchTransferInsufficientBalance(address,uint256[],uint256[],uint256[],bytes,bytes) (runs: 256, μ: 694473, ~: 478203) ERC1155Test:testFailSafeTransferFromInsufficientBalance() (gas: 63245) +ERC1155Test:testFailSafeTransferFromInsufficientBalance(address,uint256,uint256,uint256,bytes,bytes) (runs: 256, μ: 63286, ~: 67405) ERC1155Test:testFailSafeTransferFromSelfInsufficientBalance() (gas: 34297) +ERC1155Test:testFailSafeTransferFromSelfInsufficientBalance(address,uint256,uint256,uint256,bytes,bytes) (runs: 256, μ: 35566, ~: 38512) ERC1155Test:testFailSafeTransferFromToNonERC155Recipient() (gas: 96510) +ERC1155Test:testFailSafeTransferFromToNonERC155Recipient(uint256,uint256,uint256,bytes,bytes) (runs: 256, μ: 94320, ~: 100546) ERC1155Test:testFailSafeTransferFromToRevertingERC1155Recipient() (gas: 287731) +ERC1155Test:testFailSafeTransferFromToRevertingERC1155Recipient(uint256,uint256,uint256,bytes,bytes) (runs: 256, μ: 285491, ~: 291719) ERC1155Test:testFailSafeTransferFromToWrongReturnDataERC1155Recipient() (gas: 239587) +ERC1155Test:testFailSafeTransferFromToWrongReturnDataERC1155Recipient(uint256,uint256,uint256,bytes,bytes) (runs: 256, μ: 237370, ~: 243598) ERC1155Test:testFailSafeTransferFromToZero() (gas: 62014) +ERC1155Test:testFailSafeTransferFromToZero(uint256,uint256,uint256,bytes,bytes) (runs: 256, μ: 59809, ~: 66037) ERC1155Test:testMintToEOA() (gas: 34765) +ERC1155Test:testMintToEOA(address,uint256,uint256,bytes) (runs: 256, μ: 32455, ~: 35907) ERC1155Test:testMintToERC1155Recipient() (gas: 661411) +ERC1155Test:testMintToERC1155Recipient(uint256,uint256,bytes) (runs: 256, μ: 689461, ~: 684374) ERC1155Test:testSafeBatchTransferFromToEOA() (gas: 297822) +ERC1155Test:testSafeBatchTransferFromToEOA(address,uint256[],uint256[],uint256[],bytes,bytes) (runs: 256, μ: 2381808, ~: 1710727) ERC1155Test:testSafeBatchTransferFromToERC1155Recipient() (gas: 1175327) +ERC1155Test:testSafeBatchTransferFromToERC1155Recipient(uint256[],uint256[],uint256[],bytes,bytes) (runs: 256, μ: 5728970, ~: 5111381) ERC1155Test:testSafeTransferFromSelf() (gas: 64177) +ERC1155Test:testSafeTransferFromSelf(uint256,uint256,bytes,uint256,address,bytes) (runs: 256, μ: 48818, ~: 68603) ERC1155Test:testSafeTransferFromToEOA() (gas: 93167) +ERC1155Test:testSafeTransferFromToEOA(uint256,uint256,bytes,uint256,address,bytes) (runs: 256, μ: 71258, ~: 97461) ERC1155Test:testSafeTransferFromToERC1155Recipient() (gas: 739583) +ERC1155Test:testSafeTransferFromToERC1155Recipient(uint256,uint256,bytes,uint256,bytes) (runs: 256, μ: 761542, ~: 765775) +ERC20Invariants:invariantBalanceSum (runs: 256, calls: 3840, reverts: 2373) +ERC20Test:invariantMetadata (runs: 256, calls: 3840, reverts: 2564) ERC20Test:testApprove() (gas: 31058) +ERC20Test:testApprove(address,uint256) (runs: 256, μ: 29803, ~: 31280) ERC20Test:testBurn() (gas: 56970) +ERC20Test:testBurn(address,uint256,uint256) (runs: 256, μ: 54827, ~: 59645) +ERC20Test:testFailBurnInsufficientBalance(address,uint256,uint256) (runs: 256, μ: 50498, ~: 55492) ERC20Test:testFailPermitBadDeadline() (gas: 36924) +ERC20Test:testFailPermitBadDeadline(uint256,address,uint256,uint256) (runs: 256, μ: 32148, ~: 37218) ERC20Test:testFailPermitBadNonce() (gas: 36874) +ERC20Test:testFailPermitBadNonce(uint256,address,uint256,uint256,uint256) (runs: 256, μ: 31629, ~: 37187) ERC20Test:testFailPermitPastDeadline() (gas: 10938) +ERC20Test:testFailPermitPastDeadline(uint256,address,uint256,uint256) (runs: 256, μ: 12037, ~: 13101) ERC20Test:testFailPermitReplay() (gas: 66285) +ERC20Test:testFailPermitReplay(uint256,address,uint256,uint256) (runs: 256, μ: 56605, ~: 66592) ERC20Test:testFailTransferFromInsufficientAllowance() (gas: 80882) +ERC20Test:testFailTransferFromInsufficientAllowance(address,uint256,uint256) (runs: 256, μ: 79159, ~: 83393) ERC20Test:testFailTransferFromInsufficientBalance() (gas: 81358) +ERC20Test:testFailTransferFromInsufficientBalance(address,uint256,uint256) (runs: 256, μ: 77959, ~: 83870) ERC20Test:testFailTransferInsufficientBalance() (gas: 52806) +ERC20Test:testFailTransferInsufficientBalance(address,uint256,uint256) (runs: 256, μ: 50320, ~: 55310) ERC20Test:testInfiniteApproveTransferFrom() (gas: 89793) +ERC20Test:testMetadata(string,string,uint8) (runs: 256, μ: 861213, ~: 840543) ERC20Test:testMint() (gas: 53746) +ERC20Test:testMint(address,uint256) (runs: 256, μ: 50971, ~: 53925) ERC20Test:testPermit() (gas: 63193) +ERC20Test:testPermit(uint248,address,uint256,uint256) (runs: 256, μ: 62196, ~: 63517) ERC20Test:testTransfer() (gas: 60272) +ERC20Test:testTransfer(address,uint256) (runs: 256, μ: 57530, ~: 60484) ERC20Test:testTransferFrom() (gas: 83777) +ERC20Test:testTransferFrom(address,uint256,uint256) (runs: 256, μ: 80977, ~: 92841) +ERC4626Test:invariantMetadata (runs: 256, calls: 3840, reverts: 2879) ERC4626Test:testFailDepositWithNoApproval() (gas: 13357) ERC4626Test:testFailDepositWithNotEnoughApproval() (gas: 86993) ERC4626Test:testFailDepositZero() (gas: 7780) @@ -83,141 +156,280 @@ ERC4626Test:testFailRedeemWithNotEnoughShareAmount() (gas: 203638) ERC4626Test:testFailRedeemZero() (gas: 7967) ERC4626Test:testFailWithdrawWithNoUnderlyingAmount() (gas: 32289) ERC4626Test:testFailWithdrawWithNotEnoughUnderlyingAmount() (gas: 203615) +ERC4626Test:testMetadata(string,string) (runs: 256, μ: 1480973, ~: 1471854) ERC4626Test:testMintZero() (gas: 54595) ERC4626Test:testMultipleMintDepositRedeemWithdraw() (gas: 411940) +ERC4626Test:testSingleDepositWithdraw(uint128) (runs: 256, μ: 201567, ~: 201569) +ERC4626Test:testSingleMintRedeem(uint128) (runs: 256, μ: 201482, ~: 201484) ERC4626Test:testVaultInteractionsForSomeoneElse() (gas: 286247) ERC4626Test:testWithdrawZero() (gas: 52462) +ERC721Test:invariantMetadata (runs: 256, calls: 3840, reverts: 2193) ERC721Test:testApprove() (gas: 78427) +ERC721Test:testApprove(address,uint256) (runs: 256, μ: 78637, ~: 78637) ERC721Test:testApproveAll() (gas: 31063) +ERC721Test:testApproveAll(address,bool) (runs: 256, μ: 17358, ~: 11538) ERC721Test:testApproveBurn() (gas: 65550) +ERC721Test:testApproveBurn(address,uint256) (runs: 256, μ: 65174, ~: 65616) ERC721Test:testBurn() (gas: 46107) +ERC721Test:testBurn(address,uint256) (runs: 256, μ: 46150, ~: 46163) ERC721Test:testFailApproveUnAuthorized() (gas: 55598) +ERC721Test:testFailApproveUnAuthorized(address,uint256,address) (runs: 256, μ: 55872, ~: 55873) ERC721Test:testFailApproveUnMinted() (gas: 10236) +ERC721Test:testFailApproveUnMinted(uint256,address) (runs: 256, μ: 10363, ~: 10363) ERC721Test:testFailBalanceOfZeroAddress() (gas: 5555) ERC721Test:testFailBurnUnMinted() (gas: 7857) +ERC721Test:testFailBurnUnMinted(uint256) (runs: 256, μ: 7938, ~: 7938) ERC721Test:testFailDoubleBurn() (gas: 58943) +ERC721Test:testFailDoubleBurn(uint256,address) (runs: 256, μ: 59174, ~: 59174) ERC721Test:testFailDoubleMint() (gas: 53286) +ERC721Test:testFailDoubleMint(uint256,address) (runs: 256, μ: 53496, ~: 53496) ERC721Test:testFailMintToZero() (gas: 5753) +ERC721Test:testFailMintToZero(uint256) (runs: 256, μ: 5835, ~: 5835) ERC721Test:testFailOwnerOfUnminted() (gas: 7609) +ERC721Test:testFailOwnerOfUnminted(uint256) (runs: 256, μ: 7689, ~: 7689) ERC721Test:testFailSafeMintToERC721RecipientWithWrongReturnData() (gas: 159076) +ERC721Test:testFailSafeMintToERC721RecipientWithWrongReturnData(uint256) (runs: 256, μ: 159125, ~: 159125) ERC721Test:testFailSafeMintToERC721RecipientWithWrongReturnDataWithData() (gas: 159831) +ERC721Test:testFailSafeMintToERC721RecipientWithWrongReturnDataWithData(uint256,bytes) (runs: 256, μ: 160231, ~: 160182) ERC721Test:testFailSafeMintToNonERC721Recipient() (gas: 89210) +ERC721Test:testFailSafeMintToNonERC721Recipient(uint256) (runs: 256, μ: 89279, ~: 89279) ERC721Test:testFailSafeMintToNonERC721RecipientWithData() (gas: 89995) +ERC721Test:testFailSafeMintToNonERC721RecipientWithData(uint256,bytes) (runs: 256, μ: 90420, ~: 90368) ERC721Test:testFailSafeMintToRevertingERC721Recipient() (gas: 204743) +ERC721Test:testFailSafeMintToRevertingERC721Recipient(uint256) (runs: 256, μ: 204815, ~: 204815) ERC721Test:testFailSafeMintToRevertingERC721RecipientWithData() (gas: 205517) +ERC721Test:testFailSafeMintToRevertingERC721RecipientWithData(uint256,bytes) (runs: 256, μ: 205964, ~: 205915) ERC721Test:testFailSafeTransferFromToERC721RecipientWithWrongReturnData() (gas: 187276) +ERC721Test:testFailSafeTransferFromToERC721RecipientWithWrongReturnData(uint256) (runs: 256, μ: 187360, ~: 187360) ERC721Test:testFailSafeTransferFromToERC721RecipientWithWrongReturnDataWithData() (gas: 187728) +ERC721Test:testFailSafeTransferFromToERC721RecipientWithWrongReturnDataWithData(uint256,bytes) (runs: 256, μ: 188067, ~: 188063) ERC721Test:testFailSafeTransferFromToNonERC721Recipient() (gas: 117413) +ERC721Test:testFailSafeTransferFromToNonERC721Recipient(uint256) (runs: 256, μ: 117495, ~: 117495) ERC721Test:testFailSafeTransferFromToNonERC721RecipientWithData() (gas: 117872) +ERC721Test:testFailSafeTransferFromToNonERC721RecipientWithData(uint256,bytes) (runs: 256, μ: 118280, ~: 118276) ERC721Test:testFailSafeTransferFromToRevertingERC721Recipient() (gas: 233009) +ERC721Test:testFailSafeTransferFromToRevertingERC721Recipient(uint256) (runs: 256, μ: 233050, ~: 233050) ERC721Test:testFailSafeTransferFromToRevertingERC721RecipientWithData() (gas: 233396) +ERC721Test:testFailSafeTransferFromToRevertingERC721RecipientWithData(uint256,bytes) (runs: 256, μ: 233823, ~: 233819) ERC721Test:testFailTransferFromNotOwner() (gas: 57872) +ERC721Test:testFailTransferFromNotOwner(address,address,uint256) (runs: 256, μ: 56461, ~: 58162) ERC721Test:testFailTransferFromToZero() (gas: 53381) +ERC721Test:testFailTransferFromToZero(uint256) (runs: 256, μ: 53463, ~: 53463) ERC721Test:testFailTransferFromUnOwned() (gas: 8000) +ERC721Test:testFailTransferFromUnOwned(address,address,uint256) (runs: 256, μ: 8630, ~: 8241) ERC721Test:testFailTransferFromWrongFrom() (gas: 53361) +ERC721Test:testFailTransferFromWrongFrom(address,address,address,uint256) (runs: 256, μ: 50461, ~: 53752) +ERC721Test:testMetadata(string,string) (runs: 256, μ: 1341736, ~: 1332786) ERC721Test:testMint() (gas: 54336) +ERC721Test:testMint(address,uint256) (runs: 256, μ: 54521, ~: 54521) ERC721Test:testSafeMintToEOA() (gas: 56993) +ERC721Test:testSafeMintToEOA(uint256,address) (runs: 256, μ: 52541, ~: 57421) ERC721Test:testSafeMintToERC721Recipient() (gas: 427035) +ERC721Test:testSafeMintToERC721Recipient(uint256) (runs: 256, μ: 425276, ~: 427142) ERC721Test:testSafeMintToERC721RecipientWithData() (gas: 448149) +ERC721Test:testSafeMintToERC721RecipientWithData(uint256,bytes) (runs: 256, μ: 479160, ~: 470905) ERC721Test:testSafeTransferFromToEOA() (gas: 95666) +ERC721Test:testSafeTransferFromToEOA(uint256,address) (runs: 256, μ: 88253, ~: 96099) ERC721Test:testSafeTransferFromToERC721Recipient() (gas: 485549) +ERC721Test:testSafeTransferFromToERC721Recipient(uint256) (runs: 256, μ: 483816, ~: 485682) ERC721Test:testSafeTransferFromToERC721RecipientWithData() (gas: 506317) +ERC721Test:testSafeTransferFromToERC721RecipientWithData(uint256,bytes) (runs: 256, μ: 537271, ~: 529082) ERC721Test:testTransferFrom() (gas: 86347) +ERC721Test:testTransferFrom(uint256,address) (runs: 256, μ: 86462, ~: 86477) ERC721Test:testTransferFromApproveAll() (gas: 92898) +ERC721Test:testTransferFromApproveAll(uint256,address) (runs: 256, μ: 93181, ~: 93182) ERC721Test:testTransferFromSelf() (gas: 64776) +ERC721Test:testTransferFromSelf(uint256,address) (runs: 256, μ: 65060, ~: 65061) FixedPointMathLibTest:testDivWadDown() (gas: 864) +FixedPointMathLibTest:testDivWadDown(uint256,uint256) (runs: 256, μ: 608, ~: 746) FixedPointMathLibTest:testDivWadDownEdgeCases() (gas: 423) FixedPointMathLibTest:testDivWadUp() (gas: 981) +FixedPointMathLibTest:testDivWadUp(uint256,uint256) (runs: 256, μ: 743, ~: 698) FixedPointMathLibTest:testDivWadUpEdgeCases() (gas: 482) +FixedPointMathLibTest:testFailDivWadDownOverflow(uint256,uint256) (runs: 256, μ: 434, ~: 397) FixedPointMathLibTest:testFailDivWadDownZeroDenominator() (gas: 362) +FixedPointMathLibTest:testFailDivWadDownZeroDenominator(uint256) (runs: 256, μ: 419, ~: 419) +FixedPointMathLibTest:testFailDivWadUpOverflow(uint256,uint256) (runs: 256, μ: 412, ~: 375) FixedPointMathLibTest:testFailDivWadUpZeroDenominator() (gas: 342) +FixedPointMathLibTest:testFailDivWadUpZeroDenominator(uint256) (runs: 256, μ: 396, ~: 396) +FixedPointMathLibTest:testFailMulDivDownOverflow(uint256,uint256,uint256) (runs: 256, μ: 483, ~: 524) FixedPointMathLibTest:testFailMulDivDownZeroDenominator() (gas: 316) +FixedPointMathLibTest:testFailMulDivDownZeroDenominator(uint256,uint256) (runs: 256, μ: 395, ~: 395) +FixedPointMathLibTest:testFailMulDivUpOverflow(uint256,uint256,uint256) (runs: 256, μ: 505, ~: 546) FixedPointMathLibTest:testFailMulDivUpZeroDenominator() (gas: 317) +FixedPointMathLibTest:testFailMulDivUpZeroDenominator(uint256,uint256) (runs: 256, μ: 394, ~: 394) +FixedPointMathLibTest:testFailMulWadDownOverflow(uint256,uint256) (runs: 256, μ: 414, ~: 453) +FixedPointMathLibTest:testFailMulWadUpOverflow(uint256,uint256) (runs: 256, μ: 414, ~: 453) FixedPointMathLibTest:testMulDivDown() (gas: 1861) +FixedPointMathLibTest:testMulDivDown(uint256,uint256,uint256) (runs: 256, μ: 568, ~: 456) FixedPointMathLibTest:testMulDivDownEdgeCases() (gas: 751) FixedPointMathLibTest:testMulDivUp() (gas: 2273) +FixedPointMathLibTest:testMulDivUp(uint256,uint256,uint256) (runs: 256, μ: 626, ~: 455) FixedPointMathLibTest:testMulDivUpEdgeCases() (gas: 846) FixedPointMathLibTest:testMulWadDown() (gas: 821) +FixedPointMathLibTest:testMulWadDown(uint256,uint256) (runs: 256, μ: 573, ~: 450) FixedPointMathLibTest:testMulWadDownEdgeCases() (gas: 886) FixedPointMathLibTest:testMulWadUp() (gas: 959) +FixedPointMathLibTest:testMulWadUp(uint256,uint256) (runs: 256, μ: 588, ~: 407) FixedPointMathLibTest:testMulWadUpEdgeCases() (gas: 1002) FixedPointMathLibTest:testRPow() (gas: 2142) FixedPointMathLibTest:testSqrt() (gas: 2537) +FixedPointMathLibTest:testSqrt(uint256) (runs: 256, μ: 1141, ~: 1155) MultiRolesAuthorityTest:testCanCallPublicCapability() (gas: 34292) +MultiRolesAuthorityTest:testCanCallPublicCapability(address,address,bytes4) (runs: 256, μ: 34464, ~: 34449) MultiRolesAuthorityTest:testCanCallWithAuthorizedRole() (gas: 80556) +MultiRolesAuthorityTest:testCanCallWithAuthorizedRole(address,uint8,address,bytes4) (runs: 256, μ: 80847, ~: 80812) MultiRolesAuthorityTest:testCanCallWithCustomAuthority() (gas: 422681) +MultiRolesAuthorityTest:testCanCallWithCustomAuthority(address,address,bytes4) (runs: 256, μ: 423100, ~: 423100) MultiRolesAuthorityTest:testCanCallWithCustomAuthorityOverridesPublicCapability() (gas: 247674) +MultiRolesAuthorityTest:testCanCallWithCustomAuthorityOverridesPublicCapability(address,address,bytes4) (runs: 256, μ: 248127, ~: 248127) MultiRolesAuthorityTest:testCanCallWithCustomAuthorityOverridesUserWithRole() (gas: 256845) +MultiRolesAuthorityTest:testCanCallWithCustomAuthorityOverridesUserWithRole(address,uint8,address,bytes4) (runs: 256, μ: 257186, ~: 257151) MultiRolesAuthorityTest:testSetPublicCapabilities() (gas: 27762) +MultiRolesAuthorityTest:testSetPublicCapabilities(bytes4) (runs: 256, μ: 27871, ~: 27870) MultiRolesAuthorityTest:testSetRoleCapabilities() (gas: 28985) +MultiRolesAuthorityTest:testSetRoleCapabilities(uint8,bytes4) (runs: 256, μ: 29127, ~: 29127) MultiRolesAuthorityTest:testSetRoles() (gas: 29006) +MultiRolesAuthorityTest:testSetRoles(address,uint8) (runs: 256, μ: 29119, ~: 29104) MultiRolesAuthorityTest:testSetTargetCustomAuthority() (gas: 27976) +MultiRolesAuthorityTest:testSetTargetCustomAuthority(address,address) (runs: 256, μ: 27670, ~: 28018) OwnedTest:testCallFunctionAsNonOwner() (gas: 11311) +OwnedTest:testCallFunctionAsNonOwner(address) (runs: 256, μ: 16144, ~: 16257) OwnedTest:testCallFunctionAsOwner() (gas: 10479) OwnedTest:testSetOwner() (gas: 13035) +OwnedTest:testSetOwner(address) (runs: 256, μ: 13046, ~: 13170) +ReentrancyGuardTest:invariantReentrancyStatusAlways1 (runs: 256, calls: 3840, reverts: 282) ReentrancyGuardTest:testFailUnprotectedCall() (gas: 46147) ReentrancyGuardTest:testNoReentrancy() (gas: 7515) ReentrancyGuardTest:testProtectedCall() (gas: 33467) RolesAuthorityTest:testCanCallPublicCapability() (gas: 33336) +RolesAuthorityTest:testCanCallPublicCapability(address,address,bytes4) (runs: 256, μ: 33463, ~: 33459) RolesAuthorityTest:testCanCallWithAuthorizedRole() (gas: 79601) +RolesAuthorityTest:testCanCallWithAuthorizedRole(address,uint8,address,bytes4) (runs: 256, μ: 79880, ~: 79844) RolesAuthorityTest:testSetPublicCapabilities() (gas: 29183) +RolesAuthorityTest:testSetPublicCapabilities(address,bytes4) (runs: 256, μ: 29282, ~: 29280) RolesAuthorityTest:testSetRoleCapabilities() (gas: 30258) +RolesAuthorityTest:testSetRoleCapabilities(uint8,address,bytes4) (runs: 256, μ: 30489, ~: 30472) RolesAuthorityTest:testSetRoles() (gas: 28986) +RolesAuthorityTest:testSetRoles(address,uint8) (runs: 256, μ: 29103, ~: 29089) SSTORE2Test:testFailReadInvalidPointer() (gas: 2927) +SSTORE2Test:testFailReadInvalidPointer(address,bytes) (runs: 256, μ: 3730, ~: 3892) SSTORE2Test:testFailReadInvalidPointerCustomBounds() (gas: 3099) +SSTORE2Test:testFailReadInvalidPointerCustomBounds(address,uint256,uint256,bytes) (runs: 256, μ: 3902, ~: 4130) SSTORE2Test:testFailReadInvalidPointerCustomStartBound() (gas: 3004) +SSTORE2Test:testFailReadInvalidPointerCustomStartBound(address,uint256,bytes) (runs: 256, μ: 3782, ~: 3988) +SSTORE2Test:testFailWriteReadCustomBoundsOutOfRange(bytes,uint256,uint256,bytes) (runs: 256, μ: 46236, ~: 43603) +SSTORE2Test:testFailWriteReadCustomStartBoundOutOfRange(bytes,uint256,bytes) (runs: 256, μ: 46017, ~: 43452) SSTORE2Test:testFailWriteReadEmptyOutOfBounds() (gas: 34470) SSTORE2Test:testFailWriteReadOutOfBounds() (gas: 34426) SSTORE2Test:testFailWriteReadOutOfStartBound() (gas: 34362) SSTORE2Test:testWriteRead() (gas: 53497) +SSTORE2Test:testWriteRead(bytes,bytes) (runs: 256, μ: 44019, ~: 41555) SSTORE2Test:testWriteReadCustomBounds() (gas: 34869) +SSTORE2Test:testWriteReadCustomBounds(bytes,uint256,uint256,bytes) (runs: 256, μ: 28213, ~: 41177) SSTORE2Test:testWriteReadCustomStartBound() (gas: 34740) +SSTORE2Test:testWriteReadCustomStartBound(bytes,uint256,bytes) (runs: 256, μ: 46485, ~: 44053) SSTORE2Test:testWriteReadEmptyBound() (gas: 34677) SSTORE2Test:testWriteReadFullBoundedRead() (gas: 53672) SSTORE2Test:testWriteReadFullStartBound() (gas: 34764) SafeCastLibTest:testFailSafeCastTo128() (gas: 321) +SafeCastLibTest:testFailSafeCastTo128(uint256) (runs: 256, μ: 443, ~: 443) SafeCastLibTest:testFailSafeCastTo160() (gas: 342) +SafeCastLibTest:testFailSafeCastTo160(uint256) (runs: 256, μ: 400, ~: 400) SafeCastLibTest:testFailSafeCastTo192() (gas: 322) +SafeCastLibTest:testFailSafeCastTo192(uint256) (runs: 256, μ: 423, ~: 423) SafeCastLibTest:testFailSafeCastTo224() (gas: 343) +SafeCastLibTest:testFailSafeCastTo224(uint256) (runs: 256, μ: 423, ~: 423) +SafeCastLibTest:testFailSafeCastTo24(uint256) (runs: 256, μ: 402, ~: 402) SafeCastLibTest:testFailSafeCastTo248() (gas: 365) +SafeCastLibTest:testFailSafeCastTo248(uint256) (runs: 256, μ: 444, ~: 444) SafeCastLibTest:testFailSafeCastTo32() (gas: 364) +SafeCastLibTest:testFailSafeCastTo32(uint256) (runs: 256, μ: 401, ~: 401) SafeCastLibTest:testFailSafeCastTo64() (gas: 321) +SafeCastLibTest:testFailSafeCastTo64(uint256) (runs: 256, μ: 401, ~: 401) SafeCastLibTest:testFailSafeCastTo8() (gas: 341) +SafeCastLibTest:testFailSafeCastTo8(uint256) (runs: 256, μ: 421, ~: 421) SafeCastLibTest:testFailSafeCastTo96() (gas: 321) +SafeCastLibTest:testFailSafeCastTo96(uint256) (runs: 256, μ: 424, ~: 424) SafeCastLibTest:testSafeCastTo128() (gas: 472) +SafeCastLibTest:testSafeCastTo128(uint256) (runs: 256, μ: 2756, ~: 2756) SafeCastLibTest:testSafeCastTo160() (gas: 470) +SafeCastLibTest:testSafeCastTo160(uint256) (runs: 256, μ: 2731, ~: 2731) SafeCastLibTest:testSafeCastTo192() (gas: 449) +SafeCastLibTest:testSafeCastTo192(uint256) (runs: 256, μ: 2734, ~: 2734) SafeCastLibTest:testSafeCastTo224() (gas: 491) +SafeCastLibTest:testSafeCastTo224(uint256) (runs: 256, μ: 2710, ~: 2710) SafeCastLibTest:testSafeCastTo24() (gas: 470) SafeCastLibTest:testSafeCastTo248() (gas: 450) +SafeCastLibTest:testSafeCastTo248(uint256) (runs: 256, μ: 2755, ~: 2755) SafeCastLibTest:testSafeCastTo32() (gas: 449) +SafeCastLibTest:testSafeCastTo32(uint256) (runs: 256, μ: 2711, ~: 2711) SafeCastLibTest:testSafeCastTo64() (gas: 470) +SafeCastLibTest:testSafeCastTo64(uint256) (runs: 256, μ: 2732, ~: 2732) SafeCastLibTest:testSafeCastTo8() (gas: 469) +SafeCastLibTest:testSafeCastTo8(uint256) (runs: 256, μ: 2710, ~: 2710) SafeCastLibTest:testSafeCastTo96() (gas: 469) +SafeCastLibTest:testSafeCastTo96(uint256) (runs: 256, μ: 2755, ~: 2755) +SafeTransferLibTest:testApproveWithGarbage(address,uint256,bytes,bytes) (runs: 256, μ: 2212, ~: 2231) SafeTransferLibTest:testApproveWithMissingReturn() (gas: 30751) +SafeTransferLibTest:testApproveWithMissingReturn(address,uint256,bytes) (runs: 256, μ: 30095, ~: 31566) SafeTransferLibTest:testApproveWithNonContract() (gas: 3035) +SafeTransferLibTest:testApproveWithNonContract(address,address,uint256,bytes) (runs: 256, μ: 4018, ~: 4117) SafeTransferLibTest:testApproveWithReturnsTooMuch() (gas: 31134) +SafeTransferLibTest:testApproveWithReturnsTooMuch(address,uint256,bytes) (runs: 256, μ: 30563, ~: 32034) SafeTransferLibTest:testApproveWithStandardERC20() (gas: 30882) +SafeTransferLibTest:testApproveWithStandardERC20(address,uint256,bytes) (runs: 256, μ: 30289, ~: 31760) +SafeTransferLibTest:testFailApproveWithGarbage(address,uint256,bytes,bytes) (runs: 256, μ: 83167, ~: 77909) SafeTransferLibTest:testFailApproveWithReturnsFalse() (gas: 5627) +SafeTransferLibTest:testFailApproveWithReturnsFalse(address,uint256,bytes) (runs: 256, μ: 6480, ~: 6475) SafeTransferLibTest:testFailApproveWithReturnsTooLittle() (gas: 5568) +SafeTransferLibTest:testFailApproveWithReturnsTooLittle(address,uint256,bytes) (runs: 256, μ: 6444, ~: 6439) +SafeTransferLibTest:testFailApproveWithReturnsTwo(address,uint256,bytes) (runs: 256, μ: 6452, ~: 6447) SafeTransferLibTest:testFailApproveWithReverting() (gas: 5502) +SafeTransferLibTest:testFailApproveWithReverting(address,uint256,bytes) (runs: 256, μ: 6403, ~: 6398) SafeTransferLibTest:testFailTransferETHToContractWithoutFallback() (gas: 7244) +SafeTransferLibTest:testFailTransferETHToContractWithoutFallback(uint256,bytes) (runs: 256, μ: 7689, ~: 8010) +SafeTransferLibTest:testFailTransferFromWithGarbage(address,address,uint256,bytes,bytes) (runs: 256, μ: 121216, ~: 117401) SafeTransferLibTest:testFailTransferFromWithReturnsFalse() (gas: 13663) +SafeTransferLibTest:testFailTransferFromWithReturnsFalse(address,address,uint256,bytes) (runs: 256, μ: 14593, ~: 14588) SafeTransferLibTest:testFailTransferFromWithReturnsTooLittle() (gas: 13544) +SafeTransferLibTest:testFailTransferFromWithReturnsTooLittle(address,address,uint256,bytes) (runs: 256, μ: 14452, ~: 14447) +SafeTransferLibTest:testFailTransferFromWithReturnsTwo(address,address,uint256,bytes) (runs: 256, μ: 14559, ~: 14554) SafeTransferLibTest:testFailTransferFromWithReverting() (gas: 9757) +SafeTransferLibTest:testFailTransferFromWithReverting(address,address,uint256,bytes) (runs: 256, μ: 10685, ~: 10680) +SafeTransferLibTest:testFailTransferWithGarbage(address,uint256,bytes,bytes) (runs: 256, μ: 88899, ~: 83989) SafeTransferLibTest:testFailTransferWithReturnsFalse() (gas: 8532) +SafeTransferLibTest:testFailTransferWithReturnsFalse(address,uint256,bytes) (runs: 256, μ: 9451, ~: 9446) SafeTransferLibTest:testFailTransferWithReturnsTooLittle() (gas: 8538) +SafeTransferLibTest:testFailTransferWithReturnsTooLittle(address,uint256,bytes) (runs: 256, μ: 9391, ~: 9386) +SafeTransferLibTest:testFailTransferWithReturnsTwo(address,uint256,bytes) (runs: 256, μ: 9378, ~: 9373) SafeTransferLibTest:testFailTransferWithReverting() (gas: 8494) +SafeTransferLibTest:testFailTransferWithReverting(address,uint256,bytes) (runs: 256, μ: 9350, ~: 9345) SafeTransferLibTest:testTransferETH() (gas: 34592) +SafeTransferLibTest:testTransferETH(address,uint256,bytes) (runs: 256, μ: 31597, ~: 37975) +SafeTransferLibTest:testTransferFromWithGarbage(address,address,uint256,bytes,bytes) (runs: 256, μ: 2464, ~: 2253) SafeTransferLibTest:testTransferFromWithMissingReturn() (gas: 49186) +SafeTransferLibTest:testTransferFromWithMissingReturn(address,address,uint256,bytes) (runs: 256, μ: 47890, ~: 49574) SafeTransferLibTest:testTransferFromWithNonContract() (gas: 3035) +SafeTransferLibTest:testTransferFromWithNonContract(address,address,address,uint256,bytes) (runs: 256, μ: 4041, ~: 4228) SafeTransferLibTest:testTransferFromWithReturnsTooMuch() (gas: 49810) +SafeTransferLibTest:testTransferFromWithReturnsTooMuch(address,address,uint256,bytes) (runs: 256, μ: 48540, ~: 50213) SafeTransferLibTest:testTransferFromWithStandardERC20() (gas: 47603) +SafeTransferLibTest:testTransferFromWithStandardERC20(address,address,uint256,bytes) (runs: 256, μ: 46189, ~: 48022) +SafeTransferLibTest:testTransferWithGarbage(address,uint256,bytes,bytes) (runs: 256, μ: 2168, ~: 2187) SafeTransferLibTest:testTransferWithMissingReturn() (gas: 36666) +SafeTransferLibTest:testTransferWithMissingReturn(address,uint256,bytes) (runs: 256, μ: 35638, ~: 37546) SafeTransferLibTest:testTransferWithNonContract() (gas: 3012) +SafeTransferLibTest:testTransferWithNonContract(address,address,uint256,bytes) (runs: 256, μ: 4082, ~: 4181) SafeTransferLibTest:testTransferWithReturnsTooMuch() (gas: 37112) +SafeTransferLibTest:testTransferWithReturnsTooMuch(address,uint256,bytes) (runs: 256, μ: 36041, ~: 37949) SafeTransferLibTest:testTransferWithStandardERC20() (gas: 36696) +SafeTransferLibTest:testTransferWithStandardERC20(address,uint256,bytes) (runs: 256, μ: 35788, ~: 37599) +WETHInvariants:invariantTotalSupplyEqualsBalance (runs: 256, calls: 3840, reverts: 2814) WETHTest:testDeposit() (gas: 63535) +WETHTest:testDeposit(uint256) (runs: 256, μ: 61520, ~: 65880) WETHTest:testFallbackDeposit() (gas: 63249) +WETHTest:testFallbackDeposit(uint256) (runs: 256, μ: 61244, ~: 65604) WETHTest:testPartialWithdraw() (gas: 73281) WETHTest:testWithdraw() (gas: 54360) +WETHTest:testWithdraw(uint256,uint256) (runs: 256, μ: 72218, ~: 78076) diff --git a/src/test/ERC1155.t.sol b/src/test/ERC1155.t.sol index fd67358f..21a6165d 100644 --- a/src/test/ERC1155.t.sol +++ b/src/test/ERC1155.t.sol @@ -1029,8 +1029,12 @@ contract ERC1155Test is DSTestPlus, ERC1155TokenReceiver { token.safeTransferFrom(from, to, id, transferAmount, transferData); - assertEq(token.balanceOf(to, id), transferAmount); - assertEq(token.balanceOf(from, id), mintAmount - transferAmount); + if (from != to) { + assertEq(token.balanceOf(to, id), transferAmount); + assertEq(token.balanceOf(from, id), mintAmount - transferAmount); + } else { + assertEq(token.balanceOf(from, id), mintAmount); + } } function testSafeTransferFromToERC1155Recipient( @@ -1058,8 +1062,12 @@ contract ERC1155Test is DSTestPlus, ERC1155TokenReceiver { assertEq(to.id(), id); assertBytesEq(to.mintData(), transferData); - assertEq(token.balanceOf(address(to), id), transferAmount); - assertEq(token.balanceOf(from, id), mintAmount - transferAmount); + if (from != address(to)) { + assertEq(token.balanceOf(address(to), id), transferAmount); + assertEq(token.balanceOf(from, id), mintAmount - transferAmount); + } else { + assertEq(token.balanceOf(from, id), mintAmount); + } } function testSafeTransferFromSelf( @@ -1080,8 +1088,12 @@ contract ERC1155Test is DSTestPlus, ERC1155TokenReceiver { token.safeTransferFrom(address(this), to, id, transferAmount, transferData); - assertEq(token.balanceOf(to, id), transferAmount); - assertEq(token.balanceOf(address(this), id), mintAmount - transferAmount); + if (address(this) != to) { + assertEq(token.balanceOf(to, id), transferAmount); + assertEq(token.balanceOf(address(this), id), mintAmount - transferAmount); + } else { + assertEq(token.balanceOf(address(this), id), mintAmount); + } } function testSafeBatchTransferFromToEOA( @@ -1130,8 +1142,12 @@ contract ERC1155Test is DSTestPlus, ERC1155TokenReceiver { for (uint256 i = 0; i < normalizedIds.length; i++) { uint256 id = normalizedIds[i]; - assertEq(token.balanceOf(address(to), id), userTransferOrBurnAmounts[from][id]); - assertEq(token.balanceOf(from, id), userMintAmounts[from][id] - userTransferOrBurnAmounts[from][id]); + if (from != to) { + assertEq(token.balanceOf(to, id), userTransferOrBurnAmounts[from][id]); + assertEq(token.balanceOf(from, id), userMintAmounts[from][id] - userTransferOrBurnAmounts[from][id]); + } else { + assertEq(token.balanceOf(from, id), userMintAmounts[from][id]); + } } } @@ -1185,8 +1201,12 @@ contract ERC1155Test is DSTestPlus, ERC1155TokenReceiver { uint256 id = normalizedIds[i]; uint256 transferAmount = userTransferOrBurnAmounts[from][id]; - assertEq(token.balanceOf(address(to), id), transferAmount); - assertEq(token.balanceOf(from, id), userMintAmounts[from][id] - transferAmount); + if (from != address(to)) { + assertEq(token.balanceOf(address(to), id), transferAmount); + assertEq(token.balanceOf(from, id), userMintAmounts[from][id] - transferAmount); + } else { + assertEq(token.balanceOf(from, id), userMintAmounts[from][id]); + } } }