From 693bb2e3223a3eddb61eae38cf460c0dc47d4e17 Mon Sep 17 00:00:00 2001 From: Carson Date: Wed, 18 Sep 2024 13:50:40 -0400 Subject: [PATCH 1/6] feat: post-deploy makefile --- .gitmodules | 3 +++ Makefile | 17 ++++++++++++++++- nucleus-deployments | 1 + 3 files changed, 20 insertions(+), 1 deletion(-) create mode 160000 nucleus-deployments diff --git a/.gitmodules b/.gitmodules index 193938f..e05ddde 100644 --- a/.gitmodules +++ b/.gitmodules @@ -16,3 +16,6 @@ [submodule "lib/createx"] path = lib/createx url = https://github.com/pcaversaccio/createx +[submodule "nucleus-deployments"] + path = nucleus-deployments + url = git@github.com:Ion-Protocol/nucleus-deployments.git diff --git a/Makefile b/Makefile index 935477e..89875ea 100644 --- a/Makefile +++ b/Makefile @@ -43,4 +43,19 @@ deploy-createx-l2: forge script script/DeployCustomCreatex.s.sol --rpc-url $L2_RPC_URL --private-key $PRIVATE_KEY --slow --no-metadata check-configs: - bun lzConfigCheck.cjs \ No newline at end of file + bun lzConfigCheck.cjs + +chain1 := $(shell cast chain-id -r $(L1_RPC_URL)) +chain2 := $(shell cast chain-id -r $(L2_RPC_URL)) +symbol := $(shell cat deployment-config/$(fileL1) | jq -r ".boringVault.boringVaultSymbol") +post-deploy: + mkdir -p ./nucleus-deployments/$(symbol) + cp ./broadcast/deployAll.s.sol/$(chain1)/run-latest.json ./nucleus-deployments/$(symbol)/L1.json + cp ./broadcast/deployAll.s.sol/$(chain2)/run-latest.json ./nucleus-deployments/$(symbol)/L2.json + cp ./deployment-config/$(fileL1) ./nucleus-deployments/$(symbol)/L1Config.json + cp ./deployment-config/$(fileL2) ./nucleus-deployments/$(symbol)/L2Config.json + cd nucleus-deployments + git checkout -b $(symbol) + git add . + git commit -m "$(symbol) deployment" + git push origin $(symbol) diff --git a/nucleus-deployments b/nucleus-deployments new file mode 160000 index 0000000..b112e0f --- /dev/null +++ b/nucleus-deployments @@ -0,0 +1 @@ +Subproject commit b112e0febf8fc81f8d421a95631d614cd97f1642 From ca32de029fd017ff224395b366e0ac22e16c5911 Mon Sep 17 00:00:00 2001 From: Carson Date: Wed, 18 Sep 2024 14:12:30 -0400 Subject: [PATCH 2/6] fix: makefile git commands in singe command --- Makefile | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 89875ea..a0a5d2b 100644 --- a/Makefile +++ b/Makefile @@ -54,8 +54,4 @@ post-deploy: cp ./broadcast/deployAll.s.sol/$(chain2)/run-latest.json ./nucleus-deployments/$(symbol)/L2.json cp ./deployment-config/$(fileL1) ./nucleus-deployments/$(symbol)/L1Config.json cp ./deployment-config/$(fileL2) ./nucleus-deployments/$(symbol)/L2Config.json - cd nucleus-deployments - git checkout -b $(symbol) - git add . - git commit -m "$(symbol) deployment" - git push origin $(symbol) + cd nucleus-deployments && git checkout -b $(symbol) && git add . && git commit -m "$(symbol) deployment" && git push origin $(symbol) && git checkout main \ No newline at end of file From c34facf5e1c80d9662797f6ad332bfea3c231432 Mon Sep 17 00:00:00 2001 From: Carson Date: Thu, 19 Sep 2024 15:24:03 -0400 Subject: [PATCH 3/6] feat: creates out.json as a part of deploy process, and moves to nucleus-deployment in postdeploy --- Makefile | 8 ++++++++ deployment-config/out-template.json | 7 +++++++ nucleus-deployments | 2 +- script/deploy/deployAll.s.sol | 10 +++++++++- 4 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 deployment-config/out-template.json diff --git a/Makefile b/Makefile index a0a5d2b..8c595ef 100644 --- a/Makefile +++ b/Makefile @@ -10,19 +10,25 @@ checkL2: deployL1: @echo "Setting environment variable LIVE_DEPLOY_READ_FILE_NAME to $(file)" + cp ./deployment-config/out-template.json ./deployment-config/out.json @export LIVE_DEPLOY_READ_FILE_NAME=$(file) && forge script script/deploy/deployAll.s.sol --sig "run(string)" $(file) --fork-url=${L1_RPC_URL} deployL2: @echo "Setting environment variable LIVE_DEPLOY_READ_FILE_NAME to $(file)" + cp ./deployment-config/out-template.json ./deployment-config/out.json @export LIVE_DEPLOY_READ_FILE_NAME=$(file) && forge script script/deploy/deployAll.s.sol --sig "run(string)" $(file) --fork-url=${L1_RPC_URL} live-deployL1: @echo "Setting environment variable LIVE_DEPLOY_READ_FILE_NAME to $(file)" + cp ./deployment-config/out-template.json ./deployment-config/out.json @export LIVE_DEPLOY_READ_FILE_NAME=$(file) && forge script script/deploy/deployAll.s.sol --sig "run(string)" $(file) --fork-url=${L1_RPC_URL} --private-key=$(PRIVATE_KEY) --broadcast --slow --verify + mv ./deployment-config/out.json ./deployment-config/outL1.json live-deployL2: @echo "Setting environment variable LIVE_DEPLOY_READ_FILE_NAME to $(file)" + cp ./deployment-config/out-template.json ./deployment-config/out.json @export LIVE_DEPLOY_READ_FILE_NAME=$(file) && forge script script/deploy/deployAll.s.sol --sig "run(string)" $(file) --fork-url=${L1_RPC_URL} --private-key=$(PRIVATE_KEY) --broadcast --slow --verify + mv ./deployment-config/out.json ./deployment-config/outL2.json prettier: prettier --write '**/*.{md,yml,yaml,ts,js}' @@ -50,6 +56,8 @@ chain2 := $(shell cast chain-id -r $(L2_RPC_URL)) symbol := $(shell cat deployment-config/$(fileL1) | jq -r ".boringVault.boringVaultSymbol") post-deploy: mkdir -p ./nucleus-deployments/$(symbol) + mv ./deployment-config/outL1.json ./nucleus-deployments/$(symbol)/L1Out.json + mv ./deployment-config/outL2.json ./nucleus-deployments/$(symbol)/L2Out.json cp ./broadcast/deployAll.s.sol/$(chain1)/run-latest.json ./nucleus-deployments/$(symbol)/L1.json cp ./broadcast/deployAll.s.sol/$(chain2)/run-latest.json ./nucleus-deployments/$(symbol)/L2.json cp ./deployment-config/$(fileL1) ./nucleus-deployments/$(symbol)/L1Config.json diff --git a/deployment-config/out-template.json b/deployment-config/out-template.json new file mode 100644 index 0000000..3428148 --- /dev/null +++ b/deployment-config/out-template.json @@ -0,0 +1,7 @@ +{ + "boringVault": "", + "manager": "", + "accountant": "", + "teller": "", + "rolesAuthority": "" +} \ No newline at end of file diff --git a/nucleus-deployments b/nucleus-deployments index b112e0f..3aaf20c 160000 --- a/nucleus-deployments +++ b/nucleus-deployments @@ -1 +1 @@ -Subproject commit b112e0febf8fc81f8d421a95631d614cd97f1642 +Subproject commit 3aaf20cb21a5074b0749c3041fff9bfeb40b036c diff --git a/script/deploy/deployAll.s.sol b/script/deploy/deployAll.s.sol index 1db7134..fda7a22 100644 --- a/script/deploy/deployAll.s.sol +++ b/script/deploy/deployAll.s.sol @@ -22,7 +22,7 @@ import { SetAuthorityAndTransferOwnerships } from "./single/08_SetAuthorityAndTr import { ConfigReader, IAuthority } from "../ConfigReader.s.sol"; import { console } from "forge-std/console.sol"; -string constant OUTPUT_JSON_PATH = "/deployment-config/out.json"; +string constant OUTPUT_JSON_PATH = "./deployment-config/out.json"; error INVALID_TELLER_CONTRACT_NAME(); @@ -47,6 +47,7 @@ error INVALID_TELLER_CONTRACT_NAME(); */ contract DeployAll is BaseScript { using StdJson for string; + using Strings for address; ConfigReader.Config mainConfig; @@ -83,6 +84,13 @@ contract DeployAll is BaseScript { console.log("Set Authority And Transfer Ownerships Complete"); mainConfig = config; + + // write everything to an out file + config.boringVault.toHexString().write(OUTPUT_JSON_PATH, ".boringVault"); + config.manager.toHexString().write(OUTPUT_JSON_PATH, ".manager"); + config.accountant.toHexString().write(OUTPUT_JSON_PATH, ".accountant"); + config.teller.toHexString().write(OUTPUT_JSON_PATH, ".teller"); + config.rolesAuthority.toHexString().write(OUTPUT_JSON_PATH, ".rolesAuthority"); } function _deployTeller(ConfigReader.Config memory config) public returns (address teller) { From 7b22afae9fdc4ed4b1d30a8c6f6c83e7f8264297 Mon Sep 17 00:00:00 2001 From: Carson Date: Thu, 19 Sep 2024 15:31:28 -0400 Subject: [PATCH 4/6] fix: json writing no longer occurs on live test --- script/deploy/deployAll.s.sol | 18 +++++++++++------- test/LiveDeploy.t.sol | 2 +- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/script/deploy/deployAll.s.sol b/script/deploy/deployAll.s.sol index fda7a22..c9d0bfe 100644 --- a/script/deploy/deployAll.s.sol +++ b/script/deploy/deployAll.s.sol @@ -51,8 +51,19 @@ contract DeployAll is BaseScript { ConfigReader.Config mainConfig; + // skips the json writing + function runLiveTest(string memory deployFile) public { + deploy(ConfigReader.toConfig(vm.readFile(string.concat(CONFIG_PATH_ROOT, deployFile)), getChainConfigFile())); + } + function run(string memory deployFile) public { deploy(ConfigReader.toConfig(vm.readFile(string.concat(CONFIG_PATH_ROOT, deployFile)), getChainConfigFile())); + // write everything to an out file + mainConfig.boringVault.toHexString().write(OUTPUT_JSON_PATH, ".boringVault"); + mainConfig.manager.toHexString().write(OUTPUT_JSON_PATH, ".manager"); + mainConfig.accountant.toHexString().write(OUTPUT_JSON_PATH, ".accountant"); + mainConfig.teller.toHexString().write(OUTPUT_JSON_PATH, ".teller"); + mainConfig.rolesAuthority.toHexString().write(OUTPUT_JSON_PATH, ".rolesAuthority"); } function deploy(ConfigReader.Config memory config) public override returns (address) { @@ -84,13 +95,6 @@ contract DeployAll is BaseScript { console.log("Set Authority And Transfer Ownerships Complete"); mainConfig = config; - - // write everything to an out file - config.boringVault.toHexString().write(OUTPUT_JSON_PATH, ".boringVault"); - config.manager.toHexString().write(OUTPUT_JSON_PATH, ".manager"); - config.accountant.toHexString().write(OUTPUT_JSON_PATH, ".accountant"); - config.teller.toHexString().write(OUTPUT_JSON_PATH, ".teller"); - config.rolesAuthority.toHexString().write(OUTPUT_JSON_PATH, ".rolesAuthority"); } function _deployTeller(ConfigReader.Config memory config) public returns (address teller) { diff --git a/test/LiveDeploy.t.sol b/test/LiveDeploy.t.sol index 1027477..cf5a39f 100644 --- a/test/LiveDeploy.t.sol +++ b/test/LiveDeploy.t.sol @@ -71,7 +71,7 @@ contract LiveDeploy is ForkTest, DeployAll { // Run the deployment scripts - run(FILE_NAME); + runLiveTest(FILE_NAME); // check for if all rate providers are deployed, if not error for (uint256 i; i < mainConfig.assets.length; ++i) { From d775461fb8fb1f948f933081b5fb701953506a42 Mon Sep 17 00:00:00 2001 From: Carson Date: Fri, 20 Sep 2024 18:46:40 -0400 Subject: [PATCH 5/6] fix: makefile error --- Makefile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 8c595ef..9d92005 100644 --- a/Makefile +++ b/Makefile @@ -10,23 +10,23 @@ checkL2: deployL1: @echo "Setting environment variable LIVE_DEPLOY_READ_FILE_NAME to $(file)" - cp ./deployment-config/out-template.json ./deployment-config/out.json + cp ./deployment-config/out-template.json ./deployment-config/outL1.json @export LIVE_DEPLOY_READ_FILE_NAME=$(file) && forge script script/deploy/deployAll.s.sol --sig "run(string)" $(file) --fork-url=${L1_RPC_URL} deployL2: @echo "Setting environment variable LIVE_DEPLOY_READ_FILE_NAME to $(file)" - cp ./deployment-config/out-template.json ./deployment-config/out.json + cp ./deployment-config/out-template.json ./deployment-config/outL2.json @export LIVE_DEPLOY_READ_FILE_NAME=$(file) && forge script script/deploy/deployAll.s.sol --sig "run(string)" $(file) --fork-url=${L1_RPC_URL} live-deployL1: @echo "Setting environment variable LIVE_DEPLOY_READ_FILE_NAME to $(file)" - cp ./deployment-config/out-template.json ./deployment-config/out.json + cp ./deployment-config/out-template.json ./deployment-config/outL1.json @export LIVE_DEPLOY_READ_FILE_NAME=$(file) && forge script script/deploy/deployAll.s.sol --sig "run(string)" $(file) --fork-url=${L1_RPC_URL} --private-key=$(PRIVATE_KEY) --broadcast --slow --verify mv ./deployment-config/out.json ./deployment-config/outL1.json live-deployL2: @echo "Setting environment variable LIVE_DEPLOY_READ_FILE_NAME to $(file)" - cp ./deployment-config/out-template.json ./deployment-config/out.json + cp ./deployment-config/out-template.json ./deployment-config/outL2.json @export LIVE_DEPLOY_READ_FILE_NAME=$(file) && forge script script/deploy/deployAll.s.sol --sig "run(string)" $(file) --fork-url=${L1_RPC_URL} --private-key=$(PRIVATE_KEY) --broadcast --slow --verify mv ./deployment-config/out.json ./deployment-config/outL2.json @@ -62,4 +62,4 @@ post-deploy: cp ./broadcast/deployAll.s.sol/$(chain2)/run-latest.json ./nucleus-deployments/$(symbol)/L2.json cp ./deployment-config/$(fileL1) ./nucleus-deployments/$(symbol)/L1Config.json cp ./deployment-config/$(fileL2) ./nucleus-deployments/$(symbol)/L2Config.json - cd nucleus-deployments && git checkout -b $(symbol) && git add . && git commit -m "$(symbol) deployment" && git push origin $(symbol) && git checkout main \ No newline at end of file + cd nucleus-deployments && git checkout -b $(symbol) && git add . && git commit -m "$(symbol) deployment" && git push origin $(symbol) && git checkout main From 6e96e65cc84a023633aae721559543664b6fc16d Mon Sep 17 00:00:00 2001 From: Jun Kim <64379343+junkim012@users.noreply.github.com> Date: Wed, 25 Sep 2024 13:04:39 -0400 Subject: [PATCH 6/6] fix: write deployed addresses to out.json in makefile --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 33ed44e..e99f473 100644 --- a/Makefile +++ b/Makefile @@ -14,23 +14,23 @@ checkL2: deployL1: @echo "Setting environment variable LIVE_DEPLOY_READ_FILE_NAME to $(file)" - cp ./deployment-config/out-template.json ./deployment-config/outL1.json + cp ./deployment-config/out-template.json ./deployment-config/out.json @export LIVE_DEPLOY_READ_FILE_NAME=$(file) && forge script script/deploy/deployAll.s.sol --sig "run(string)" $(file) --fork-url=${L1_RPC_URL} deployL2: @echo "Setting environment variable LIVE_DEPLOY_READ_FILE_NAME to $(file)" - cp ./deployment-config/out-template.json ./deployment-config/outL2.json + cp ./deployment-config/out-template.json ./deployment-config/out.json @export LIVE_DEPLOY_READ_FILE_NAME=$(file) && forge script script/deploy/deployAll.s.sol --sig "run(string)" $(file) --fork-url=${L2_RPC_URL} live-deployL1: @echo "Setting environment variable LIVE_DEPLOY_READ_FILE_NAME to $(file)" - cp ./deployment-config/out-template.json ./deployment-config/outL1.json + cp ./deployment-config/out-template.json ./deployment-config/out.json @export LIVE_DEPLOY_READ_FILE_NAME=$(file) && forge script script/deploy/deployAll.s.sol --sig "run(string)" $(file) --fork-url=${L1_RPC_URL} --private-key=$(PRIVATE_KEY) --broadcast --slow --verify mv ./deployment-config/out.json ./deployment-config/outL1.json live-deployL2: @echo "Setting environment variable LIVE_DEPLOY_READ_FILE_NAME to $(file)" - cp ./deployment-config/out-template.json ./deployment-config/outL2.json + cp ./deployment-config/out-template.json ./deployment-config/out.json @export LIVE_DEPLOY_READ_FILE_NAME=$(file) && forge script script/deploy/deployAll.s.sol --sig "run(string)" $(file) --fork-url=${L2_RPC_URL} --private-key=$(PRIVATE_KEY) --broadcast --slow --verify mv ./deployment-config/out.json ./deployment-config/outL2.json