openzeppelin-contracts icon indicating copy to clipboard operation
openzeppelin-contracts copied to clipboard

Inconsistency between the code and the doc of IERC1820Registry.setInterfaceImplementer

Open DocCon-team opened this issue 3 years ago • 3 comments

Hi,

The doc of the function IERC1820Registry.setInterfaceImplementer references a parameter name interfaceHash, which is different from the actual parameter name _interfaceHash.

https://github.com/OpenZeppelin/openzeppelin-contracts/blob/fcf35e5722847f5eadaaee052968a8a54d03622a/contracts/utils/introspection/IERC1820Registry.sol#L61-L70

The function IERC1820Registry.getInterfaceImplementer also has the same issue.

https://github.com/OpenZeppelin/openzeppelin-contracts/blob/fcf35e5722847f5eadaaee052968a8a54d03622a/contracts/utils/introspection/IERC1820Registry.sol#L74-L82

Could you please check it?

Thanks.

DocCon-team avatar Apr 29 '22 02:04 DocCon-team

Hey i'm new to contributing I don't mind updating this in the code, If i'm not mistaken I can't see a reason to have the argument named _interfaceHash, apart from this being an interface for this contract - https://eips.ethereum.org/EIPS/eip-1820#erc-1820-registry-smart-contract Which has this function implemented as - function setInterfaceImplementer(address _addr, bytes32 _interfaceHash, address _implementer) Maybe someone was trying to keep the argument names consistent with that? But looks as though you can name them as you wish.

gitChimp88 avatar May 17 '22 10:05 gitChimp88

interfaceHash is a function name defined by IERC1820. This means that using the same name for a parameter would trigger a warning (name shadowing). This is why we prefix the param name with an underscore (that is usually the way we go when there is a name conflict)

Amxx avatar May 17 '22 14:05 Amxx

"This means that using the same name for a parameter would trigger a warning (name shadowing)" Ah I didn't know this (still learning) :)

gitChimp88 avatar May 17 '22 15:05 gitChimp88