Skip to content

Factory uses bytes4 to track instanceTypes, this is unjustifiably restrictive #278

@fulldecent

Description

@fulldecent

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;

Metadata

Metadata

Assignees

No one assigned

    Labels

    Breaking ChangesBreaking changes to the interface or architecture

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions