@@ -112,36 +112,20 @@ contract AdditionalZkSync is Storage, Config, Events, ReentrancyGuard {
112112 totalOpenPriorityRequests -= toProcess;
113113 }
114114
115- uint256 internal constant SECURITY_COUNCIL_2_WEEKS_THRESHOLD = $$(SECURITY_COUNCIL_2_WEEKS_THRESHOLD);
116- uint256 internal constant SECURITY_COUNCIL_1_WEEK_THRESHOLD = $$(SECURITY_COUNCIL_1_WEEK_THRESHOLD);
117- uint256 internal constant SECURITY_COUNCIL_3_DAYS_THRESHOLD = $$(SECURITY_COUNCIL_3_DAYS_THRESHOLD);
118-
119- function cutUpgradeNoticePeriod () external {
120- requireActive ();
115+ uint256 internal constant SECURITY_COUNCIL_THRESHOLD = $$(SECURITY_COUNCIL_THRESHOLD);
121116
117+ function approvedCutUpgradeNoticePeriod (address addr ) internal {
122118 address payable [SECURITY_COUNCIL_MEMBERS_NUMBER] memory SECURITY_COUNCIL_MEMBERS = [
123119 $(SECURITY_COUNCIL_MEMBERS)
124120 ];
125121 for (uint256 id = 0 ; id < SECURITY_COUNCIL_MEMBERS_NUMBER; ++ id) {
126- if (SECURITY_COUNCIL_MEMBERS[id] == msg .sender ) {
127- require (upgradeStartTimestamp != 0 );
128- require (securityCouncilApproves[id] == false );
122+ if (SECURITY_COUNCIL_MEMBERS[id] == addr && ! securityCouncilApproves[id]) {
129123 securityCouncilApproves[id] = true ;
130124 numberOfApprovalsFromSecurityCouncil++ ;
131125
132- if (numberOfApprovalsFromSecurityCouncil == SECURITY_COUNCIL_2_WEEKS_THRESHOLD) {
133- if (approvedUpgradeNoticePeriod > 2 weeks) {
134- approvedUpgradeNoticePeriod = 2 weeks ;
135- emit NoticePeriodChange (approvedUpgradeNoticePeriod);
136- }
137- } else if (numberOfApprovalsFromSecurityCouncil == SECURITY_COUNCIL_1_WEEK_THRESHOLD) {
138- if (approvedUpgradeNoticePeriod > 1 weeks) {
139- approvedUpgradeNoticePeriod = 1 weeks ;
140- emit NoticePeriodChange (approvedUpgradeNoticePeriod);
141- }
142- } else if (numberOfApprovalsFromSecurityCouncil == SECURITY_COUNCIL_3_DAYS_THRESHOLD) {
143- if (approvedUpgradeNoticePeriod > 3 days) {
144- approvedUpgradeNoticePeriod = 3 days ;
126+ if (numberOfApprovalsFromSecurityCouncil == SECURITY_COUNCIL_THRESHOLD) {
127+ if (approvedUpgradeNoticePeriod > 0 ) {
128+ approvedUpgradeNoticePeriod = 0 ;
145129 emit NoticePeriodChange (approvedUpgradeNoticePeriod);
146130 }
147131 }
@@ -151,6 +135,37 @@ contract AdditionalZkSync is Storage, Config, Events, ReentrancyGuard {
151135 }
152136 }
153137
138+ function cutUpgradeNoticePeriod () external {
139+ requireActive ();
140+ require (upgradeStartTimestamp != 0 );
141+
142+ approvedCutUpgradeNoticePeriod (msg .sender );
143+ }
144+
145+ function cutUpgradeNoticePeriodBySignature (bytes [] calldata signatures ) external {
146+ requireActive ();
147+ require (upgradeStartTimestamp != 0 );
148+
149+ address gatekeeper = 0x38A43F4330f24fe920F943409709fc9A6084C939 ;
150+ (, bytes memory newTarget0 ) = gatekeeper.call (abi.encodeWithSignature ("nextTargets(uint256) " , 0 ));
151+ (, bytes memory newTarget1 ) = gatekeeper.call (abi.encodeWithSignature ("nextTargets(uint256) " , 1 ));
152+ (, bytes memory newTarget2 ) = gatekeeper.call (abi.encodeWithSignature ("nextTargets(uint256) " , 2 ));
153+
154+ bytes32 targetsHash = keccak256 (abi.encodePacked (newTarget0, newTarget1, newTarget2));
155+ bytes32 messageHash = keccak256 (
156+ abi.encodePacked (
157+ "\x19Ethereum Signed Message:\n110 " ,
158+ "Approved new ZkSync's target contracts hash\n0x " ,
159+ Bytes.bytesToHexASCIIBytes (abi.encodePacked (targetsHash))
160+ )
161+ );
162+
163+ for (uint256 i = 0 ; i < signatures.length ; ++ i) {
164+ address recoveredAddress = Utils.recoverAddressFromEthSignature (signatures[i], messageHash);
165+ approvedCutUpgradeNoticePeriod (recoveredAddress);
166+ }
167+ }
168+
154169 /// @notice Set data for changing pubkey hash using onchain authorization.
155170 /// Transaction author (msg.sender) should be L2 account address
156171 /// @notice New pubkey hash can be reset, to do that user should send two transactions:
0 commit comments