-
Notifications
You must be signed in to change notification settings - Fork 153
Simplify nested ownership transfer #302
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,10 @@ | ||
OP_COMMIT=dff5f16c510e7f44f1be0574372ccb08bfec045c | ||
BASE_CONTRACTS_COMMIT=d98da18a2732b97d6318ebd9e73708e3eea84ffe | ||
OP_COMMIT=2073f4059bd806af3e8b76b820aa3fa0b42016d0 | ||
BASE_CONTRACTS_COMMIT=cdedd0fe728eb1f9d63eaa4c6e59138cfb3803d3 | ||
|
||
# 3-of-6 | ||
OWNER_SAFE=0x9855054731540A48b28990B63DcF4f33d8AE46A1 | ||
L1_GNOSIS_SAFE_IMPLEMENTATION=0x41675C099F32341bf84BFc5382aF534df5C7461a | ||
L1_GNOSIS_COMPATIBILITY_FALLBACK_HANDLER=0xfd0732Dc9E303f09fCEf3a7388Ad10A83459Ec99 | ||
|
||
# 2-of-2 | ||
SIGNER_TO_ADD= | ||
SIGNER_TO_KEEP= | ||
OWNER_SAFE=0x9855054731540A48b28990B63DcF4f33d8AE46A1 | ||
|
||
# 7-of-10 | ||
NESTED_SIGNER_TO_ADD= | ||
SAFE_B_OWNERS_ENCODED= | ||
SAFE_B_THRESHOLD=7 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,68 +6,21 @@ ifndef LEDGER_ACCOUNT | |
override LEDGER_ACCOUNT = 0 | ||
endif | ||
|
||
## | ||
# MultisigBuilder commands | ||
## | ||
.PHONY: deps | ||
deps: | ||
forge install --no-git safe-global/safe-smart-account@21dc82410445637820f600c7399a804ad55841d5 | ||
|
||
.PHONY: sign-add-signer | ||
sign-add-signer: | ||
$(GOPATH)/bin/eip712sign --ledger --hd-paths "m/44'/60'/$(LEDGER_ACCOUNT)'/0/0" -- \ | ||
forge script --rpc-url $(L1_RPC_URL) AddSigner --sig "sign()" | ||
|
||
.PHONY: run-add-signer | ||
run-add-signer: | ||
forge script --rpc-url $(L1_RPC_URL) \ | ||
AddSigner --sig "run(bytes)" $(SIGNATURES) \ | ||
--ledger --hd-paths "m/44'/60'/$(LEDGER_ACCOUNT)'/0/0" \ | ||
--broadcast | ||
|
||
.PHONY: sign-remove-signer | ||
sign-remove-signer: | ||
$(GOPATH)/bin/eip712sign --ledger --hd-paths "m/44'/60'/$(LEDGER_ACCOUNT)'/0/0" -- \ | ||
forge script --rpc-url $(L1_RPC_URL) RemoveSigner --sig "sign()" | ||
|
||
.PHONY: run-remove-signer | ||
run-remove-signer: | ||
forge script --rpc-url $(L1_RPC_URL) \ | ||
RemoveSigner --sig "run(bytes)" $(SIGNATURES) \ | ||
--ledger --hd-paths "m/44'/60'/$(LEDGER_ACCOUNT)'/0/0" \ | ||
--broadcast | ||
|
||
## | ||
# NestedMultisigBuilder commands | ||
## | ||
.PHONY: deploy | ||
deploy: | ||
forge script --rpc-url $(L1_RPC_URL) DeploySafes --account testnet-admin --broadcast -vvvv | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
.PHONY: sign-add-nested-signer | ||
sign-add-nested-signer: | ||
.PHONY: sign | ||
sign: | ||
$(GOPATH)/bin/eip712sign --ledger --hd-paths "m/44'/60'/$(LEDGER_ACCOUNT)'/0/0" -- \ | ||
forge script --rpc-url $(L1_RPC_URL) AddNestedSigner \ | ||
--sig "sign(address)" $(SIGNER_TO_ADD) | ||
|
||
.PHONY: approve-add-nested-signer | ||
approve-add-nested-signer: | ||
forge script --rpc-url $(L1_RPC_URL) AddNestedSigner \ | ||
--sig "approve(address,bytes)" $(SIGNER_TO_ADD) $(SIGNATURES) \ | ||
--ledger --hd-paths "m/44'/60'/$(LEDGER_ACCOUNT)'/0/0" --broadcast | ||
|
||
.PHONY: execute-add-nested-signer | ||
execute-add-nested-signer: | ||
forge script --rpc-url $(L1_RPC_URL) AddNestedSigner \ | ||
--sig "run()" --ledger --hd-paths "m/44'/60'/$(LEDGER_ACCOUNT)'/0/0" --broadcast | ||
|
||
.PHONY: sign-set-threshold | ||
sign-set-threshold: | ||
$(GOPATH)/bin/eip712sign --ledger --hd-paths "m/44'/60'/$(LEDGER_ACCOUNT)'/0/0" -- \ | ||
forge script --rpc-url $(L1_RPC_URL) SetThreshold \ | ||
--sig "sign(address)" $(NESTED_SIGNER_TO_ADD) | ||
|
||
.PHONY: approve-set-threshold | ||
approve-set-threshold: | ||
forge script --rpc-url $(L1_RPC_URL) SetThreshold \ | ||
--sig "approve(address,bytes)" $(NESTED_SIGNER_TO_ADD) $(SIGNATURES) \ | ||
--ledger --hd-paths "m/44'/60'/$(LEDGER_ACCOUNT)'/0/0" --broadcast | ||
forge script --rpc-url $(L1_RPC_URL) UpdateSigners --sig "sign()" | ||
|
||
.PHONY: execute-set-threshold | ||
execute-set-threshold: | ||
forge script --rpc-url $(L1_RPC_URL) SetThreshold \ | ||
--sig "run()" --ledger --hd-paths "m/44'/60'/$(LEDGER_ACCOUNT)'/0/0" --broadcast | ||
.PHONY: execute | ||
execute: | ||
forge script --rpc-url $(L1_RPC_URL) UpdateSigners \ | ||
--sig "run(bytes)" $(SIGNATURES) \ | ||
--ledger --hd-paths "m/44'/60'/$(LEDGER_ACCOUNT)'/0/0" --broadcast -vvvv |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
# Nested Ownership Transfer | ||
|
||
Status: READY TO DEPLOY | ||
|
||
## Procedure | ||
|
||
### 1. Update repo: | ||
|
||
```bash | ||
cd contract-deployments | ||
git pull | ||
cd mainnet/2025-01-15-nested-ownership-transfer | ||
make deps | ||
``` | ||
|
||
### 2. Setup Ledger | ||
|
||
Your Ledger needs to be connected and unlocked. The Ethereum | ||
application needs to be opened on Ledger with the message "Application | ||
is ready". | ||
|
||
### 3. Run relevant script(s) | ||
|
||
#### 3.1 Deploy new Safes | ||
|
||
```bash | ||
make deploy | ||
``` | ||
|
||
This will output the new addresses of the `SafeA` and `SafeB` contracts to an `addresses.json` file. You will need to commit this file to the repo before signers can sign. | ||
|
||
#### 3.2 Sign the transaction | ||
|
||
```bash | ||
make sign | ||
``` | ||
|
||
You will see a "Simulation link" from the output. | ||
|
||
Paste this URL in your browser. A prompt may ask you to choose a | ||
project, any project will do. You can create one if necessary. | ||
|
||
Click "Simulate Transaction". | ||
|
||
We will be performing 3 validations and extract the domain hash and message hash to approve on your Ledger: | ||
|
||
1. Validate integrity of the simulation. | ||
2. Validate correctness of the state diff. | ||
3. Validate and extract domain hash and message hash to approve. | ||
|
||
##### 3.2.1 Validate integrity of the simulation. | ||
|
||
Make sure you are on the "Overview" tab of the tenderly simulation, to | ||
validate integrity of the simulation, we need to check the following: | ||
|
||
1. "Network": Check the network is Mainnet. | ||
2. "Timestamp": Check the simulation is performed on a block with a | ||
recent timestamp (i.e. close to when you run the script). | ||
3. "Sender": Check the address shown is your signer account. If not see the derivation path Note above. | ||
|
||
##### 3.2.2. Validate correctness of the state diff. | ||
|
||
Now click on the "State" tab, and refer to the [State Validations](./VALIDATION.md) instructions for the transaction you are signing. | ||
Once complete return to this document to complete the signing. | ||
|
||
##### 3.2.3. Extract the domain hash and the message hash to approve. | ||
|
||
Now that we have verified the transaction performs the right | ||
operation, we need to extract the domain hash and the message hash to | ||
approve. | ||
|
||
Go back to the "Overview" tab, and find the | ||
`GnosisSafe.checkSignatures` call. This call's `data` parameter | ||
contains both the domain hash and the message hash that will show up | ||
in your Ledger. | ||
|
||
It will be a concatenation of `0x1901`, the domain hash, and the | ||
message hash: `0x1901[domain hash][message hash]`. | ||
|
||
Note down this value. You will need to compare it with the ones | ||
displayed on the Ledger screen at signing. | ||
|
||
Once the validations are done, it's time to actually sign the | ||
transaction. | ||
|
||
> [!WARNING] | ||
> This is the most security critical part of the playbook: make sure the | ||
> domain hash and message hash in the following two places match: | ||
> | ||
> 1. On your Ledger screen. | ||
> 2. In the Tenderly simulation. You should use the same Tenderly | ||
> simulation as the one you used to verify the state diffs, instead | ||
> of opening the new one printed in the console. | ||
> | ||
> There is no need to verify anything printed in the console. There is | ||
> no need to open the new Tenderly simulation link either. | ||
|
||
After verification, sign the transaction. You will see the `Data`, | ||
`Signer` and `Signature` printed in the console. Format should be | ||
something like this: | ||
|
||
```shell | ||
Data: <DATA> | ||
Signer: <ADDRESS> | ||
Signature: <SIGNATURE> | ||
``` | ||
|
||
Double check the signer address is the right one. | ||
|
||
##### 3.2.4 Send the output to Facilitator(s) | ||
|
||
Nothing has occurred onchain - these are offchain signatures which | ||
will be collected by Facilitators for execution. Execution can occur | ||
by anyone once a threshold of signatures are collected, so a | ||
Facilitator will do the final execution for convenience. | ||
|
||
Share the `Data`, `Signer` and `Signature` with the Facilitator, and | ||
congrats, you are done! | ||
|
||
### [For Facilitator ONLY] How to execute | ||
|
||
#### Execute the transaction | ||
|
||
1. IMPORTANT: Ensure op-challenger has been updated before executing. | ||
1. Collect outputs from all participating signers. | ||
1. Concatenate all signatures and export it as the `SIGNATURES` | ||
environment variable, i.e. `export | ||
SIGNATURES="[SIGNATURE1][SIGNATURE2]..."`. | ||
1. Run the `make execute` command as described below to execute the transaction. | ||
|
||
For example, if the quorum is 2 and you get the following outputs: | ||
|
||
```shell | ||
Data: 0xDEADBEEF | ||
Signer: 0xC0FFEE01 | ||
Signature: AAAA | ||
``` | ||
|
||
```shell | ||
Data: 0xDEADBEEF | ||
Signer: 0xC0FFEE02 | ||
Signature: BBBB | ||
``` | ||
|
||
Then you should run: | ||
|
||
```bash | ||
SIGNATURES=AAAABBBB make execute | ||
``` |
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
71 changes: 0 additions & 71 deletions
71
mainnet/2025-01-15-nested-ownership-transfer/script/AddNestedSigner.s.sol
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not strongly opposed to this because abi encoded addresses are quite readable but I think it's important to keep the .env human readable.