Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ PROJECT_DIR = $(network)/$(shell date +'%Y-%m-%d')-$(task)
GAS_INCREASE_DIR = $(network)/$(shell date +'%Y-%m-%d')-increase-gas-limit
GAS_AND_ELASTICITY_INCREASE_DIR = $(network)/$(shell date +'%Y-%m-%d')-increase-gas-and-elasticity-limit
FAULT_PROOF_UPGRADE_DIR = $(network)/$(shell date +'%Y-%m-%d')-upgrade-fault-proofs
SAFE_MANAGEMENT_DIR = $(network)/$(shell date +'%Y-%m-%d')-safe-swap-owner
SAFE_MANAGEMENT_DIR = $(network)/$(shell date +'%Y-%m-%d')-safe-management
FUNDING_DIR = $(network)/$(shell date +'%Y-%m-%d')-funding
SET_BASE_BRIDGE_PARTNER_THRESHOLD_DIR = $(network)/$(shell date +'%Y-%m-%d')-pause-bridge-base
PAUSE_BRIDGE_BASE_DIR = $(network)/$(shell date +'%Y-%m-%d')-pause-bridge-base
Expand Down
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ To execute a new task, run one of the following commands (depending on the type
- For funding: `make setup-funding network=<network>`
- For fault proof upgrade: `make setup-upgrade-fault-proofs network=<network>`
- For safe management tasks: `make setup-safe-management network=<network>`
- For funding tasks: `make setup-funding network=<network>`
- For updating the partner threshold in Base Bridge: `make setup-bridge-partner-threshold network=<network>`
- For pausing / un-pausing Base Bridge: `make setup-bridge-pause network=<network>`

Expand Down Expand Up @@ -129,17 +130,19 @@ This template is used to upgrade the fault proof contracts. This is commonly don
1. Check in the task when it's ready to sign and collect signatures from signers
1. Once executed, check in the records files and mark the task `EXECUTED` in the README.

## Using the swap owner template
## Using the safe management template

This template is used to perform ownership management on a Gnosis Safe multisig, specifically it can swap owners on the multisig.
This template is used to perform ownership management on a Gnosis Safe, like the incident multisig, specifically it can be used to change the owners of the multisig.

1. Ensure you have followed the instructions above in `setup`.
1. Run `make setup-safe-management network=<network>` and go to the folder that was created by this command.
1. Ensure you have followed the instructions above in `setup`, including running `make setup-safe-management network=<network>` and go to the folder that was created by this command.
1. Specify the commit of [Optimism code](https://github.com/ethereum-optimism/optimism) and [Base contracts code](https://github.com/base-org/contracts) you intend to use in the `.env` file.
1. Run `make deps`.
1. Specify the `OWNER_SAFE`, which is the safe multisig where an owner will be replaced, the `OLD_SIGNER` (current owner) to remove, and the `NEW_SIGNER` (new owner) to be added in the `.env` file.
1. Enter the directory that was generated for the task (in the first step) and then run `make deps`.
1. Specify the `OWNER_SAFE`, which is the safe multisig where an owner will be replaced and the `SENDER` which should be the address of a current signer of the multisig.
1. Fill in the `OwnerDiff.json` inside the task's directory with the addresses to add to, and remove from, the multisig in their respective fields.
1. Ensure that the `EXISTING_OWNERS_LENGTH` constant value inside the `script/UpdateSigners.s.sol` script is set appropriately, in particular that it equals the exact number of current members of the Incident Multisig Safe (prior to running the task).
1. Build the contracts with `forge build`.
1. Simulate the task with `make sign` and update the generic validations in `VALIDATION.md` with the real values.
1. Generate the validation file for signers with `make gen-validation`.
1. Double check the `cmd` field at the top of the generated validation file at `validations/base-signer.json` and ensure that the value passed to the `--sender` flag matches the `SENDER` env var already defined in the `.env` file.
1. Check in the task when it's ready to sign and request the facilitators to collect signatures from signers.
1. Once executed, check in the records files and mark the task `EXECUTED` in the README.

Expand Down
13 changes: 8 additions & 5 deletions setup-templates/template-safe-management/.env
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
OP_COMMIT=
BASE_CONTRACTS_COMMIT=
OP_COMMIT=TODO # Recommend using the version of https://github.com/ethereum-optimism/optimism that the current SystemConfig contract is on
BASE_CONTRACTS_COMMIT=TODO # Recommend using the latest version of https://github.com/base-org/contracts

OWNER_SAFE=
# TODO: ensure `OWNER_SAFE` is correct on the given network
OWNER_SAFE=TODO

OLD_SIGNER=
NEW_SIGNER=
# TODO: ensure `SENDER` is a signer for `OWNER_SAFE` on the given network and is ALSO the same sender defined in the validations/base-signer.json file
SENDER=TODO

RECORD_STATE_DIFF=true
29 changes: 20 additions & 9 deletions setup-templates/template-safe-management/Makefile
Original file line number Diff line number Diff line change
@@ -1,22 +1,33 @@
include ../../Makefile
include ../../Multisig.mk

include ../.env
include .env

RPC_URL = $(L1_RPC_URL)
SCRIPT = UpdateSigners

ifndef LEDGER_ACCOUNT
override LEDGER_ACCOUNT = 0
override LEDGER_ACCOUNT = 1
endif

# OWNER_SAFE/
# └── Signers
.PHONY: deps
deps: new-forge-deps

RPC_URL = $(L1_RPC_URL)
SCRIPT_NAME = SwapOwner
.PHONY: new-forge-deps
new-forge-deps:
forge install --no-git safe-global/safe-smart-account@186a21a74b327f17fc41217a927dea7064f74604

.PHONY: gen-validation
gen-validation: checkout-signer-tool run-script

.PHONY: sign
sign:
$(call MULTISIG_SIGN,)
.PHONY: run-script
run-script:
mkdir validations; \
cd $(SIGNER_TOOL_PATH); \
npm ci; \
bun run scripts/genValidationFile.ts --rpc-url $(L1_RPC_URL) \
--workdir .. --forge-cmd 'forge script --rpc-url $(L1_RPC_URL) \
$(SCRIPT) --sig "sign(address[])" [] --sender $(SENDER)' --out ../validations/base-signer.json;

.PHONY: execute
execute:
Expand Down
8 changes: 8 additions & 0 deletions setup-templates/template-safe-management/OwnerDiff.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"OwnersToAdd": [
"0x0000000000000000000000000000000000000000"
],
"OwnersToRemove": [
"0x0000000000000000000000000000000000000001"
]
}
147 changes: 25 additions & 122 deletions setup-templates/template-safe-management/README.md
Original file line number Diff line number Diff line change
@@ -1,149 +1,52 @@
# Swap Owner on Gnosis Safe
# Update Sepolia Incident Multisig Signers

Status: PENDING
Status: TODO[READY TO SIGN|EXECUTED]

## Description

This task contains a single script that can be used to swap an owner in a Gnosis Safe.
We wish to update the owners of our Incident Multisig to be consistent with the current state of our Base Chain Eng team. This involves removing signers that are no longer closely involved with the team, and adding new team members as signers. The exact signer changes are outlined in the [OwnerDiff.json](./OwnerDiff.json) file.

## Procedure
## Install dependencies

### 1. Update repo:
### 1. Update foundry

```bash
cd contract-deployments
git pull
make setup-safe-management network=<network>
cd <network>/<date>safe-swap-owner
make deps
foundryup
```

### 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. Simulate, Validate, and Sign
### 2. Install Node.js if needed

#### 3.1. Simulate and validate the transaction

Make sure your ledger is still unlocked and run the following.
First, check if you have node installed

```bash
make sign
node --version
```

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.1.1. Validate integrity of the simulation.

Make sure you are on the "Summary" tab of the tenderly simulation, to
validate integrity of the simulation, we need to check the following:

1. "Network": Check the network is `<network>`.
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.

##### 3.1.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.

### 4. 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 "Summary" tab, and find the
`Safe.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]`.
If you see a version output from the above command, you can move on. Otherwise, install node

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 three places match:
>
> 1. On your Ledger screen.
> 2. In the terminal output.
> 3. 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.
>

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>
```bash
brew install node
```

Double check the signer address is the right one.

#### 4.1. 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
## Approving Signers Update

#### Execute the transaction
### 1. Update repo:

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.
```bash
cd contract-deployments
git pull
```

For example, if the quorum is 2 and you get the following outputs:
### 2. Run the signing tool (NOTE: do not enter the task directory. Run this command from the project's root).

```shell
Data: 0xDEADBEEF
Signer: 0xC0FFEE01
Signature: AAAA
```bash
make sign-task
```

```shell
Data: 0xDEADBEEF
Signer: 0xC0FFEE02
Signature: BBBB
```
### 3. Open the UI at [http://localhost:3000](http://localhost:3000)

Then you should run:
Be sure to select the correct task from the list of available tasks to sign.

Coinbase facilitator:
### 4. Send signature to facilitator

```bash
SIGNATURES=AAAABBBB make execute
```
You may now kill the Signer Tool process in your terminal window by running `Ctrl + C`.
78 changes: 0 additions & 78 deletions setup-templates/template-safe-management/VALIDATION.md

This file was deleted.

6 changes: 3 additions & 3 deletions setup-templates/template-safe-management/foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ src = 'src'
out = 'out'
libs = ['lib']
broadcast = 'records'
fs_permissions = [ {access = "read-write", path = "./"} ]
fs_permissions = [{ access = "read-write", path = "./" }]
optimizer = true
optimizer_runs = 999999
solc_version = "0.8.15"
Expand All @@ -14,7 +14,7 @@ remappings = [
'@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts',
'@rari-capital/solmate/=lib/solmate/',
'@base-contracts/=lib/base-contracts',
'@solady/=lib/solady/src/'
'solady/=lib/solady/src/',
]

# See more config options https://github.com/foundry-rs/foundry/tree/master/config
# See more config options https://github.com/foundry-rs/foundry/tree/master/config
Loading
Loading