-
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.
- Loading branch information
Showing
4 changed files
with
41 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ ue | |
tha | ||
bu | ||
crate | ||
DNE |
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 |
---|---|---|
|
@@ -6,6 +6,7 @@ import {Ownable2Step} from "@openzeppelin/contracts/access/Ownable2Step.sol"; | |
import {LibMap} from "./libraries/LibMap.sol"; | ||
import {IExecutor} from "./chain-interfaces/IExecutor.sol"; | ||
import {IStateTransitionManager} from "./IStateTransitionManager.sol"; | ||
import {Unauthorized, TimeNotReached} from "../common/L1ContractErrors.sol"; | ||
|
||
/// @author Matter Labs | ||
/// @custom:security-contact [email protected] | ||
|
@@ -62,13 +63,17 @@ contract ValidatorTimelock is IExecutor, Ownable2Step { | |
|
||
/// @notice Checks if the caller is the admin of the chain. | ||
modifier onlyChainAdmin(uint256 _chainId) { | ||
require(msg.sender == stateTransitionManager.getChainAdmin(_chainId), "ValidatorTimelock: only chain admin"); | ||
if (msg.sender != stateTransitionManager.getChainAdmin(_chainId)) { | ||
revert Unauthorized(msg.sender); | ||
} | ||
_; | ||
} | ||
|
||
/// @notice Checks if the caller is a validator. | ||
modifier onlyValidator(uint256 _chainId) { | ||
require(validators[_chainId][msg.sender], "ValidatorTimelock: only validator"); | ||
if (!validators[_chainId][msg.sender]) { | ||
revert Unauthorized(msg.sender); | ||
} | ||
_; | ||
} | ||
|
||
|
@@ -203,7 +208,9 @@ contract ValidatorTimelock is IExecutor, Ownable2Step { | |
// * The batch wasn't committed at all, so execution will fail in the zkSync contract. | ||
// We allow executing such batches. | ||
|
||
require(block.timestamp >= commitBatchTimestamp + delay, "5c"); // The delay is not passed | ||
if (block.timestamp < commitBatchTimestamp + delay) { | ||
revert TimeNotReached(); | ||
} | ||
} | ||
} | ||
_propagateToZkSyncHyperchain(_chainId); | ||
|
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