Skip to content

Commit

Permalink
simplify interaction with multisig wallets in deployment scripts (#1859)
Browse files Browse the repository at this point in the history
* instructions for deploying Fee contract without defender and without needing to deploy with a multisig wallet - but the multisig wallet is set as the admin

* added script to deploy the LC contract without defender and upgraded the readme and example env

* ugprading the fee contract without opzd but with the safe sdk

* include initData as part of safe sdk proxy upgrades

* upgrade LC contract without OPZD and support for initData

* consolidated LC scripts and created script contract for deploying the PV without openzeppelin defender and the multisig wallet

* move scripts related to tests in the test folder

* remove unused script and added the ability to upgrade to the same LC contract as we do in dev phases

* switched all scripts using private keys to mnenomics

* consistent naming convention for deploy & upgrade scripts

* consolidated scripts and added more comprehensive comments to scripts

* restructuring and updating the deployment & upgrades readme

* do not commit sepolia deployments

* do not commit sepolia deployments

* move all test scripts into the test/script folder

* consolidating test scripts

* updating scripts and readme after merge from main and adding an env variable for the original contract

* add rpc url and use instead of sepolia rpc url

* update safe sdk proposal tests and switch env variable name
  • Loading branch information
alysiahuggins authored Sep 16, 2024
1 parent 7ef71ea commit f3ce319
Show file tree
Hide file tree
Showing 51 changed files with 3,184 additions and 789 deletions.
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ ESPRESSO_SEQUENCER_STAKE_TABLE_CAPACITY=10
# Foundry
# The mnemonic used by foundry to deploy contracts.
MNEMONIC="test test test test test test test test test test test junk"
# The mnemonic offset, starts at zero
MNEMONIC_OFFSET=0
# The RPC URL for deploying to the sepolia network.
SEPOLIA_RPC_URL=

Expand Down
48 changes: 28 additions & 20 deletions .env.contracts.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,48 @@ export DEFENDER_KEY=
export DEFENDER_SECRET=
export FEE_CONTRACT_SALT=
export LIGHT_CLIENT_SALT=
export FEE_CONTRACT_UPGRADE_NAME= #e.g "FeeContract.sol"
export LIGHT_CLIENT_UPGRADE_NAME=
export FOUNDRY_OUT=contracts/out

# The Ethereum address of the safe multisig wallet used to deploy and operate the contracts.
export SAFE_MULTISIG_ADDRESS=
# The Ethereum private key of the wallet used for the proposing multisig transactions.
export SAFE_ORCHESTRATOR_PRIVATE_KEY=

export RPC_URL=


# Plonk Verifier
export PLONK_VERIFIER_SALT=
export PLONK_VERIFIER_ADDRESS=

# Light Client
export LIGHT_CLIENT_PROXY_CONTRACT_ADDRESS=
export APPROVED_PROVER_ADDRESS=

# Plonk Verification Library Deployment with Defender
export PLONK_VERIFIER_SALT=# Openzeppelin Defender Deployment Profile
export DEFENDER_KEY=
export DEFENDER_SECRET=
export FEE_CONTRACT_SALT=
export LIGHT_CLIENT_CONTRACT_UPGRADE_NAME=
export LIGHT_CLIENT_ORIGINAL_CONTRACT_NAME =
export LIGHT_CLIENT_SALT=


# Fee Contract
export FEE_CONTRACT_PROXY_ADDRESS=
export FEE_CONTRACT_UPGRADE_NAME= #e.g "FeeContract.sol"
export LIGHT_CLIENT_UPGRADE_NAME=
export FOUNDRY_OUT=contracts/out
export FEE_CONTRACT_ORIGINAL_NAME=
export FEE_CONTRACT_SALT=

# The Ethereum address of the safe multisig wallet used to deploy and operate the contracts.
export SAFE_MULTISIG_ADDRESS=
# The Ethereum private key of the wallet used for the proposing multisig transactions.
export SAFE_ORCHESTRATOR_PRIVATE_KEY=

# Light Client
export LIGHT_CLIENT_PROXY_CONTRACT_ADDRESS=
export APPROVED_PROVER_ADDRESS=

# Plonk Verification Library Deployment with Defender
export PLONK_VERIFIER_SALT=
# Deployment with Defender
export DEFENDER_KEY=
export DEFENDER_SECRET=
export FOUNDRY_OUT=contracts/out

# The etherscan API key is needed to verify contracts on etherscan.
export ETHERSCAN_API_KEY=
export ETHERSCAN_API_KEY=
export SOLC_VERSION=

# foundry scripts
export DEPLOYER_PRIVATE_KEY= #include the 0x prefixg
export DEPLOYER_MNEMONIC=
export DEPLOYER_MNEMONIC_OFFSET=
export STATE_HISTORY_RETENTION_PERIOD= #in seconds
export NUM_INIT_VALIDATORS=
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,6 @@ data/*-actual.bin

# Generated by nix-direnv
.direnv/

# Deployments to Sepolia
contracts/broadcast/*/11155111/
2 changes: 1 addition & 1 deletion contracts/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ out/
/broadcast/*/900/
/broadcast/**/dry-run/
/broadcast/LightClientCallNewFinalizedState.s.sol
/broadcast/DeployLightClientTestScript.s.sol
/broadcast/LightClientTestScript.s.sol

# Dotenv file
.env
Expand Down
59 changes: 59 additions & 0 deletions contracts/broadcast/FeeContract.s.sol/11155111/run-1723219248.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"transactions": [
{
"hash": null,
"transactionType": "CREATE",
"contractName": "FeeContract",
"contractAddress": "0xf1d9d1d4f664cbb2e39c5e07523ae8c11cdece5c",
"function": null,
"arguments": null,
"transaction": {
"from": "0xb22167f12c232e825d26ffbb3780e024c506664e",
"gas": "0xe9d1e",
"value": "0x0",
"input": "0x60a06040523060805234801561001457600080fd5b5061001d610022565b6100d4565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805468010000000000000000900460ff16156100725760405163f92ee8a960e01b815260040160405180910390fd5b80546001600160401b03908116146100d15780546001600160401b0319166001600160401b0390811782556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50565b608051610be56100fd6000396000818161050d0152818161053601526106ad0152610be56000f3fe60806040526004361061009b5760003560e01c80630d8e6e2c146100d257806327e235e3146101045780634f1ef2861461013f57806352d1902d14610154578063645006ca14610169578063715018a61461017f5780638da5cb5b146101945780638ed83271146101b6578063ad3cb1cc146101cc578063c4d66de81461020a578063f2fde38b1461022a578063f340fa011461024a576100b9565b366100b95760405163bc8eca1b60e01b815260040160405180910390fd5b604051631535ac5f60e31b815260040160405180910390fd5b3480156100de57600080fd5b506040805160018152600060208201819052918101919091526060015b60405180910390f35b34801561011057600080fd5b5061013161011f366004610a05565b60026020526000908152604090205481565b6040519081526020016100fb565b61015261014d366004610a36565b61025d565b005b34801561016057600080fd5b5061013161027c565b34801561017557600080fd5b5061013160015481565b34801561018b57600080fd5b50610152610299565b3480156101a057600080fd5b506101a96102ad565b6040516100fb9190610af7565b3480156101c257600080fd5b5061013160005481565b3480156101d857600080fd5b506101fd604051806040016040528060058152602001640352e302e360dc1b81525081565b6040516100fb9190610b2f565b34801561021657600080fd5b50610152610225366004610a05565b6102c8565b34801561023657600080fd5b50610152610245366004610a05565b6103e0565b610152610258366004610a05565b610427565b610265610502565b61026e826105a7565b61027882826105e9565b5050565b60006102866106a2565b50600080516020610bb983398151915290565b6102a16106eb565b6102ab600061071d565b565b6000806102b8610779565b546001600160a01b031692915050565b60006102d261079d565b805490915060ff600160401b82041615906001600160401b03166000811580156102f95750825b90506000826001600160401b031660011480156103155750303b155b905081158015610323575080155b156103415760405163f92ee8a960e01b815260040160405180910390fd5b84546001600160401b0319166001178555831561036a57845460ff60401b1916600160401b1785555b610373866107c1565b61037b6107d2565b670de0b6b3a764000060005566038d7ea4c6800060015583156103d857845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b505050505050565b6103e86106eb565b6001600160a01b03811661041b576000604051631e4fbdf760e01b81526004016104129190610af7565b60405180910390fd5b6104248161071d565b50565b60015434101561044a57604051636ba4a1c760e01b815260040160405180910390fd5b60005434111561046d5760405163c56d46d360e01b815260040160405180910390fd5b6001600160a01b03811661049457604051630702b3d960e41b815260040160405180910390fd5b6001600160a01b038116600090815260026020526040812080543492906104bc908490610b62565b90915550506040513481526001600160a01b038216907fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c9060200160405180910390a250565b306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016148061058957507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661057d600080516020610bb9833981519152546001600160a01b031690565b6001600160a01b031614155b156102ab5760405163703e46dd60e11b815260040160405180910390fd5b6105af6106eb565b7ff78721226efe9a1bb678189a16d1554928b9f2192e2cb93eeda83b79fa40007d816040516105de9190610af7565b60405180910390a150565b816001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015610643575060408051601f3d908101601f1916820190925261064091810190610b83565b60015b6106625781604051634c9c8ce360e01b81526004016104129190610af7565b600080516020610bb9833981519152811461069357604051632a87526960e21b815260048101829052602401610412565b61069d83836107da565b505050565b306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146102ab5760405163703e46dd60e11b815260040160405180910390fd5b336106f46102ad565b6001600160a01b0316146102ab573360405163118cdaa760e01b81526004016104129190610af7565b6000610727610779565b80546001600160a01b038481166001600160a01b031983168117845560405193945091169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3505050565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930090565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0090565b6107c9610830565b61042481610855565b6102ab610830565b6107e38261085d565b6040516001600160a01b038316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a28051156108285761069d82826108b9565b610278610931565b610838610950565b6102ab57604051631afcd79f60e31b815260040160405180910390fd5b6103e8610830565b806001600160a01b03163b60000361088a5780604051634c9c8ce360e01b81526004016104129190610af7565b600080516020610bb983398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b6060600080846001600160a01b0316846040516108d69190610b9c565b600060405180830381855af49150503d8060008114610911576040519150601f19603f3d011682016040523d82523d6000602084013e610916565b606091505b509150915061092685838361096a565b925050505b92915050565b34156102ab5760405163b398979f60e01b815260040160405180910390fd5b600061095a61079d565b54600160401b900460ff16919050565b60608261097f5761097a826109c0565b6109b9565b815115801561099657506001600160a01b0384163b155b156109b65783604051639996b31560e01b81526004016104129190610af7565b50805b9392505050565b8051156109d05780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b80356001600160a01b0381168114610a0057600080fd5b919050565b600060208284031215610a1757600080fd5b6109b9826109e9565b634e487b7160e01b600052604160045260246000fd5b60008060408385031215610a4957600080fd5b610a52836109e9565b915060208301356001600160401b0380821115610a6e57600080fd5b818501915085601f830112610a8257600080fd5b813581811115610a9457610a94610a20565b604051601f8201601f19908116603f01168101908382118183101715610abc57610abc610a20565b81604052828152886020848701011115610ad557600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b6001600160a01b0391909116815260200190565b60005b83811015610b26578181015183820152602001610b0e565b50506000910152565b6020815260008251806020840152610b4e816040850160208701610b0b565b601f01601f19169190910160400192915050565b8082018082111561092b57634e487b7160e01b600052601160045260246000fd5b600060208284031215610b9557600080fd5b5051919050565b60008251610bae818460208701610b0b565b919091019291505056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbca164736f6c6343000817000a",
"nonce": "0x37",
"chainId": "0xaa36a7"
},
"additionalContracts": [],
"isFixedGasLimit": false
},
{
"hash": null,
"transactionType": "CREATE",
"contractName": "ERC1967Proxy",
"contractAddress": "0xbcaf67958f7155afa9e86aea9148cc65477ae54c",
"function": null,
"arguments": [
"0xF1D9D1d4F664CbB2E39C5E07523Ae8C11CdecE5c",
"0xc4d66de8000000000000000000000000c56fa6505d10bf322e01327e22479de78c3bf1ce"
],
"transaction": {
"from": "0xb22167f12c232e825d26ffbb3780e024c506664e",
"gas": "0x44b15",
"value": "0x0",
"input": "0x60806040526040516103e73803806103e78339810160408190526100229161025a565b61002c8282610033565b5050610358565b61003c82610092565b6040516001600160a01b038316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a2805115610086576100818282610109565b505050565b61008e610180565b5050565b806001600160a01b03163b6000036100c85780604051634c9c8ce360e01b81526004016100bf9190610328565b60405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80546001600160a01b0319166001600160a01b0392909216919091179055565b6060600080846001600160a01b031684604051610126919061033c565b600060405180830381855af49150503d8060008114610161576040519150601f19603f3d011682016040523d82523d6000602084013e610166565b606091505b5090925090506101778583836101a1565b95945050505050565b341561019f5760405163b398979f60e01b815260040160405180910390fd5b565b6060826101b6576101b1826101f7565b6101f0565b81511580156101cd57506001600160a01b0384163b155b156101ed5783604051639996b31560e01b81526004016100bf9190610328565b50805b9392505050565b8051156102075780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b634e487b7160e01b600052604160045260246000fd5b60005b83811015610251578181015183820152602001610239565b50506000910152565b6000806040838503121561026d57600080fd5b82516001600160a01b038116811461028457600080fd5b60208401519092506001600160401b03808211156102a157600080fd5b818501915085601f8301126102b557600080fd5b8151818111156102c7576102c7610220565b604051601f8201601f19908116603f011681019083821181831017156102ef576102ef610220565b8160405282815288602084870101111561030857600080fd5b610319836020830160208801610236565b80955050505050509250929050565b6001600160a01b0391909116815260200190565b6000825161034e818460208701610236565b9190910192915050565b6081806103666000396000f3fe6080604052600a600c565b005b60186014601a565b6051565b565b6000604c7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b905090565b3660008037600080366000845af43d6000803e808015606f573d6000f35b3d6000fdfea164736f6c6343000817000a000000000000000000000000f1d9d1d4f664cbb2e39c5e07523ae8c11cdece5c00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000024c4d66de8000000000000000000000000c56fa6505d10bf322e01327e22479de78c3bf1ce00000000000000000000000000000000000000000000000000000000",
"nonce": "0x38",
"chainId": "0xaa36a7"
},
"additionalContracts": [],
"isFixedGasLimit": false
}
],
"receipts": [],
"libraries": [],
"pending": [],
"returns": {
"implementationAddress": {
"internal_type": "address",
"value": "0xF1D9D1d4F664CbB2E39C5E07523Ae8C11CdecE5c"
},
"proxy": {
"internal_type": "address payable",
"value": "0xbCaf67958f7155afa9e86aEA9148CC65477Ae54C"
}
},
"timestamp": 1723219248,
"chain": 11155111,
"commit": "a82aa8b3"
}
Loading

0 comments on commit f3ce319

Please sign in to comment.