-
Notifications
You must be signed in to change notification settings - Fork 0
feat: pause scripts #93
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
Merged
Merged
Changes from 11 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
669f178
feat: Add bridge pause/unpause operations and status monitoring scripts
gfournierPro 21a7e60
feat: Include pauser.mk in Makefile for enhanced bridge operations
gfournierPro 35ffff9
feat: Implement pause and unpause scripts for bridge operations with …
gfournierPro 20e87e4
feat: Add bridge pause/unpause operations with enhanced options and C…
gfournierPro 56f559b
feat: Reorder network options in bridge pause operations workflow
gfournierPro 1983acc
fix: Ensure newline at end of file in bridge pause operations scripts
gfournierPro 7ee2fb1
feat: Update bridge pause operations workflow to support network type…
gfournierPro 940511d
refactor: Clean up whitespace in PauseBridge and PauseBridgeScriptTes…
gfournierPro dc73330
refactor: Remove redundant pause/unpause sequence tests and helper fu…
gfournierPro 1ced7d4
Merge branch 'main' into feature/pause-scripts
gfournierPro 81a146a
fix: treat copilot suggestions
gfournierPro 1b3e378
Merge branch 'main' into feature/pause-scripts
gfournierPro c07f29e
fix: Remove unnecessary output conversion for matrix in workflows
gfournierPro d2d94aa
fix: Set concurrency cancel-in-progress to false for bridge pause ope…
gfournierPro 7d237be
fix: Update bridge address assignment and remove unused helper functi…
gfournierPro d49f5e4
fix: Simplify pause operation handling by removing redundant operatio…
gfournierPro c546e1e
fix: Update pauseOutboundTransfers log message to clarify transfer be…
gfournierPro 4b88cb1
fix: Remove bridge address validation from pause and unpause functions
gfournierPro bfb63f8
fix: Remove unused PauseBridgeValidation import from PauseBridgeScrip…
gfournierPro d3cecfc
fix: Remove redundant UnpauseOutboundTransfers import from PauseBridg…
gfournierPro 04ad851
fix: Remove redundant pauser role tests from PauseBridgeScriptTest
gfournierPro File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| name: Bridge Pause Operations | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| operation: | ||
| description: 'Pause operation to perform' | ||
| required: true | ||
| type: choice | ||
| options: | ||
| - 'pause-bridge' | ||
| - 'unpause-bridge' | ||
| - 'pause-outbound' | ||
| - 'unpause-outbound' | ||
| network_type: | ||
| description: 'Network type to configure' | ||
| required: true | ||
| type: choice | ||
| options: | ||
| - testnets | ||
| - mainnets | ||
| default: 'testnets' | ||
| jobs: | ||
| setup-matrix: | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| matrix: ${{ steps.set-matrix.outputs.matrix }} | ||
| steps: | ||
| - name: Set matrix based on network type | ||
| id: set-matrix | ||
| run: | | ||
| if [ "${{ github.event.inputs.network_type }}" == "testnets" ]; then | ||
| MATRIX='[ | ||
| { | ||
| "chain": "sepolia" | ||
| }, | ||
| { | ||
| "chain": "arbitrum_sepolia" | ||
| } | ||
| ]' | ||
| else | ||
| MATRIX='[ | ||
| { | ||
| "chain": "ethereum" | ||
| }, | ||
| { | ||
| "chain": "arbitrum" | ||
| } | ||
| ]' | ||
| fi | ||
|
|
||
| # Convert to single line for GitHub Output | ||
| echo "matrix=$(echo "$MATRIX" | jq -c .)" >> $GITHUB_OUTPUT | ||
Le-Caignec marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| bridge-pause-operation: | ||
| needs: setup-matrix | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| include: ${{ fromJson(needs.setup-matrix.outputs.matrix) }} | ||
| fail-fast: false | ||
| concurrency: | ||
| group: pause-bridge-${{ matrix.chain }} | ||
| cancel-in-progress: true | ||
Le-Caignec marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| env: | ||
| CI: true | ||
| environment: ${{ matrix.chain }} | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| submodules: recursive | ||
|
|
||
| - name: Install Foundry | ||
| uses: foundry-rs/foundry-toolchain@v1 | ||
| with: | ||
| version: stable | ||
| cache: true | ||
|
|
||
| - name: Set operation details | ||
| id: operation-details | ||
| run: | | ||
| case "${{ github.event.inputs.operation }}" in | ||
| pause-bridge) | ||
| echo "make_target=pause-bridge-single-chain" >> $GITHUB_OUTPUT | ||
| ;; | ||
| unpause-bridge) | ||
| echo "make_target=unpause-bridge-single-chain" >> $GITHUB_OUTPUT | ||
| ;; | ||
| pause-outbound) | ||
| echo "make_target=pause-outbound-single-chain" >> $GITHUB_OUTPUT | ||
| ;; | ||
| unpause-outbound) | ||
| echo "make_target=unpause-outbound-single-chain" >> $GITHUB_OUTPUT | ||
| ;; | ||
| esac | ||
|
|
||
| - name: Run pause operation on bridge from ${{ matrix.chain }} | ||
| env: | ||
| CHAIN: ${{ matrix.chain }} | ||
| RPC_URL: ${{ secrets.RPC_URL }} | ||
| PAUSER_PRIVATE_KEY: ${{ secrets.PAUSER_PRIVATE_KEY }} | ||
| run: make ${{ steps.operation-details.outputs.make_target }} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,167 @@ | ||
| // SPDX-FileCopyrightText: 2025 IEXEC BLOCKCHAIN TECH <[email protected]> | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| pragma solidity ^0.8.22; | ||
|
|
||
| import {Script} from "forge-std/Script.sol"; | ||
| import {console} from "forge-std/console.sol"; | ||
| import {ConfigLib} from "./lib/ConfigLib.sol"; | ||
| import {IexecLayerZeroBridge} from "../src/bridges/layerZero/IexecLayerZeroBridge.sol"; | ||
|
|
||
| /** | ||
| * Levels of pause: | ||
| * Level 1 (Complete Pause): Blocks ALL bridge operations (inbound and outbound) | ||
| * Level 2 (Outbound Only): Blocks only outbound transfers, allows users to receive/withdraw | ||
| */ | ||
|
|
||
| /** | ||
| * @title PauseBridge | ||
| * @dev Script to pause bridge operations on the current chain. | ||
| */ | ||
| contract PauseBridge is Script { | ||
| /** | ||
| * @notice Pauses all bridge operations (Level 1 - Complete Pause) | ||
| * @dev This function blocks both inbound and outbound transfers | ||
| * Use this for critical security incidents | ||
| */ | ||
| function run() external virtual { | ||
| string memory chain = vm.envString("CHAIN"); | ||
| console.log("Pausing ALL bridge operations on chain:", chain); | ||
|
|
||
| ConfigLib.CommonConfigParams memory params = ConfigLib.readCommonConfig(chain); | ||
| vm.startBroadcast(); | ||
| pauseBridge(params); | ||
| vm.stopBroadcast(); | ||
| } | ||
|
|
||
| /** | ||
| * @notice Pauses the bridge operations | ||
| * @param params The configuration parameters for the current chain | ||
| */ | ||
| function pauseBridge(ConfigLib.CommonConfigParams memory params) public virtual { | ||
| PauseBridgeValidation.validateBridgeAddress(params.iexecLayerZeroBridgeAddress); | ||
| IexecLayerZeroBridge bridge = IexecLayerZeroBridge(params.iexecLayerZeroBridgeAddress); | ||
|
|
||
| console.log("Executing complete pause on bridge at:", params.iexecLayerZeroBridgeAddress); | ||
| bridge.pause(); | ||
| console.log("Bridge completely paused"); | ||
| console.log("Both inbound and outbound transfers are now blocked"); | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * @title UnpauseBridge | ||
| * @dev Script to unpause bridge operations on the current chain. | ||
| * This restores all bridge functionality. | ||
| */ | ||
| contract UnpauseBridge is Script { | ||
| /** | ||
| * @notice Unpauses all bridge operations | ||
| * @dev This function restores both inbound and outbound transfers | ||
| */ | ||
| function run() external virtual { | ||
| string memory chain = vm.envString("CHAIN"); | ||
| console.log("Unpausing ALL bridge operations on chain:", chain); | ||
|
|
||
| ConfigLib.CommonConfigParams memory params = ConfigLib.readCommonConfig(chain); | ||
| vm.startBroadcast(); | ||
| unpauseBridge(params); | ||
| vm.stopBroadcast(); | ||
| } | ||
|
|
||
| /** | ||
| * @notice Unpauses the bridge operations | ||
| * @param params The configuration parameters for the current chain | ||
| */ | ||
| function unpauseBridge(ConfigLib.CommonConfigParams memory params) public virtual { | ||
| PauseBridgeValidation.validateBridgeAddress(params.iexecLayerZeroBridgeAddress); | ||
| IexecLayerZeroBridge bridge = IexecLayerZeroBridge(params.iexecLayerZeroBridgeAddress); | ||
|
|
||
| console.log("Executing unpause on bridge at:", params.iexecLayerZeroBridgeAddress); | ||
| bridge.unpause(); | ||
| console.log("Bridge unpaused"); | ||
| console.log("Both inbound and outbound transfers are now enabled"); | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * @title PauseOutboundTransfers | ||
| * @dev Script to pause only outbound transfers (Level 2 - Partial Pause) | ||
| * This allows users to still receive funds and "exit" their positions while blocking new outbound transfers. | ||
| */ | ||
| contract PauseOutboundTransfers is Script { | ||
| /** | ||
| * @notice Pauses only outbound transfers (Level 2 - Partial Pause) | ||
| * @dev This function blocks outbound transfers but allows inbound transfers | ||
| * Use this for less critical issues when you want to allow user withdrawals | ||
| */ | ||
| function run() external virtual { | ||
| string memory chain = vm.envString("CHAIN"); | ||
| console.log("Pausing OUTBOUND transfers only on chain:", chain); | ||
|
|
||
| ConfigLib.CommonConfigParams memory params = ConfigLib.readCommonConfig(chain); | ||
| vm.startBroadcast(); | ||
| pauseOutboundTransfers(params); | ||
| vm.stopBroadcast(); | ||
| } | ||
|
|
||
| /** | ||
| * @notice Pauses outbound transfers on the bridge | ||
| * @param params The configuration parameters for the current chain | ||
| */ | ||
| function pauseOutboundTransfers(ConfigLib.CommonConfigParams memory params) public virtual { | ||
| PauseBridgeValidation.validateBridgeAddress(params.iexecLayerZeroBridgeAddress); | ||
| IexecLayerZeroBridge bridge = IexecLayerZeroBridge(params.iexecLayerZeroBridgeAddress); | ||
|
|
||
| console.log("Executing outbound transfer pause on bridge at:", params.iexecLayerZeroBridgeAddress); | ||
| bridge.pauseOutboundTransfers(); | ||
| console.log("Outbound transfers paused"); | ||
| console.log("Outbound transfers are blocked, inbound transfers still work"); | ||
| console.log("Users can still receive funds and exit their positions"); | ||
zguesmi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
| } | ||
|
|
||
| /** | ||
| * @title UnpauseOutboundTransfers | ||
| * @dev Script to unpause outbound transfers (restores send functionality) | ||
| * This restores outbound transfer capability while maintaining inbound functionality. | ||
| */ | ||
| contract UnpauseOutboundTransfers is Script { | ||
| /** | ||
| * @notice Unpauses outbound transfers (restores send functionality) | ||
| * @dev This function restores outbound transfer capability | ||
| */ | ||
| function run() external virtual { | ||
| string memory chain = vm.envString("CHAIN"); | ||
| console.log("Unpausing OUTBOUND transfers on chain:", chain); | ||
|
|
||
| ConfigLib.CommonConfigParams memory params = ConfigLib.readCommonConfig(chain); | ||
| vm.startBroadcast(); | ||
| unpauseOutboundTransfers(params); | ||
| vm.stopBroadcast(); | ||
| } | ||
|
|
||
| /** | ||
| * @notice Unpauses outbound transfers on the bridge | ||
| * @param params The configuration parameters for the current chain | ||
| */ | ||
| function unpauseOutboundTransfers(ConfigLib.CommonConfigParams memory params) public virtual { | ||
| PauseBridgeValidation.validateBridgeAddress(params.iexecLayerZeroBridgeAddress); | ||
| IexecLayerZeroBridge bridge = IexecLayerZeroBridge(params.iexecLayerZeroBridgeAddress); | ||
|
|
||
| console.log("Executing outbound transfer unpause on bridge at:", params.iexecLayerZeroBridgeAddress); | ||
| bridge.unpauseOutboundTransfers(); | ||
| console.log("Outbound transfers unpaused"); | ||
| console.log("Both inbound and outbound transfers are now enabled"); | ||
| } | ||
| } | ||
|
|
||
| library PauseBridgeValidation { | ||
| /** | ||
| * @notice Validates that the bridge contract address is not zero | ||
| * @param bridgeAddress The bridge contract address | ||
| */ | ||
| function validateBridgeAddress(address bridgeAddress) internal pure { | ||
zguesmi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| require(bridgeAddress != address(0), "Bridge address cannot be zero"); | ||
| } | ||
| } | ||
Le-Caignec marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.