From a1a991bc67a09875dd04ada6b2e6b277a8b69c2d Mon Sep 17 00:00:00 2001 From: cygaar Date: Thu, 8 Dec 2022 11:39:46 -0800 Subject: [PATCH 1/2] Add natspec --- src/OperatorFilterer.sol | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/OperatorFilterer.sol b/src/OperatorFilterer.sol index a77bb77..1adb285 100644 --- a/src/OperatorFilterer.sol +++ b/src/OperatorFilterer.sol @@ -13,6 +13,9 @@ abstract contract OperatorFilterer { /// @dev The OpenSea operator filter registry. address internal constant _OPERATOR_FILTER_REGISTRY = 0x000000000000AAeB6D7670E522A718067333cd4E; + /// @dev The bit mask used to remove any dirty bits in an address. + uint256 private constant _CLEAN_ADDR_MASK = (1 << 160) - 1; + /// @dev Registers the current contract to OpenSea's operator filter, /// and subscribe to the default OpenSea operator blocklist. /// Note: Will not revert nor update existing settings for repeated registration. @@ -31,7 +34,7 @@ abstract contract OperatorFilterer { let functionSelector := 0x7d3e3dbe // `registerAndSubscribe(address,address)`. // Clean the upper 96 bits of `subscriptionOrRegistrantToCopy` in case they are dirty. - subscriptionOrRegistrantToCopy := shr(96, shl(96, subscriptionOrRegistrantToCopy)) + subscriptionOrRegistrantToCopy := and(subscriptionOrRegistrantToCopy, _CLEAN_ADDR_MASK) for {} iszero(subscribe) {} { if iszero(subscriptionOrRegistrantToCopy) { From 72257552b5c62a1050c313f8937e1bd353836aeb Mon Sep 17 00:00:00 2001 From: cygaar Date: Thu, 8 Dec 2022 11:41:43 -0800 Subject: [PATCH 2/2] Update snapshot --- .gas-snapshot | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.gas-snapshot b/.gas-snapshot index b41d35d..9ec9c17 100644 --- a/.gas-snapshot +++ b/.gas-snapshot @@ -80,16 +80,16 @@ OperatorFilterRegistryTest:testUpdateOperators_CannotUpdateWhileSubscribed() (ga OperatorFilterRegistryTest:testUpdateOperators_OnlyAddressOrOwner() (gas: 18782) OperatorFilterRegistryTest:testUpdateOperators_notRegistered() (gas: 13599) OperatorFilterRegistryTest:testUpdateOperators_unfilter() (gas: 133965) -OperatorFiltererTest:testConstructor_copy() (gas: 238316) -OperatorFiltererTest:testConstructor_subscribe() (gas: 157548) -OperatorFiltererTest:testConstructory_noSubscribeOrCopy() (gas: 308570) +OperatorFiltererTest:testConstructor_copy() (gas: 238315) +OperatorFiltererTest:testConstructor_subscribe() (gas: 157547) +OperatorFiltererTest:testConstructory_noSubscribeOrCopy() (gas: 308569) OperatorFiltererTest:testFilter() (gas: 40886) OperatorFiltererTest:testFilterWithMsgSenderGas() (gas: 5589) OperatorFiltererTest:testFilterWithMsgSenderOriginalGas() (gas: 8268) OperatorFiltererTest:testFilterWithOperatorGas() (gas: 18132) OperatorFiltererTest:testFilterWithOperatorOriginalGas() (gas: 18498) -OperatorFiltererTest:testRegisterNonExistentRegistryDoesNotRevert() (gas: 103746) -OperatorFiltererTest:testRegistryNotDeployedDoesNotRevert() (gas: 278432) +OperatorFiltererTest:testRegisterNonExistentRegistryDoesNotRevert() (gas: 103744) +OperatorFiltererTest:testRegistryNotDeployedDoesNotRevert() (gas: 278431) OperatorFiltererTest:testConstructor() (gas: 87287) PriorityOperatorFiltererTest:testPriorityFilter() (gas: 100485) PriorityOperatorFiltererTest:testPriorityFilterWithMsgSenderGas() (gas: 5568) @@ -105,30 +105,30 @@ ExampleERC721Test:testExclusionExceptionDoesNotApplyToOperators() (gas: 151947) ExampleERC721Test:testFilter() (gas: 55543) ExampleERC721Test:testOwnersNotExcluded() (gas: 124039) ExampleERC721Test:testOwnersNotExcludedSafeTransfer() (gas: 162272) -ExampleERC721Test:testRepeatRegistrationOk() (gas: 5914480) +ExampleERC721Test:testRepeatRegistrationOk() (gas: 5914479) ExampleERC721Test:testSetOperatorFilteringEnabled() (gas: 6246860) ExampleERC721ATest:testExcludeApprovals() (gas: 149484) ExampleERC721ATest:testExclusionExceptionDoesNotApplyToOperators() (gas: 173534) ExampleERC721ATest:testFilter() (gas: 55426) ExampleERC721ATest:testOwnersNotExcluded() (gas: 164799) ExampleERC721ATest:testOwnersNotExcludedSafeTransfer() (gas: 203104) -ExampleERC721ATest:testRepeatRegistrationOk() (gas: 4941288) +ExampleERC721ATest:testRepeatRegistrationOk() (gas: 4941287) ExampleERC721ATest:testSetOperatorFilteringEnabled() (gas: 5273669) ExampleER1155UpgradeableTest:testExcludeApprovals() (gas: 99556) ExampleER1155UpgradeableTest:testExclusionExceptionDoesNotApplyToOperators() (gas: 131416) ExampleER1155UpgradeableTest:testFilter() (gas: 38684) ExampleER1155UpgradeableTest:testOwnersNotExcluded() (gas: 106349) ExampleER1155UpgradeableTest:testOwnersNotExcludedBatch() (gas: 109587) -ExampleER1155UpgradeableTest:testUpgradeable() (gas: 1709546) +ExampleER1155UpgradeableTest:testUpgradeable() (gas: 1709545) ExampleERC721AUpgradeableTest:testExcludeApprovals() (gas: 145158) ExampleERC721AUpgradeableTest:testExclusionExceptionDoesNotApplyToOperators() (gas: 171273) ExampleERC721AUpgradeableTest:testFilter() (gas: 49268) ExampleERC721AUpgradeableTest:testOwnersNotExcluded() (gas: 164886) ExampleERC721AUpgradeableTest:testOwnersNotExcludedSafeTransfer() (gas: 203226) -ExampleERC721AUpgradeableTest:testUpgradeable() (gas: 1756936) +ExampleERC721AUpgradeableTest:testUpgradeable() (gas: 1756935) ExampleERC721UpgradeableTest:testExcludeApprovals() (gas: 123499) ExampleERC721UpgradeableTest:testExclusionExceptionDoesNotApplyToOperators() (gas: 149690) ExampleERC721UpgradeableTest:testFilter() (gas: 49296) ExampleERC721UpgradeableTest:testOwnersNotExcluded() (gas: 124107) ExampleERC721UpgradeableTest:testOwnersNotExcludedSafeTransfer() (gas: 162453) -ExampleERC721UpgradeableTest:testUpgradeable() (gas: 1604287) +ExampleERC721UpgradeableTest:testUpgradeable() (gas: 1604286)