Skip to content

Commit

Permalink
import paths updated for zkSync scripts (#811)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
0xDEnYO and ezynda3 authored Sep 30, 2024
1 parent 8a3d456 commit e7667ad
Show file tree
Hide file tree
Showing 14 changed files with 43 additions and 25 deletions.
26 changes: 22 additions & 4 deletions .github/workflows/protectAuditLabels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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 }}"
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,4 @@
"solhint --fix"
]
}
}
}
8 changes: 4 additions & 4 deletions script/deploy/zksync/006_deploy_receiver.ts
Original file line number Diff line number Diff line change
@@ -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 }
Expand Down
4 changes: 2 additions & 2 deletions script/deploy/zksync/007_deploy_fee_collector.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions script/deploy/zksync/008_deploy_service_fee_collector.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion script/deploy/zksync/010_deploy_cbridge_facet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]: {
Expand Down
2 changes: 1 addition & 1 deletion script/deploy/zksync/011_deploy_cbridge_facet_packed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]: {
Expand Down
2 changes: 1 addition & 1 deletion script/deploy/zksync/012_deploy_across_facet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]: {
Expand Down
4 changes: 2 additions & 2 deletions script/deploy/zksync/013_deploy_lifuel_fee_collector.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions script/deploy/zksync/015_deploy_celerim_facet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion script/deploy/zksync/016_deploy_across_facet_packed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]: {
Expand Down
4 changes: 2 additions & 2 deletions script/deploy/zksync/017_deploy_token_wrapper.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion script/deploy/zksync/018_deploy_symbiosis_facet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]: {
Expand Down
2 changes: 1 addition & 1 deletion script/utils/diamond.ts
Original file line number Diff line number Diff line change
@@ -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(
Expand Down

0 comments on commit e7667ad

Please sign in to comment.