The Factory contract wants to track types of contracts. It does this using a bytes4 type. It seems this is inspired from the ERC-165 standard.
The baseline choice should be using a full 32 byte hash. The bytes4 costs more gas to store, retrieve and compare (EVM stores a whole word, Solidity handles truncation) also it has less collision resistance.
As an author of ERC-165 I think bytes4 is a bad choice here.
The
Factory
contract wants to track types of contracts. It does this using abytes4
type. It seems this is inspired from the ERC-165 standard.The baseline choice should be using a full 32 byte hash. The
bytes4
costs more gas to store, retrieve and compare (EVM stores a whole word, Solidity handles truncation) also it has less collision resistance.As an author of ERC-165 I think
bytes4
is a bad choice here.Recommendation: use a full word hash
References: Definition https://github.com/erasureprotocol/erasure-protocol/blob/4a3d98ce023a264a9f3c7ba62ef77a9207bba5fe/contracts/modules/Factory.sol#L20