consensus-shipyard / ipc

🌳 Spawn multi-level trees of customized, scalable, EVM-compatible networks with IPC. L2++ powered by FVM, Wasm, libp2p, IPFS/IPLD, and CometBFT.
https://ipc.space
Apache License 2.0
43 stars 39 forks source link

Remove ERC165 from diamonds #11

Closed snissn closed 7 months ago

snissn commented 10 months ago

The diamond standard example is manually setting the supportedInterfaces variable to match how the example is configured.

ds.supportedInterfaces[type(IERC165).interfaceId] = true;
ds.supportedInterfaces[type(IDiamondCut).interfaceId] = true;
ds.supportedInterfaces[type(IDiamondLoupe).interfaceId] = true;
ds.supportedInterfaces[type(IERC173).interfaceId] = true;

From following the example we have similar code. However I do not know exactly the need and meaning behidn this. How I currently understand this, I think that when we add our custom facets to our gateway, subnet actor and subnet registry actor we are also supposed to update this variable. And likewise we would have to update it when we do upgrades if we remove unused facets.

Considering we do not ever use this variables and use the diamondLoupe feature specifically to see what functions are in the diamond I think we should remove any references to the supportedInterfaces variable

Personally I haven't used or seen ERC165 before and don't particularly see it helping us in this project. https://eips.ethereum.org/EIPS/eip-165#implementation

chatgpt: ERC-165 is a technical standard used for Ethereum smart contracts. It provides a way for smart contracts to publish and detect what interfaces they implement. This is important for interoperability between contracts in the Ethereum network.

For instance, a smart contract can announce that it adheres to ERC-721 (the standard for non-fungible tokens, or NFTs) by implementing the interface specified in ERC-165. This makes it easier for other contracts and applications to interact with it, knowing what kind of functionality to expect. ERC-165 helps in determining whether a smart contract has certain functions, reducing the likelihood of errors and enabling more complex behaviors in the decentralized finance (DeFi) and wider Ethereum ecosystem.
linear[bot] commented 10 months ago

IPC-32 Remove ERC165 from diamonds