From 47a9a15be5ec97c4682643711081d51a484c3b76 Mon Sep 17 00:00:00 2001 From: Max <82761650+MaxMustermann2@users.noreply.github.com> Date: Tue, 31 Dec 2024 14:42:36 +0530 Subject: [PATCH] fix(ci): correct the address names and keys (#137) * fix(ci): require reward vault deployment * fix(ci): update keys in deployment * fix(ci): add address validation --- .github/workflows/forge-ci.yml | 55 ++++++++++++++++++++++++++++++++++ script/compareLayouts.js | 3 +- script/deployedContracts.json | 8 +++-- 3 files changed, 61 insertions(+), 5 deletions(-) diff --git a/.github/workflows/forge-ci.yml b/.github/workflows/forge-ci.yml index 759baf4..d38ac05 100644 --- a/.github/workflows/forge-ci.yml +++ b/.github/workflows/forge-ci.yml @@ -112,6 +112,61 @@ jobs: - name: Check formatting run: forge fmt --check + check-contract-deployments: + # Takes less than 30s + timeout-minutes: 5 + runs-on: ubuntu-latest + needs: build + steps: + - name: Restore cached Foundry toolchain + uses: actions/cache/restore@v3 + with: + path: ${{ needs.build.outputs.installation-dir }} + key: ${{ needs.build.outputs.cache-key }} + - name: Add Foundry to PATH + run: echo "${{ needs.build.outputs.installation-dir }}" >> "$GITHUB_PATH" + - name: Checkout repository + uses: actions/checkout@v4 + - name: Validate deployedContracts.json + run: | + data=$(cat script/deployedContracts.json) + + bootstrap=$(echo "$data" | jq -r '.clientChain.bootstrapLogic // empty') + clientGateway=$(echo "$data" | jq -r '.clientChain.clientGatewayLogic // empty') + vault=$(echo "$data" | jq -r '.clientChain.vaultImplementation // empty') + rewardVault=$(echo "$data" | jq -r '.clientChain.rewardVaultImplementation // empty') + capsule=$(echo "$data" | jq -r '.clientChain.capsuleImplementation // empty') + + validate_address() { + local address=$1 + if [ -z "$address" ]; then + echo "Validation failed: Address is empty" + exit 1 + fi + if [ "$(cast 2a $address)" != "$address" ]; then + echo "Validation failed: $address is not a valid Ethereum checksum address" + exit 1 + fi + } + + # Check each address + echo "Validating bootstrap address..." + validate_address "$bootstrap" + + echo "Validating clientGateway address..." + validate_address "$clientGateway" + + echo "Validating vault address..." + validate_address "$vault" + + echo "Validating rewardVault address..." + validate_address "$rewardVault" + + echo "Validating capsule address..." + validate_address "$capsule" + + echo "Validation passed: All fields are non-empty and valid Ethereum checksum addresses" + extract-base-storage-layout-exocore-gateway: # Takes less than 30 seconds, but add some margin for git clone timeout-minutes: 10 diff --git a/script/compareLayouts.js b/script/compareLayouts.js index 11c5789..db527b7 100644 --- a/script/compareLayouts.js +++ b/script/compareLayouts.js @@ -6,8 +6,7 @@ const fileMappings = [ { before: 'Bootstrap.deployed.json', after: 'Bootstrap.compiled.json', mustExist: true }, { before: 'ClientChainGateway.deployed.json', after: 'ClientChainGateway.compiled.json', mustExist: true }, { before: 'Vault.deployed.json', after: 'Vault.compiled.json', mustExist: true }, - // TODO: once RewardVault is deployed, change mustExist to true - { before: 'RewardVault.deployed.json', after: 'RewardVault.compiled.json', mustExist: false }, + { before: 'RewardVault.deployed.json', after: 'RewardVault.compiled.json', mustExist: true }, { before: 'ExoCapsule.deployed.json', after: 'ExoCapsule.compiled.json', mustExist: true }, { before: 'ExocoreGateway.base.json', after: 'ExocoreGateway.compiled.json', mustExist: true }, { before: 'Bootstrap.compiled.json', after: 'ClientChainGateway.compiled.json', mustExist: true }, diff --git a/script/deployedContracts.json b/script/deployedContracts.json index 80d5720..739938f 100644 --- a/script/deployedContracts.json +++ b/script/deployedContracts.json @@ -2,16 +2,18 @@ "clientChain": { "beaconOracle": "0xd3D285cd1516038dAED61B8BF7Ae2daD63662492", "beaconProxyBytecode": "0xA15Ce26ba8E50ac21ecDa1791BAa3bf22a95b575", + "bootstrap": "0xDf9caDCfb027d9f6264Ecd5eAEc839a8335d8520", + "bootstrapLogic": "0xB97A39004Ba6900FAE801Ac04F8ce4DA70689879", "capsuleBeacon": "0xB8D032a30a3B950CBcc6c1689E2381ab4290D4BB", "capsuleImplementation": "0x8638502De2001e0dF71BbB5dd503E2008b2Ae948", - "clientChainGateway": "0xDf9caDCfb027d9f6264Ecd5eAEc839a8335d8520", - "clientChainGatewayLogic": "0x92A645a44DFf3e5499F9e6A1d6738520971267AA", + "clientGatewayLogic": "0x92A645a44DFf3e5499F9e6A1d6738520971267AA", "lzEndpoint": "0x6EDCE65403992e310A62460808c4b910D972f10f", "proxyAdmin": "0x4317A7f62dA871E4512424Df8CaE91A6Ccc2afEA", "rewardVaultBeacon": "0xEe75FF2f3A6E49a7cfd0aa2F729563F8c0F7707b", "rewardVaultImplementation": "0xAE4Aed8C1A66f89D7c19D7B1021BE027846A51e6", "vaultBeacon": "0x737e311Bf34B838943A30110289C5a9b22eba2A8", - "vaultImplementation": "0xce7f4AC8D00f5e4aB3BEd9fDD1EDB9cD20516477" + "vaultImplementation": "0xce7f4AC8D00f5e4aB3BEd9fDD1EDB9cD20516477", + "wstETH": "0xB82381A3fBD3FaFA77B3a7bE693342618240067b" }, "exocore": { "exocoreGateway": "0xEAf4E4D09b9CeB936492518A852026c914beb11E",