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

1.4.1: Backport SafeToL2Setup contract #800

Merged
merged 2 commits into from
Jul 24, 2024

Conversation

mmv08
Copy link
Member

@mmv08 mmv08 commented Jul 23, 2024

A follow up to #795 completely fixing #781.

This PR migrates:

And adjusts the tests for ethers v5

This PR introduces a setup contract that can be called from the `Safe`
setup function in order to automatically promote a Safe at setup time if
the code is executing on an L2. Namely, this allows the Safe Proxy
factory to use a single singleton and initializer for all chains, but
end up with different `singleton`s depending on the chain ID.

The expected use of this contract is to use the standard proxy factory:

```solidity
Safe l1Singleton;
SafeL2 l2Singleton;
SafeToL2Setup l2Setup;

proxyFactory.createProxyWithNonce(
    address(l1Singleton),
    abi.encodeCall(
        l1Singleton.setup,
        (
            owners,
            threshold,
            address(l2Setup),
            abi.encodeCall(l2Setup.setupToL2, address(l2Singleton)),
            fallbackHandler,
            paymentToken,
            payment,
            paymentReceiver
        )
    ),
    saltNonce
)
```

On L1 (i.e. Ethereum Mainnet where `chainId == 1`), you would end up
with a Safe where `safe.singleton == l1Singleton` and on any other
chains, you would end up with `safe.singleton == l2Singleton`. This
would happen _before_ the first transaction.

---------

Co-authored-by: Mikhail <[email protected]>
@mmv08 mmv08 requested review from a team, nlordell, akshay-ap and remedcu and removed request for a team July 23, 2024 17:01
@mmv08 mmv08 force-pushed the 1.4.1/backport-safetol2setup-contract branch from 4b6d1c6 to ff45dc3 Compare July 23, 2024 17:01
@mmv08 mmv08 force-pushed the 1.4.1/backport-safetol2setup-contract branch from ff45dc3 to 6ec7e88 Compare July 23, 2024 17:02
@coveralls
Copy link

coveralls commented Jul 23, 2024

Pull Request Test Coverage Report for Build 10063161129

Details

  • 12 of 12 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.03%) to 94.098%

Totals Coverage Status
Change from base Build 10058981375: 0.03%
Covered Lines: 376
Relevant Lines: 391

💛 - Coveralls

@mmv08
Copy link
Member Author

mmv08 commented Jul 24, 2024

The coverall job is failing, but it was fixed later for 1.5.0: bbd9918

lmk if I should backmerge the fix

@nlordell
Copy link
Collaborator

lmk if I should backmerge the fix

I would - makes developing on the release/v1.4.1 branch easier.

@nlordell
Copy link
Collaborator

(Can be a separate PR targetting the branch directly IMO).

@mmv08 mmv08 merged commit e69f6f0 into release/v1.4.1-2 Jul 24, 2024
10 of 11 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Jul 24, 2024
@mmv08 mmv08 deleted the 1.4.1/backport-safetol2setup-contract branch July 24, 2024 10:24
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants