Skip to content
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

[SC-57] Gnosis Chain Deploy #31

Merged
merged 33 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
28e5d31
update aave-v3-core and add deploy script
hexonaut Jun 20, 2023
c6859be
minor
hexonaut Jun 20, 2023
036d2c8
add goerli and mainnet deploys for Aave V3.0.2 Pool upgrade
hexonaut Jun 27, 2023
83ffdd7
add tests for pool implementation deploy + bytecode compare
hexonaut Jul 4, 2023
067eec5
making progress on verification of libraries
hexonaut Jul 4, 2023
beec0b7
fix library addresses
hexonaut Jul 7, 2023
14fa081
adding upgrade test
hexonaut Jul 8, 2023
b629a11
add readme; set proper version in gitmodules
hexonaut Jul 8, 2023
407212e
testing against aave deploy
hexonaut Jul 10, 2023
cf0f933
refactor deploy structure; remove extra deploy testing stuff
hexonaut Jul 11, 2023
aa6f41e
spacing
hexonaut Jul 11, 2023
91afef2
switching to use sourcify+broadcast files as bytecode validation
hexonaut Jul 13, 2023
1220736
new deploy with fixed library handling
hexonaut Jul 13, 2023
a17ef9e
add pool implementation upgrade with proper library linking
hexonaut Jul 14, 2023
5e399f7
update periphery
hexonaut Jul 14, 2023
87978c5
add gnosis deploy
hexonaut Jul 14, 2023
6957b20
merge master
hexonaut Jul 15, 2023
15d0bb6
mergefix
hexonaut Jul 15, 2023
a7efa18
case consistency
hexonaut Jul 15, 2023
9bc7266
started with gnosis chain testnet
hexonaut Jul 26, 2023
070ec89
add actual wxDAI address on chiado testnet along with mock oracle
hexonaut Jul 26, 2023
36551a8
forge install: governance-crosschain-bridges
hexonaut Jul 30, 2023
ed34254
Merge branch 'master' into SC-57-deploy-gnosis-chain
hexonaut Sep 5, 2023
ad7c983
deploy with proper l2 executor
hexonaut Sep 5, 2023
e9f2f4c
update block
hexonaut Sep 5, 2023
3bb57a8
remove testnet as we are dropping this
hexonaut Sep 7, 2023
0b4a98d
deploy config engine to gnosis chain
hexonaut Sep 16, 2023
aaeaf21
use mainnet rpc instead of active one for migration tests
hexonaut Sep 19, 2023
3323b67
disable migration helper tests
hexonaut Sep 19, 2023
61f407d
use org secrets
hexonaut Sep 19, 2023
dd529b1
add detailed deployer / reviewer instructions
hexonaut Sep 20, 2023
9536b14
also verify the spark config engine deploys
hexonaut Sep 20, 2023
d947c00
dont fail for unverified contracts, but keep a running counter
hexonaut Sep 21, 2023
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
8 changes: 7 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,13 @@ jobs:

- name: Run Forge tests
env:
ETH_RPC_URL: ${{secrets.ETH_RPC_URL}}
MAINNET_RPC_URL: ${{secrets.MAINNET_RPC_URL}}
OPTIMISM_RPC_URL: ${{secrets.OPTIMISM_RPC_URL}}
ARBITRUM_ONE_RPC_URL: ${{secrets.ARBITRUM_ONE_RPC_URL}}
ARBITRUM_NOVA_RPC_URL: ${{secrets.ARBITRUM_NOVA_RPC_URL}}
GNOSIS_CHAIN_RPC_URL: ${{secrets.GNOSIS_CHAIN_RPC_URL}}
BASE_RPC_URL: ${{secrets.BASE_RPC_URL}}
GOERLI_RPC_URL: ${{secrets.GOERLI_RPC_URL}}
run: |
forge test -vvv
id: test
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@
[submodule "lib/dss-test"]
path = lib/dss-test
url = https://github.com/makerdao/dss-test
[submodule "lib/governance-crosschain-bridges"]
path = lib/governance-crosschain-bridges
url = https://github.com/marsfoundation/governance-crosschain-bridges
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
deploy :; forge script script/DeploySpark.s.sol:DeploySpark --rpc-url ${ETH_RPC_URL} --sender ${ETH_FROM} --broadcast --verify --slow
deploy-sce :; forge script script/DeploySparkConfigEngine.s.sol:DeploySparkConfigEngine --optimizer-runs 200 --rpc-url ${ETH_RPC_URL} --sender ${ETH_FROM} --broadcast --verify --slow
deploy-pool :; forge script script/DeployPoolImplementation.s.sol:DeployPoolImplementation --rpc-url ${ETH_RPC_URL} --sender ${ETH_FROM} --broadcast --verify --slow

