Hi. I am using hardhat upgrades plugin to deploy my proxy, proxy admin and implementation contract. Afterwards, I use a script to extract the addresses of all the deployed contracts from the generated rinkeby.json file into a separate file. Under the "impls" field, I do not understand what's the first field which is a very long address b0beb24c340350c72510cfb042b4f6509cf9f8998aab5b2eb3d142006c3c8aab. Here is a screenshot of my rinkeby.json file.
Hi @Maham_Zaidi,
That string is a version identifier used by the upgrades plugins to identify different versions of implementation contracts. It is a hash of the implementation contract's init bytecode, so any changes to the implementation contract logic would result in a different version identifier.
Hi, out of curiosity, how is this hash computed? Which hashing function is used and what information is included in it? Is it the entire object after the identifier ?
{"address":"0x123", "txHash":"0x9876", "layout":{ "storage":[], "types":{} }}
Thanks!
It uses a keccak256 hash of the linked bytecode without the metadata part (although it does some transformations before hashing). You can find the implementation here: https://github.com/OpenZeppelin/openzeppelin-upgrades/blob/a77c68c3362a0631b9a9a6169a44b7fe822a98f5/packages/core/src/version.ts#L15