From 43f041b91b9d63beeb162f1007d5e66fbcce63cb Mon Sep 17 00:00:00 2001 From: Pascal Marco Caversaccio Date: Fri, 27 Sep 2024 17:19:55 +0200 Subject: [PATCH 1/2] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Add=20`testCancelTrans?= =?UTF-8?q?ferOwnership`=20Unit=20Test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pascal Marco Caversaccio --- .gas-snapshot | 207 +++++++++++++++-------------- lib/forge-std | 2 +- lib/openzeppelin-contracts | 2 +- lib/solady | 2 +- pnpm-lock.yaml | 36 ++--- src/snekmate/auth/ownable_2step.vy | 17 +-- test/auth/Ownable2Step.t.sol | 26 ++++ 7 files changed, 160 insertions(+), 132 deletions(-) diff --git a/.gas-snapshot b/.gas-snapshot index 0d23937d..25191841 100644 --- a/.gas-snapshot +++ b/.gas-snapshot @@ -1,5 +1,5 @@ -AccessControlInvariants:statefulFuzzGetRoleAdmin() (runs: 256, calls: 3840, reverts: 3839) -AccessControlInvariants:statefulFuzzHasRole() (runs: 256, calls: 3840, reverts: 3839) +AccessControlInvariants:statefulFuzzGetRoleAdmin() (runs: 256, calls: 3840, reverts: 3840) +AccessControlInvariants:statefulFuzzHasRole() (runs: 256, calls: 3840, reverts: 3840) AccessControlTest:testFuzzGrantRoleAdminRoleSuccess(address) (runs: 256, μ: 44064, ~: 44064) AccessControlTest:testFuzzGrantRoleMultipleTimesSuccess(address) (runs: 256, μ: 49938, ~: 49938) AccessControlTest:testFuzzGrantRoleNonAdmin(address,address) (runs: 256, μ: 16458, ~: 16458) @@ -9,7 +9,7 @@ AccessControlTest:testFuzzRenounceRoleNonMsgSender(address) (runs: 256, μ: 9474 AccessControlTest:testFuzzRenounceRoleSuccess(address) (runs: 256, μ: 41996, ~: 41981) AccessControlTest:testFuzzRevokeRoleMultipleTimesSuccess(address) (runs: 256, μ: 41708, ~: 41693) AccessControlTest:testFuzzRevokeRoleNonAdmin(address,address) (runs: 256, μ: 16390, ~: 16390) -AccessControlTest:testFuzzRevokeRoleSuccess(address) (runs: 256, μ: 40525, ~: 40510) +AccessControlTest:testFuzzRevokeRoleSuccess(address) (runs: 256, μ: 40524, ~: 40510) AccessControlTest:testFuzzSetRoleAdminPreviousAdminCallsGrantRole(address,address) (runs: 256, μ: 75962, ~: 75962) AccessControlTest:testFuzzSetRoleAdminPreviousAdminCallsRevokeRole(address,address) (runs: 256, μ: 101503, ~: 101503) AccessControlTest:testFuzzSetRoleAdminSuccess(address,address) (runs: 256, μ: 91053, ~: 91053) @@ -61,8 +61,8 @@ BatchDistributorTest:testDistributeTokenMultipleAddressesSuccess() (gas: 617057) BatchDistributorTest:testDistributeTokenOneAddressSuccess() (gas: 579047) BatchDistributorTest:testDistributeTokenRevertWithInsufficientAllowance() (gas: 573557) BatchDistributorTest:testDistributeTokenRevertWithInsufficientBalance() (gas: 574210) -BatchDistributorTest:testFuzzDistributeEtherMultipleAddressesSuccess(((address,uint256)[]),uint256) (runs: 256, μ: 1752867, ~: 1784036) -BatchDistributorTest:testFuzzDistributeTokenMultipleAddressesSuccess(((address,uint256)[]),address,uint256) (runs: 256, μ: 1325356, ~: 1251024) +BatchDistributorTest:testFuzzDistributeEtherMultipleAddressesSuccess(((address,uint256)[]),uint256) (runs: 256, μ: 1763209, ~: 1784070) +BatchDistributorTest:testFuzzDistributeTokenMultipleAddressesSuccess(((address,uint256)[]),address,uint256) (runs: 256, μ: 1325679, ~: 1251024) Create2AddressTest:testComputeAddress() (gas: 532144) Create2AddressTest:testComputeAddressSelf() (gas: 540803) Create2AddressTest:testFuzzComputeAddress(bytes32,address) (runs: 256, μ: 532738, ~: 532738) @@ -88,26 +88,26 @@ CreateAddressTest:testComputeAddressSelfNonceUint56() (gas: 534900) CreateAddressTest:testComputeAddressSelfNonceUint64() (gas: 534981) CreateAddressTest:testComputeAddressSelfNonceUint8() (gas: 534627) CreateAddressTest:testComputeAddressSelfRevertTooHighNonce() (gas: 8874) -CreateAddressTest:testFuzzComputeAddressNonce0x7f(uint64,address) (runs: 256, μ: 533144, ~: 533224) -CreateAddressTest:testFuzzComputeAddressNonceUint16(uint64,address) (runs: 256, μ: 532573, ~: 532830) -CreateAddressTest:testFuzzComputeAddressNonceUint24(uint64,address) (runs: 256, μ: 532706, ~: 532789) -CreateAddressTest:testFuzzComputeAddressNonceUint32(uint64,address) (runs: 256, μ: 532697, ~: 532818) -CreateAddressTest:testFuzzComputeAddressNonceUint40(uint64,address) (runs: 256, μ: 532826, ~: 532888) -CreateAddressTest:testFuzzComputeAddressNonceUint48(uint64,address) (runs: 256, μ: 532792, ~: 532894) -CreateAddressTest:testFuzzComputeAddressNonceUint56(uint64,address) (runs: 256, μ: 532858, ~: 532942) -CreateAddressTest:testFuzzComputeAddressNonceUint64(uint64,address) (runs: 256, μ: 532894, ~: 532992) -CreateAddressTest:testFuzzComputeAddressNonceUint8(uint64,address) (runs: 256, μ: 532609, ~: 532663) -CreateAddressTest:testFuzzComputeAddressRevertTooHighNonce(uint256,address) (runs: 256, μ: 12841, ~: 13144) +CreateAddressTest:testFuzzComputeAddressNonce0x7f(uint64,address) (runs: 256, μ: 533145, ~: 533224) +CreateAddressTest:testFuzzComputeAddressNonceUint16(uint64,address) (runs: 256, μ: 532570, ~: 532829) +CreateAddressTest:testFuzzComputeAddressNonceUint24(uint64,address) (runs: 256, μ: 532708, ~: 532789) +CreateAddressTest:testFuzzComputeAddressNonceUint32(uint64,address) (runs: 256, μ: 532705, ~: 532818) +CreateAddressTest:testFuzzComputeAddressNonceUint40(uint64,address) (runs: 256, μ: 532823, ~: 532888) +CreateAddressTest:testFuzzComputeAddressNonceUint48(uint64,address) (runs: 256, μ: 532799, ~: 532894) +CreateAddressTest:testFuzzComputeAddressNonceUint56(uint64,address) (runs: 256, μ: 532860, ~: 532942) +CreateAddressTest:testFuzzComputeAddressNonceUint64(uint64,address) (runs: 256, μ: 532892, ~: 532992) +CreateAddressTest:testFuzzComputeAddressNonceUint8(uint64,address) (runs: 256, μ: 532610, ~: 532663) +CreateAddressTest:testFuzzComputeAddressRevertTooHighNonce(uint256,address) (runs: 256, μ: 12839, ~: 13144) CreateAddressTest:testFuzzComputeAddressSelfNonce0x7f(uint64) (runs: 256, μ: 539386, ~: 539445) -CreateAddressTest:testFuzzComputeAddressSelfNonceUint16(uint64) (runs: 256, μ: 538621, ~: 538903) -CreateAddressTest:testFuzzComputeAddressSelfNonceUint24(uint64) (runs: 256, μ: 538961, ~: 539043) -CreateAddressTest:testFuzzComputeAddressSelfNonceUint32(uint64) (runs: 256, μ: 538955, ~: 539051) +CreateAddressTest:testFuzzComputeAddressSelfNonceUint16(uint64) (runs: 256, μ: 538610, ~: 538903) +CreateAddressTest:testFuzzComputeAddressSelfNonceUint24(uint64) (runs: 256, μ: 538963, ~: 539043) +CreateAddressTest:testFuzzComputeAddressSelfNonceUint32(uint64) (runs: 256, μ: 538958, ~: 539051) CreateAddressTest:testFuzzComputeAddressSelfNonceUint40(uint64) (runs: 256, μ: 539047, ~: 539122) CreateAddressTest:testFuzzComputeAddressSelfNonceUint48(uint64) (runs: 256, μ: 539045, ~: 539109) -CreateAddressTest:testFuzzComputeAddressSelfNonceUint56(uint64) (runs: 256, μ: 539116, ~: 539175) -CreateAddressTest:testFuzzComputeAddressSelfNonceUint64(uint64) (runs: 256, μ: 539209, ~: 539296) -CreateAddressTest:testFuzzComputeAddressSelfNonceUint8(uint64) (runs: 256, μ: 538721, ~: 538769) -CreateAddressTest:testFuzzComputeAddressSelfRevertTooHighNonce(uint256) (runs: 256, μ: 12677, ~: 12998) +CreateAddressTest:testFuzzComputeAddressSelfNonceUint56(uint64) (runs: 256, μ: 539113, ~: 539175) +CreateAddressTest:testFuzzComputeAddressSelfNonceUint64(uint64) (runs: 256, μ: 539219, ~: 539296) +CreateAddressTest:testFuzzComputeAddressSelfNonceUint8(uint64) (runs: 256, μ: 538720, ~: 538769) +CreateAddressTest:testFuzzComputeAddressSelfRevertTooHighNonce(uint256) (runs: 256, μ: 12680, ~: 12998) ECDSATest:testFuzzRecoverWithInvalidSignature(bytes,string) (runs: 256, μ: 15336, ~: 15339) ECDSATest:testFuzzRecoverWithTooLongSignature(bytes,string) (runs: 256, μ: 13772, ~: 13775) ECDSATest:testFuzzRecoverWithValidSignature(string,string) (runs: 256, μ: 21665, ~: 21670) @@ -125,7 +125,7 @@ ECDSATest:testRecoverWithWrongVersion() (gas: 14950) EIP712DomainSeparatorTest:testCachedDomainSeparatorV4() (gas: 10561) EIP712DomainSeparatorTest:testDomainSeparatorV4() (gas: 11703) EIP712DomainSeparatorTest:testEIP712Domain() (gas: 18025) -EIP712DomainSeparatorTest:testFuzzDomainSeparatorV4(uint8) (runs: 256, μ: 11850, ~: 11878) +EIP712DomainSeparatorTest:testFuzzDomainSeparatorV4(uint8) (runs: 256, μ: 11851, ~: 11878) EIP712DomainSeparatorTest:testFuzzEIP712Domain(bytes1,uint8,bytes32,uint256[]) (runs: 256, μ: 21388, ~: 21431) EIP712DomainSeparatorTest:testFuzzHashTypedDataV4(address,address,uint256,uint256,uint64) (runs: 256, μ: 10654, ~: 10654) EIP712DomainSeparatorTest:testHashTypedDataV4() (gas: 13130) @@ -154,23 +154,23 @@ ERC1155Test:testExistsAfterBatchMint() (gas: 128340) ERC1155Test:testExistsAfterSingleBurn() (gas: 120522) ERC1155Test:testExistsAfterSingleMint() (gas: 107182) ERC1155Test:testExistsBeforeMint() (gas: 10456) -ERC1155Test:testFuzzBurnBatchSuccess(address,uint256,uint256,uint256,uint256) (runs: 256, μ: 114411, ~: 114399) +ERC1155Test:testFuzzBurnBatchSuccess(address,uint256,uint256,uint256,uint256) (runs: 256, μ: 114409, ~: 114399) ERC1155Test:testFuzzBurnSuccess(address,address,uint256) (runs: 256, μ: 123474, ~: 123484) ERC1155Test:testFuzzRenounceOwnershipNonOwner(address) (runs: 256, μ: 13928, ~: 13928) ERC1155Test:testFuzzRenounceOwnershipSuccess(address) (runs: 256, μ: 48706, ~: 48692) -ERC1155Test:testFuzzSafeBatchTransferFromByApprovedOperator(address,address,address,uint256,uint256,uint256,uint256,bytes) (runs: 256, μ: 195985, ~: 195984) -ERC1155Test:testFuzzSafeBatchTransferFromEOAReceiver(address,address,uint256,uint256,uint256,uint256,bytes) (runs: 256, μ: 160553, ~: 160542) +ERC1155Test:testFuzzSafeBatchTransferFromByApprovedOperator(address,address,address,uint256,uint256,uint256,uint256,bytes) (runs: 256, μ: 196005, ~: 195984) +ERC1155Test:testFuzzSafeBatchTransferFromEOAReceiver(address,address,uint256,uint256,uint256,uint256,bytes) (runs: 256, μ: 160554, ~: 160542) ERC1155Test:testFuzzSafeBatchTransferFromNoData(address,uint256,uint256,uint256,uint256) (runs: 256, μ: 528669, ~: 528669) -ERC1155Test:testFuzzSafeBatchTransferFromWithData(address,uint256,uint256,uint256,uint256) (runs: 256, μ: 529052, ~: 529361) +ERC1155Test:testFuzzSafeBatchTransferFromWithData(address,uint256,uint256,uint256,uint256) (runs: 256, μ: 529045, ~: 528739) ERC1155Test:testFuzzSafeMintBatchEOAReceiver(address,address,uint256,uint256,uint256,uint256,bytes) (runs: 256, μ: 138098, ~: 138102) ERC1155Test:testFuzzSafeMintBatchNoData(address,uint256,uint256,uint256,uint256) (runs: 256, μ: 500117, ~: 500117) ERC1155Test:testFuzzSafeMintBatchNonMinter(address) (runs: 256, μ: 26517, ~: 26517) -ERC1155Test:testFuzzSafeMintBatchWithData(address,uint256,uint256,uint256,uint256) (runs: 256, μ: 500489, ~: 500656) +ERC1155Test:testFuzzSafeMintBatchWithData(address,uint256,uint256,uint256,uint256) (runs: 256, μ: 500485, ~: 500320) ERC1155Test:testFuzzSafeMintEOAReceiver(address,address,uint256,uint256,uint256,uint256,bytes) (runs: 256, μ: 140545, ~: 140537) ERC1155Test:testFuzzSafeMintNoData(address,uint256,uint256,uint256,uint256) (runs: 256, μ: 503459, ~: 503459) ERC1155Test:testFuzzSafeMintNonMinter(address) (runs: 256, μ: 26112, ~: 26112) ERC1155Test:testFuzzSafeMintWithData(address,uint256,uint256,uint256,uint256,bytes) (runs: 256, μ: 504589, ~: 504229) -ERC1155Test:testFuzzSafeTransferFromByApprovedOperator(address,address,address,uint256,uint256,uint256,uint256,bytes) (runs: 256, μ: 187660, ~: 187648) +ERC1155Test:testFuzzSafeTransferFromByApprovedOperator(address,address,address,uint256,uint256,uint256,uint256,bytes) (runs: 256, μ: 187680, ~: 187648) ERC1155Test:testFuzzSafeTransferFromEOAReceiver(address,address,uint256,uint256,uint256,uint256,bytes) (runs: 256, μ: 152315, ~: 152293) ERC1155Test:testFuzzSafeTransferFromNoData(address,uint256,uint256,uint256,uint256) (runs: 256, μ: 578642, ~: 578642) ERC1155Test:testFuzzSafeTransferFromWithData(address,uint256,uint256,uint256,uint256,bytes) (runs: 256, μ: 580727, ~: 580010) @@ -179,10 +179,10 @@ ERC1155Test:testFuzzSetApprovalForAllSuccess(address,address) (runs: 256, μ: 45 ERC1155Test:testFuzzSetMinterNonOwner(address,string) (runs: 256, μ: 15488, ~: 15481) ERC1155Test:testFuzzSetMinterSuccess(string) (runs: 256, μ: 33547, ~: 33557) ERC1155Test:testFuzzSetUriNonMinter(address) (runs: 256, μ: 14413, ~: 14413) -ERC1155Test:testFuzzTotalSupplyAfterBatchBurn(address,uint256,uint256,uint256,uint256) (runs: 256, μ: 108009, ~: 107998) -ERC1155Test:testFuzzTotalSupplyAfterBatchMint(address,uint256,uint256,uint256,uint256) (runs: 256, μ: 126252, ~: 126284) +ERC1155Test:testFuzzTotalSupplyAfterBatchBurn(address,uint256,uint256,uint256,uint256) (runs: 256, μ: 108008, ~: 107997) +ERC1155Test:testFuzzTotalSupplyAfterBatchMint(address,uint256,uint256,uint256,uint256) (runs: 256, μ: 126251, ~: 126220) ERC1155Test:testFuzzTotalSupplyAfterSingleBurn(address,uint256,bytes) (runs: 256, μ: 120543, ~: 120509) -ERC1155Test:testFuzzTotalSupplyAfterSingleMint(uint256,uint256,bytes) (runs: 256, μ: 78723, ~: 107838) +ERC1155Test:testFuzzTotalSupplyAfterSingleMint(uint256,uint256,bytes) (runs: 256, μ: 80589, ~: 107841) ERC1155Test:testFuzzTransferOwnershipNonOwner(address,address) (runs: 256, μ: 14036, ~: 14036) ERC1155Test:testFuzzTransferOwnershipSuccess(address,address) (runs: 256, μ: 75645, ~: 75613) ERC1155Test:testHasOwner() (gas: 12677) @@ -257,8 +257,8 @@ ERC1155Test:testUriBaseAndTokenUriNotSet() (gas: 2851412) ERC1155Test:testUriBaseAndTokenUriSet() (gas: 64187) ERC1155Test:testUriNoBaseURI() (gas: 2900815) ERC1155Test:testUriNoTokenUri() (gas: 18805) -ERC20Invariants:statefulFuzzOwner() (runs: 256, calls: 3840, reverts: 3444) -ERC20Invariants:statefulFuzzTotalSupply() (runs: 256, calls: 3840, reverts: 3444) +ERC20Invariants:statefulFuzzOwner() (runs: 256, calls: 3840, reverts: 3442) +ERC20Invariants:statefulFuzzTotalSupply() (runs: 256, calls: 3840, reverts: 3442) ERC20Test:testApproveExceedingBalanceCase1() (gas: 40802) ERC20Test:testApproveExceedingBalanceCase2() (gas: 47789) ERC20Test:testApproveFromZeroAddress() (gas: 12962) @@ -281,25 +281,25 @@ ERC20Test:testCachedDomainSeparator() (gas: 10598) ERC20Test:testDomainSeparator() (gas: 11819) ERC20Test:testEIP712Domain() (gas: 18200) ERC20Test:testFuzzApproveSuccess(address,uint256) (runs: 256, μ: 41115, ~: 41193) -ERC20Test:testFuzzBurnFromInsufficientAllowance(address,uint256,uint8) (runs: 256, μ: 205962, ~: 205979) -ERC20Test:testFuzzBurnFromSuccess(address,uint256) (runs: 256, μ: 339788, ~: 339651) +ERC20Test:testFuzzBurnFromInsufficientAllowance(address,uint256,uint8) (runs: 256, μ: 205956, ~: 205979) +ERC20Test:testFuzzBurnFromSuccess(address,uint256) (runs: 256, μ: 339786, ~: 339651) ERC20Test:testFuzzBurnInvalidAmount(address,uint256) (runs: 256, μ: 16394, ~: 16394) -ERC20Test:testFuzzBurnSuccessCase(uint256) (runs: 256, μ: 314359, ~: 314150) +ERC20Test:testFuzzBurnSuccessCase(uint256) (runs: 256, μ: 314361, ~: 314150) ERC20Test:testFuzzDomainSeparator(uint8) (runs: 256, μ: 12027, ~: 12055) ERC20Test:testFuzzEIP712Domain(bytes1,uint8,bytes32,uint256[]) (runs: 256, μ: 21696, ~: 21739) ERC20Test:testFuzzMintNonMinter(string,uint256) (runs: 256, μ: 12922, ~: 12923) -ERC20Test:testFuzzMintSuccess(string,uint256) (runs: 256, μ: 55710, ~: 55509) +ERC20Test:testFuzzMintSuccess(string,uint256) (runs: 256, μ: 55705, ~: 55509) ERC20Test:testFuzzPermitInvalid(string,string,uint16) (runs: 256, μ: 44558, ~: 44557) ERC20Test:testFuzzPermitSuccess(string,string,uint16) (runs: 256, μ: 70551, ~: 70554) ERC20Test:testFuzzRenounceOwnershipNonOwner(address) (runs: 256, μ: 13929, ~: 13929) -ERC20Test:testFuzzRenounceOwnershipSuccess(address) (runs: 256, μ: 48635, ~: 48620) +ERC20Test:testFuzzRenounceOwnershipSuccess(address) (runs: 256, μ: 48634, ~: 48620) ERC20Test:testFuzzSetMinterNonOwner(address,string) (runs: 256, μ: 15519, ~: 15512) ERC20Test:testFuzzSetMinterSuccess(string) (runs: 256, μ: 33568, ~: 33578) -ERC20Test:testFuzzTransferFromInsufficientAllowance(address,address,uint256,uint8) (runs: 256, μ: 204605, ~: 204593) -ERC20Test:testFuzzTransferFromSuccess(address,address,uint256) (runs: 256, μ: 233564, ~: 234140) +ERC20Test:testFuzzTransferFromInsufficientAllowance(address,address,uint256,uint8) (runs: 256, μ: 204604, ~: 204593) +ERC20Test:testFuzzTransferFromSuccess(address,address,uint256) (runs: 256, μ: 233562, ~: 234137) ERC20Test:testFuzzTransferInvalidAmount(address,address,uint256) (runs: 256, μ: 16752, ~: 16752) ERC20Test:testFuzzTransferOwnershipNonOwner(address,address) (runs: 256, μ: 14040, ~: 14040) -ERC20Test:testFuzzTransferOwnershipSuccess(address,address) (runs: 256, μ: 75609, ~: 75577) +ERC20Test:testFuzzTransferOwnershipSuccess(address,address) (runs: 256, μ: 75610, ~: 75577) ERC20Test:testFuzzTransferSuccess(address,uint256) (runs: 256, μ: 205509, ~: 205569) ERC20Test:testHasOwner() (gas: 12655) ERC20Test:testInitialSetup() (gas: 1566549) @@ -342,16 +342,16 @@ ERC2981Test:testFuzzRenounceOwnershipNonOwner(address) (runs: 256, μ: 13901, ~: ERC2981Test:testFuzzRenounceOwnershipSuccess(address) (runs: 256, μ: 25199, ~: 25199) ERC2981Test:testFuzzResetTokenRoyalty(address,address,uint256,uint256,uint96,uint256) (runs: 256, μ: 97459, ~: 97732) ERC2981Test:testFuzzResetTokenRoyaltyNonOwner(address) (runs: 256, μ: 13306, ~: 13306) -ERC2981Test:testFuzzRoyaltyInfoDefaultRoyalty(address,uint256,uint256,uint96,uint256) (runs: 256, μ: 80637, ~: 81179) -ERC2981Test:testFuzzRoyaltyInfoDeleteDefaultRoyalty(address,uint256,uint256,uint96,uint256) (runs: 256, μ: 65541, ~: 65916) +ERC2981Test:testFuzzRoyaltyInfoDefaultRoyalty(address,uint256,uint256,uint96,uint256) (runs: 256, μ: 80653, ~: 81179) +ERC2981Test:testFuzzRoyaltyInfoDeleteDefaultRoyalty(address,uint256,uint256,uint96,uint256) (runs: 256, μ: 65554, ~: 65923) ERC2981Test:testFuzzRoyaltyInfoSetTokenRoyalty(address,address,uint256,uint256,uint96,uint256) (runs: 256, μ: 122277, ~: 122718) ERC2981Test:testFuzzRoyaltyInfoSetTokenRoyaltyUpdate(address,address,uint256,uint256,uint96,uint256) (runs: 256, μ: 168696, ~: 169293) ERC2981Test:testFuzzRoyaltyInfoUpdateDefaultRoyalty(address,address,uint256,uint256,uint96,uint256) (runs: 256, μ: 88645, ~: 88931) ERC2981Test:testFuzzSetDefaultRoyaltyNonOwner(address) (runs: 256, μ: 15608, ~: 15608) -ERC2981Test:testFuzzSetDefaultRoyaltyTooHighFeeNumerator(uint96) (runs: 256, μ: 21080, ~: 20869) +ERC2981Test:testFuzzSetDefaultRoyaltyTooHighFeeNumerator(uint96) (runs: 256, μ: 21072, ~: 20869) ERC2981Test:testFuzzSetTokenRoyaltyInvalidReceiver(address) (runs: 256, μ: 18664, ~: 18664) ERC2981Test:testFuzzSetTokenRoyaltyNonOwner(address) (runs: 256, μ: 15625, ~: 15625) -ERC2981Test:testFuzzSetTokenRoyaltyTooHighFeeNumerator(uint96) (runs: 256, μ: 21098, ~: 20887) +ERC2981Test:testFuzzSetTokenRoyaltyTooHighFeeNumerator(uint96) (runs: 256, μ: 21090, ~: 20887) ERC2981Test:testFuzzTransferOwnershipNonOwner(address,address) (runs: 256, μ: 14053, ~: 14053) ERC2981Test:testFuzzTransferOwnershipSuccess(address,address) (runs: 256, μ: 30234, ~: 30234) ERC2981Test:testHasOwner() (gas: 12590) @@ -379,8 +379,8 @@ ERC2981Test:testSupportsInterfaceSuccessGasCost() (gas: 9227) ERC2981Test:testTransferOwnershipNonOwner() (gas: 12354) ERC2981Test:testTransferOwnershipSuccess() (gas: 22163) ERC2981Test:testTransferOwnershipToZeroAddress() (gas: 15490) -ERC4626VaultInvariants:statefulFuzzTotalAssets() (runs: 256, calls: 3840, reverts: 3290) -ERC4626VaultInvariants:statefulFuzzTotalSupply() (runs: 256, calls: 3840, reverts: 3290) +ERC4626VaultInvariants:statefulFuzzTotalAssets() (runs: 256, calls: 3840, reverts: 3289) +ERC4626VaultInvariants:statefulFuzzTotalSupply() (runs: 256, calls: 3840, reverts: 3289) ERC4626VaultTest:testCachedDomainSeparator() (gas: 10575) ERC4626VaultTest:testDepositInsufficientAllowance() (gas: 82478) ERC4626VaultTest:testDepositWithNoApproval() (gas: 24309) @@ -391,9 +391,9 @@ ERC4626VaultTest:testEmptyVaultDeposit() (gas: 567200) ERC4626VaultTest:testEmptyVaultMint() (gas: 568085) ERC4626VaultTest:testEmptyVaultRedeem() (gas: 202461) ERC4626VaultTest:testEmptyVaultwithdraw() (gas: 215305) -ERC4626VaultTest:testFail_redeem((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 553364, ~: 556438) -ERC4626VaultTest:testFail_withdraw((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 555131, ~: 557997) -ERC4626VaultTest:testFuzzDomainSeparator(uint8) (runs: 256, μ: 11916, ~: 11944) +ERC4626VaultTest:testFail_redeem((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 553582, ~: 556438) +ERC4626VaultTest:testFail_withdraw((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 555327, ~: 557997) +ERC4626VaultTest:testFuzzDomainSeparator(uint8) (runs: 256, μ: 11917, ~: 11944) ERC4626VaultTest:testFuzzEIP712Domain(bytes1,uint8,bytes32,uint256[]) (runs: 256, μ: 21719, ~: 21769) ERC4626VaultTest:testFuzzPermitInvalid(string,string,uint16) (runs: 256, μ: 44523, ~: 44522) ERC4626VaultTest:testFuzzPermitSuccess(string,string,uint16) (runs: 256, μ: 70458, ~: 70461) @@ -415,30 +415,30 @@ ERC4626VaultTest:testVaultInteractionsForSomeoneElse() (gas: 224104) ERC4626VaultTest:testWithdrawInsufficientAllowance() (gas: 122383) ERC4626VaultTest:testWithdrawInsufficientAssets() (gas: 117788) ERC4626VaultTest:testWithdrawWithNoAssets() (gas: 21277) -ERC4626VaultTest:test_RT_deposit_redeem((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 472215, ~: 473172) -ERC4626VaultTest:test_RT_deposit_withdraw((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 474200, ~: 474402) -ERC4626VaultTest:test_RT_mint_redeem((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 471828, ~: 473267) -ERC4626VaultTest:test_RT_mint_withdraw((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 473542, ~: 474475) -ERC4626VaultTest:test_RT_redeem_deposit((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 472530, ~: 473239) -ERC4626VaultTest:test_RT_redeem_mint((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 472629, ~: 473312) -ERC4626VaultTest:test_RT_withdraw_deposit((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 473781, ~: 474422) -ERC4626VaultTest:test_RT_withdraw_mint((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 473872, ~: 474587) -ERC4626VaultTest:test_asset((address[4],uint256[4],uint256[4],int256)) (runs: 256, μ: 424194, ~: 426303) -ERC4626VaultTest:test_convertToAssets((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 428895, ~: 430540) -ERC4626VaultTest:test_convertToShares((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 428902, ~: 430559) -ERC4626VaultTest:test_deposit((address[4],uint256[4],uint256[4],int256),uint256,uint256) (runs: 256, μ: 469787, ~: 471112) -ERC4626VaultTest:test_maxDeposit((address[4],uint256[4],uint256[4],int256)) (runs: 256, μ: 424188, ~: 426297) -ERC4626VaultTest:test_maxMint((address[4],uint256[4],uint256[4],int256)) (runs: 256, μ: 424231, ~: 426340) -ERC4626VaultTest:test_maxRedeem((address[4],uint256[4],uint256[4],int256)) (runs: 256, μ: 424328, ~: 426437) -ERC4626VaultTest:test_maxWithdraw((address[4],uint256[4],uint256[4],int256)) (runs: 256, μ: 425778, ~: 427682) -ERC4626VaultTest:test_mint((address[4],uint256[4],uint256[4],int256),uint256,uint256) (runs: 256, μ: 469844, ~: 471132) -ERC4626VaultTest:test_previewDeposit((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 464625, ~: 465772) -ERC4626VaultTest:test_previewMint((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 464394, ~: 465956) -ERC4626VaultTest:test_previewRedeem((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 467013, ~: 467221) -ERC4626VaultTest:test_previewWithdraw((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 467910, ~: 468540) -ERC4626VaultTest:test_redeem((address[4],uint256[4],uint256[4],int256),uint256,uint256) (runs: 256, μ: 472981, ~: 473825) -ERC4626VaultTest:test_totalAssets((address[4],uint256[4],uint256[4],int256)) (runs: 256, μ: 424777, ~: 426886) -ERC4626VaultTest:test_withdraw((address[4],uint256[4],uint256[4],int256),uint256,uint256) (runs: 256, μ: 474595, ~: 475018) +ERC4626VaultTest:test_RT_deposit_redeem((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 472231, ~: 473175) +ERC4626VaultTest:test_RT_deposit_withdraw((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 473951, ~: 474403) +ERC4626VaultTest:test_RT_mint_redeem((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 471616, ~: 473267) +ERC4626VaultTest:test_RT_mint_withdraw((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 473552, ~: 474479) +ERC4626VaultTest:test_RT_redeem_deposit((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 472606, ~: 473251) +ERC4626VaultTest:test_RT_redeem_mint((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 472647, ~: 473324) +ERC4626VaultTest:test_RT_withdraw_deposit((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 473722, ~: 474422) +ERC4626VaultTest:test_RT_withdraw_mint((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 473891, ~: 474659) +ERC4626VaultTest:test_asset((address[4],uint256[4],uint256[4],int256)) (runs: 256, μ: 424211, ~: 426303) +ERC4626VaultTest:test_convertToAssets((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 429114, ~: 430540) +ERC4626VaultTest:test_convertToShares((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 429120, ~: 430556) +ERC4626VaultTest:test_deposit((address[4],uint256[4],uint256[4],int256),uint256,uint256) (runs: 256, μ: 469793, ~: 471113) +ERC4626VaultTest:test_maxDeposit((address[4],uint256[4],uint256[4],int256)) (runs: 256, μ: 424205, ~: 426297) +ERC4626VaultTest:test_maxMint((address[4],uint256[4],uint256[4],int256)) (runs: 256, μ: 424247, ~: 426340) +ERC4626VaultTest:test_maxRedeem((address[4],uint256[4],uint256[4],int256)) (runs: 256, μ: 424345, ~: 426437) +ERC4626VaultTest:test_maxWithdraw((address[4],uint256[4],uint256[4],int256)) (runs: 256, μ: 425800, ~: 427698) +ERC4626VaultTest:test_mint((address[4],uint256[4],uint256[4],int256),uint256,uint256) (runs: 256, μ: 469879, ~: 471132) +ERC4626VaultTest:test_previewDeposit((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 464641, ~: 465775) +ERC4626VaultTest:test_previewMint((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 464182, ~: 465956) +ERC4626VaultTest:test_previewRedeem((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 467253, ~: 467226) +ERC4626VaultTest:test_previewWithdraw((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 468159, ~: 468541) +ERC4626VaultTest:test_redeem((address[4],uint256[4],uint256[4],int256),uint256,uint256) (runs: 256, μ: 472975, ~: 473824) +ERC4626VaultTest:test_totalAssets((address[4],uint256[4],uint256[4],int256)) (runs: 256, μ: 424794, ~: 426886) +ERC4626VaultTest:test_withdraw((address[4],uint256[4],uint256[4],int256),uint256,uint256) (runs: 256, μ: 474765, ~: 475016) ERC721Invariants:statefulFuzzOwner() (runs: 256, calls: 3840, reverts: 3506) ERC721Invariants:statefulFuzzTotalSupply() (runs: 256, calls: 3840, reverts: 3506) ERC721Test:testApproveClearingApprovalWithNoPriorApproval() (gas: 177097) @@ -475,7 +475,7 @@ ERC721Test:testFuzzPermitSuccess(string,string,uint16) (runs: 256, μ: 227006, ~ ERC721Test:testFuzzRenounceOwnershipNonOwner(address) (runs: 256, μ: 13974, ~: 13974) ERC721Test:testFuzzRenounceOwnershipSuccess(address) (runs: 256, μ: 48629, ~: 48615) ERC721Test:testFuzzSafeMintNonMinter(address) (runs: 256, μ: 15677, ~: 15677) -ERC721Test:testFuzzSafeMintSuccess(address[]) (runs: 256, μ: 21301787, ~: 20697706) +ERC721Test:testFuzzSafeMintSuccess(address[]) (runs: 256, μ: 21252900, ~: 20354267) ERC721Test:testFuzzSafeTransferFromWithData(address,address,address,bytes) (runs: 256, μ: 1433791, ~: 1433893) ERC721Test:testFuzzSetApprovalForAllSuccess(address,address) (runs: 256, μ: 189156, ~: 189156) ERC721Test:testFuzzSetMinterNonOwner(address,string) (runs: 256, μ: 15519, ~: 15512) @@ -547,19 +547,19 @@ ERC721Test:testTransferOwnershipToZeroAddress() (gas: 15540) MathTest:testCbrtRoundDown() (gas: 51605) MathTest:testCbrtRoundUp() (gas: 52252) MathTest:testCeilDiv() (gas: 14716) -MathTest:testFuzzCbrt(uint256,bool) (runs: 256, μ: 22386, ~: 22319) +MathTest:testFuzzCbrt(uint256,bool) (runs: 256, μ: 22399, ~: 22321) MathTest:testFuzzCeilDiv(uint256,uint256) (runs: 256, μ: 9759, ~: 9760) MathTest:testFuzzInt256Average(int256,int256) (runs: 256, μ: 8533, ~: 8533) -MathTest:testFuzzLog10(uint256,bool) (runs: 256, μ: 10374, ~: 10347) -MathTest:testFuzzLog2(uint256,bool) (runs: 256, μ: 10134, ~: 10177) -MathTest:testFuzzLog256(uint256,bool) (runs: 256, μ: 10219, ~: 10139) +MathTest:testFuzzLog10(uint256,bool) (runs: 256, μ: 10375, ~: 10347) +MathTest:testFuzzLog2(uint256,bool) (runs: 256, μ: 10135, ~: 10177) +MathTest:testFuzzLog256(uint256,bool) (runs: 256, μ: 10224, ~: 10139) MathTest:testFuzzMulDiv(uint256,uint256,uint256) (runs: 256, μ: 14269, ~: 14059) MathTest:testFuzzMulDivDomain(uint256,uint256,uint256) (runs: 256, μ: 10847, ~: 10886) MathTest:testFuzzSignum(int256) (runs: 256, μ: 8483, ~: 8475) MathTest:testFuzzUint256Average(uint256,uint256) (runs: 256, μ: 8662, ~: 8662) -MathTest:testFuzzWadCbrt(uint256) (runs: 256, μ: 22269, ~: 21981) -MathTest:testFuzzWadExp(int256) (runs: 256, μ: 14698, ~: 15050) -MathTest:testFuzzWadLn(int256) (runs: 256, μ: 16342, ~: 16083) +MathTest:testFuzzWadCbrt(uint256) (runs: 256, μ: 22281, ~: 21999) +MathTest:testFuzzWadExp(int256) (runs: 256, μ: 14700, ~: 15050) +MathTest:testFuzzWadLn(int256) (runs: 256, μ: 16343, ~: 16087) MathTest:testInt256Average() (gas: 18813) MathTest:testLog10RoundDown() (gas: 26172) MathTest:testLog10RoundUp() (gas: 27375) @@ -580,8 +580,8 @@ MathTest:testWadExp() (gas: 34284) MathTest:testWadExpOverflow() (gas: 11133) MathTest:testWadLn() (gas: 31203) MathTest:testWadLnNegativeValues() (gas: 11090) -MerkleProofVerificationTest:testFuzzMultiProofVerifySingleLeaf(bytes32[],uint256) (runs: 256, μ: 262415, ~: 273902) -MerkleProofVerificationTest:testFuzzVerify(bytes32[],uint256) (runs: 256, μ: 177001, ~: 186697) +MerkleProofVerificationTest:testFuzzMultiProofVerifySingleLeaf(bytes32[],uint256) (runs: 256, μ: 262416, ~: 273900) +MerkleProofVerificationTest:testFuzzVerify(bytes32[],uint256) (runs: 256, μ: 177002, ~: 186695) MerkleProofVerificationTest:testFuzzVerifyMultiProofMultipleLeaves(bool,bool,bool) (runs: 256, μ: 45519, ~: 45510) MerkleProofVerificationTest:testInvalidMerkleMultiProof() (gas: 46727) MerkleProofVerificationTest:testInvalidMerkleProof() (gas: 18786) @@ -611,22 +611,23 @@ MulticallTest:testMultistaticcallRevert() (gas: 1040449054) MulticallTest:testMultistaticcallSuccess() (gas: 1128937) Ownable2StepInvariants:statefulFuzzOwner() (runs: 256, calls: 3840, reverts: 3840) Ownable2StepInvariants:statefulFuzzPendingOwner() (runs: 256, calls: 3840, reverts: 3840) -Ownable2StepTest:testAcceptOwnershipNonPendingOwner() (gas: 47299) -Ownable2StepTest:testAcceptOwnershipSuccess() (gas: 40586) +Ownable2StepTest:testAcceptOwnershipNonPendingOwner() (gas: 47277) +Ownable2StepTest:testAcceptOwnershipSuccess() (gas: 40622) +Ownable2StepTest:testCancelTransferOwnership() (gas: 40659) Ownable2StepTest:testFuzzAcceptOwnershipNonPendingOwner(address) (runs: 256, μ: 46742, ~: 46742) Ownable2StepTest:testFuzzAcceptOwnershipSuccess(address,address) (runs: 256, μ: 67595, ~: 67564) Ownable2StepTest:testFuzzPendingOwnerResetAfterRenounceOwnership(address) (runs: 256, μ: 40060, ~: 40045) -Ownable2StepTest:testFuzzRenounceOwnershipNonOwner(address) (runs: 256, μ: 13860, ~: 13860) -Ownable2StepTest:testFuzzRenounceOwnershipSuccess(address) (runs: 256, μ: 45335, ~: 45320) -Ownable2StepTest:testFuzzTransferOwnershipNonOwner(address,address) (runs: 256, μ: 14011, ~: 14011) -Ownable2StepTest:testFuzzTransferOwnershipSuccess(address,address) (runs: 256, μ: 52133, ~: 52133) +Ownable2StepTest:testFuzzRenounceOwnershipNonOwner(address) (runs: 256, μ: 13927, ~: 13927) +Ownable2StepTest:testFuzzRenounceOwnershipSuccess(address) (runs: 256, μ: 45317, ~: 45302) +Ownable2StepTest:testFuzzTransferOwnershipNonOwner(address,address) (runs: 256, μ: 13989, ~: 13989) +Ownable2StepTest:testFuzzTransferOwnershipSuccess(address,address) (runs: 256, μ: 52111, ~: 52111) Ownable2StepTest:testHasOwner() (gas: 12524) -Ownable2StepTest:testInitialSetup() (gas: 241586) -Ownable2StepTest:testPendingOwnerResetAfterRenounceOwnership() (gas: 40771) -Ownable2StepTest:testRenounceOwnershipNonOwner() (gas: 10853) -Ownable2StepTest:testRenounceOwnershipSuccess() (gas: 20258) +Ownable2StepTest:testInitialSetup() (gas: 241651) +Ownable2StepTest:testPendingOwnerResetAfterRenounceOwnership() (gas: 40753) +Ownable2StepTest:testRenounceOwnershipNonOwner() (gas: 10831) +Ownable2StepTest:testRenounceOwnershipSuccess() (gas: 20236) Ownable2StepTest:testTransferOwnershipNonOwner() (gas: 12300) -Ownable2StepTest:testTransferOwnershipSuccess() (gas: 45706) +Ownable2StepTest:testTransferOwnershipSuccess() (gas: 45684) OwnableInvariants:statefulFuzzOwner() (runs: 256, calls: 3840, reverts: 3840) OwnableTest:testFuzzRenounceOwnershipNonOwner(address) (runs: 256, μ: 13879, ~: 13879) OwnableTest:testFuzzRenounceOwnershipSuccess(address) (runs: 256, μ: 25196, ~: 25196) @@ -665,13 +666,13 @@ SignatureCheckerTest:testFuzzEOAWithInvalidSignature(bytes,string) (runs: 256, SignatureCheckerTest:testFuzzEOAWithInvalidSigner(string,string) (runs: 256, μ: 20412, ~: 20416) SignatureCheckerTest:testFuzzEOAWithValidSignature(string,string) (runs: 256, μ: 20344, ~: 20348) SignatureCheckerTest:testInitialSetup() (gas: 8356) -TimelockControllerInvariants:statefulFuzzExecutedLessThanOrEqualToScheduled() (runs: 256, calls: 3840, reverts: 1288) -TimelockControllerInvariants:statefulFuzzExecutedProposalCancellation() (runs: 256, calls: 3840, reverts: 1252) -TimelockControllerInvariants:statefulFuzzExecutingCancelledProposal() (runs: 256, calls: 3840, reverts: 1236) -TimelockControllerInvariants:statefulFuzzExecutingNotReadyProposal() (runs: 256, calls: 3840, reverts: 1339) -TimelockControllerInvariants:statefulFuzzOnceProposalExecution() (runs: 256, calls: 3840, reverts: 1258) -TimelockControllerInvariants:statefulFuzzProposalsExecutedMatchCount() (runs: 256, calls: 3840, reverts: 1288) -TimelockControllerInvariants:statefulFuzzSumOfProposals() (runs: 256, calls: 3840, reverts: 1288) +TimelockControllerInvariants:statefulFuzzExecutedLessThanOrEqualToScheduled() (runs: 256, calls: 3840, reverts: 1303) +TimelockControllerInvariants:statefulFuzzExecutedProposalCancellation() (runs: 256, calls: 3840, reverts: 1270) +TimelockControllerInvariants:statefulFuzzExecutingCancelledProposal() (runs: 256, calls: 3840, reverts: 1238) +TimelockControllerInvariants:statefulFuzzExecutingNotReadyProposal() (runs: 256, calls: 3840, reverts: 1306) +TimelockControllerInvariants:statefulFuzzOnceProposalExecution() (runs: 256, calls: 3840, reverts: 1280) +TimelockControllerInvariants:statefulFuzzProposalsExecutedMatchCount() (runs: 256, calls: 3840, reverts: 1303) +TimelockControllerInvariants:statefulFuzzSumOfProposals() (runs: 256, calls: 3840, reverts: 1304) TimelockControllerTest:testAdminCannotBatchExecute() (gas: 750632) TimelockControllerTest:testAdminCannotBatchSchedule() (gas: 748419) TimelockControllerTest:testAdminCannotCancel() (gas: 13369) diff --git a/lib/forge-std b/lib/forge-std index 5a802d7c..8f24d6b0 160000 --- a/lib/forge-std +++ b/lib/forge-std @@ -1 +1 @@ -Subproject commit 5a802d7c10abb4bbfb3e7214c75052ef9e6a06f8 +Subproject commit 8f24d6b04c92975e0795b5868aa0d783251cdeaa diff --git a/lib/openzeppelin-contracts b/lib/openzeppelin-contracts index cc67e0eb..ae753b7e 160000 --- a/lib/openzeppelin-contracts +++ b/lib/openzeppelin-contracts @@ -1 +1 @@ -Subproject commit cc67e0eb83a0aef1e0f3e44491344f93cf67ff2c +Subproject commit ae753b7eac6eaba0e8eebab11ecf2ca5a0057d90 diff --git a/lib/solady b/lib/solady index 42af395e..e0ef35ad 160000 --- a/lib/solady +++ b/lib/solady @@ -1 +1 @@ -Subproject commit 42af395e631fcc9d640eddf11c57c6f1ca3f9103 +Subproject commit e0ef35adb0ccd1032794731a995cb599bba7b537 diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b332816a..4dc4d3d0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -422,16 +422,16 @@ packages: peerDependencies: eslint: '>=7.0.0' - eslint-scope@8.0.2: - resolution: {integrity: sha512-6E4xmrTw5wtxnLA5wYL3WDfhZ/1bUBGOXV0zQvVRDOtrR8D0p6W7fs3JweNYhwRYeGvd/1CKX2se0/2s7Q/nJA==} + eslint-scope@8.1.0: + resolution: {integrity: sha512-14dSvlhaVhKKsa9Fx1l8A17s7ah7Ef7wCakJ10LYk6+GYmP9yDti2oq2SEwcyndt6knfcZyhyxwY3i9yL78EQw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} eslint-visitor-keys@3.4.3: resolution: {integrity: sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - eslint-visitor-keys@4.0.0: - resolution: {integrity: sha512-OtIRv/2GyiF6o/d8K7MYKKbXrOUBIK6SfkIRM4Z0dY3w+LiQ0vy3F57m0Z71bjbyeiWFiHJ8brqnmE6H6/jEuw==} + eslint-visitor-keys@4.1.0: + resolution: {integrity: sha512-Q7lok0mqMUSf5a/AdAZkA5a/gHcO6snwQClVNNvFKCAVlxXucdU8pKydU5ZVZjBx5xr37vGbFFWtLQYreLzrZg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} eslint@9.11.1: @@ -444,8 +444,8 @@ packages: jiti: optional: true - espree@10.1.0: - resolution: {integrity: sha512-M1M6CpiE6ffoigIOWYO9UDP8TMUw9kqb21tf+08IgDYjCsOvCuDt4jQcZmoYxx+w7zlKw9/N0KXfto+I8/FrXA==} + espree@10.2.0: + resolution: {integrity: sha512-upbkBJbckcCNBDBDXEbuhjbP68n+scUd3k/U2EkyM9nw+I/jPiL4cLF/Al06CF96wRltFda16sxDFrxsI1v0/g==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} esquery@1.6.0: @@ -490,8 +490,8 @@ packages: fast-levenshtein@2.0.6: resolution: {integrity: sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==} - fast-uri@3.0.1: - resolution: {integrity: sha512-MWipKbbYiYI0UC7cl8m/i/IWTqfC8YXsqjzybjddLsFjStroQzsHXkc73JutMvBiXmOvapk+axIl79ig5t55Bw==} + fast-uri@3.0.2: + resolution: {integrity: sha512-GR6f0hD7XXyNJa25Tb9BuIdN0tdr+0BMi6/CJPH3wJO1JjNG3n/VsSw38AwRdKZABm8lGbPfakLRkYzx2V9row==} fastq@1.17.1: resolution: {integrity: sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==} @@ -1007,7 +1007,7 @@ snapshots: dependencies: ajv: 6.12.6 debug: 4.3.7 - espree: 10.1.0 + espree: 10.2.0 globals: 14.0.0 ignore: 5.3.2 import-fresh: 3.3.0 @@ -1252,7 +1252,7 @@ snapshots: ajv@8.17.1: dependencies: fast-deep-equal: 3.1.3 - fast-uri: 3.0.1 + fast-uri: 3.0.2 json-schema-traverse: 1.0.0 require-from-string: 2.0.2 @@ -1403,14 +1403,14 @@ snapshots: dependencies: eslint: 9.11.1 - eslint-scope@8.0.2: + eslint-scope@8.1.0: dependencies: esrecurse: 4.3.0 estraverse: 5.3.0 eslint-visitor-keys@3.4.3: {} - eslint-visitor-keys@4.0.0: {} + eslint-visitor-keys@4.1.0: {} eslint@9.11.1: dependencies: @@ -1431,9 +1431,9 @@ snapshots: cross-spawn: 7.0.3 debug: 4.3.7 escape-string-regexp: 4.0.0 - eslint-scope: 8.0.2 - eslint-visitor-keys: 4.0.0 - espree: 10.1.0 + eslint-scope: 8.1.0 + eslint-visitor-keys: 4.1.0 + espree: 10.2.0 esquery: 1.6.0 esutils: 2.0.3 fast-deep-equal: 3.1.3 @@ -1454,11 +1454,11 @@ snapshots: transitivePeerDependencies: - supports-color - espree@10.1.0: + espree@10.2.0: dependencies: acorn: 8.12.1 acorn-jsx: 5.3.2(acorn@8.12.1) - eslint-visitor-keys: 4.0.0 + eslint-visitor-keys: 4.1.0 esquery@1.6.0: dependencies: @@ -1509,7 +1509,7 @@ snapshots: fast-levenshtein@2.0.6: {} - fast-uri@3.0.1: {} + fast-uri@3.0.2: {} fastq@1.17.1: dependencies: diff --git a/src/snekmate/auth/ownable_2step.vy b/src/snekmate/auth/ownable_2step.vy index 1862baae..da514395 100644 --- a/src/snekmate/auth/ownable_2step.vy +++ b/src/snekmate/auth/ownable_2step.vy @@ -70,14 +70,15 @@ def transfer_ownership(new_owner: address): """ @dev Starts the ownership transfer of the contract to a new account `new_owner`. - @notice Note that this function can only be - called by the current `owner`. Also, there is - no security risk in setting `new_owner` to the - zero address as the default value of `pending_owner` - is in fact already the zero address and the zero - address cannot call `accept_ownership`. Eventually, - the function replaces the pending transfer if - there is one. + @notice Note that this function can only be called by + the current `owner`. Importantly, there is no + security risk in assigning `new_owner` to the + zero address, as the default value of `pending_owner` + is already set to the zero address, and the zero + address cannot invoke `accept_ownership`. In fact, + this can serve as a method to cancel an ongoing + ownership transfer. Eventually, the function + replaces the pending transfer if there is one. @param new_owner The 20-byte address of the new owner. """ ownable._check_owner() diff --git a/test/auth/Ownable2Step.t.sol b/test/auth/Ownable2Step.t.sol index ac42be13..6399202d 100644 --- a/test/auth/Ownable2Step.t.sol +++ b/test/auth/Ownable2Step.t.sol @@ -98,6 +98,32 @@ contract Ownable2StepTest is Test { vm.stopPrank(); } + function testCancelTransferOwnership() public { + address oldOwner = deployer; + address newOwner = makeAddr("newOwner"); + vm.startPrank(oldOwner); + assertEq(ownable2Step.pending_owner(), zeroAddress); + vm.expectEmit(true, true, false, false); + emit IOwnable2Step.OwnershipTransferStarted(oldOwner, newOwner); + ownable2Step.transfer_ownership(newOwner); + assertEq(ownable2Step.owner(), oldOwner); + assertEq(ownable2Step.pending_owner(), newOwner); + vm.stopPrank(); + + vm.startPrank(oldOwner); + vm.expectEmit(true, true, false, false); + emit IOwnable2Step.OwnershipTransferStarted(oldOwner, zeroAddress); + ownable2Step.transfer_ownership(zeroAddress); + assertEq(ownable2Step.owner(), oldOwner); + assertEq(ownable2Step.pending_owner(), zeroAddress); + vm.stopPrank(); + + vm.startPrank(newOwner); + vm.expectRevert(bytes("ownable_2step: caller is not the new owner")); + ownable2Step.accept_ownership(); + vm.stopPrank(); + } + function testRenounceOwnershipSuccess() public { address oldOwner = deployer; address newOwner = zeroAddress; From cd537d32d57d646721b83ead17a218f64c36fe85 Mon Sep 17 00:00:00 2001 From: Pascal Marco Caversaccio Date: Fri, 27 Sep 2024 18:16:32 +0200 Subject: [PATCH 2/2] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Refine=20Test=20Covera?= =?UTF-8?q?ge?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pascal Marco Caversaccio --- .gas-snapshot | 4 ++-- test/auth/Ownable2Step.t.sol | 22 +++++++++++++++++----- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/.gas-snapshot b/.gas-snapshot index 25191841..b3f6c6e1 100644 --- a/.gas-snapshot +++ b/.gas-snapshot @@ -613,7 +613,7 @@ Ownable2StepInvariants:statefulFuzzOwner() (runs: 256, calls: 3840, reverts: 384 Ownable2StepInvariants:statefulFuzzPendingOwner() (runs: 256, calls: 3840, reverts: 3840) Ownable2StepTest:testAcceptOwnershipNonPendingOwner() (gas: 47277) Ownable2StepTest:testAcceptOwnershipSuccess() (gas: 40622) -Ownable2StepTest:testCancelTransferOwnership() (gas: 40659) +Ownable2StepTest:testCancelTransferOwnership() (gas: 48910) Ownable2StepTest:testFuzzAcceptOwnershipNonPendingOwner(address) (runs: 256, μ: 46742, ~: 46742) Ownable2StepTest:testFuzzAcceptOwnershipSuccess(address,address) (runs: 256, μ: 67595, ~: 67564) Ownable2StepTest:testFuzzPendingOwnerResetAfterRenounceOwnership(address) (runs: 256, μ: 40060, ~: 40045) @@ -672,7 +672,7 @@ TimelockControllerInvariants:statefulFuzzExecutingCancelledProposal() (runs: 256 TimelockControllerInvariants:statefulFuzzExecutingNotReadyProposal() (runs: 256, calls: 3840, reverts: 1306) TimelockControllerInvariants:statefulFuzzOnceProposalExecution() (runs: 256, calls: 3840, reverts: 1280) TimelockControllerInvariants:statefulFuzzProposalsExecutedMatchCount() (runs: 256, calls: 3840, reverts: 1303) -TimelockControllerInvariants:statefulFuzzSumOfProposals() (runs: 256, calls: 3840, reverts: 1304) +TimelockControllerInvariants:statefulFuzzSumOfProposals() (runs: 256, calls: 3840, reverts: 1303) TimelockControllerTest:testAdminCannotBatchExecute() (gas: 750632) TimelockControllerTest:testAdminCannotBatchSchedule() (gas: 748419) TimelockControllerTest:testAdminCannotCancel() (gas: 13369) diff --git a/test/auth/Ownable2Step.t.sol b/test/auth/Ownable2Step.t.sol index 6399202d..c9697337 100644 --- a/test/auth/Ownable2Step.t.sol +++ b/test/auth/Ownable2Step.t.sol @@ -100,14 +100,26 @@ contract Ownable2StepTest is Test { function testCancelTransferOwnership() public { address oldOwner = deployer; - address newOwner = makeAddr("newOwner"); + address newOwner1 = makeAddr("newOwner1"); + address newOwner2 = makeAddr("newOwner2"); vm.startPrank(oldOwner); assertEq(ownable2Step.pending_owner(), zeroAddress); vm.expectEmit(true, true, false, false); - emit IOwnable2Step.OwnershipTransferStarted(oldOwner, newOwner); - ownable2Step.transfer_ownership(newOwner); + emit IOwnable2Step.OwnershipTransferStarted(oldOwner, newOwner1); + ownable2Step.transfer_ownership(newOwner1); assertEq(ownable2Step.owner(), oldOwner); - assertEq(ownable2Step.pending_owner(), newOwner); + assertEq(ownable2Step.pending_owner(), newOwner1); + + vm.expectEmit(true, true, false, false); + emit IOwnable2Step.OwnershipTransferStarted(oldOwner, newOwner2); + ownable2Step.transfer_ownership(newOwner2); + assertEq(ownable2Step.owner(), oldOwner); + assertEq(ownable2Step.pending_owner(), newOwner2); + vm.stopPrank(); + + vm.startPrank(newOwner1); + vm.expectRevert(bytes("ownable_2step: caller is not the new owner")); + ownable2Step.accept_ownership(); vm.stopPrank(); vm.startPrank(oldOwner); @@ -118,7 +130,7 @@ contract Ownable2StepTest is Test { assertEq(ownable2Step.pending_owner(), zeroAddress); vm.stopPrank(); - vm.startPrank(newOwner); + vm.startPrank(newOwner2); vm.expectRevert(bytes("ownable_2step: caller is not the new owner")); ownable2Step.accept_ownership(); vm.stopPrank();