Skip to content

Commit 72d08ed

Browse files
xenolissjackchuma
andauthored
[CHAIN-282] Add Recovery contract deployment scripts (#387)
* chore: implement scripts * chore: fix Makefile commands * fix readme and add todo comments * chore: use Recovery contract from base/contracts * chore: impl review feedback * apply address aliasing * use recent base contracts commit * add record files from implementation deployments and proxy deployment dry runs --------- Co-authored-by: Jack Chuma <[email protected]>
1 parent 0abce0b commit 72d08ed

File tree

12 files changed

+742
-0
lines changed

12 files changed

+742
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
OP_COMMIT=ef7a933ca7f3d27ac40406f87fea25e0c3ba2016
2+
BASE_CONTRACTS_COMMIT=7de26a851c70a2970a19f1d2553a9ced7896ae6b
3+
4+
# Used in the forge scripts.
5+
INCIDENT_MULTISIG=0x14536667Cd30e52C0b458BaACcB9faDA7046E056
6+
# Base & Optimism
7+
RECOVERY_IMPLEMENTATION=0xd6Cd8A71EcE6d009220F1F9A7055749edf13C140
8+
# Arbitrum
9+
# RECOVERY_IMPLEMENTATION=0xb2a7C27935BD4f63F6362D90Eff46a4beC5D61e0
10+
EXPECTED_PROXY_ADDRESSES=0x0475cBCAebd9CE8AfA5025828d5b98DFb67E059E,0x8EfB6B5c4767B09Dc9AA6Af4eAA89F749522BaE2,0x3154Cf16ccdb4C6d922629664174b904d80F2C35,0x56315b90c40730925ec5485cf004d835058518A0,0x866E82a600A1414e583f7F13623F1aC5d58b0Afa,0x49048044D57e1C92A77f79988d21Fa8fAF74E97e
11+
12+
# Used in the Make commands
13+
DEPLOYER=0x6606d3c20cc94cc7aa1d430c0e83a5129976153a
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
include ../../Makefile
2+
include ../.env
3+
include .env
4+
5+
ifndef LEDGER_ACCOUNT
6+
override LEDGER_ACCOUNT = 0
7+
endif
8+
9+
.PHONY: deploy-implementation
10+
deploy-implementation:
11+
@if [ -z "$(RPC_URL)" ]; then \
12+
echo "Error: RPC_URL is required. Usage: make deploy-implementation RPC_URL=<url>"; \
13+
exit 1; \
14+
fi
15+
forge script --rpc-url $(RPC_URL) DeployRecoveryImplementation \
16+
--ledger --hd-paths "m/44'/60'/$(LEDGER_ACCOUNT)'/0/0" --sig "run()" --broadcast
17+
18+
.PHONY: dry-run-deployments
19+
dry-run-deployments:
20+
@if [ -z "$(RPC_URL)" ]; then \
21+
echo "Error: RPC_URL is required. Usage: make dry-run-deployments RPC_URL=<url>"; \
22+
exit 1; \
23+
fi
24+
forge script --rpc-url $(RPC_URL) DeployRecoveryProxies --sig "run()" --sender $(DEPLOYER)
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# ETH Recovery Contract Deployment
2+
3+
Status: PENDING
4+
5+
## Description
6+
7+
This task deploys an ETH recovery system to recover funds mistakenly sent to the Base portal address on Ethereum mainnet. Users have been sending ETH to the same address (0x49048044D57e1C92A77f79988d21Fa8fAF74E97e) that exists on Ethereum as the Base portal contract.
8+
9+
The deployment consists of two separate phases:
10+
11+
**Phase 1 - Implementation Deployment (via DeployRecoveryImplementation.s.sol)**
12+
> This deployment will be broadcasted and executed onchain directly from this script
13+
- **Command**: `make deploy-implementation RPC_URL=<your-rpc-url>`
14+
- Deploy the Recovery implementation contract from a separate EOA (NOT the DEPLOYER address)
15+
16+
**Phase 2 - Proxy Deployment (via DeployRecoveryProxies.s.sol)**
17+
> This script will NOT broadcast or execute any deployment - it only generates the deployment artifacts that will be consumed by our key management system
18+
- **Command**: `make dry-run-deployments RPC_URL=<your-rpc-url>`
19+
- Generate artifacts for 6 Recovery proxy contract deployments to align the DEPLOYER's nonce
20+
- The first 5 deployments increment the nonce (deploying Recovery proxies allows potential fund recovery from these addresses if needed)
21+
- The 6th deployment will reach the target portal address (0x49048044D57e1C92A77f79988d21Fa8fAF74E97e) where the funds are located
22+
23+
The Recovery contract enables the incident multisig to rescue ETH from any deployed contract address.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[profile.default]
2+
src = 'src'
3+
out = 'out'
4+
libs = ['lib']
5+
broadcast = 'records'
6+
fs_permissions = [{ access = "read-write", path = "./" }]
7+
optimizer = true
8+
optimizer_runs = 999999
9+
solc_version = "0.8.15"
10+
via-ir = false
11+
remappings = [
12+
'@eth-optimism-bedrock/=lib/optimism/packages/contracts-bedrock/',
13+
'@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts',
14+
'@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts',
15+
'@rari-capital/solmate/=lib/solmate/',
16+
'@base-contracts/=lib/base-contracts',
17+
'@solady/=lib/solady/src/',
18+
]
19+
20+
# See more config options https://github.com/foundry-rs/foundry/tree/master/config
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{
2+
"transactions": [
3+
{
4+
"hash": "0x86cdbe8fa5bd7ce78b76697caed0bdba6920d53c013f89f2546a2b8d7b8e512b",
5+
"transactionType": "CREATE",
6+
"contractName": "Recovery",
7+
"contractAddress": "0xd6cd8a71ece6d009220f1f9a7055749edf13c140",
8+
"function": null,
9+
"arguments": [
10+
"0x25646667cD30e52c0b458bAAcCB9fAdA7046f167"
11+
],
12+
"transaction": {
13+
"from": "0x644e3dedb0e4f83bfcf8f9992964d240224b74dc",
14+
"gas": "0x1323b9",
15+
"value": "0x0",
16+
"input": "0x60c06040523060805234801561001457600080fd5b5060405161115e38038061115e83398101604081905261003391610044565b6001600160a01b031660a052610074565b60006020828403121561005657600080fd5b81516001600160a01b038116811461006d57600080fd5b9392505050565b60805160a05161109c6100c26000396000818160710152818161054d015261077a01526000818161014c0152818161020101528181610356015281816104060152610690015261109c6000f3fe60806040526004361061005a5760003560e01c80634f1ef286116100435780634f1ef286146100df578063501d976c146100f257806352d1902d1461011257600080fd5b8063117803e31461005f5780633659cfe6146100bd575b600080fd5b34801561006b57600080fd5b506100937f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b3480156100c957600080fd5b506100dd6100d8366004610d1d565b610135565b005b6100dd6100ed366004610d67565b61033f565b3480156100fe57600080fd5b506100dd61010d366004610e93565b610535565b34801561011e57600080fd5b50610127610676565b6040519081526020016100b4565b73ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001630036101ff576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f64656c656761746563616c6c000000000000000000000000000000000000000060648201526084015b60405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166102747f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff1614610317576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f6163746976652070726f7879000000000000000000000000000000000000000060648201526084016101f6565b61032081610762565b6040805160008082526020820190925261033c918391906107d1565b50565b73ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000163003610404576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f64656c656761746563616c6c000000000000000000000000000000000000000060648201526084016101f6565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166104797f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff161461051c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f6163746976652070726f7879000000000000000000000000000000000000000060648201526084016101f6565b61052582610762565b610531828260016107d1565b5050565b3373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016146105a4576040517f82b4290000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b8381101561066f5760008585838181106105c3576105c3610eff565b90506020020160208101906105d89190610d1d565b73ffffffffffffffffffffffffffffffffffffffff1684848481811061060057610600610eff565b9050602002013560405160006040518083038185875af1925050503d8060008114610647576040519150601f19603f3d011682016040523d82523d6000602084013e61064c565b606091505b505090508061065b575061065d565b505b8061066781610f2e565b9150506105a7565b5050505050565b60003073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000161461073d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c000000000000000060648201526084016101f6565b507f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc90565b3373ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000161461033c576040517f82b4290000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff161561080957610804836109d5565b505050565b8273ffffffffffffffffffffffffffffffffffffffff166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa92505050801561088e575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820190925261088b91810190610f8d565b60015b61091a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201527f6f6e206973206e6f74205555505300000000000000000000000000000000000060648201526084016101f6565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc81146109c9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f7860448201527f6961626c6555554944000000000000000000000000000000000000000000000060648201526084016101f6565b50610804838383610adf565b73ffffffffffffffffffffffffffffffffffffffff81163b610a79576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e74726163740000000000000000000000000000000000000060648201526084016101f6565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b610ae883610b0a565b600082511180610af55750805b1561080457610b048383610b57565b50505050565b610b13816109d5565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060610b7c838360405180606001604052806027815260200161104060279139610b83565b9392505050565b60606000808573ffffffffffffffffffffffffffffffffffffffff1685604051610bad9190610fd2565b600060405180830381855af49150503d8060008114610be8576040519150601f19603f3d011682016040523d82523d6000602084013e610bed565b606091505b5091509150610bfe86838387610c08565b9695505050505050565b60608315610c9e578251600003610c975773ffffffffffffffffffffffffffffffffffffffff85163b610c97576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016101f6565b5081610ca8565b610ca88383610cb0565b949350505050565b815115610cc05781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101f69190610fee565b803573ffffffffffffffffffffffffffffffffffffffff81168114610d1857600080fd5b919050565b600060208284031215610d2f57600080fd5b610b7c82610cf4565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60008060408385031215610d7a57600080fd5b610d8383610cf4565b9150602083013567ffffffffffffffff80821115610da057600080fd5b818501915085601f830112610db457600080fd5b813581811115610dc657610dc6610d38565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908382118183101715610e0c57610e0c610d38565b81604052828152886020848701011115610e2557600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b60008083601f840112610e5957600080fd5b50813567ffffffffffffffff811115610e7157600080fd5b6020830191508360208260051b8501011115610e8c57600080fd5b9250929050565b60008060008060408587031215610ea957600080fd5b843567ffffffffffffffff80821115610ec157600080fd5b610ecd88838901610e47565b90965094506020870135915080821115610ee657600080fd5b50610ef387828801610e47565b95989497509550505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610f86577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b5060010190565b600060208284031215610f9f57600080fd5b5051919050565b60005b83811015610fc1578181015183820152602001610fa9565b83811115610b045750506000910152565b60008251610fe4818460208701610fa6565b9190910192915050565b602081526000825180602084015261100d816040850160208701610fa6565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122004f2c6d0973c106f68fa09ad30e6cab7fcbf96f131d84b00564e47edb277797264736f6c634300080f003300000000000000000000000025646667cd30e52c0b458baaccb9fada7046f167",
17+
"nonce": "0x3",
18+
"chainId": "0xa"
19+
},
20+
"additionalContracts": [],
21+
"isFixedGasLimit": false
22+
}
23+
],
24+
"receipts": [
25+
{
26+
"status": "0x1",
27+
"cumulativeGasUsed": "0x9012ac",
28+
"logs": [],
29+
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
30+
"type": "0x2",
31+
"transactionHash": "0x86cdbe8fa5bd7ce78b76697caed0bdba6920d53c013f89f2546a2b8d7b8e512b",
32+
"transactionIndex": "0x16",
33+
"blockHash": "0x9f6b3dca1dcaf3445cd2c6a4703dcc71cf83ec163968fceefbe6f73fdedbbf8b",
34+
"blockNumber": "0x84b551c",
35+
"gasUsed": "0xeba1d",
36+
"effectiveGasPrice": "0x4f0a",
37+
"from": "0x644e3dedb0e4f83bfcf8f9992964d240224b74dc",
38+
"to": null,
39+
"contractAddress": "0xd6cd8a71ece6d009220f1f9a7055749edf13c140",
40+
"l1BaseFeeScalar": "0x146b",
41+
"l1BlobBaseFee": "0x1",
42+
"l1BlobBaseFeeScalar": "0xf79c5",
43+
"l1Fee": "0x5913831a11",
44+
"l1GasPrice": "0x8fa6e482",
45+
"l1GasUsed": "0x76a1",
46+
"operatorFeeConstant": "0x0",
47+
"operatorFeeScalar": "0x0"
48+
}
49+
],
50+
"libraries": [],
51+
"pending": [],
52+
"returns": {},
53+
"timestamp": 1753908210,
54+
"chain": 10,
55+
"commit": "51b152e"
56+
}

0 commit comments

Comments
 (0)