5afe / contract-proxy-kit

Enable batched transactions and contract account interactions using a unique deterministic Gnosis Safe.
103 stars 38 forks source link

Factory methods to return Proxy's extcodehash and runtimeCode #31

Open gitpusha opened 4 years ago

gitpusha commented 4 years ago

It would be great if the CPK Factory had two pure methods that returned the 👍

  1. extcodehash of the Proxy being deployed
  2. runtimCode (because why not)

This way protocols that want to do some Proxy verification/identification have a trivial way of comparing the calling Proxy's extcodehash against that from the CPK Factory.

The mastercopy is already queriable, which would then make a sound on-chain Gnosis Proxy identification and verification procedure possible and trivial.

cag commented 4 years ago

In principle, I don't oppose this. Still, I feel like a lot of what needs to be verified is actually in the storage of the proxy instance. Some proxy verification/identification may be done, but I guess depending on the question "what are you trying to protect users from," it might be prudent to consider what checking the extcodehash won't do (for example, it won't protect from bad storage setups from arbitrary factories deploying the same proxy code).