-
Notifications
You must be signed in to change notification settings - Fork 358
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Danil <[email protected]> Co-authored-by: kelemeno <[email protected]> Co-authored-by: Stanislav Breadless <[email protected]> Co-authored-by: Raid Ateir <[email protected]> Co-authored-by: Grzegorz Prusak <[email protected]> Co-authored-by: Moshe Shababo <[email protected]> Co-authored-by: Akosh Farkash <[email protected]> Co-authored-by: Bruno França <[email protected]> Co-authored-by: Vlad Bochok <[email protected]> Co-authored-by: Roman Brodetski <[email protected]> Co-authored-by: vladbochok <[email protected]> Co-authored-by: Danil <[email protected]> Co-authored-by: kelemeno <[email protected]> Co-authored-by: Neo <[email protected]> Co-authored-by: tommysr <[email protected]> Co-authored-by: Rahul Saxena <[email protected]> Co-authored-by: Artem Makhortov <[email protected]> Co-authored-by: Bence Haromi <[email protected]> Co-authored-by: Zach Kolodny <[email protected]> Co-authored-by: perekopskiy <[email protected]> Co-authored-by: perekopskiy <[email protected]> Co-authored-by: Ivan Schasny <[email protected]> Co-authored-by: mm <[email protected]> Co-authored-by: Dima Zhornyk <[email protected]> Co-authored-by: Yberjon <[email protected]>
- Loading branch information
1 parent
9b940ef
commit 45cf28c
Showing
27 changed files
with
179 additions
and
235 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
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 |
---|---|---|
|
@@ -4,7 +4,9 @@ pragma solidity ^0.8.21; | |
|
||
/** | ||
* @author Matter Labs | ||
* @notice System smart contract that is responsible for deploying other smart contracts on a ZK chain. | ||
* @custom:security-contact [email protected] | ||
* @notice Interface for the contract that is used to deploy contracts on L2. | ||
* @dev Identical interface is defined in L2ContractHelper library. Duplication is for testing purposes only. | ||
*/ | ||
interface IL2ContractDeployer { | ||
/// @notice A struct that describes a forced deployment on an 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
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 |
---|---|---|
|
@@ -2,8 +2,10 @@ | |
// We use a floating point pragma here so it can be used within other projects that interact with the ZKsync ecosystem without using our exact pragma version. | ||
pragma solidity ^0.8.21; | ||
|
||
// solhint-disable gas-custom-errors | ||
|
||
import {UncheckedMath} from "../../common/libraries/UncheckedMath.sol"; | ||
import {MerklePathEmpty, MerklePathOutOfBounds, MerkleIndexOutOfBounds, MerklePathLengthMismatch, MerkleNothingToProve, MerkleIndexOrHeightMismatch} from "../../common/L1ContractErrors.sol"; | ||
import {MerklePathEmpty, MerklePathOutOfBounds, MerkleIndexOutOfBounds} from "../../common/L1ContractErrors.sol"; | ||
|
||
/// @author Matter Labs | ||
/// @custom:security-contact [email protected] | ||
|
@@ -12,7 +14,6 @@ library Merkle { | |
|
||
/// @dev Calculate Merkle root by the provided Merkle proof. | ||
/// NOTE: When using this function, check that the _path length is equal to the tree height to prevent shorter/longer paths attack | ||
/// however, for chains settling on GW the proof includes the GW proof, so the path increases. See Mailbox for more details. | ||
/// @param _path Merkle path from the leaf to the root | ||
/// @param _index Leaf index in the tree | ||
/// @param _itemHash Hash of leaf content | ||
|
@@ -75,9 +76,7 @@ library Merkle { | |
bytes32[] memory _itemHashes | ||
) internal pure returns (bytes32) { | ||
uint256 pathLength = _startPath.length; | ||
if (pathLength != _endPath.length) { | ||
revert MerklePathLengthMismatch(pathLength, _endPath.length); | ||
} | ||
require(pathLength == _endPath.length, "Merkle: path length mismatch"); | ||
if (pathLength >= 256) { | ||
revert MerklePathOutOfBounds(); | ||
} | ||
|
@@ -86,12 +85,8 @@ library Merkle { | |
if (pathLength == 0 && (_startIndex != 0 || levelLen != 1)) { | ||
revert MerklePathEmpty(); | ||
} | ||
if (levelLen == 0) { | ||
revert MerkleNothingToProve(); | ||
} | ||
if (_startIndex + levelLen > (1 << pathLength)) { | ||
revert MerkleIndexOrHeightMismatch(); | ||
} | ||
require(levelLen > 0, "Merkle: nothing to prove"); | ||
require(_startIndex + levelLen <= (1 << pathLength), "Merkle: index/height mismatch"); | ||
bytes32[] memory itemHashes = _itemHashes; | ||
|
||
for (uint256 level; level < pathLength; level = level.uncheckedInc()) { | ||
|
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,15 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity 0.8.24; | ||
|
||
import {Call} from "./Common.sol"; | ||
|
||
/// @title Restriction contract interface | ||
/// @author Matter Labs | ||
/// @custom:security-contact [email protected] | ||
interface IRestriction { | ||
/// @notice Ensures that the invoker has the required role to call the function. | ||
/// @param _call The call data. | ||
/// @param _invoker The address of the invoker. | ||
function validateCall(Call calldata _call, address _invoker) external view; | ||
} |
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
Oops, something went wrong.