From 464125cad1123de4e3be780b2492de0b178a158f Mon Sep 17 00:00:00 2001 From: Jack Chuma Date: Tue, 8 Apr 2025 08:12:40 -0400 Subject: [PATCH 1/3] add script for SmartEscrow ownership transfer initiation --- .../.env | 9 + .../Makefile | 38 ++++ .../README.md | 174 ++++++++++++++++++ .../VALIDATION.md | 145 +++++++++++++++ .../foundry.toml | 20 ++ .../script/InitOwnershipTransfer.s.sol | 64 +++++++ 6 files changed, 450 insertions(+) create mode 100644 mainnet/2025-04-07-init-smart-escrow-ownership-transfer/.env create mode 100644 mainnet/2025-04-07-init-smart-escrow-ownership-transfer/Makefile create mode 100644 mainnet/2025-04-07-init-smart-escrow-ownership-transfer/README.md create mode 100644 mainnet/2025-04-07-init-smart-escrow-ownership-transfer/VALIDATION.md create mode 100644 mainnet/2025-04-07-init-smart-escrow-ownership-transfer/foundry.toml create mode 100644 mainnet/2025-04-07-init-smart-escrow-ownership-transfer/script/InitOwnershipTransfer.s.sol diff --git a/mainnet/2025-04-07-init-smart-escrow-ownership-transfer/.env b/mainnet/2025-04-07-init-smart-escrow-ownership-transfer/.env new file mode 100644 index 00000000..59d7f7f2 --- /dev/null +++ b/mainnet/2025-04-07-init-smart-escrow-ownership-transfer/.env @@ -0,0 +1,9 @@ +OP_COMMIT=8d0dd96e494b2ba154587877351e87788336a4ec +BASE_CONTRACTS_COMMIT=6ca464d118d2d33331ea44893f0930f753663f60 + +L1_SAFE=0x7bB41C3008B3f03FE483B28b8DB90e19Cf07595c +TARGET=0xb3C2f9fC2727078EC3A2255410e83BA5B62c5B5f + +OWNER_SAFE=0x0a7361e734cf3f0394B0FC4a45C74E7a4Ec70940 +CB_SIGNER_SAFE_ADDR=0x6e1DFd5C1E22A4677663A81D24C6BA03561ef0f6 +OP_SIGNER_SAFE_ADDR=0x2501c477D0A35545a387Aa4A3EEe4292A9a8B3F0 diff --git a/mainnet/2025-04-07-init-smart-escrow-ownership-transfer/Makefile b/mainnet/2025-04-07-init-smart-escrow-ownership-transfer/Makefile new file mode 100644 index 00000000..17eca2d6 --- /dev/null +++ b/mainnet/2025-04-07-init-smart-escrow-ownership-transfer/Makefile @@ -0,0 +1,38 @@ +include ../../Makefile +include ../.env +include .env + +L2_RPC_URL=https://mainnet.optimism.io + +ifndef LEDGER_ACCOUNT +override LEDGER_ACCOUNT = 0 +endif + +.PHONY: sign-cb +sign-cb: + $(GOPATH)/bin/eip712sign --ledger --hd-paths "m/44'/60'/$(LEDGER_ACCOUNT)'/0/0" -- \ + forge script --rpc-url $(L2_RPC_URL) InitOwnershipTransfer \ + --sig "sign(address)" $(CB_SIGNER_SAFE_ADDR) + +.PHONY: sign-op +sign-op: + $(GOPATH)/bin/eip712sign --ledger --hd-paths "m/44'/60'/$(LEDGER_ACCOUNT)'/0/0" -- \ + forge script --rpc-url $(L2_RPC_URL) InitOwnershipTransfer \ + --sig "sign(address)" $(OP_SIGNER_SAFE_ADDR) + +.PHONY: approve-cb +approve-cb: + forge script --rpc-url $(L2_RPC_URL) InitOwnershipTransfer \ + --sig "approve(address,bytes)" $(CB_SIGNER_SAFE_ADDR) $(SIGNATURES) \ + --ledger --hd-paths "m/44'/60'/$(LEDGER_ACCOUNT)'/0/0" --broadcast -vvvv + +.PHONY: approve-op +approve-op: + forge script --rpc-url $(L2_RPC_URL) InitOwnershipTransfer \ + --sig "approve(address,bytes)" $(OP_SIGNER_SAFE_ADDR) $(SIGNATURES) \ + --ledger --hd-paths "m/44'/60'/$(LEDGER_ACCOUNT)'/0/0" --broadcast -vvvv + +.PHONY: execute +execute: + forge script --rpc-url $(L2_RPC_URL) InitOwnershipTransfer \ + --sig "run()" --ledger --hd-paths "m/44'/60'/$(LEDGER_ACCOUNT)'/0/0" --broadcast -vvvv diff --git a/mainnet/2025-04-07-init-smart-escrow-ownership-transfer/README.md b/mainnet/2025-04-07-init-smart-escrow-ownership-transfer/README.md new file mode 100644 index 00000000..5df66f0a --- /dev/null +++ b/mainnet/2025-04-07-init-smart-escrow-ownership-transfer/README.md @@ -0,0 +1,174 @@ +# Initiate SmartEscrow Ownership Transfer + +Status: READY TO SIGN + +## Description + +We wish to update the owner of our [SmartEscrow](https://optimistic.etherscan.io/address/0xb3c2f9fc2727078ec3a2255410e83ba5b62c5b5f) contract on OP Mainnet to be the aliased address of our L1 [ProxyAdminOwner](https://etherscan.io/address/0x7bB41C3008B3f03FE483B28b8DB90e19Cf07595c). The `SmartEscrow` contract inherits access control mechanisms from OpenZeppelin's `AccessControlDefaultAdminRules`, which requires an ownership transfer to be invoked in two separate steps: + +1. Initiate the transfer to a new owner from the existing owner +2. Accept the transfer from the pending new owner after a configured delay + +This task represents the initiation step. A subsequent task will be written for ownership acceptance after a 5 day delay. + +## Procedure + +### 1. Update repo: + +```bash +cd contract-deployments +git pull +cd mainnet/2025-04-07-init-smart-escrow-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) + +#### Sign the transaction + +Coinbase signer: + +```bash +make sign-cb +``` + +Op signer: + +```bash +make sign-op +``` + +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 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 OP 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. 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.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: +Signer:
+Signature: +``` + +Double check the signer address is the right one. + +##### 3.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 + +#### Approve 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 approve` 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: + +Coinbase facilitator: + +```bash +SIGNATURES=AAAABBBB make approve-cb +``` + +Optimism facilitator: + +```bash +SIGNATURES=AAAABBBB make approve-op +``` + +#### Execute the transaction + +Once the signatures have been submitted approving the transaction for all nested Safes run: + +```bash +make execute +``` diff --git a/mainnet/2025-04-07-init-smart-escrow-ownership-transfer/VALIDATION.md b/mainnet/2025-04-07-init-smart-escrow-ownership-transfer/VALIDATION.md new file mode 100644 index 00000000..14ac880e --- /dev/null +++ b/mainnet/2025-04-07-init-smart-escrow-ownership-transfer/VALIDATION.md @@ -0,0 +1,145 @@ +# Validation + +This document can be used to validate the inputs and result of the execution of the upgrade transaction which you are +signing. + +The steps are: + +1. [Validate the Domain and Message Hashes](#expected-domain-and-message-hashes) +2. [Verifying the state changes](#state-changes) + +## Expected Domain and Message Hashes + +First, we need to validate the domain and message hashes. These values should match both the values on your ledger and +the values printed to the terminal when you run the task. + +> [!CAUTION] +> +> Before signing, ensure the below hashes match what is on your ledger. +> +> ### Child Safe 1: `0x6e1DFd5C1E22A4677663A81D24C6BA03561ef0f6` (Base) +> +> - Domain Hash: `0x4ac8f60706331537a33c4a4cbda024cb722855e6b160a3e8b28ab487510598b1` +> - Message Hash: `0x3a25fa618752b5d5408cef7c063ff8f08f6a833e3ac131666452d099c4cb1896` +> +> ### Child Safe 2: `0x2501c477D0A35545a387Aa4A3EEe4292A9a8B3F0` (Optimism Foundation) +> +> - Domain Hash: `0xb34978142f4478f3e5633915597a756daa58a1a59a3e0234f9acd5444f1ca70e` +> - Message Hash: `0x810c12369f2efe81a2a6825b3b41e8d9b4315ba44fdf286ff23d5c4637755689` + +# State Validations + +For each contract listed in the state diff, please verify that no contracts or state changes shown in the Tenderly diff are missing from this document. Additionally, please verify that for each contract: + +- The following state changes (and none others) are made to that contract. This validates that no unexpected state + changes occur. +- All addresses (in section headers and storage values) match the provided name, using the Etherscan and Superchain + Registry links provided. This validates the bytecode deployed at the addresses contains the correct logic. +- All key values match the semantic meaning provided, which can be validated using the storage layout links provided. + +## State Overrides + +### `0x0a7361e734cf3f0394B0FC4a45C74E7a4Ec70940` (`ProxyAdminOwner` on OP Mainnet) + +- **Key**: `0x0000000000000000000000000000000000000000000000000000000000000004`
+ **Override**: `0x0000000000000000000000000000000000000000000000000000000000000001`
+ **Meaning**: Override the threshold to 1 so the transaction simulation can occur. + +### Nested Safe + +[For CB Signers] `0x6e1DFd5C1E22A4677663A81D24C6BA03561ef0f6` (`CB Nested Safe`) +[For OP Signers] `0x2501c477D0A35545a387Aa4A3EEe4292A9a8B3F0` (`OP Nested Safe`) + +- **Key**: `0x0000000000000000000000000000000000000000000000000000000000000003`
+ **Override**: `0x0000000000000000000000000000000000000000000000000000000000000001`
+ **Meaning**: Override the owner count to 1 so the transaction simulation can occur. + +- **Key**: `0x0000000000000000000000000000000000000000000000000000000000000004`
+ **Override**: `0x0000000000000000000000000000000000000000000000000000000000000001`
+ **Meaning**: Override the threshold to 1 so the transaction simulation can occur. + +- **Key**: `0x316a0aac0d94f5824f0b66f5bbe94a8c360a17699a1d3a233aafcf7146e9f11c`
+ **Override**: `0x0000000000000000000000000000000000000000000000000000000000000001`
+ **Meaning**: This is owners[0xca11bde05977b3631167028862be2a173976ca11] -> 1, so the key can be derived from cast index address 0xca11bde05977b3631167028862be2a173976ca11 2. + +- **Key**: `0xe90b7bceb6e7df5418fb78d8ee546e97c83a08bbccc01a0644d599ccd2a7c2e0`
+ **Override**: `0x000000000000000000000000ca11bde05977b3631167028862be2a173976ca11`
+ **Meaning**: This is owners[1] -> 0xca11bde05977b3631167028862be2a173976ca11, so the key can be derived from cast index address 0x0000000000000000000000000000000000000001 2. + +## Task State Changes + +
+
+----- DecodedStateDiff[0] -----
+  Who:               0x0a7361e734cf3f0394B0FC4a45C74E7a4Ec70940
+  Contract:          ProxyAdminOwner - OP Mainnet
+  Chain ID:          10
+  Raw Slot:          0x0000000000000000000000000000000000000000000000000000000000000005
+  Raw Old Value:     0x0000000000000000000000000000000000000000000000000000000000000002
+  Raw New Value:     0x0000000000000000000000000000000000000000000000000000000000000003
+  Decoded Kind:      uint256
+  Decoded Old Value: 2
+  Decoded New Value: 3
+
+  Summary:           Increment nonce in ProxyAdminOwner
+
+----- DecodedStateDiff[1] -----
+  Who:               0x0a7361e734cf3f0394B0FC4a45C74E7a4Ec70940
+  Contract:          ProxyAdminOwner - OP Mainnet
+  Chain ID:          10
+  Raw Slot:          0xe23f453082938f6d8fda616d15a8d5919aec431dff18fc69ddf7fd4cd01bd59e
+  Raw Old Value:     0x0000000000000000000000000000000000000000000000000000000000000000
+  Raw New Value:     0x0000000000000000000000000000000000000000000000000000000000000001
+  Decoded Kind:      uint256
+  Decoded Old Value: 0
+  Decoded New Value: 1
+
+  Summary:           Transaction approval
+  Detail:            Approves the ownership transfer initiation tranasction on behalf of the signing safe. The slot derivation depends on which safe is being signed for. This can be derived with `cast index bytes32 0xd806ab578902502aa5b3caf2d4a5d03b14a9e9522c8b9214ba4e05af1c39e2f4 $(cast index address $SIGNER_SAFE 8)`. For OP signers, the slot should be `0x8f6ea3dc592330bb5d3d2f07897e65e16fda3259be1ad4bc00d0033f29399eee`.
+
+----- DecodedStateDiff[2] -----
+  Who:               0x6e1DFd5C1E22A4677663A81D24C6BA03561ef0f6 or 0x2501c477D0A35545a387Aa4A3EEe4292A9a8B3F0
+  Contract:          Signer Safe - OP Mainnet
+  Chain ID:          10
+  Raw Slot:          0x0000000000000000000000000000000000000000000000000000000000000005
+  Raw Old Value:     0x0000000000000000000000000000000000000000000000000000000000000000
+  Raw New Value:     0x0000000000000000000000000000000000000000000000000000000000000001
+  Decoded Kind:      uint256
+  Decoded Old Value: 0
+  Decoded New Value: 1
+
+  Summary:           Increment nonce in Signer safe
+
+----- DecodedStateDiff[3] -----
+  Who:               0xb3C2f9fC2727078EC3A2255410e83BA5B62c5B5f
+  Contract:          SmartEscrow - OP Mainnet
+  Chain ID:          10
+  Raw Slot:          0x0000000000000000000000000000000000000000000000000000000000000001
+  Raw Old Value:     0x0000000697800000000000000000000000000000000000000000000000000000
+  Raw New Value:     0x000000069780000067fba22c8cc51c3008b3f03fe483b28b8db90e19cf076a6d
+  Decoded Kind:      uint48, uint48, address
+  Decoded Old Value: 432000, 0, 0x0000000000000000000000000000000000000000
+  Decoded New Value: 432000, 1744544300, 0x8cC51c3008b3f03Fe483B28B8Db90e19cF076a6d
+
+  Summary:           Sets the pending default admin for SmartEscrow
+  Detail:            This is a packed storage slot containing three values: `_currentDelay`, `_pendingDefaultAdminSchedule` and `_pendingDefaultAdmin`. The `_currentDelay` is set to 432000 which is 5 days (in seconds). `_pendingDefaultAdminSchedule` gets set to `block.timestamp + _currentDelay`. NOTE: the `_pendingDefaultAdminSchedule` may be different from what you see in you Tenderly simulation - this is ok! It's derived based on the current block.timestamp. The `_pendingDefaultAdmin` address gets set to `0x8cC51c3008b3f03Fe483B28B8Db90e19cF076a6d` which is the aliased address of `0x7bB41C3008B3f03FE483B28b8DB90e19Cf07595c` (`ProxyAdminOwner`).
+
+ATTENTION TASK REVIEWER: It is safe to continue if `_pendingDefaultAdminSchedule` is different than what is seen in the Tenderly state diff.
+
+----- Additional Balance Changes -----
+  Who:               0x420000000000000000000000000000000000001A
+  Contract:          L1FeeValue - OP Mainnet
+  Chain ID:          10
+  Old Balance:       1892652089755161
+  New Balance:       1892663085405498
+
+  Summary:           L1 fees collected from the transaction
+  Detail:            Note: these values may differ from what you see in the Tenderly simulation - that is ok!
+
+----- Additional Nonce Changes -----
+  Who:               0x6CD3850756b7894774Ab715D136F9dD02837De50
+
+  Details:           Nonce Updates for all addresses listed above.
+  Summary:
+    - 0x6CD3850756b7894774Ab715D136F9dD02837De50 is the caller
+
diff --git a/mainnet/2025-04-07-init-smart-escrow-ownership-transfer/foundry.toml b/mainnet/2025-04-07-init-smart-escrow-ownership-transfer/foundry.toml new file mode 100644 index 00000000..14499ab0 --- /dev/null +++ b/mainnet/2025-04-07-init-smart-escrow-ownership-transfer/foundry.toml @@ -0,0 +1,20 @@ +[profile.default] +src = 'src' +out = 'out' +libs = ['lib'] +broadcast = 'records' +fs_permissions = [{ access = "read-write", path = "./" }] +optimizer = true +optimizer_runs = 999999 +solc_version = "0.8.15" +via-ir = false +remappings = [ + '@eth-optimism-bedrock/=lib/optimism/packages/contracts-bedrock/', + '@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts', + '@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts', + '@rari-capital/solmate/=lib/solmate/', + '@base-contracts/=lib/base-contracts', + 'solady/=lib/solady/src/', +] + +# See more config options https://github.com/foundry-rs/foundry/tree/master/config diff --git a/mainnet/2025-04-07-init-smart-escrow-ownership-transfer/script/InitOwnershipTransfer.s.sol b/mainnet/2025-04-07-init-smart-escrow-ownership-transfer/script/InitOwnershipTransfer.s.sol new file mode 100644 index 00000000..0c0e7943 --- /dev/null +++ b/mainnet/2025-04-07-init-smart-escrow-ownership-transfer/script/InitOwnershipTransfer.s.sol @@ -0,0 +1,64 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.15; + +import {Vm} from "forge-std/Vm.sol"; +import {Simulation} from "@base-contracts/script/universal/Simulation.sol"; +import {IMulticall3} from "forge-std/interfaces/IMulticall3.sol"; + +import {NestedMultisigBuilder} from "@base-contracts/script/universal/NestedMultisigBuilder.sol"; +import {AccessControlDefaultAdminRules} from "@openzeppelin/contracts/access/AccessControlDefaultAdminRules.sol"; + +contract InitOwnershipTransfer is NestedMultisigBuilder { + address public immutable OWNER_SAFE; + address public immutable L1_SAFE; + address public immutable TARGET; + + // Using example from OP L1 Proxy Admin to confirm accuracy of `_convertToAliasAddress` + address public constant OP_L1_PROXY_ADMIN = 0x5a0Aae59D09fccBdDb6C6CcEB07B7279367C3d2A; + address public constant OP_L1_PROXY_ADMIN_ALIAS = 0x6B1BAE59D09fCcbdDB6C6cceb07B7279367C4E3b; + + constructor() { + OWNER_SAFE = vm.envAddress("OWNER_SAFE"); + L1_SAFE = vm.envAddress("L1_SAFE"); + TARGET = vm.envAddress("TARGET"); + } + + // Confirm the alias address conversion is correct using Optimism L1 Proxy Admin as an example + function setUp() public pure { + require( + _convertToAliasAddress(OP_L1_PROXY_ADMIN) == OP_L1_PROXY_ADMIN_ALIAS, "Something wrong with ConvertToAlias" + ); + } + + // Confirm the proxy admin owner is now the pending admin of SmartEscrow + function _postCheck(Vm.AccountAccess[] memory, Simulation.Payload memory) internal view override { + AccessControlDefaultAdminRules target = AccessControlDefaultAdminRules(TARGET); + (address pendingAdmin,) = target.pendingDefaultAdmin(); + require(pendingAdmin == _convertToAliasAddress(L1_SAFE), "Pending admin is not L1_SAFE"); + } + + function _buildCalls() internal view override returns (IMulticall3.Call3[] memory) { + IMulticall3.Call3[] memory calls = new IMulticall3.Call3[](1); + + calls[0] = IMulticall3.Call3({ + target: TARGET, + allowFailure: false, + callData: abi.encodeCall( + AccessControlDefaultAdminRules.beginDefaultAdminTransfer, (_convertToAliasAddress(L1_SAFE)) + ) + }); + + return calls; + } + + function _ownerSafe() internal view override returns (address) { + return OWNER_SAFE; + } + + /// @dev An alias address is the original address + 0x1111000000000000000000000000000000001111 + function _convertToAliasAddress(address addr) private pure returns (address) { + uint160 enumeratedAddress = uint160(addr); + uint160 offset = uint160(0x1111000000000000000000000000000000001111); + return address(enumeratedAddress + offset); + } +} From e01540e2664f85973936c85eebcd534c487e5822 Mon Sep 17 00:00:00 2001 From: Jack Chuma Date: Tue, 8 Apr 2025 08:21:35 -0400 Subject: [PATCH 2/3] Update mainnet/2025-04-07-init-smart-escrow-ownership-transfer/VALIDATION.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .../VALIDATION.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mainnet/2025-04-07-init-smart-escrow-ownership-transfer/VALIDATION.md b/mainnet/2025-04-07-init-smart-escrow-ownership-transfer/VALIDATION.md index 14ac880e..a245b331 100644 --- a/mainnet/2025-04-07-init-smart-escrow-ownership-transfer/VALIDATION.md +++ b/mainnet/2025-04-07-init-smart-escrow-ownership-transfer/VALIDATION.md @@ -95,8 +95,7 @@ For each contract listed in the state diff, please verify that no contracts or s Decoded New Value: 1 Summary: Transaction approval - Detail: Approves the ownership transfer initiation tranasction on behalf of the signing safe. The slot derivation depends on which safe is being signed for. This can be derived with `cast index bytes32 0xd806ab578902502aa5b3caf2d4a5d03b14a9e9522c8b9214ba4e05af1c39e2f4 $(cast index address $SIGNER_SAFE 8)`. For OP signers, the slot should be `0x8f6ea3dc592330bb5d3d2f07897e65e16fda3259be1ad4bc00d0033f29399eee`. - + Detail: Approves the ownership transfer initiation transaction on behalf of the signing safe. The slot derivation depends on which safe is being signed for. This can be derived with `cast index bytes32 0xd806ab578902502aa5b3caf2d4a5d03b14a9e9522c8b9214ba4e05af1c39e2f4 $(cast index address $SIGNER_SAFE 8)`. For OP signers, the slot should be `0x8f6ea3dc592330bb5d3d2f07897e65e16fda3259be1ad4bc00d0033f29399eee`. ----- DecodedStateDiff[2] ----- Who: 0x6e1DFd5C1E22A4677663A81D24C6BA03561ef0f6 or 0x2501c477D0A35545a387Aa4A3EEe4292A9a8B3F0 Contract: Signer Safe - OP Mainnet From 3118d6871350f8a71fca7ffa7e993bdccfe18006 Mon Sep 17 00:00:00 2001 From: Jack Chuma Date: Tue, 8 Apr 2025 10:19:54 -0400 Subject: [PATCH 3/3] use op library for address aliasing --- .../script/InitOwnershipTransfer.s.sol | 27 ++++--------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/mainnet/2025-04-07-init-smart-escrow-ownership-transfer/script/InitOwnershipTransfer.s.sol b/mainnet/2025-04-07-init-smart-escrow-ownership-transfer/script/InitOwnershipTransfer.s.sol index 0c0e7943..2b76b950 100644 --- a/mainnet/2025-04-07-init-smart-escrow-ownership-transfer/script/InitOwnershipTransfer.s.sol +++ b/mainnet/2025-04-07-init-smart-escrow-ownership-transfer/script/InitOwnershipTransfer.s.sol @@ -7,34 +7,26 @@ import {IMulticall3} from "forge-std/interfaces/IMulticall3.sol"; import {NestedMultisigBuilder} from "@base-contracts/script/universal/NestedMultisigBuilder.sol"; import {AccessControlDefaultAdminRules} from "@openzeppelin/contracts/access/AccessControlDefaultAdminRules.sol"; +import {AddressAliasHelper} from "@eth-optimism-bedrock/src/vendor/AddressAliasHelper.sol"; contract InitOwnershipTransfer is NestedMultisigBuilder { + using AddressAliasHelper for address; + address public immutable OWNER_SAFE; address public immutable L1_SAFE; address public immutable TARGET; - // Using example from OP L1 Proxy Admin to confirm accuracy of `_convertToAliasAddress` - address public constant OP_L1_PROXY_ADMIN = 0x5a0Aae59D09fccBdDb6C6CcEB07B7279367C3d2A; - address public constant OP_L1_PROXY_ADMIN_ALIAS = 0x6B1BAE59D09fCcbdDB6C6cceb07B7279367C4E3b; - constructor() { OWNER_SAFE = vm.envAddress("OWNER_SAFE"); L1_SAFE = vm.envAddress("L1_SAFE"); TARGET = vm.envAddress("TARGET"); } - // Confirm the alias address conversion is correct using Optimism L1 Proxy Admin as an example - function setUp() public pure { - require( - _convertToAliasAddress(OP_L1_PROXY_ADMIN) == OP_L1_PROXY_ADMIN_ALIAS, "Something wrong with ConvertToAlias" - ); - } - // Confirm the proxy admin owner is now the pending admin of SmartEscrow function _postCheck(Vm.AccountAccess[] memory, Simulation.Payload memory) internal view override { AccessControlDefaultAdminRules target = AccessControlDefaultAdminRules(TARGET); (address pendingAdmin,) = target.pendingDefaultAdmin(); - require(pendingAdmin == _convertToAliasAddress(L1_SAFE), "Pending admin is not L1_SAFE"); + require(pendingAdmin == L1_SAFE.applyL1ToL2Alias(), "Pending admin is not L1_SAFE"); } function _buildCalls() internal view override returns (IMulticall3.Call3[] memory) { @@ -43,9 +35,7 @@ contract InitOwnershipTransfer is NestedMultisigBuilder { calls[0] = IMulticall3.Call3({ target: TARGET, allowFailure: false, - callData: abi.encodeCall( - AccessControlDefaultAdminRules.beginDefaultAdminTransfer, (_convertToAliasAddress(L1_SAFE)) - ) + callData: abi.encodeCall(AccessControlDefaultAdminRules.beginDefaultAdminTransfer, (L1_SAFE.applyL1ToL2Alias())) }); return calls; @@ -54,11 +44,4 @@ contract InitOwnershipTransfer is NestedMultisigBuilder { function _ownerSafe() internal view override returns (address) { return OWNER_SAFE; } - - /// @dev An alias address is the original address + 0x1111000000000000000000000000000000001111 - function _convertToAliasAddress(address addr) private pure returns (address) { - uint160 enumeratedAddress = uint160(addr); - uint160 offset = uint160(0x1111000000000000000000000000000000001111); - return address(enumeratedAddress + offset); - } }