ProjectOpenSea / operator-filter-registry

MIT License
312 stars 89 forks source link

fix unreachable code: `revert OperatorNotAllowed(operator);` #79

Closed felipelincoln closed 1 year ago

felipelincoln commented 1 year ago

The following line /src/OperatorFilterer.sol#L56 is unreachable because isOperatorAllowed/2 can only return true or throw the errors AddressFiltered/1 and CodeHashFiltered/2.

To fix it and also make it compatible with documentation:

isOperatorAllowed will return true. Otherwise, isOperatorAllowed will return false

-- /README.md#updatecodehash

This PR refactors isOperatorAllowed/2 removing the reverts and returning false instead.

felipelincoln commented 1 year ago

TODO: fix tests

haowang1013 commented 1 year ago

I'm also bothered by the problem "fixed" in this PR but as I understand it the registry contract is not upradable so it's likely that it'll never get fixed on-chain...