Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change DeputyGuardianModule to use a Proxy to be DeputyGuardianModuleProxy #89

Merged
merged 4 commits into from
Oct 22, 2024

Conversation

Ethnical
Copy link
Contributor

@Ethnical Ethnical commented Sep 23, 2024

Introduce a proposal that will prevent to regenerate the PSPs and make some unnecessary changes to the guardian contract each time we update the DeputyGuardianModule code.
As discussed here on discord.

@Ethnical Ethnical marked this pull request as ready for review September 24, 2024 15:15
@Ethnical Ethnical changed the title WIP: Make the DeputyGuardianModule a Proxy Refactor DeputyGuardianModule to use a Proxy and be DeputyGuardianModuleProxy Sep 24, 2024
@Ethnical Ethnical changed the title Refactor DeputyGuardianModule to use a Proxy and be DeputyGuardianModuleProxy Change DeputyGuardianModule to use a Proxy to be DeputyGuardianModuleProxy Sep 24, 2024
@Ethnical Ethnical added documentation Improvements or additions to documentation enhancement New feature or request labels Sep 24, 2024
Copy link
Contributor

@Inphi Inphi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Pretty slick.

It appears that we'll never have a need to destroy or replace a PSP. If not, when could that happens?

Copy link
Contributor

@ajsutton ajsutton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes a lot of sense to me - we should be able to modify the deputy guardian module without invalidating PSPs. Ensuring only the security council can perform that upgrade preserves the security properties of the system so the deputy guardian is still restricted in the actions they can perform and the security council is in control.

@Ethnical
Copy link
Contributor Author

It appears that we'll never have a need to destroy or replace a PSP. If not, when could that happens?
@Inphi Good point, I will highlight the way to have invalidated PSPs into the new system.

  1. The first cause of invalidated the PSPs is Nonces of the FoS increase too much so made monitoring for this op-defender and oncall should be aware about it.
  2. If there is breaking changes on the smart contracts on L1. For example, the SuperchainConfig is updated. Or the Guardian overwrite the list of the modules that can execute action. Really unlikely, but worth noting.

![image](https://github.com/user-attachments/assets/099258f4-19fb-44b8-84e9-670b78a2f868)

Here we propose some modification of the architecture with a proxy contract on top of the `DeputyGuardianModule`, this will allow us to upgrade the `DeputyGuardianModule` and keeping the same address.
Thus, this will not invalidate the PSPs and we will not need to regenerate new PSPs each time we upgrade the `DeputyGuardianModule`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will invalidate the PSPs when we replace the DGM with the proxy though right? Perhaps we should wait until we need to upgrade the DGM for another reason, and then move to a proxy at the same time.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will invalidate the PSPs when we replace the DGM with the proxy though right?

This is correct.

Perhaps we should wait until we need to upgrade the DGM for another reason

Yes this is the idea! With Incident Response Improvements We will do the upgrade during the improvements of our incident response SC on L1.
I should write this down somewhere.

Here we propose some modification of the architecture with a proxy contract on top of the `DeputyGuardianModule`, this will allow us to upgrade the `DeputyGuardianModule` and keeping the same address.
Thus, this will not invalidate the PSPs and we will not need to regenerate new PSPs each time we upgrade the `DeputyGuardianModule`.

The owner of the proxy contract `DeputyGuardianModuleProxy` would be the `Security Council` as the `DeputyGuardianModule` is doing action into the `Guardian` contract that is owned by the `Security Council`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should think a bit more about whether the proxy owner should be:

  1. The L1 ProxyAdmin: This has the benefit of an upgrade path that is most like the other contracts.
  2. The 2 of 2: This has the same upgrade auth as other contracts, but a different path as it skips the L1 ProxyAdmin. I don't like it.
  3. The Security Council: This would makes sense as the Security Council should have full control over the DGM, but it can already disable/replace the DGM via the Safe's ModuleManager functionality.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it can already disable/replace the DGM via the Safe's ModuleManager functionality.

I think we should discuss about it during the review, I am not sure to follow this point there.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Decision: we will make it the 2of2 (L1 ProxyAdmin owner), this prevents us from needing a separate upgrade transaction for the DGM, without weakening the Security Council's ability to remove/replace the module.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I missed this design review so not sure if this was discussed—Do we need to run this decision by @sammcingvale or L2Beat to verify there's no reason it might cause a change in stage 1 status? Intuitively it feels like the SC is the right owner, since it's the SC's module, and the rationale is we're choosing the 2 of 2 to simplify operations by reducing the number of playbooks?

Copy link
Contributor Author

@Ethnical Ethnical Oct 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point @mds1!
I didn't thought about the L2Beat during the meeting!
We should definitely make sure we are not going in the correct decision will reach @sammcingvale in the meanwhile.

A potential issue can occur with the PSPs coverage.
During the upgrade the PSPs are going to be invalid so we need to make sure to presign new PSPs with the new `DeputyGuardianModuleProxy` address and simulate the PSPs accordingly.

Now, we are using a proxy executing the same actions than before will cost a more gas. We should ensure there no previous call that can run out of gas (really unlikely).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean by "previous call that can run out of gas"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

previous call that can run out of gas?

First, this should not happen (this is extremely unlikely).
But, as I don't know the full components used with the DGM, it is possible that some hardcoded call are made with a certain amount of gas to the DGM (with automated code for switching automatically to certain game type or automatically call pause() or unpause() like Automated Pause or automated game switcher).
Since the delegatecall will now be replacing the previous normal call into the DGM as this is a proxy this will be more expensive and can lead to DoS if there is hardcoded gas limit in some code that called the DGM methods automatically.

@Ethnical
Copy link
Contributor Author

I have merged the change for the gap PSPs:
ethereum-optimism/superchain-ops#347
Also, Eli told us this is not suppose the cause issue with l2beat so we are good to merge this final doc review.

@Ethnical Ethnical merged commit 78c8568 into main Oct 22, 2024
@Ethnical Ethnical deleted the ethni/dgm-proxy branch October 22, 2024 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants