-
Notifications
You must be signed in to change notification settings - Fork 345
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge main back into protocol defense (#839)
Signed-off-by: Danil <deniallugo@gmail.com> Co-authored-by: Bence Haromi <56651250+benceharomi@users.noreply.github.com> Co-authored-by: Grzegorz Prusak <pompon.pompon@gmail.com> Co-authored-by: Moshe Shababo <17073733+moshababo@users.noreply.github.com> Co-authored-by: Akosh Farkash <aakoshh@gmail.com> Co-authored-by: Bruno França <bruno@franca.xyz> Co-authored-by: Vlad Bochok <41153528+vladbochok@users.noreply.github.com> Co-authored-by: Roman Brodetski <Roman.Brodetski@gmail.com> Co-authored-by: vladbochok <vladbochok1@gmail.com> Co-authored-by: Stanislav Bezkorovainyi <stanislavbezkor@gmail.com> Co-authored-by: Danil <deniallugo@gmail.com>
- Loading branch information
1 parent
1fba03d
commit a7e8923
Showing
8 changed files
with
253 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity 0.8.24; | ||
|
||
library EIP712Utils { | ||
bytes32 private constant TYPE_HASH = | ||
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"); | ||
|
||
function buildDomainHash( | ||
address _verifyingContract, | ||
string memory _name, | ||
string memory _version | ||
) internal view returns (bytes32) { | ||
return | ||
keccak256( | ||
// solhint-disable-next-line func-named-parameters | ||
abi.encode( | ||
TYPE_HASH, | ||
keccak256(bytes(_name)), | ||
keccak256(bytes(_version)), | ||
block.chainid, | ||
_verifyingContract | ||
) | ||
); | ||
} | ||
|
||
function buildDigest(bytes32 _domainHash, bytes32 _message) internal view returns (bytes32) { | ||
return keccak256(abi.encodePacked("\x19\x01", _domainHash, _message)); | ||
} | ||
} |
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
23 changes: 23 additions & 0 deletions
23
l1-contracts/deploy-scripts/interfaces/IEmergencyUpgrageBoard.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,23 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity 0.8.24; | ||
|
||
import {IProtocolUpgradeHandler} from "./IProtocolUpgradeHandler.sol"; | ||
|
||
/// @author Matter Labs | ||
/// @custom:security-contact security@matterlabs.dev | ||
interface IEmergencyUpgrageBoard { | ||
function GUARDIANS() external view returns (address); | ||
|
||
function SECURITY_COUNCIL() external view returns (address); | ||
|
||
function ZK_FOUNDATION_SAFE() external view returns (address); | ||
|
||
function executeEmergencyUpgrade( | ||
IProtocolUpgradeHandler.Call[] calldata _calls, | ||
bytes32 _salt, | ||
bytes calldata _guardiansSignatures, | ||
bytes calldata _securityCouncilSignatures, | ||
bytes calldata _zkFoundationSignatures | ||
) external; | ||
} |
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,9 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity 0.8.24; | ||
|
||
/// @author Matter Labs | ||
/// @custom:security-contact security@matterlabs.dev | ||
interface IMultisig { | ||
function members(uint256) external view returns (address); | ||
} |
33 changes: 33 additions & 0 deletions
33
l1-contracts/deploy-scripts/interfaces/IProtocolUpgradeHandler.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,33 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity 0.8.24; | ||
|
||
/// @author Matter Labs | ||
/// @custom:security-contact security@matterlabs.dev | ||
interface IProtocolUpgradeHandler { | ||
/// @dev Represents a call to be made during an upgrade. | ||
/// @param target The address to which the call will be made. | ||
/// @param value The amount of Ether (in wei) to be sent along with the call. | ||
/// @param data The calldata to be executed on the `target` address. | ||
struct Call { | ||
address target; | ||
uint256 value; | ||
bytes data; | ||
} | ||
|
||
/// @dev Defines the structure of an upgrade that is executed by Protocol Upgrade Handler. | ||
/// @param executor The L1 address that is authorized to perform the upgrade execution (if address(0) then anyone). | ||
/// @param calls An array of `Call` structs, each representing a call to be made during the upgrade execution. | ||
/// @param salt A bytes32 value used for creating unique upgrade proposal hashes. | ||
struct UpgradeProposal { | ||
Call[] calls; | ||
address executor; | ||
bytes32 salt; | ||
} | ||
|
||
function emergencyUpgradeBoard() external view returns (address); | ||
|
||
function guardians() external view returns (address); | ||
|
||
function securityCouncil() external view returns (address); | ||
} |
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,9 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity 0.8.24; | ||
|
||
/// @author Matter Labs | ||
/// @custom:security-contact security@matterlabs.dev | ||
interface ISafe { | ||
function getMessageHash(bytes memory _message) external view returns (bytes32); | ||
} |
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