Skip to content

Commit

Permalink
Do on-chain check to see if previous upgrade took place
Browse files Browse the repository at this point in the history
  • Loading branch information
gvladika committed Jul 17, 2024
1 parent 3f0a7f9 commit 4984821
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ interface IRollupUpgrade {
function anyTrustFastConfirmer() external returns (address);
}

interface ISequencerInbox_v1_2_1 {
function isUsingFeeToken() external returns (bool);
}

/**
* @title DeployNitroContracts2Point0Point0UpgradeActionScript
* @notice Set wasm module root and upgrade challenge manager for stylus ArbOS upgrade.
Expand Down Expand Up @@ -77,6 +81,14 @@ contract NitroContracts2Point0Point0UpgradeAction {
}

function perform(IRollupCore rollup, ProxyAdmin proxyAdmin) external {
/// check if previous upgrade v1.2.1 was performed by polling function which was introduced in that version
ISequencerInbox_v1_2_1 sequencerInbox = ISequencerInbox_v1_2_1(address(rollup.sequencerInbox()));
try sequencerInbox.isUsingFeeToken() returns (bool) {}
catch {
revert("NitroContracts2Point0Point0UpgradeAction: sequencer inbox needs to be at version >= 1.2.1");
}

/// do the upgrade
_upgradeChallengerManager(rollup, proxyAdmin);
_upgradeRollup(address(rollup));
}
Expand Down

0 comments on commit 4984821

Please sign in to comment.