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

Check for correct contract when importing proxy implementation

Open ericglau opened this issue 3 years ago • 1 comments

Currently the forceImport function does not check whether the user provided contract source code matches with the contract deployed at the implementation address.

Perform some checks when importing (perhaps in a separate function which does not "force" the import). This can include trying to compare the metadata hash, and if that fails, falling back to contract bytecode comparison (which does not work for cases where immutable variables or constructors are used).

ericglau avatar Jun 21 '22 15:06 ericglau

The key part here is the metadata hash as it enables us to check even in the presence of immutable variables. See Contract Metadata.

frangio avatar Jun 24 '22 18:06 frangio