1.4.1: Backport SafeToL2Setup contract#800
Merged
Merged
Conversation
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 <16622558+mmv08@users.noreply.github.com>
4b6d1c6 to
ff45dc3
Compare
ff45dc3 to
6ec7e88
Compare
Pull Request Test Coverage Report for Build 10063161129Details
💛 - Coveralls |
Contributor
Author
|
The coverall job is failing, but it was fixed later for 1.5.0: bbd9918 lmk if I should backmerge the fix |
Collaborator
I would - makes developing on the |
Collaborator
|
(Can be a separate PR targetting the branch directly IMO). |
nlordell
approved these changes
Jul 24, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A follow up to #795 completely fixing #781.
This PR migrates:
And adjusts the tests for ethers v5