0

Suppose we have a Proxy contract that forwards to call to a Logic contract by using delegatecall.

If we pause the Proxy, users will still be able to directly interact with the Logic contract. While if we pause the Logic contract, it will not have any effect on calls made to Proxy as it will just load the code and use its own storage anyway.

Is there a common known pattern to pause a contract in this situation?

0

In most cases, it would be a good idea to ensure that no one interacts with an implementation contract without going through the Proxy. Have a look at this. There is a modifier suggested for each function in the implementation contract to make sure no one ever does that. https://github.com/rob-Hitchens/TrustlessUpgrades/blob/master/contracts/Upgradable.sol

While if we pause the Logic contract, it will not have any effect on calls made to Proxy as it will just load the code and use its own storage anyway.

That doesn't seem right to me. If you pause the logic contract (properly), then when the Proxy tries to deletegatecall to it, the function should revert, which is what you want. The proxy should observe the failure and also abort.

Hope it helps.

  • Thank you for your always helpful answers. The first part is clear and seems a good solution to me but I have a question left on the second part. Pausing the logic by setting the 'paused' property to true will result in proxy reading its own 'paused' property thus having no effect on calls made to the proxy, right? So what would be the proper way of pausing the logic contract? – AleG Jul 10 at 10:26
  • It depends on the implementation, of course, but generally "pause" is no different than any other function. It sets a state variable. A function modifier checks and pausable function revert. Do that to the implementation. State resides in the Proxy, sure, but it's the implementation that decides to revert. – Rob Hitchens - B9lab Jul 10 at 14:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.