Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/gateway-contracts-upgrade-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ jobs:
# See https://github.com/zama-ai/fhevm-internal/issues/379
- name: Upgrade GatewayConfig contract
working-directory: current-fhevm/gateway-contracts
if: false
run: |
npx hardhat task:upgradeGatewayConfig \
--current-implementation previous-contracts/GatewayConfig.sol:GatewayConfig \
Expand Down
36 changes: 28 additions & 8 deletions gateway-contracts/contracts/GatewayConfig.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ contract GatewayConfig is IGatewayConfig, Ownable2StepUpgradeable, UUPSUpgradeab
*/
string private constant CONTRACT_NAME = "GatewayConfig";
uint256 private constant MAJOR_VERSION = 0;
uint256 private constant MINOR_VERSION = 4;
uint256 private constant MINOR_VERSION = 5;
uint256 private constant PATCH_VERSION = 0;

/**
Expand All @@ -44,7 +44,7 @@ contract GatewayConfig is IGatewayConfig, Ownable2StepUpgradeable, UUPSUpgradeab
* This constant does not represent the number of time a specific contract have been upgraded,
* as a contract deployed from version VX will have a REINITIALIZER_VERSION > 2.
*/
uint64 private constant REINITIALIZER_VERSION = 5;
uint64 private constant REINITIALIZER_VERSION = 6;

/**
* @notice The address of the all gateway contracts
Expand Down Expand Up @@ -359,21 +359,41 @@ contract GatewayConfig is IGatewayConfig, Ownable2StepUpgradeable, UUPSUpgradeab
/**
* @notice See {IGatewayConfig-pauseAllGatewayContracts}.
* Contracts that are technically pausable but do not provide any pausable functions are not
* paused. If at least one of the contracts is already paused, the function will revert.
* paused. If all of the contracts are already paused, the function will revert.
*/
function pauseAllGatewayContracts() external virtual onlyPauser {
DECRYPTION.pause();
INPUT_VERIFICATION.pause();
if (DECRYPTION.paused() && INPUT_VERIFICATION.paused()) {
revert AllGatewayContractsAlreadyPaused();
}

if (!DECRYPTION.paused()) {
DECRYPTION.pause();
}

if (!INPUT_VERIFICATION.paused()) {
INPUT_VERIFICATION.pause();
}

emit PauseAllGatewayContracts();
}

/**
* @notice See {IGatewayConfig-unpauseAllGatewayContracts}.
* If at least one of the contracts is not paused, the function will revert.
* If all of the contracts are not paused, the function will revert.
*/
function unpauseAllGatewayContracts() external virtual onlyOwner {
DECRYPTION.unpause();
INPUT_VERIFICATION.unpause();
if (!DECRYPTION.paused() && !INPUT_VERIFICATION.paused()) {
revert AllGatewayContractsAlreadyUnpaused();
}

if (DECRYPTION.paused()) {
DECRYPTION.unpause();
}

if (INPUT_VERIFICATION.paused()) {
INPUT_VERIFICATION.unpause();
}

emit UnpauseAllGatewayContracts();
}

Expand Down
10 changes: 10 additions & 0 deletions gateway-contracts/contracts/interfaces/IGatewayConfig.sol
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,16 @@ interface IGatewayConfig {
*/
error ChainIdNotUint64(uint256 chainId);

/**
* @notice Error emitted when all the pausable gateway contracts are already paused.
*/
error AllGatewayContractsAlreadyPaused();

/**
* @notice Error emitted when all the pausable gateway contracts are already unpaused.
*/
error AllGatewayContractsAlreadyUnpaused();

/**
* @notice Update the list of KMS nodes and their thresholds.
* @dev ⚠️ This function should be used with caution as it can lead to unexpected behavior in
Expand Down
250 changes: 245 additions & 5 deletions gateway-contracts/rust_bindings/src/gateway_config.rs

Large diffs are not rendered by default.

Loading
Loading