sourcify icon indicating copy to clipboard operation
sourcify copied to clipboard

Returning create2 contracts when a contract is requested on a chain

Open kuzdogan opened this issue 2 years ago • 1 comments

Following the create2 verification support, we might better be returning those create2 verified contracts whenever they are requested on another chain. Currently, we only return them only if the chainId 0 is included in a checkByAddess request. That's how we are showing it on the Lookup UI (example contract: 0x948524e32Dc168fD6cbbb32A67028dDc24D52557)

Some considerations might be:

  • How do we return it in checkByAddress if it wasn't included in the request
  • How do we return it when files are accessed over https://repo.sourcify.dev/
    • Should https://repo.sourcify.dev/contracts/full_match/11155111/0x948524e32Dc168fD6cbbb32A67028dDc24D52557/metadata.json respond https://repo.sourcify.dev/contracts/full_match/0/0x948524e32Dc168fD6cbbb32A67028dDc24D52557/metadata.json? Even if the contract is not deployed?
  • How do we display on the UI repo
    • E.g. should https://repo.sourcify.dev/contracts/full_match/11155111/0x948524e32Dc168fD6cbbb32A67028dDc24D52557/ redirect to https://repo.sourcify.dev/contracts/full_match/0/0x948524e32Dc168fD6cbbb32A67028dDc24D52557/ ?
  • How do we handle it in static file serving endpoint on server /repository ?
    • E.g. https://sourcify.dev/server/repository/contracts/full_match/11155111/0x948524e32Dc168fD6cbbb32A67028dDc24D52557/metadata.json Adding this issue just as a tracker without any immediate TODOs

kuzdogan avatar May 04 '23 10:05 kuzdogan

I'll leave here my optionions regarding the questions above:

Some considerations might be:

  • How do we return it in checkByAddress if it wasn't included in the request
    • maybe we can always check if the contract is create2 verified even if 0 is not included
  • For all the other questions:
    • we must redirect the user when accessing the file through the API
    • we can redirect with the repo (h5ai) with some customization
    • we cannot redirect if accessed through IPFS
    • the solution that would solve this is adding a symlink into every chain that points to /0/0x... (what are the pros and the cons?)

marcocastignoli avatar May 04 '23 11:05 marcocastignoli