-
Notifications
You must be signed in to change notification settings - Fork 347
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #158 from matter-labs/sb-more-scrict-upgrade-valid…
…ation Make upgrade validation more strict
- Loading branch information
Showing
3 changed files
with
34 additions
and
31 deletions.
There are no files selected for viewing
This file contains 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 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 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 |
---|---|---|
|
@@ -8,39 +8,10 @@ import "./BaseZkSyncUpgrade.sol"; | |
/// @author Matter Labs | ||
/// @custom:security-contact [email protected] | ||
contract DefaultUpgrade is BaseZkSyncUpgrade { | ||
/// @notice Placeholder function for custom logic for upgrading L1 contract. | ||
/// Typically this function will never be used. | ||
/// @param _customCallDataForUpgrade Custom data for an upgrade, which may be interpreted differently for each | ||
/// upgrade. | ||
function _upgradeL1Contract(bytes calldata _customCallDataForUpgrade) internal virtual {} | ||
|
||
/// @notice placeholder function for custom logic for post-upgrade logic. | ||
/// Typically this function will never be used. | ||
/// @param _customCallDataForUpgrade Custom data for an upgrade, which may be interpreted differently for each | ||
/// upgrade. | ||
function _postUpgrade(bytes calldata _customCallDataForUpgrade) internal virtual {} | ||
|
||
/// @notice The main function that will be called by the upgrade proxy. | ||
/// @param _proposedUpgrade The upgrade to be executed. | ||
function upgrade(ProposedUpgrade calldata _proposedUpgrade) public override returns (bytes32) { | ||
super.upgrade(_proposedUpgrade); | ||
|
||
_setNewProtocolVersion(_proposedUpgrade.newProtocolVersion); | ||
_upgradeL1Contract(_proposedUpgrade.l1ContractsUpgradeCalldata); | ||
_upgradeVerifier(_proposedUpgrade.verifier, _proposedUpgrade.verifierParams); | ||
_setBaseSystemContracts(_proposedUpgrade.bootloaderHash, _proposedUpgrade.defaultAccountHash); | ||
|
||
bytes32 txHash; | ||
txHash = _setL2SystemContractUpgrade( | ||
_proposedUpgrade.l2ProtocolUpgradeTx, | ||
_proposedUpgrade.factoryDeps, | ||
_proposedUpgrade.newProtocolVersion | ||
); | ||
|
||
_postUpgrade(_proposedUpgrade.postUpgradeCalldata); | ||
|
||
emit UpgradeComplete(_proposedUpgrade.newProtocolVersion, txHash, _proposedUpgrade); | ||
|
||
return Diamond.DIAMOND_INIT_SUCCESS_RETURN_VALUE; | ||
} | ||
} |