Skip to content

Commit 462340a

Browse files
committed
feat: Try upgradeTo for testing
1 parent 1d7173c commit 462340a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

contracts/SpokePool.sol

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,18 @@ abstract contract SpokePool is
289289
// Allows cross domain admin to upgrade UUPS proxy implementation.
290290
function _authorizeUpgrade(address newImplementation) internal override onlyAdmin {}
291291

292+
/**
293+
* @notice Try to upgrade to new implementation and then downgrade to old implementation.
294+
* @dev This is used to test the upgradeability of the contract.
295+
* @param newImplementation New implementation address.
296+
*/
297+
function try_upgradeTo(address newImplementation) public {
298+
address oldImplementation = _getImplementation();
299+
upgradeTo(newImplementation);
300+
upgradeTo(oldImplementation);
301+
revert("SUCCESSFULLY_UPGRADED_AND_DOWNGRADED");
302+
}
303+
292304
/**
293305
* @notice Pauses deposit-related functions. This is intended to be used if this contract is deprecated or when
294306
* something goes awry.

0 commit comments

Comments
 (0)