From e7667ad75eabbaf4ebec11188db81007a46e8c85 Mon Sep 17 00:00:00 2001 From: Daniel <77058885+0xDEnYO@users.noreply.github.com> Date: Mon, 30 Sep 2024 09:54:42 +0700 Subject: [PATCH] import paths updated for zkSync scripts (#811) * import paths updated for zkSync scripts * fixes one more import * adds ready_for_review triggers to git actions * adds logic to not execute checks when triggered by non-label event types --------- Co-authored-by: Ed Zynda --- .github/workflows/protectAuditLabels.yml | 26 ++++++++++++++++--- package.json | 2 +- script/deploy/zksync/006_deploy_receiver.ts | 8 +++--- .../deploy/zksync/007_deploy_fee_collector.ts | 4 +-- .../008_deploy_service_fee_collector.ts | 4 +-- .../deploy/zksync/010_deploy_cbridge_facet.ts | 2 +- .../zksync/011_deploy_cbridge_facet_packed.ts | 2 +- .../deploy/zksync/012_deploy_across_facet.ts | 2 +- .../zksync/013_deploy_lifuel_fee_collector.ts | 4 +-- .../deploy/zksync/015_deploy_celerim_facet.ts | 4 +-- .../zksync/016_deploy_across_facet_packed.ts | 2 +- .../deploy/zksync/017_deploy_token_wrapper.ts | 4 +-- .../zksync/018_deploy_symbiosis_facet.ts | 2 +- script/utils/diamond.ts | 2 +- 14 files changed, 43 insertions(+), 25 deletions(-) diff --git a/.github/workflows/protectAuditLabels.yml b/.github/workflows/protectAuditLabels.yml index 2112246cf..10da37961 100644 --- a/.github/workflows/protectAuditLabels.yml +++ b/.github/workflows/protectAuditLabels.yml @@ -2,13 +2,17 @@ # - Makes sure that the following labels can only be assigned by a GitHub Action: "AuditCompleted", "AuditRequired", and "AuditNotRequired" # - Will undo any unauthorized change of these labels # - Will fail if it runs into an error, otherwise pass +# - Will skip checks if the PR was just approved or set from draft to "ready for review" state + name: Protect Audit Labels on: pull_request: - types: [labeled, unlabeled] + types: [labeled, unlabeled, synchronize, review_requested, ready_for_review] + pull_request_review: + types: [submitted] jobs: protect_audit_labels: runs-on: ubuntu-latest @@ -17,9 +21,25 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - name: Check for authorized actor + - name: Check if event requires audit label protection + id: check_event run: | + # Define the events that we care about (labeled/unlabeled) + EVENT_TYPES=("labeled" "unlabeled") + EVENT_ACTION="${{ github.event.action }}" + + # Check if the action is one of the events we care about + if [[ " ${EVENT_TYPES[*]} " =~ " $EVENT_ACTION " ]]; then + echo "Human-triggered label event detected, proceeding with checks." + echo "CONTINUE=true" >> $GITHUB_ENV + else + echo -e "\033[32mAction was triggered by a non-label event, thus skipping checks (not required).\033[0m" + echo "CONTINUE=false" >> $GITHUB_ENV + fi + - name: Check for authorized actor + if: env.CONTINUE == 'true' + run: | ##### Only allow the specific bot to manipulate audit labels if [[ "${{ github.actor }}" == "lifi-action-bot" ]]; then @@ -36,7 +56,6 @@ jobs: GITHUB_TOKEN: ${{ secrets.GIT_ACTIONS_BOT_PAT_CLASSIC }} run: | - ##### Define the labels to protect PROTECTED_LABELS=("AuditCompleted" "AuditRequired" "AuditNotRequired") TARGET_LABEL="${{ github.event.label.name }}" @@ -74,4 +93,3 @@ jobs: echo -e "\033[32mUnauthorized label modification was successfully prevented and undone.\033[0m" else echo -e "\033[32mNo protected labels were modified.\033[0m" - fi diff --git a/package.json b/package.json index 3bf999c1a..52a991c07 100644 --- a/package.json +++ b/package.json @@ -119,4 +119,4 @@ "solhint --fix" ] } -} \ No newline at end of file +} diff --git a/script/deploy/zksync/006_deploy_receiver.ts b/script/deploy/zksync/006_deploy_receiver.ts index d8caa2855..daee6a376 100644 --- a/script/deploy/zksync/006_deploy_receiver.ts +++ b/script/deploy/zksync/006_deploy_receiver.ts @@ -1,15 +1,15 @@ import { HardhatRuntimeEnvironment } from 'hardhat/types' import { DeployFunction } from 'hardhat-deploy/types' import { ethers, network } from 'hardhat' -import { Receiver, PeripheryRegistryFacet } from '../typechain' +import { Receiver, PeripheryRegistryFacet } from '../../../typechain' import { diamondContractName, updateDeploymentLogs, verifyContract, } from './9999_utils' -import globalConfig from '../config/global.json' -import stargateConfig from '../config/stargate.json' -import amarokConfig from '../config/amarok.json' +import globalConfig from '../../../config/global.json' +import stargateConfig from '../../../config/stargate.json' +import amarokConfig from '../../../config/amarok.json' interface StargateConfig { routers: { [network: string]: string } diff --git a/script/deploy/zksync/007_deploy_fee_collector.ts b/script/deploy/zksync/007_deploy_fee_collector.ts index da1cccf9d..ae3f85faf 100644 --- a/script/deploy/zksync/007_deploy_fee_collector.ts +++ b/script/deploy/zksync/007_deploy_fee_collector.ts @@ -1,13 +1,13 @@ import { HardhatRuntimeEnvironment } from 'hardhat/types' import { DeployFunction } from 'hardhat-deploy/types' import { ethers, network } from 'hardhat' -import { PeripheryRegistryFacet } from '../typechain' +import { PeripheryRegistryFacet } from '../../../typechain' import { diamondContractName, updateDeploymentLogs, verifyContract, } from './9999_utils' -import globalConfig from '../config/global.json' +import globalConfig from '../../../config/global.json' const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { // Protect against unwanted redeployments diff --git a/script/deploy/zksync/008_deploy_service_fee_collector.ts b/script/deploy/zksync/008_deploy_service_fee_collector.ts index a7bae77e0..a67d938e4 100644 --- a/script/deploy/zksync/008_deploy_service_fee_collector.ts +++ b/script/deploy/zksync/008_deploy_service_fee_collector.ts @@ -1,13 +1,13 @@ import { HardhatRuntimeEnvironment } from 'hardhat/types' import { DeployFunction } from 'hardhat-deploy/types' import { ethers, network } from 'hardhat' -import { PeripheryRegistryFacet } from '../typechain' +import { PeripheryRegistryFacet } from '../../../typechain' import { diamondContractName, updateDeploymentLogs, verifyContract, } from './9999_utils' -import globalConfig from '../config/global.json' +import globalConfig from '../../../config/global.json' const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { // Protect against unwanted redeployments diff --git a/script/deploy/zksync/010_deploy_cbridge_facet.ts b/script/deploy/zksync/010_deploy_cbridge_facet.ts index 09019b007..2e8558bdc 100644 --- a/script/deploy/zksync/010_deploy_cbridge_facet.ts +++ b/script/deploy/zksync/010_deploy_cbridge_facet.ts @@ -2,7 +2,7 @@ import { HardhatRuntimeEnvironment } from 'hardhat/types' import { DeployFunction } from 'hardhat-deploy/types' import { network } from 'hardhat' import { diamondContractName, deployFacet } from './9999_utils' -import config from '../config/cbridge.json' +import config from '../../../config/cbridge.json' interface CBridgeConfig { [network: string]: { diff --git a/script/deploy/zksync/011_deploy_cbridge_facet_packed.ts b/script/deploy/zksync/011_deploy_cbridge_facet_packed.ts index eb9e3d222..3daf6753d 100644 --- a/script/deploy/zksync/011_deploy_cbridge_facet_packed.ts +++ b/script/deploy/zksync/011_deploy_cbridge_facet_packed.ts @@ -2,7 +2,7 @@ import { HardhatRuntimeEnvironment } from 'hardhat/types' import { DeployFunction } from 'hardhat-deploy/types' import { network } from 'hardhat' import { diamondContractName, deployFacet } from './9999_utils' -import config from '../config/cbridge.json' +import config from '../../../config/cbridge.json' interface CBridgeConfig { [network: string]: { diff --git a/script/deploy/zksync/012_deploy_across_facet.ts b/script/deploy/zksync/012_deploy_across_facet.ts index f909ed8e2..507d469da 100644 --- a/script/deploy/zksync/012_deploy_across_facet.ts +++ b/script/deploy/zksync/012_deploy_across_facet.ts @@ -2,7 +2,7 @@ import { HardhatRuntimeEnvironment } from 'hardhat/types' import { DeployFunction } from 'hardhat-deploy/types' import { network } from 'hardhat' import { diamondContractName, deployFacet } from './9999_utils' -import config from '../config/across.json' +import config from '../../../config/across.json' interface AcrossConfig { [network: string]: { diff --git a/script/deploy/zksync/013_deploy_lifuel_fee_collector.ts b/script/deploy/zksync/013_deploy_lifuel_fee_collector.ts index 05a4a28fe..e0328c605 100644 --- a/script/deploy/zksync/013_deploy_lifuel_fee_collector.ts +++ b/script/deploy/zksync/013_deploy_lifuel_fee_collector.ts @@ -1,13 +1,13 @@ import { HardhatRuntimeEnvironment } from 'hardhat/types' import { DeployFunction } from 'hardhat-deploy/types' import { ethers, network } from 'hardhat' -import { PeripheryRegistryFacet } from '../typechain' +import { PeripheryRegistryFacet } from '../../../typechain' import { diamondContractName, updateDeploymentLogs, verifyContract, } from './9999_utils' -import globalConfig from '../config/global.json' +import globalConfig from '../../../config/global.json' const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { // Protect against unwanted redeployments diff --git a/script/deploy/zksync/015_deploy_celerim_facet.ts b/script/deploy/zksync/015_deploy_celerim_facet.ts index 2e17de53d..957a1934b 100644 --- a/script/deploy/zksync/015_deploy_celerim_facet.ts +++ b/script/deploy/zksync/015_deploy_celerim_facet.ts @@ -7,8 +7,8 @@ import { addressesFile, AddressesFile, } from './9999_utils' -import config from '../config/cbridge.json' -import global from '../config/global.json' +import config from '../../../config/cbridge.json' +import global from '../../../config/global.json' import fs from 'fs' interface CBridgeConfig { diff --git a/script/deploy/zksync/016_deploy_across_facet_packed.ts b/script/deploy/zksync/016_deploy_across_facet_packed.ts index 41d9ecfc8..7b77a7456 100644 --- a/script/deploy/zksync/016_deploy_across_facet_packed.ts +++ b/script/deploy/zksync/016_deploy_across_facet_packed.ts @@ -2,7 +2,7 @@ import { HardhatRuntimeEnvironment } from 'hardhat/types' import { DeployFunction } from 'hardhat-deploy/types' import { network } from 'hardhat' import { diamondContractName, deployFacet } from './9999_utils' -import config from '../config/across.json' +import config from '../../../config/across.json' interface AcrossConfig { [network: string]: { diff --git a/script/deploy/zksync/017_deploy_token_wrapper.ts b/script/deploy/zksync/017_deploy_token_wrapper.ts index dc0b701e8..e57453f6f 100644 --- a/script/deploy/zksync/017_deploy_token_wrapper.ts +++ b/script/deploy/zksync/017_deploy_token_wrapper.ts @@ -1,13 +1,13 @@ import { HardhatRuntimeEnvironment } from 'hardhat/types' import { DeployFunction } from 'hardhat-deploy/types' import { ethers, network } from 'hardhat' -import { PeripheryRegistryFacet } from '../typechain' +import { PeripheryRegistryFacet } from '../../../typechain' import { diamondContractName, updateDeploymentLogs, verifyContract, } from './9999_utils' -import globalConfig from '../config/tokenwrapper.json' +import globalConfig from '../../../config/tokenwrapper.json' const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { // Protect against unwanted redeployments diff --git a/script/deploy/zksync/018_deploy_symbiosis_facet.ts b/script/deploy/zksync/018_deploy_symbiosis_facet.ts index 650ef192a..8e44d4eb7 100644 --- a/script/deploy/zksync/018_deploy_symbiosis_facet.ts +++ b/script/deploy/zksync/018_deploy_symbiosis_facet.ts @@ -2,7 +2,7 @@ import { HardhatRuntimeEnvironment } from 'hardhat/types' import { DeployFunction } from 'hardhat-deploy/types' import { network } from 'hardhat' import { deployFacet } from './9999_utils' -import config from '../config/symbiosis.json' +import config from '../../../config/symbiosis.json' interface SymbiosisConfig { [network: string]: { diff --git a/script/utils/diamond.ts b/script/utils/diamond.ts index 7a5783286..c3d781644 100644 --- a/script/utils/diamond.ts +++ b/script/utils/diamond.ts @@ -1,7 +1,7 @@ import { constants, Contract } from 'ethers' import { Fragment, FunctionFragment } from 'ethers/lib/utils' import { ethers } from 'hardhat' -import { IDiamondCut, IDiamondLoupe } from '../typechain' +import { IDiamondCut, IDiamondLoupe } from '../../typechain' export function getSelectors(contract: Contract): string[] { const selectors = contract.interface.fragments.reduce(