gildlab / ethgild

Other
2 stars 3 forks source link

protofire immutable values in proxies #191

Open thedavidmeister opened 2 days ago

thedavidmeister commented 2 days ago

In a few upgradeable contracts, the constructor is used to initialize immutable variables. Since the value of immutable variables is stored in the bytecode, it will be shared among all proxies pointing to a given contract instead of being stored in each proxy’s storage.

thedavidmeister commented 2 days ago

yes, the immutable values for ReceiptVault are intentional, because they're essentially extensions of the core logic and so shouldn't be modifiable across all proxies, the storage variables are named s* and are useful to change per-proxy, because you would want different assets to deposit and the receipt contract needs to be created and owned by the proxy.

the oracles are not intended for cloning and so aren't designed to be proxied, because they are stateless so any given configuration only ever needs to be deployed once, so the gas optimisation is for use not deployment (proxies cost more to call)

i don't think there are any other contracts where this is relevant, but correct me if i'm wrong?