# Special case for verifier url and we remove --slow
deploy-gnosis :; ETHERSCAN_API_KEY=${GNOSISSCAN_API_KEY} forge script script/DeploySpark.s.sol:DeploySpark --rpc-url ${ETH_RPC_URL} --sender ${ETH_FROM} --broadcast --verify --verifier-url "https://api.gnosisscan.io/api"
deploy-sce-gnosis :; ETHERSCAN_API_KEY=${GNOSISSCAN_API_KEY} forge script script/DeploySparkConfigEngine.s.sol:DeploySparkConfigEngine --optimizer-runs 200 --rpc-url ${ETH_RPC_URL} --sender ${ETH_FROM} --broadcast --verify --verifier-url "https://api.gnosisscan.io/api"
32 changes: 31 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,36 @@ Deploy Spark Lend (Custom Instance): `INSTANCE_ID=<Custom Instance Name> ETH_RPC
Deploy Config Engine (Custom Instance): `INSTANCE_ID=<Custom Instance Name> ETH_RPC_URL=<YOUR RPC ENDPOINT> make deploy-engine`
Deploy Pool Upgrade: `ETH_RPC_URL=<YOUR RPC ENDPOINT> make deploy-pool` (Please note you need to set the proper `POOL_REVISION` in `Pool.sol`)

Please note there may be some custom configs so please check the `Makefile`.

## Full Instructions to Deploy

These instructions assume that an `admin` L2 Executor governance relay has already been deployed. If you haven't deployed this already then please follow the instructions to deploy in https://github.com/marsfoundation/spark-gov-relay .

As deployer:

1. Create directory `script/input/<CHAINID>/`.
1. Copy `primary.json` from `script/input/100/` to your newly created directory.
1. Update relevant fields in the json. `admin` will usually point to the L2 Executor governance relay.
1. Run `ETH_RPC_URL=<YOUR RPC ENDPOINT> make deploy` to deploy an empty instance of Spark Lend.
1. This will generate an output file in `script/output/<CHAINID>/primary-<TIMESTAMP>.json`. Rename this to `primary-latest.json`.
1. Inside `script/output/<CHAINID>/` create the directory `broadcast`.
1. Copy the broadcast file generated from `broadcast/DeploySpark.s.sol/<CHAINID>/run-latest.json` into the newly created broadcast directory. Rename it to `primary-<DATE>.json`. This broadcast file will be used to validate the deploy by reviewers.
1. Run `ETH_RPC_URL=<YOUR RPC ENDPOINT> make deploy-engine` to deploy an instance of the config engine.
1. This will generate an output file in `script/output/<CHAINID>/primary-sce-<TIMESTAMP>.json`. Rename this to `primary-sce-latest.json`.
1. Copy the broadcast file generated from `broadcast/DeploySparkConfigEngine.s.sol/<CHAINID>/run-latest.json` into the broadcast directory. Rename it to `primary-sce-<DATE>.json`.
1. Copy the file `test/deploys/100/primary/SparkDeploy_20230714_GnosisPrimary.t.sol` to `test/deploys/<CHAINID>/primary/SparkDeploy_<DATE>_<CHAINNAME>Primary.t.sol`.
1. Update the file as necessary. Tests should pass.
1. Notify the reviewers that the deploy is ready for review.

As reviewer:

1. Verify the deployer followed all steps above.
1. Verify all contract addresses in the json files makes sense. IE `admin` is the L2 Executor. `pool` is the pool proxy, etc.
1. Run `forge test`. This will ensure the deployment configuration was done correctly, and will check most of the permissions (not all - you need to check some manually below).
1. Verify the bytecode of all deployed contracts for both the Spark Lend and Config Engine Deploys. (see detailed instructions below on how to do this)
1. Manually verify no extra permissions have been added on the `ACLManager`. The automated checks will prove that `admin` has access and `deployer` doesn't, but the `deployer` may have added another address in an intermediate transaction. In the transactions tab for the `ACLManager` ensure that only the proper adds and removes that correspond to the deployer script are present with either the address `deployer` (which should be the deployer address) and the `admin`.

## Verifying Bytecode on Deploys

### To Install
Expand All @@ -21,7 +51,7 @@ Deploy Pool Upgrade: `ETH_RPC_URL=<YOUR RPC ENDPOINT> make deploy-pool` (Please

### To Run

Run `./validate-deploy.sh path/to/broadcast.json` (Be sure to `forge build` with proper settings first)
Run `./validate-deploy.sh path/to/broadcast.json --local` (Be sure to `forge build` with proper settings first)

If you want to delete previously verified contracts then run `rm -rf /tmp/sourcify/repository/contracts/*`

Expand Down
1 change: 1 addition & 0 deletions lib/governance-crosschain-bridges
7 changes: 7 additions & 0 deletions script/input/100/primary.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"admin": "0xc4218C1127cB24a0D6c1e7D25dc34e10f2625f5A",
"marketId": "Spark Protocol - Gnosis Chain - Primary",
"nativeToken": "0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d",
"nativeTokenOracle": "0x678df3415fc31947dA4324eC63212874be5a82f8",
"daiToken": "0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d"
}
2,764 changes: 2,764 additions & 0 deletions script/output/100/broadcast/primary-20230905.json

Large diffs are not rendered by default.

Loading