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.
Recommendation: use a full word hash
References: Definition
|
bytes4 private _instanceType; |
The
Factorycontract wants to track types of contracts. It does this using abytes4type. It seems this is inspired from the ERC-165 standard.The baseline choice should be using a full 32 byte hash. The
bytes4costs 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
bytes4is a bad choice here.Recommendation: use a full word hash
References: Definition
erasure-protocol/contracts/modules/Factory.sol
Line 20 in 4a3d98c