-
Notifications
You must be signed in to change notification settings - Fork 346
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 #3 from matter-labs/update-scripts-for-new-upgrade
Update scripts for new upgrade
- Loading branch information
Showing
15 changed files
with
539 additions
and
41 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
57 changes: 57 additions & 0 deletions
57
ethereum/contracts/zksync/upgrade-initializers/DiamondUpgradeInit3.sol
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 |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity ^0.8.0; | ||
|
||
import "../libraries/Diamond.sol"; | ||
import "../facets/Base.sol"; | ||
|
||
interface IOldDiamondCut { | ||
function proposeDiamondCut(Diamond.FacetCut[] calldata _facetCuts, address _initAddress) external; | ||
|
||
function cancelDiamondCutProposal() external; | ||
|
||
function executeDiamondCutProposal(Diamond.DiamondCutData calldata _diamondCut) external; | ||
|
||
function emergencyFreezeDiamond() external; | ||
|
||
function unfreezeDiamond() external; | ||
|
||
function approveEmergencyDiamondCutAsSecurityCouncilMember(bytes32 _diamondCutHash) external; | ||
|
||
// FIXME: token holders should have the ability to cancel the upgrade | ||
|
||
event DiamondCutProposal(Diamond.FacetCut[] _facetCuts, address _initAddress); | ||
|
||
event DiamondCutProposalCancelation(uint256 currentProposalId, bytes32 indexed proposedDiamondCutHash); | ||
|
||
event DiamondCutProposalExecution(Diamond.DiamondCutData _diamondCut); | ||
|
||
event EmergencyFreeze(); | ||
|
||
event Unfreeze(uint256 lastDiamondFreezeTimestamp); | ||
|
||
event EmergencyDiamondCutApproved( | ||
address indexed _address, | ||
uint256 currentProposalId, | ||
uint256 securityCouncilEmergencyApprovals, | ||
bytes32 indexed proposedDiamondCutHash | ||
); | ||
} | ||
|
||
/// @author Matter Labs | ||
contract DiamondUpgradeInit3 is Base { | ||
function upgrade( | ||
uint256 _priorityTxMaxErgsLimit, | ||
IAllowList _allowList, | ||
Verifier _verifier | ||
) external payable returns (bytes32) { | ||
// Zero out the deprecated storage slots | ||
delete s.__DEPRECATED_diamondCutStorage; | ||
|
||
s.priorityTxMaxErgsLimit = _priorityTxMaxErgsLimit; | ||
s.allowList = _allowList; | ||
s.verifier = _verifier; | ||
|
||
return Diamond.DIAMOND_INIT_SUCCESS_RETURN_VALUE; | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
ethereum/contracts/zksync/upgrade-initializers/DiamondUpgradeInit4.sol
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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity ^0.8.0; | ||
|
||
import "../Config.sol"; | ||
import "../facets/Mailbox.sol"; | ||
import "../libraries/Diamond.sol"; | ||
import "../../common/L2ContractHelper.sol"; | ||
|
||
interface IOldContractDeployer { | ||
struct ForceDeployment { | ||
bytes32 bytecodeHash; | ||
address newAddress; | ||
uint256 value; | ||
bytes input; | ||
} | ||
|
||
function forceDeployOnAddresses(ForceDeployment[] calldata _deployParams) external; | ||
} | ||
|
||
/// @author Matter Labs | ||
contract DiamondUpgradeInit4 is MailboxFacet { | ||
function forceDeploy2( | ||
bytes calldata _upgradeDeployerCalldata, | ||
bytes calldata _upgradeSystemContractsCalldata, | ||
bytes[] calldata _factoryDeps | ||
) external payable returns (bytes32) { | ||
// 1. Update bytecode for the deployer smart contract | ||
_requestL2Transaction( | ||
FORCE_DEPLOYER, | ||
DEPLOYER_SYSTEM_CONTRACT_ADDRESS, | ||
0, | ||
_upgradeDeployerCalldata, | ||
$(PRIORITY_TX_MAX_ERGS_LIMIT), | ||
_factoryDeps | ||
); | ||
|
||
// 2. Redeploy other contracts by one transaction | ||
_requestL2Transaction( | ||
FORCE_DEPLOYER, | ||
DEPLOYER_SYSTEM_CONTRACT_ADDRESS, | ||
0, | ||
_upgradeSystemContractsCalldata, | ||
$(PRIORITY_TX_MAX_ERGS_LIMIT), | ||
_factoryDeps | ||
); | ||
|
||
return Diamond.DIAMOND_INIT_SUCCESS_RETURN_VALUE; | ||
} | ||
} |
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
File renamed without changes.
File renamed without changes.
Oops, something went wrong.