Skip to content

Commit 3510678

Browse files
authored
Merge of #1747
2 parents 36ba1e1 + 57baf54 commit 3510678

File tree

6 files changed

+592
-12
lines changed

6 files changed

+592
-12
lines changed

gateway-contracts/contracts/GatewayConfig.sol

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -429,21 +429,47 @@ contract GatewayConfig is IGatewayConfig, Ownable2StepUpgradeable, UUPSUpgradeab
429429
/**
430430
* @notice See {IGatewayConfig-pauseAllGatewayContracts}.
431431
* Contracts that are technically pausable but do not provide any pausable functions are not
432-
* paused. If at least one of the contracts is already paused, the function will revert.
432+
* paused. If all of the contracts are already paused, the function will revert.
433433
*/
434434
function pauseAllGatewayContracts() external virtual onlyPauser {
435-
DECRYPTION.pause();
436-
INPUT_VERIFICATION.pause();
435+
bool isDecryptionPaused = DECRYPTION.paused();
436+
bool isInputVerificationPaused = INPUT_VERIFICATION.paused();
437+
438+
if (isDecryptionPaused && isInputVerificationPaused) {
439+
revert AllGatewayContractsAlreadyPaused();
440+
}
441+
442+
if (!isDecryptionPaused) {
443+
DECRYPTION.pause();
444+
}
445+
446+
if (!isInputVerificationPaused) {
447+
INPUT_VERIFICATION.pause();
448+
}
449+
437450
emit PauseAllGatewayContracts();
438451
}
439452

440453
/**
441454
* @notice See {IGatewayConfig-unpauseAllGatewayContracts}.
442-
* If at least one of the contracts is not paused, the function will revert.
455+
* If none of the contracts are paused, the function will revert.
443456
*/
444457
function unpauseAllGatewayContracts() external virtual onlyOwner {
445-
DECRYPTION.unpause();
446-
INPUT_VERIFICATION.unpause();
458+
bool isDecryptionPaused = DECRYPTION.paused();
459+
bool isInputVerificationPaused = INPUT_VERIFICATION.paused();
460+
461+
if (!isDecryptionPaused && !isInputVerificationPaused) {
462+
revert AllGatewayContractsAlreadyUnpaused();
463+
}
464+
465+
if (isDecryptionPaused) {
466+
DECRYPTION.unpause();
467+
}
468+
469+
if (isInputVerificationPaused) {
470+
INPUT_VERIFICATION.unpause();
471+
}
472+
447473
emit UnpauseAllGatewayContracts();
448474
}
449475

gateway-contracts/contracts/interfaces/IGatewayConfig.sol

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,16 @@ interface IGatewayConfig {
271271
*/
272272
error ChainIdNotUint64(uint256 chainId);
273273

274+
/**
275+
* @notice Error emitted when all the pausable gateway contracts are already paused.
276+
*/
277+
error AllGatewayContractsAlreadyPaused();
278+
279+
/**
280+
* @notice Error emitted when all the pausable gateway contracts are already unpaused.
281+
*/
282+
error AllGatewayContractsAlreadyUnpaused();
283+
274284
/**
275285
* @notice Update the KMS context: nodes and thresholds for a given context ID.
276286
* @dev ⚠️ This function should be used with caution as it can lead to unexpected behavior in

gateway-contracts/rust_bindings/src/gateway_config.rs

Lines changed: 245 additions & 5 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)