From 4ce4f2811a6a20265edabc7790d98a9dcf718ee9 Mon Sep 17 00:00:00 2001 From: sudo rm -rf --no-preserve-root / Date: Tue, 25 Jun 2024 15:56:55 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=92=20Amend=20`p256`=20Test=20Coverage?= =?UTF-8?q?=20(#256)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### 🕓 Changelog In the test function `testVerifyWycheproofData` for the `p256` contract, we flip the `s` parameter if it is higher than the malleability threshold to validate the correctness of the underlying implementation (h/t @cairoeth for raising this point). We also `bound` the fuzzed private key in the `testFuzzVerifyWithValidSignature` test to account for the secp256r1 curve specifications. Finally, we refactor (i.e. remove) the `_SIGNATURE_INCREMENT` constant in the `ecdsa` contract by using the built-in Vyper constant `max_value(int256)` instead. You can validate the equivalence of the two constants by using [`titanoboa`](https://github.com/vyperlang/titanoboa): ```console ~$ pip install git+https://github.com/vyperlang/titanoboa@vyper-0.4.0 ~$ python >>> import boa >>> boa.eval("convert(max_value(int256), uint256)") == 57_896_044_618_658_097_711_785_492_504_343_953_926_634_992_332_820_282_019_728_792_003_956_564_819_967 True ``` --------- Signed-off-by: Pascal Marco Caversaccio --- .gas-snapshot | 230 ++++++++++++++++++------------------ lib/create-util | 2 +- lib/solady | 2 +- src/snekmate/utils/ecdsa.vy | 11 +- src/snekmate/utils/p256.vy | 8 +- test/utils/P256.t.sol | 16 ++- 6 files changed, 140 insertions(+), 129 deletions(-) diff --git a/.gas-snapshot b/.gas-snapshot index 61a988ae..56706631 100644 --- a/.gas-snapshot +++ b/.gas-snapshot @@ -1,15 +1,15 @@ -AccessControlInvariants:statefulFuzzGetRoleAdmin() (runs: 256, calls: 3840, reverts: 3840) -AccessControlInvariants:statefulFuzzHasRole() (runs: 256, calls: 3840, reverts: 3840) +AccessControlInvariants:statefulFuzzGetRoleAdmin() (runs: 256, calls: 3840, reverts: 3839) +AccessControlInvariants:statefulFuzzHasRole() (runs: 256, calls: 3840, reverts: 3839) AccessControlTest:testFuzzGrantRoleAdminRoleSuccess(address) (runs: 256, μ: 44082, ~: 44082) AccessControlTest:testFuzzGrantRoleMultipleTimesSuccess(address) (runs: 256, μ: 49983, ~: 49983) AccessControlTest:testFuzzGrantRoleNonAdmin(address,address) (runs: 256, μ: 16471, ~: 16471) AccessControlTest:testFuzzGrantRoleSuccess(address) (runs: 256, μ: 44148, ~: 44148) AccessControlTest:testFuzzRenounceRoleMultipleTimesSuccess(address) (runs: 256, μ: 45995, ~: 45980) AccessControlTest:testFuzzRenounceRoleNonMsgSender(address) (runs: 256, μ: 9483, ~: 9483) -AccessControlTest:testFuzzRenounceRoleSuccess(address) (runs: 256, μ: 42042, ~: 42027) -AccessControlTest:testFuzzRevokeRoleMultipleTimesSuccess(address) (runs: 256, μ: 41759, ~: 41744) +AccessControlTest:testFuzzRenounceRoleSuccess(address) (runs: 256, μ: 42041, ~: 42027) +AccessControlTest:testFuzzRevokeRoleMultipleTimesSuccess(address) (runs: 256, μ: 41758, ~: 41744) AccessControlTest:testFuzzRevokeRoleNonAdmin(address,address) (runs: 256, μ: 16403, ~: 16403) -AccessControlTest:testFuzzRevokeRoleSuccess(address) (runs: 256, μ: 40573, ~: 40558) +AccessControlTest:testFuzzRevokeRoleSuccess(address) (runs: 256, μ: 40572, ~: 40558) AccessControlTest:testFuzzSetRoleAdminPreviousAdminCallsGrantRole(address,address) (runs: 256, μ: 76002, ~: 76002) AccessControlTest:testFuzzSetRoleAdminPreviousAdminCallsRevokeRole(address,address) (runs: 256, μ: 101546, ~: 101546) AccessControlTest:testFuzzSetRoleAdminSuccess(address,address) (runs: 256, μ: 91135, ~: 91135) @@ -61,8 +61,8 @@ BatchDistributorTest:testDistributeTokenMultipleAddressesSuccess() (gas: 617110) BatchDistributorTest:testDistributeTokenOneAddressSuccess() (gas: 579078) BatchDistributorTest:testDistributeTokenRevertWithInsufficientAllowance() (gas: 573601) BatchDistributorTest:testDistributeTokenRevertWithInsufficientBalance() (gas: 574254) -BatchDistributorTest:testFuzzDistributeEtherMultipleAddressesSuccess(((address,uint256)[]),uint256) (runs: 256, μ: 1763314, ~: 1784680) -BatchDistributorTest:testFuzzDistributeTokenMultipleAddressesSuccess(((address,uint256)[]),address,uint256) (runs: 256, μ: 1325891, ~: 1251126) +BatchDistributorTest:testFuzzDistributeEtherMultipleAddressesSuccess(((address,uint256)[]),uint256) (runs: 256, μ: 1763583, ~: 1784454) +BatchDistributorTest:testFuzzDistributeTokenMultipleAddressesSuccess(((address,uint256)[]),address,uint256) (runs: 256, μ: 1325883, ~: 1251202) Create2AddressTest:testComputeAddress() (gas: 532147) Create2AddressTest:testComputeAddressSelf() (gas: 540807) Create2AddressTest:testFuzzComputeAddress(bytes32,address) (runs: 256, μ: 532742, ~: 532742) @@ -88,25 +88,25 @@ CreateAddressTest:testComputeAddressSelfNonceUint56() (gas: 534925) CreateAddressTest:testComputeAddressSelfNonceUint64() (gas: 535006) CreateAddressTest:testComputeAddressSelfNonceUint8() (gas: 534652) CreateAddressTest:testComputeAddressSelfRevertTooHighNonce() (gas: 8877) -CreateAddressTest:testFuzzComputeAddressNonce0x7f(uint64,address) (runs: 256, μ: 533175, ~: 533249) -CreateAddressTest:testFuzzComputeAddressNonceUint16(uint64,address) (runs: 256, μ: 532583, ~: 532851) -CreateAddressTest:testFuzzComputeAddressNonceUint24(uint64,address) (runs: 256, μ: 532729, ~: 532811) -CreateAddressTest:testFuzzComputeAddressNonceUint32(uint64,address) (runs: 256, μ: 532734, ~: 532840) -CreateAddressTest:testFuzzComputeAddressNonceUint40(uint64,address) (runs: 256, μ: 532846, ~: 532910) -CreateAddressTest:testFuzzComputeAddressNonceUint48(uint64,address) (runs: 256, μ: 532817, ~: 532916) -CreateAddressTest:testFuzzComputeAddressNonceUint56(uint64,address) (runs: 256, μ: 532884, ~: 532964) -CreateAddressTest:testFuzzComputeAddressNonceUint64(uint64,address) (runs: 256, μ: 532920, ~: 533014) -CreateAddressTest:testFuzzComputeAddressNonceUint8(uint64,address) (runs: 256, μ: 532624, ~: 532685) +CreateAddressTest:testFuzzComputeAddressNonce0x7f(uint64,address) (runs: 256, μ: 533178, ~: 533249) +CreateAddressTest:testFuzzComputeAddressNonceUint16(uint64,address) (runs: 256, μ: 532586, ~: 532851) +CreateAddressTest:testFuzzComputeAddressNonceUint24(uint64,address) (runs: 256, μ: 532730, ~: 532811) +CreateAddressTest:testFuzzComputeAddressNonceUint32(uint64,address) (runs: 256, μ: 532732, ~: 532840) +CreateAddressTest:testFuzzComputeAddressNonceUint40(uint64,address) (runs: 256, μ: 532850, ~: 532910) +CreateAddressTest:testFuzzComputeAddressNonceUint48(uint64,address) (runs: 256, μ: 532818, ~: 532916) +CreateAddressTest:testFuzzComputeAddressNonceUint56(uint64,address) (runs: 256, μ: 532882, ~: 532964) +CreateAddressTest:testFuzzComputeAddressNonceUint64(uint64,address) (runs: 256, μ: 532916, ~: 533014) +CreateAddressTest:testFuzzComputeAddressNonceUint8(uint64,address) (runs: 256, μ: 532631, ~: 532685) CreateAddressTest:testFuzzComputeAddressRevertTooHighNonce(uint256,address) (runs: 256, μ: 12848, ~: 13145) -CreateAddressTest:testFuzzComputeAddressSelfNonce0x7f(uint64) (runs: 256, μ: 539407, ~: 539473) -CreateAddressTest:testFuzzComputeAddressSelfNonceUint16(uint64) (runs: 256, μ: 538660, ~: 538928) -CreateAddressTest:testFuzzComputeAddressSelfNonceUint24(uint64) (runs: 256, μ: 538986, ~: 539068) -CreateAddressTest:testFuzzComputeAddressSelfNonceUint32(uint64) (runs: 256, μ: 538972, ~: 539076) -CreateAddressTest:testFuzzComputeAddressSelfNonceUint40(uint64) (runs: 256, μ: 539070, ~: 539147) -CreateAddressTest:testFuzzComputeAddressSelfNonceUint48(uint64) (runs: 256, μ: 539067, ~: 539134) -CreateAddressTest:testFuzzComputeAddressSelfNonceUint56(uint64) (runs: 256, μ: 539139, ~: 539200) -CreateAddressTest:testFuzzComputeAddressSelfNonceUint64(uint64) (runs: 256, μ: 539228, ~: 539321) -CreateAddressTest:testFuzzComputeAddressSelfNonceUint8(uint64) (runs: 256, μ: 538738, ~: 538794) +CreateAddressTest:testFuzzComputeAddressSelfNonce0x7f(uint64) (runs: 256, μ: 539412, ~: 539473) +CreateAddressTest:testFuzzComputeAddressSelfNonceUint16(uint64) (runs: 256, μ: 538663, ~: 538928) +CreateAddressTest:testFuzzComputeAddressSelfNonceUint24(uint64) (runs: 256, μ: 538984, ~: 539068) +CreateAddressTest:testFuzzComputeAddressSelfNonceUint32(uint64) (runs: 256, μ: 538976, ~: 539076) +CreateAddressTest:testFuzzComputeAddressSelfNonceUint40(uint64) (runs: 256, μ: 539068, ~: 539147) +CreateAddressTest:testFuzzComputeAddressSelfNonceUint48(uint64) (runs: 256, μ: 539068, ~: 539134) +CreateAddressTest:testFuzzComputeAddressSelfNonceUint56(uint64) (runs: 256, μ: 539140, ~: 539200) +CreateAddressTest:testFuzzComputeAddressSelfNonceUint64(uint64) (runs: 256, μ: 539232, ~: 539321) +CreateAddressTest:testFuzzComputeAddressSelfNonceUint8(uint64) (runs: 256, μ: 538734, ~: 538794) CreateAddressTest:testFuzzComputeAddressSelfRevertTooHighNonce(uint256) (runs: 256, μ: 12677, ~: 12998) ECDSATest:testFuzzRecoverWithInvalidSignature(bytes,string) (runs: 256, μ: 15349, ~: 15352) ECDSATest:testFuzzRecoverWithTooLongSignature(bytes,string) (runs: 256, μ: 13782, ~: 13785) @@ -126,7 +126,7 @@ EIP712DomainSeparatorTest:testCachedDomainSeparatorV4() (gas: 10564) EIP712DomainSeparatorTest:testDomainSeparatorV4() (gas: 11709) EIP712DomainSeparatorTest:testEIP712Domain() (gas: 18055) EIP712DomainSeparatorTest:testFuzzDomainSeparatorV4(uint8) (runs: 256, μ: 11856, ~: 11884) -EIP712DomainSeparatorTest:testFuzzEIP712Domain(bytes1,uint8,bytes32,uint256[]) (runs: 256, μ: 21425, ~: 21469) +EIP712DomainSeparatorTest:testFuzzEIP712Domain(bytes1,uint8,bytes32,uint256[]) (runs: 256, μ: 21427, ~: 21469) EIP712DomainSeparatorTest:testFuzzHashTypedDataV4(address,address,uint256,uint256,uint64) (runs: 256, μ: 10659, ~: 10659) EIP712DomainSeparatorTest:testHashTypedDataV4() (gas: 13147) ERC1155Invariants:statefulFuzzOwner() (runs: 256, calls: 3840, reverts: 3480) @@ -154,35 +154,35 @@ ERC1155Test:testExistsAfterBatchMint() (gas: 128359) ERC1155Test:testExistsAfterSingleBurn() (gas: 120554) ERC1155Test:testExistsAfterSingleMint() (gas: 107205) ERC1155Test:testExistsBeforeMint() (gas: 10459) -ERC1155Test:testFuzzBurnBatchSuccess(address,uint256,uint256,uint256,uint256) (runs: 256, μ: 114433, ~: 114427) -ERC1155Test:testFuzzBurnSuccess(address,address,uint256) (runs: 256, μ: 123505, ~: 123515) +ERC1155Test:testFuzzBurnBatchSuccess(address,uint256,uint256,uint256,uint256) (runs: 256, μ: 114439, ~: 114427) +ERC1155Test:testFuzzBurnSuccess(address,address,uint256) (runs: 256, μ: 123495, ~: 123515) ERC1155Test:testFuzzRenounceOwnershipNonOwner(address) (runs: 256, μ: 13940, ~: 13940) -ERC1155Test:testFuzzRenounceOwnershipSuccess(address) (runs: 256, μ: 48744, ~: 48730) -ERC1155Test:testFuzzSafeBatchTransferFromByApprovedOperator(address,address,address,uint256,uint256,uint256,uint256,bytes) (runs: 256, μ: 196054, ~: 196043) +ERC1155Test:testFuzzRenounceOwnershipSuccess(address) (runs: 256, μ: 48745, ~: 48730) +ERC1155Test:testFuzzSafeBatchTransferFromByApprovedOperator(address,address,address,uint256,uint256,uint256,uint256,bytes) (runs: 256, μ: 196064, ~: 196043) ERC1155Test:testFuzzSafeBatchTransferFromEOAReceiver(address,address,uint256,uint256,uint256,uint256,bytes) (runs: 256, μ: 160604, ~: 160583) -ERC1155Test:testFuzzSafeBatchTransferFromNoData(address,uint256,uint256,uint256,uint256) (runs: 256, μ: 528707, ~: 528717) -ERC1155Test:testFuzzSafeBatchTransferFromWithData(address,uint256,uint256,uint256,uint256) (runs: 256, μ: 529117, ~: 529409) +ERC1155Test:testFuzzSafeBatchTransferFromNoData(address,uint256,uint256,uint256,uint256) (runs: 256, μ: 528717, ~: 528717) +ERC1155Test:testFuzzSafeBatchTransferFromWithData(address,uint256,uint256,uint256,uint256) (runs: 256, μ: 529100, ~: 529409) ERC1155Test:testFuzzSafeMintBatchEOAReceiver(address,address,uint256,uint256,uint256,uint256,bytes) (runs: 256, μ: 138142, ~: 138137) -ERC1155Test:testFuzzSafeMintBatchNoData(address,uint256,uint256,uint256,uint256) (runs: 256, μ: 500140, ~: 500150) +ERC1155Test:testFuzzSafeMintBatchNoData(address,uint256,uint256,uint256,uint256) (runs: 256, μ: 500150, ~: 500150) ERC1155Test:testFuzzSafeMintBatchNonMinter(address) (runs: 256, μ: 26539, ~: 26539) -ERC1155Test:testFuzzSafeMintBatchWithData(address,uint256,uint256,uint256,uint256) (runs: 256, μ: 500526, ~: 500689) +ERC1155Test:testFuzzSafeMintBatchWithData(address,uint256,uint256,uint256,uint256) (runs: 256, μ: 500522, ~: 500689) ERC1155Test:testFuzzSafeMintEOAReceiver(address,address,uint256,uint256,uint256,uint256,bytes) (runs: 256, μ: 140596, ~: 140578) -ERC1155Test:testFuzzSafeMintNoData(address,uint256,uint256,uint256,uint256) (runs: 256, μ: 503490, ~: 503500) +ERC1155Test:testFuzzSafeMintNoData(address,uint256,uint256,uint256,uint256) (runs: 256, μ: 503500, ~: 503500) ERC1155Test:testFuzzSafeMintNonMinter(address) (runs: 256, μ: 26140, ~: 26140) -ERC1155Test:testFuzzSafeMintWithData(address,uint256,uint256,uint256,uint256,bytes) (runs: 256, μ: 504642, ~: 504272) -ERC1155Test:testFuzzSafeTransferFromByApprovedOperator(address,address,address,uint256,uint256,uint256,uint256,bytes) (runs: 256, μ: 187729, ~: 187707) +ERC1155Test:testFuzzSafeMintWithData(address,uint256,uint256,uint256,uint256,bytes) (runs: 256, μ: 504632, ~: 504272) +ERC1155Test:testFuzzSafeTransferFromByApprovedOperator(address,address,address,uint256,uint256,uint256,uint256,bytes) (runs: 256, μ: 187739, ~: 187707) ERC1155Test:testFuzzSafeTransferFromEOAReceiver(address,address,uint256,uint256,uint256,uint256,bytes) (runs: 256, μ: 152365, ~: 152334) -ERC1155Test:testFuzzSafeTransferFromNoData(address,uint256,uint256,uint256,uint256) (runs: 256, μ: 578740, ~: 578750) -ERC1155Test:testFuzzSafeTransferFromWithData(address,uint256,uint256,uint256,uint256,bytes) (runs: 256, μ: 580847, ~: 580120) +ERC1155Test:testFuzzSafeTransferFromNoData(address,uint256,uint256,uint256,uint256) (runs: 256, μ: 578750, ~: 578750) +ERC1155Test:testFuzzSafeTransferFromWithData(address,uint256,uint256,uint256,uint256,bytes) (runs: 256, μ: 580837, ~: 580120) ERC1155Test:testFuzzSetApprovalForAllRevoke(address,address) (runs: 256, μ: 31972, ~: 31940) ERC1155Test:testFuzzSetApprovalForAllSuccess(address,address) (runs: 256, μ: 45350, ~: 45350) ERC1155Test:testFuzzSetMinterNonOwner(address,string) (runs: 256, μ: 15506, ~: 15499) ERC1155Test:testFuzzSetMinterSuccess(string) (runs: 256, μ: 33573, ~: 33584) ERC1155Test:testFuzzSetUriNonMinter(address) (runs: 256, μ: 14425, ~: 14425) -ERC1155Test:testFuzzTotalSupplyAfterBatchBurn(address,uint256,uint256,uint256,uint256) (runs: 256, μ: 108022, ~: 108016) -ERC1155Test:testFuzzTotalSupplyAfterBatchMint(address,uint256,uint256,uint256,uint256) (runs: 256, μ: 126262, ~: 126301) +ERC1155Test:testFuzzTotalSupplyAfterBatchBurn(address,uint256,uint256,uint256,uint256) (runs: 256, μ: 108028, ~: 108016) +ERC1155Test:testFuzzTotalSupplyAfterBatchMint(address,uint256,uint256,uint256,uint256) (runs: 256, μ: 126269, ~: 126301) ERC1155Test:testFuzzTotalSupplyAfterSingleBurn(address,uint256,bytes) (runs: 256, μ: 120578, ~: 120544) -ERC1155Test:testFuzzTotalSupplyAfterSingleMint(uint256,uint256,bytes) (runs: 256, μ: 76650, ~: 48267) +ERC1155Test:testFuzzTotalSupplyAfterSingleMint(uint256,uint256,bytes) (runs: 256, μ: 79682, ~: 107864) ERC1155Test:testFuzzTransferOwnershipNonOwner(address,address) (runs: 256, μ: 14049, ~: 14049) ERC1155Test:testFuzzTransferOwnershipSuccess(address,address) (runs: 256, μ: 75704, ~: 75672) ERC1155Test:testHasOwner() (gas: 12680) @@ -281,25 +281,25 @@ ERC20Test:testCachedDomainSeparator() (gas: 10601) ERC20Test:testDomainSeparator() (gas: 11831) ERC20Test:testEIP712Domain() (gas: 18230) ERC20Test:testFuzzApproveSuccess(address,uint256) (runs: 256, μ: 41131, ~: 41209) -ERC20Test:testFuzzBurnFromInsufficientAllowance(address,uint256,uint8) (runs: 256, μ: 205904, ~: 205979) -ERC20Test:testFuzzBurnFromSuccess(address,uint256) (runs: 256, μ: 339780, ~: 339644) +ERC20Test:testFuzzBurnFromInsufficientAllowance(address,uint256,uint8) (runs: 256, μ: 205968, ~: 205979) +ERC20Test:testFuzzBurnFromSuccess(address,uint256) (runs: 256, μ: 339782, ~: 339644) ERC20Test:testFuzzBurnInvalidAmount(address,uint256) (runs: 256, μ: 16404, ~: 16404) ERC20Test:testFuzzBurnSuccessCase(uint256) (runs: 256, μ: 314349, ~: 314139) ERC20Test:testFuzzDomainSeparator(uint8) (runs: 256, μ: 12039, ~: 12067) ERC20Test:testFuzzEIP712Domain(bytes1,uint8,bytes32,uint256[]) (runs: 256, μ: 21735, ~: 21785) ERC20Test:testFuzzMintNonMinter(string,uint256) (runs: 256, μ: 12934, ~: 12935) -ERC20Test:testFuzzMintSuccess(string,uint256) (runs: 256, μ: 55737, ~: 55536) +ERC20Test:testFuzzMintSuccess(string,uint256) (runs: 256, μ: 55648, ~: 55536) ERC20Test:testFuzzPermitInvalid(string,string,uint16) (runs: 256, μ: 44594, ~: 44593) ERC20Test:testFuzzPermitSuccess(string,string,uint16) (runs: 256, μ: 70587, ~: 70590) ERC20Test:testFuzzRenounceOwnershipNonOwner(address) (runs: 256, μ: 13941, ~: 13941) ERC20Test:testFuzzRenounceOwnershipSuccess(address) (runs: 256, μ: 48673, ~: 48658) ERC20Test:testFuzzSetMinterNonOwner(address,string) (runs: 256, μ: 15537, ~: 15530) ERC20Test:testFuzzSetMinterSuccess(string) (runs: 256, μ: 33594, ~: 33604) -ERC20Test:testFuzzTransferFromInsufficientAllowance(address,address,uint256,uint8) (runs: 256, μ: 204544, ~: 204594) -ERC20Test:testFuzzTransferFromSuccess(address,address,uint256) (runs: 256, μ: 233453, ~: 234154) +ERC20Test:testFuzzTransferFromInsufficientAllowance(address,address,uint256,uint8) (runs: 256, μ: 204543, ~: 204594) +ERC20Test:testFuzzTransferFromSuccess(address,address,uint256) (runs: 256, μ: 233451, ~: 234153) ERC20Test:testFuzzTransferInvalidAmount(address,address,uint256) (runs: 256, μ: 16762, ~: 16762) ERC20Test:testFuzzTransferOwnershipNonOwner(address,address) (runs: 256, μ: 14053, ~: 14053) -ERC20Test:testFuzzTransferOwnershipSuccess(address,address) (runs: 256, μ: 75668, ~: 75636) +ERC20Test:testFuzzTransferOwnershipSuccess(address,address) (runs: 256, μ: 75667, ~: 75636) ERC20Test:testFuzzTransferSuccess(address,uint256) (runs: 256, μ: 205511, ~: 205572) ERC20Test:testHasOwner() (gas: 12658) ERC20Test:testInitialSetup() (gas: 1568383) @@ -340,18 +340,18 @@ ERC2981Test:testDeleteDefaultRoyaltyNonOwner() (gas: 10674) ERC2981Test:testFuzzDeleteDefaultRoyaltyNonOwner(address) (runs: 256, μ: 13341, ~: 13341) ERC2981Test:testFuzzRenounceOwnershipNonOwner(address) (runs: 256, μ: 13913, ~: 13913) ERC2981Test:testFuzzRenounceOwnershipSuccess(address) (runs: 256, μ: 25232, ~: 25232) -ERC2981Test:testFuzzResetTokenRoyalty(address,address,uint256,uint256,uint96,uint256) (runs: 256, μ: 97519, ~: 97793) +ERC2981Test:testFuzzResetTokenRoyalty(address,address,uint256,uint256,uint96,uint256) (runs: 256, μ: 97531, ~: 97799) ERC2981Test:testFuzzResetTokenRoyaltyNonOwner(address) (runs: 256, μ: 13315, ~: 13315) -ERC2981Test:testFuzzRoyaltyInfoDefaultRoyalty(address,uint256,uint256,uint96,uint256) (runs: 256, μ: 80675, ~: 81225) -ERC2981Test:testFuzzRoyaltyInfoDeleteDefaultRoyalty(address,uint256,uint256,uint96,uint256) (runs: 256, μ: 65587, ~: 65965) -ERC2981Test:testFuzzRoyaltyInfoSetTokenRoyalty(address,address,uint256,uint256,uint96,uint256) (runs: 256, μ: 122333, ~: 122777) -ERC2981Test:testFuzzRoyaltyInfoSetTokenRoyaltyUpdate(address,address,uint256,uint256,uint96,uint256) (runs: 256, μ: 168787, ~: 169387) -ERC2981Test:testFuzzRoyaltyInfoUpdateDefaultRoyalty(address,address,uint256,uint256,uint96,uint256) (runs: 256, μ: 88724, ~: 89013) +ERC2981Test:testFuzzRoyaltyInfoDefaultRoyalty(address,uint256,uint256,uint96,uint256) (runs: 256, μ: 80691, ~: 81225) +ERC2981Test:testFuzzRoyaltyInfoDeleteDefaultRoyalty(address,uint256,uint256,uint96,uint256) (runs: 256, μ: 65599, ~: 65971) +ERC2981Test:testFuzzRoyaltyInfoSetTokenRoyalty(address,address,uint256,uint256,uint96,uint256) (runs: 256, μ: 122349, ~: 122777) +ERC2981Test:testFuzzRoyaltyInfoSetTokenRoyaltyUpdate(address,address,uint256,uint256,uint96,uint256) (runs: 256, μ: 168803, ~: 169387) +ERC2981Test:testFuzzRoyaltyInfoUpdateDefaultRoyalty(address,address,uint256,uint256,uint96,uint256) (runs: 256, μ: 88740, ~: 89013) ERC2981Test:testFuzzSetDefaultRoyaltyNonOwner(address) (runs: 256, μ: 15620, ~: 15620) -ERC2981Test:testFuzzSetDefaultRoyaltyTooHighFeeNumerator(uint96) (runs: 256, μ: 21095, ~: 20900) +ERC2981Test:testFuzzSetDefaultRoyaltyTooHighFeeNumerator(uint96) (runs: 256, μ: 21100, ~: 20900) ERC2981Test:testFuzzSetTokenRoyaltyInvalidReceiver(address) (runs: 256, μ: 18691, ~: 18691) ERC2981Test:testFuzzSetTokenRoyaltyNonOwner(address) (runs: 256, μ: 15637, ~: 15637) -ERC2981Test:testFuzzSetTokenRoyaltyTooHighFeeNumerator(uint96) (runs: 256, μ: 21113, ~: 20918) +ERC2981Test:testFuzzSetTokenRoyaltyTooHighFeeNumerator(uint96) (runs: 256, μ: 21118, ~: 20918) ERC2981Test:testFuzzTransferOwnershipNonOwner(address,address) (runs: 256, μ: 14066, ~: 14066) ERC2981Test:testFuzzTransferOwnershipSuccess(address,address) (runs: 256, μ: 30268, ~: 30268) ERC2981Test:testHasOwner() (gas: 12593) @@ -391,9 +391,9 @@ ERC4626VaultTest:testEmptyVaultDeposit() (gas: 567388) ERC4626VaultTest:testEmptyVaultMint() (gas: 568273) ERC4626VaultTest:testEmptyVaultRedeem() (gas: 202644) ERC4626VaultTest:testEmptyVaultwithdraw() (gas: 215488) -ERC4626VaultTest:testFail_redeem((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 553747, ~: 556594) -ERC4626VaultTest:testFail_withdraw((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 555557, ~: 558153) -ERC4626VaultTest:testFuzzDomainSeparator(uint8) (runs: 256, μ: 11932, ~: 11959) +ERC4626VaultTest:testFail_redeem((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 553559, ~: 556594) +ERC4626VaultTest:testFail_withdraw((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 555334, ~: 558153) +ERC4626VaultTest:testFuzzDomainSeparator(uint8) (runs: 256, μ: 11931, ~: 11959) ERC4626VaultTest:testFuzzEIP712Domain(bytes1,uint8,bytes32,uint256[]) (runs: 256, μ: 21760, ~: 21810) ERC4626VaultTest:testFuzzPermitInvalid(string,string,uint16) (runs: 256, μ: 44559, ~: 44558) ERC4626VaultTest:testFuzzPermitSuccess(string,string,uint16) (runs: 256, μ: 70491, ~: 70494) @@ -415,32 +415,32 @@ ERC4626VaultTest:testVaultInteractionsForSomeoneElse() (gas: 224169) ERC4626VaultTest:testWithdrawInsufficientAllowance() (gas: 122396) ERC4626VaultTest:testWithdrawInsufficientAssets() (gas: 117792) ERC4626VaultTest:testWithdrawWithNoAssets() (gas: 21280) -ERC4626VaultTest:test_RT_deposit_redeem((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 472493, ~: 473300) -ERC4626VaultTest:test_RT_deposit_withdraw((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 474288, ~: 474527) -ERC4626VaultTest:test_RT_mint_redeem((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 472261, ~: 473389) -ERC4626VaultTest:test_RT_mint_withdraw((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 474000, ~: 474597) -ERC4626VaultTest:test_RT_redeem_deposit((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 472761, ~: 473415) -ERC4626VaultTest:test_RT_redeem_mint((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 472866, ~: 473545) -ERC4626VaultTest:test_RT_withdraw_deposit((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 473935, ~: 474631) -ERC4626VaultTest:test_RT_withdraw_mint((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 474066, ~: 475096) -ERC4626VaultTest:test_asset((address[4],uint256[4],uint256[4],int256)) (runs: 256, μ: 424297, ~: 426405) -ERC4626VaultTest:test_convertToAssets((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 429200, ~: 430646) -ERC4626VaultTest:test_convertToShares((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 429209, ~: 430664) -ERC4626VaultTest:test_deposit((address[4],uint256[4],uint256[4],int256),uint256,uint256) (runs: 256, μ: 469913, ~: 471244) -ERC4626VaultTest:test_maxDeposit((address[4],uint256[4],uint256[4],int256)) (runs: 256, μ: 424291, ~: 426400) -ERC4626VaultTest:test_maxMint((address[4],uint256[4],uint256[4],int256)) (runs: 256, μ: 424333, ~: 426442) -ERC4626VaultTest:test_maxRedeem((address[4],uint256[4],uint256[4],int256)) (runs: 256, μ: 424431, ~: 426540) -ERC4626VaultTest:test_maxWithdraw((address[4],uint256[4],uint256[4],int256)) (runs: 256, μ: 425886, ~: 427791) -ERC4626VaultTest:test_mint((address[4],uint256[4],uint256[4],int256),uint256,uint256) (runs: 256, μ: 469965, ~: 471260) -ERC4626VaultTest:test_previewDeposit((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 464962, ~: 465896) -ERC4626VaultTest:test_previewMint((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 464760, ~: 466077) -ERC4626VaultTest:test_previewRedeem((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 467360, ~: 467342) -ERC4626VaultTest:test_previewWithdraw((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 468287, ~: 468664) -ERC4626VaultTest:test_redeem((address[4],uint256[4],uint256[4],int256),uint256,uint256) (runs: 256, μ: 472911, ~: 473952) -ERC4626VaultTest:test_totalAssets((address[4],uint256[4],uint256[4],int256)) (runs: 256, μ: 424880, ~: 426988) -ERC4626VaultTest:test_withdraw((address[4],uint256[4],uint256[4],int256),uint256,uint256) (runs: 256, μ: 474684, ~: 475143) -ERC721Invariants:statefulFuzzOwner() (runs: 256, calls: 3840, reverts: 3506) -ERC721Invariants:statefulFuzzTotalSupply() (runs: 256, calls: 3840, reverts: 3506) +ERC4626VaultTest:test_RT_deposit_redeem((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 472097, ~: 473298) +ERC4626VaultTest:test_RT_deposit_withdraw((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 474085, ~: 474527) +ERC4626VaultTest:test_RT_mint_redeem((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 471700, ~: 473389) +ERC4626VaultTest:test_RT_mint_withdraw((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 473637, ~: 474599) +ERC4626VaultTest:test_RT_redeem_deposit((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 472458, ~: 473402) +ERC4626VaultTest:test_RT_redeem_mint((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 472561, ~: 473497) +ERC4626VaultTest:test_RT_withdraw_deposit((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 473633, ~: 474586) +ERC4626VaultTest:test_RT_withdraw_mint((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 473797, ~: 474994) +ERC4626VaultTest:test_asset((address[4],uint256[4],uint256[4],int256)) (runs: 256, μ: 424308, ~: 426403) +ERC4626VaultTest:test_convertToAssets((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 428967, ~: 430647) +ERC4626VaultTest:test_convertToShares((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 428967, ~: 430663) +ERC4626VaultTest:test_deposit((address[4],uint256[4],uint256[4],int256),uint256,uint256) (runs: 256, μ: 469919, ~: 471244) +ERC4626VaultTest:test_maxDeposit((address[4],uint256[4],uint256[4],int256)) (runs: 256, μ: 424303, ~: 426397) +ERC4626VaultTest:test_maxMint((address[4],uint256[4],uint256[4],int256)) (runs: 256, μ: 424345, ~: 426440) +ERC4626VaultTest:test_maxRedeem((address[4],uint256[4],uint256[4],int256)) (runs: 256, μ: 424443, ~: 426537) +ERC4626VaultTest:test_maxWithdraw((address[4],uint256[4],uint256[4],int256)) (runs: 256, μ: 425895, ~: 427791) +ERC4626VaultTest:test_mint((address[4],uint256[4],uint256[4],int256),uint256,uint256) (runs: 256, μ: 469812, ~: 471263) +ERC4626VaultTest:test_previewDeposit((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 464507, ~: 465896) +ERC4626VaultTest:test_previewMint((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 464263, ~: 466078) +ERC4626VaultTest:test_previewRedeem((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 467109, ~: 467337) +ERC4626VaultTest:test_previewWithdraw((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 468251, ~: 468664) +ERC4626VaultTest:test_redeem((address[4],uint256[4],uint256[4],int256),uint256,uint256) (runs: 256, μ: 472970, ~: 473956) +ERC4626VaultTest:test_totalAssets((address[4],uint256[4],uint256[4],int256)) (runs: 256, μ: 424891, ~: 426986) +ERC4626VaultTest:test_withdraw((address[4],uint256[4],uint256[4],int256),uint256,uint256) (runs: 256, μ: 474750, ~: 475149) +ERC721Invariants:statefulFuzzOwner() (runs: 256, calls: 3840, reverts: 3507) +ERC721Invariants:statefulFuzzTotalSupply() (runs: 256, calls: 3840, reverts: 3507) ERC721Test:testApproveClearingApprovalWithNoPriorApproval() (gas: 177128) ERC721Test:testApproveClearingApprovalWithPriorApproval() (gas: 186030) ERC721Test:testApproveFromApprovedAddress() (gas: 198755) @@ -460,29 +460,29 @@ ERC721Test:testBurnSuccessViaApproveAndSetApprovalForAll() (gas: 371444) ERC721Test:testCachedDomainSeparator() (gas: 10624) ERC721Test:testDomainSeparator() (gas: 11921) ERC721Test:testEIP712Domain() (gas: 18341) -ERC721Test:testFuzzApproveClearingApprovalWithNoPriorApproval(address,address) (runs: 256, μ: 196808, ~: 196808) -ERC721Test:testFuzzApproveClearingApprovalWithPriorApproval(address,address) (runs: 256, μ: 184461, ~: 184461) +ERC721Test:testFuzzApproveClearingApprovalWithNoPriorApproval(address,address) (runs: 256, μ: 196798, ~: 196808) +ERC721Test:testFuzzApproveClearingApprovalWithPriorApproval(address,address) (runs: 256, μ: 184451, ~: 184461) ERC721Test:testFuzzApproveFromNonOwner(address) (runs: 256, μ: 172087, ~: 172087) ERC721Test:testFuzzApproveFromOperatorAddress(address,address,address) (runs: 256, μ: 222952, ~: 222952) -ERC721Test:testFuzzApproveWithNoPriorApproval(address,address) (runs: 256, μ: 196808, ~: 196808) -ERC721Test:testFuzzApproveWithPriorApproval(address,address) (runs: 256, μ: 204346, ~: 204346) -ERC721Test:testFuzzBurnSuccess(address) (runs: 256, μ: 305375, ~: 305368) +ERC721Test:testFuzzApproveWithNoPriorApproval(address,address) (runs: 256, μ: 196798, ~: 196808) +ERC721Test:testFuzzApproveWithPriorApproval(address,address) (runs: 256, μ: 204336, ~: 204346) +ERC721Test:testFuzzBurnSuccess(address) (runs: 256, μ: 305367, ~: 305368) ERC721Test:testFuzzDomainSeparator(uint8) (runs: 256, μ: 12040, ~: 12068) -ERC721Test:testFuzzEIP712Domain(bytes1,uint8,bytes32,uint256[]) (runs: 256, μ: 21822, ~: 21873) -ERC721Test:testFuzzGetApprovedApprovedTokenId(address,address) (runs: 256, μ: 194372, ~: 194372) +ERC721Test:testFuzzEIP712Domain(bytes1,uint8,bytes32,uint256[]) (runs: 256, μ: 21821, ~: 21859) +ERC721Test:testFuzzGetApprovedApprovedTokenId(address,address) (runs: 256, μ: 194362, ~: 194372) ERC721Test:testFuzzPermitInvalid(string,string,uint16) (runs: 256, μ: 200603, ~: 200602) ERC721Test:testFuzzPermitSuccess(string,string,uint16) (runs: 256, μ: 227051, ~: 227054) ERC721Test:testFuzzRenounceOwnershipNonOwner(address) (runs: 256, μ: 13986, ~: 13986) -ERC721Test:testFuzzRenounceOwnershipSuccess(address) (runs: 256, μ: 48667, ~: 48653) +ERC721Test:testFuzzRenounceOwnershipSuccess(address) (runs: 256, μ: 48668, ~: 48653) ERC721Test:testFuzzSafeMintNonMinter(address) (runs: 256, μ: 15693, ~: 15693) -ERC721Test:testFuzzSafeMintSuccess(address[]) (runs: 256, μ: 20944818, ~: 20615118) -ERC721Test:testFuzzSafeTransferFromWithData(address,address,address,bytes) (runs: 256, μ: 1434485, ~: 1434589) +ERC721Test:testFuzzSafeMintSuccess(address[]) (runs: 256, μ: 21504341, ~: 21574299) +ERC721Test:testFuzzSafeTransferFromWithData(address,address,address,bytes) (runs: 256, μ: 1434486, ~: 1434589) ERC721Test:testFuzzSetApprovalForAllSuccess(address,address) (runs: 256, μ: 189205, ~: 189205) ERC721Test:testFuzzSetMinterNonOwner(address,string) (runs: 256, μ: 15537, ~: 15530) ERC721Test:testFuzzSetMinterSuccess(string) (runs: 256, μ: 33649, ~: 33660) ERC721Test:testFuzzTokenByIndex(address,string[]) (runs: 256, μ: 22027488, ~: 22030064) ERC721Test:testFuzzTotalSupply(address,string[]) (runs: 256, μ: 21845139, ~: 21849392) -ERC721Test:testFuzzTransferFrom(address,address,address) (runs: 256, μ: 565005, ~: 564981) +ERC721Test:testFuzzTransferFrom(address,address,address) (runs: 256, μ: 565004, ~: 564981) ERC721Test:testFuzzTransferOwnershipNonOwner(address,address) (runs: 256, μ: 14053, ~: 14053) ERC721Test:testFuzzTransferOwnershipSuccess(address,address) (runs: 256, μ: 75765, ~: 75735) ERC721Test:testGetApprovedApprovedTokenId() (gas: 193918) @@ -547,17 +547,17 @@ ERC721Test:testTransferOwnershipToZeroAddress() (gas: 15546) MathTest:testCbrtRoundDown() (gas: 51656) MathTest:testCbrtRoundUp() (gas: 52303) MathTest:testCeilDiv() (gas: 14734) -MathTest:testFuzzCbrt(uint256,bool) (runs: 256, μ: 22390, ~: 22323) +MathTest:testFuzzCbrt(uint256,bool) (runs: 256, μ: 22387, ~: 22306) MathTest:testFuzzCeilDiv(uint256,uint256) (runs: 256, μ: 9769, ~: 9770) MathTest:testFuzzInt256Average(int256,int256) (runs: 256, μ: 8537, ~: 8537) -MathTest:testFuzzLog10(uint256,bool) (runs: 256, μ: 10382, ~: 10354) +MathTest:testFuzzLog10(uint256,bool) (runs: 256, μ: 10381, ~: 10354) MathTest:testFuzzLog2(uint256,bool) (runs: 256, μ: 10141, ~: 10184) -MathTest:testFuzzLog256(uint256,bool) (runs: 256, μ: 10231, ~: 10146) -MathTest:testFuzzMulDiv(uint256,uint256,uint256) (runs: 256, μ: 14292, ~: 14078) +MathTest:testFuzzLog256(uint256,bool) (runs: 256, μ: 10229, ~: 10146) +MathTest:testFuzzMulDiv(uint256,uint256,uint256) (runs: 256, μ: 14288, ~: 14078) MathTest:testFuzzMulDivDomain(uint256,uint256,uint256) (runs: 256, μ: 10851, ~: 10890) MathTest:testFuzzSignum(int256) (runs: 256, μ: 8486, ~: 8478) MathTest:testFuzzUint256Average(uint256,uint256) (runs: 256, μ: 8666, ~: 8666) -MathTest:testFuzzWadCbrt(uint256) (runs: 256, μ: 22271, ~: 22005) +MathTest:testFuzzWadCbrt(uint256) (runs: 256, μ: 22268, ~: 22000) MathTest:testFuzzWadExp(int256) (runs: 256, μ: 14727, ~: 15077) MathTest:testFuzzWadLn(int256) (runs: 256, μ: 16368, ~: 16116) MathTest:testInt256Average() (gas: 18843) @@ -580,8 +580,8 @@ MathTest:testWadExp() (gas: 34590) MathTest:testWadExpOverflow() (gas: 11169) MathTest:testWadLn() (gas: 31356) MathTest:testWadLnNegativeValues() (gas: 11096) -MerkleProofVerificationTest:testFuzzMultiProofVerifySingleLeaf(bytes32[],uint256) (runs: 256, μ: 262432, ~: 273878) -MerkleProofVerificationTest:testFuzzVerify(bytes32[],uint256) (runs: 256, μ: 177018, ~: 186673) +MerkleProofVerificationTest:testFuzzMultiProofVerifySingleLeaf(bytes32[],uint256) (runs: 256, μ: 262445, ~: 273998) +MerkleProofVerificationTest:testFuzzVerify(bytes32[],uint256) (runs: 256, μ: 177030, ~: 186793) MerkleProofVerificationTest:testFuzzVerifyMultiProofMultipleLeaves(bool,bool,bool) (runs: 256, μ: 45529, ~: 45520) MerkleProofVerificationTest:testInvalidMerkleMultiProof() (gas: 46754) MerkleProofVerificationTest:testInvalidMerkleProof() (gas: 18798) @@ -614,7 +614,7 @@ Ownable2StepInvariants:statefulFuzzPendingOwner() (runs: 256, calls: 3840, rever Ownable2StepTest:testAcceptOwnershipNonPendingOwner() (gas: 47330) Ownable2StepTest:testAcceptOwnershipSuccess() (gas: 40620) Ownable2StepTest:testFuzzAcceptOwnershipNonPendingOwner(address) (runs: 256, μ: 46769, ~: 46769) -Ownable2StepTest:testFuzzAcceptOwnershipSuccess(address,address) (runs: 256, μ: 67649, ~: 67617) +Ownable2StepTest:testFuzzAcceptOwnershipSuccess(address,address) (runs: 256, μ: 67648, ~: 67617) Ownable2StepTest:testFuzzPendingOwnerResetAfterRenounceOwnership(address) (runs: 256, μ: 40091, ~: 40076) Ownable2StepTest:testFuzzRenounceOwnershipNonOwner(address) (runs: 256, μ: 13872, ~: 13872) Ownable2StepTest:testFuzzRenounceOwnershipSuccess(address) (runs: 256, μ: 45378, ~: 45363) @@ -639,14 +639,14 @@ OwnableTest:testRenounceOwnershipSuccess() (gas: 17957) OwnableTest:testTransferOwnershipNonOwner() (gas: 12300) OwnableTest:testTransferOwnershipSuccess() (gas: 22138) OwnableTest:testTransferOwnershipToZeroAddress() (gas: 15450) -P256Test:testFuzzVerifyWithValidSignature(string,string) (runs: 256, μ: 973792, ~: 733509) +P256Test:testFuzzVerifyWithValidSignature(string,string) (runs: 256, μ: 977277, ~: 736993) P256Test:testVerifyWithFlippedValues() (gas: 1106984) P256Test:testVerifyWithInvalidSignature() (gas: 552149) P256Test:testVerifyWithOutOfBoundsPublicKey() (gas: 16907) P256Test:testVerifyWithTooHighSValue() (gas: 9293) P256Test:testVerifyWithValidSignature() (gas: 554143) P256Test:testVerifyWithZeroInputs() (gas: 8654) -P256Test:testVerifyWycheproofData() (gas: 230715022) +P256Test:testVerifyWycheproofData() (gas: 350911923) SignatureCheckerTest:testEIP1271NoIsValidSignatureFunction() (gas: 18866) SignatureCheckerTest:testEIP1271WithInvalidSignature(bytes,string) (runs: 256, μ: 23654, ~: 23647) SignatureCheckerTest:testEIP1271WithInvalidSignature1() (gas: 29798) @@ -665,13 +665,13 @@ SignatureCheckerTest:testFuzzEOAWithInvalidSignature(bytes,string) (runs: 256, SignatureCheckerTest:testFuzzEOAWithInvalidSigner(string,string) (runs: 256, μ: 20434, ~: 20438) SignatureCheckerTest:testFuzzEOAWithValidSignature(string,string) (runs: 256, μ: 20366, ~: 20370) SignatureCheckerTest:testInitialSetup() (gas: 8359) -TimelockControllerInvariants:statefulFuzzExecutedLessThanOrEqualToScheduled() (runs: 256, calls: 3840, reverts: 1258) -TimelockControllerInvariants:statefulFuzzExecutedProposalCancellation() (runs: 256, calls: 3840, reverts: 1287) -TimelockControllerInvariants:statefulFuzzExecutingCancelledProposal() (runs: 256, calls: 3840, reverts: 1258) -TimelockControllerInvariants:statefulFuzzExecutingNotReadyProposal() (runs: 256, calls: 3840, reverts: 1248) -TimelockControllerInvariants:statefulFuzzOnceProposalExecution() (runs: 256, calls: 3840, reverts: 1286) -TimelockControllerInvariants:statefulFuzzProposalsExecutedMatchCount() (runs: 256, calls: 3840, reverts: 1258) -TimelockControllerInvariants:statefulFuzzSumOfProposals() (runs: 256, calls: 3840, reverts: 1258) +TimelockControllerInvariants:statefulFuzzExecutedLessThanOrEqualToScheduled() (runs: 256, calls: 3840, reverts: 1260) +TimelockControllerInvariants:statefulFuzzExecutedProposalCancellation() (runs: 256, calls: 3840, reverts: 1282) +TimelockControllerInvariants:statefulFuzzExecutingCancelledProposal() (runs: 256, calls: 3840, reverts: 1210) +TimelockControllerInvariants:statefulFuzzExecutingNotReadyProposal() (runs: 256, calls: 3840, reverts: 1234) +TimelockControllerInvariants:statefulFuzzOnceProposalExecution() (runs: 256, calls: 3840, reverts: 1268) +TimelockControllerInvariants:statefulFuzzProposalsExecutedMatchCount() (runs: 256, calls: 3840, reverts: 1260) +TimelockControllerInvariants:statefulFuzzSumOfProposals() (runs: 256, calls: 3840, reverts: 1260) TimelockControllerTest:testAdminCannotBatchExecute() (gas: 750638) TimelockControllerTest:testAdminCannotBatchSchedule() (gas: 748425) TimelockControllerTest:testAdminCannotCancel() (gas: 13375) @@ -709,10 +709,10 @@ TimelockControllerTest:testExecutorCanExecute() (gas: 29474) TimelockControllerTest:testExecutorCannotBatchSchedule() (gas: 1485529) TimelockControllerTest:testExecutorCannotCancel() (gas: 15471) TimelockControllerTest:testExecutorCannotSchedule() (gas: 19139) -TimelockControllerTest:testFuzzBatchValue(uint256) (runs: 256, μ: 4650562, ~: 4650371) +TimelockControllerTest:testFuzzBatchValue(uint256) (runs: 256, μ: 4650559, ~: 4650371) TimelockControllerTest:testFuzzHashOperation(address,uint256,bytes,bytes32,bytes32) (runs: 256, μ: 10606, ~: 10586) TimelockControllerTest:testFuzzHashOperationBatch(address[],uint256[],bytes[],bytes32,bytes32) (runs: 256, μ: 1826841, ~: 1817250) -TimelockControllerTest:testFuzzOperationValue(uint256) (runs: 256, μ: 111622, ~: 111431) +TimelockControllerTest:testFuzzOperationValue(uint256) (runs: 256, μ: 111619, ~: 111431) TimelockControllerTest:testHandleERC1155() (gas: 41561916) TimelockControllerTest:testHandleERC721() (gas: 7162262) TimelockControllerTest:testHashOperation() (gas: 12368) diff --git a/lib/create-util b/lib/create-util index 1c4f3ec9..44591734 160000 --- a/lib/create-util +++ b/lib/create-util @@ -1 +1 @@ -Subproject commit 1c4f3ec9bbe6718f6bed576b1e16b0bc57a2f082 +Subproject commit 44591734d88962594f67e3b8b1566dfad80cdfb0 diff --git a/lib/solady b/lib/solady index 12dc92e5..d28bdb94 160000 --- a/lib/solady +++ b/lib/solady @@ -1 +1 @@ -Subproject commit 12dc92e5fa08d871c5c1dbf0cce83f7051e671b0 +Subproject commit d28bdb949a2edf205c29964c7ea869a7dce525cd diff --git a/src/snekmate/utils/ecdsa.vy b/src/snekmate/utils/ecdsa.vy index c21cdd34..b1c68c2c 100644 --- a/src/snekmate/utils/ecdsa.vy +++ b/src/snekmate/utils/ecdsa.vy @@ -20,9 +20,9 @@ """ -# @dev Constants used as part of the ECDSA recovery function. +# @dev The malleability threshold used as part of the ECDSA +# verification function. _MALLEABILITY_THRESHOLD: constant(uint256) = 57_896_044_618_658_097_711_785_492_504_343_953_926_418_782_139_537_452_191_302_581_570_759_080_747_168 -_SIGNATURE_INCREMENT: constant(uint256) = 57_896_044_618_658_097_711_785_492_504_343_953_926_634_992_332_820_282_019_728_792_003_956_564_819_967 @deploy @@ -102,10 +102,9 @@ def _try_recover_r_vs(hash: bytes32, r: uint256, vs: uint256) -> address: @param vs The secp256k1 32-byte short signature field of `v` and `s`. @return address The recovered 20-byte signer address. """ - s: uint256 = vs & _SIGNATURE_INCREMENT - # We do not check for an overflow here since the shift operation - # `vs >> 255` results essentially in a `uint8` type (`0` or `1`) and - # we use `uint256` as result type. + s: uint256 = vs & convert(max_value(int256), uint256) + # We do not check for an overflow here, as the shift operation + # `vs >> 255` results in `0` or `1`. v: uint256 = unsafe_add(vs >> 255, 27) return self._try_recover_vrs(hash, v, r, s) diff --git a/src/snekmate/utils/p256.vy b/src/snekmate/utils/p256.vy index 4e354bef..6f5b8f9a 100644 --- a/src/snekmate/utils/p256.vy +++ b/src/snekmate/utils/p256.vy @@ -27,6 +27,10 @@ _C: constant(uint256) = 32 # curve database: https://neuromancer.sk/std/secg/secp256r1). +# @dev The secp256r1 curve order (number of points). +_N: constant(uint256) = 115_792_089_210_356_248_762_697_446_949_407_573_529_996_955_224_135_760_342_422_259_061_068_512_044_369 + + # @dev The malleability threshold used as part of the ECDSA # verification function. _MALLEABILITY_THRESHOLD: constant(uint256) = 57_896_044_605_178_124_381_348_723_474_703_786_764_998_477_612_067_880_171_211_129_530_534_256_022_184 @@ -49,10 +53,6 @@ _GX: constant(uint256) = 48_439_561_293_906_451_759_052_585_252_797_914_202_762_ _GY: constant(uint256) = 36_134_250_956_749_795_798_585_127_919_587_881_956_611_106_672_985_015_071_877_198_253_568_414_405_109 -# @dev The secp256r1 curve order (number of points). -_N: constant(uint256) = 115_792_089_210_356_248_762_697_446_949_407_573_529_996_955_224_135_760_342_422_259_061_068_512_044_369 - - # @dev The "-2 mod _P" constant is used to speed up inversion # and doubling (avoid negation). _MINUS_2MODP: constant(uint256) = 115_792_089_210_356_248_762_697_446_949_407_573_530_086_143_415_290_314_195_533_631_308_867_097_853_949 diff --git a/test/utils/P256.t.sol b/test/utils/P256.t.sol index 19d0fccb..01f256f0 100644 --- a/test/utils/P256.t.sol +++ b/test/utils/P256.t.sol @@ -14,6 +14,8 @@ contract P256Test is Test { using BytesLib for bytes; using stdJson for string; + uint256 private constant _N = + 115_792_089_210_356_248_762_697_446_949_407_573_529_996_955_224_135_760_342_422_259_061_068_512_044_369; uint256 private constant _MALLEABILITY_THRESHOLD = 57_896_044_605_178_124_381_348_723_474_703_786_764_998_477_612_067_880_171_211_129_530_534_256_022_184; /* solhint-disable const-name-snakecase */ @@ -110,9 +112,18 @@ contract P256Test is Test { uint256 y = uint256(vector.readBytes32(".y")); bytes32 hash = vector.readBytes32(".hash"); - if (uint256(s) <= _MALLEABILITY_THRESHOLD) { + if (s <= _N) { assertEq( - P256.verify_sig(hash, r, s, x, y), + P256.verify_sig( + hash, + r, + /** + * @dev Flip the `s` parameter if it is higher than the malleability threshold. + */ + (s > _MALLEABILITY_THRESHOLD) ? (_N - s) : s, + x, + y + ), vector.readBool(".valid") ); } else { @@ -133,6 +144,7 @@ contract P256Test is Test { string calldata message ) public { (, uint256 key) = makeAddrAndKey(signer); + key = bound(key, 1, _N - 1); bytes32 hash = keccak256(abi.encode(message)); (bytes32 r, bytes32 s) = vm.signP256(key, hash); (uint256 qx, uint256 qy) = FCL_ecdsa_utils.ecdsa_derivKpub(key);