IValidatorTimelock

Git Source

Inherits: IExecutor

Author: Matter Labs

Note: security-contact: security@matterlabs.dev

Functions

PRECOMMITTER_ROLE

Role hash for addresses allowed to precommit batches on a chain.

function PRECOMMITTER_ROLE() external view returns (bytes32);

COMMITTER_ROLE

Role hash for addresses allowed to commit batches on a chain.

function COMMITTER_ROLE() external view returns (bytes32);

REVERTER_ROLE

Role hash for addresses allowed to revert batches on a chain.

function REVERTER_ROLE() external view returns (bytes32);

PROVER_ROLE

Role hash for addresses allowed to prove batches on a chain.

function PROVER_ROLE() external view returns (bytes32);

EXECUTOR_ROLE

Role hash for addresses allowed to execute batches on a chain.

function EXECUTOR_ROLE() external view returns (bytes32);

OPTIONAL_PRECOMMITTER_ADMIN_ROLE

Optional admin role hash for managing PRECOMMITTER_ROLE assignments.

Note, that it is optional, meaning that by default the admin role is held by the chain admin

function OPTIONAL_PRECOMMITTER_ADMIN_ROLE() external view returns (bytes32);

OPTIONAL_COMMITTER_ADMIN_ROLE

Optional admin role hash for managing COMMITTER_ROLE assignments.

Note, that it is optional, meaning that by default the admin role is held by the chain admin

function OPTIONAL_COMMITTER_ADMIN_ROLE() external view returns (bytes32);

OPTIONAL_REVERTER_ADMIN_ROLE

Optional admin role hash for managing REVERTER_ROLE assignments.

Note, that it is optional, meaning that by default the admin role is held by the chain admin

function OPTIONAL_REVERTER_ADMIN_ROLE() external view returns (bytes32);

OPTIONAL_PROVER_ADMIN_ROLE

Optional admin role hash for managing PROVER_ROLE assignments.

Note, that it is optional, meaning that by default the admin role is held by the chain admin

function OPTIONAL_PROVER_ADMIN_ROLE() external view returns (bytes32);

OPTIONAL_EXECUTOR_ADMIN_ROLE

Optional admin role hash for managing EXECUTOR_ROLE assignments.

Note, that it is optional, meaning that by default the admin role is held by the chain admin

function OPTIONAL_EXECUTOR_ADMIN_ROLE() external view returns (bytes32);

BRIDGE_HUB

The address of the bridgehub

function BRIDGE_HUB() external view returns (IBridgehub);

executionDelay

The delay between committing and executing batches.

function executionDelay() external view returns (uint32);

getName

Part of the IBase interface. Not used in this contract.

function getName() external pure returns (string memory);

initialize

Initializer for the contract.

Expected to be delegatecalled in the constructor of the TransparentUpgradeableProxy

function initialize(address _initialOwner, uint32 _initialExecutionDelay)
  external;

Parameters

NameTypeDescription
_initialOwneraddressThe initial owner of the Validator timelock.
_initialExecutionDelayuint32The initial execution delay, i.e. minimal time between a batch is committed and executed.

setExecutionDelay

Set the delay between committing and executing batches.

function setExecutionDelay(uint32 _executionDelay) external;

getCommittedBatchTimestamp

Returns the timestamp when _l2BatchNumber was committed.

function getCommittedBatchTimestamp(
  address _chainAddress,
  uint256 _l2BatchNumber
) external view returns (uint256);

removeValidatorRoles

Revokes the specified validator roles for a given validator on the target chain.

Note that the access control is managed by the inner revokeRole functions.

function removeValidatorRoles(
  address _chainAddress,
  address _validator,
  ValidatorRotationParams memory params
) external;

Parameters

NameTypeDescription
_chainAddressaddressThe address identifier of the ZK chain.
_validatoraddressThe address of the validator to update.
paramsValidatorRotationParamsFlags indicating which roles to revoke.

removeValidator

Convenience wrapper to revoke all validator roles for a given validator on the target chain.

function removeValidator(address _chainAddress, address _validator) external;

Parameters

NameTypeDescription
_chainAddressaddressThe address identifier of the ZK chain.
_validatoraddressThe address of the validator to remove.

removeValidatorForChainId

Convenience wrapper to revoke all validator roles for a given validator on the target chain.

function removeValidatorForChainId(uint256 _chainId, address _validator)
  external;

Parameters

NameTypeDescription
_chainIduint256The chain Id of the ZK chain.
_validatoraddressThe address of the validator to remove.

addValidatorRoles

Grants the specified validator roles for a given validator on the target chain.

function addValidatorRoles(
  address _chainAddress,
  address _validator,
  ValidatorRotationParams memory params
) external;

Parameters

NameTypeDescription
_chainAddressaddressThe address identifier of the ZK chain.
_validatoraddressThe address of the validator to update.
paramsValidatorRotationParamsFlags indicating which roles to grant.

addValidator

Convenience wrapper to grant all validator roles for a given validator on the target chain.

function addValidator(address _chainAddress, address _validator) external;

Parameters

NameTypeDescription
_chainAddressaddressThe address identifier of the ZK chain.
_validatoraddressThe address of the validator to add.

addValidatorForChainId

Convenience wrapper to grant all validator roles for a given validator on the target chain.

function addValidatorForChainId(uint256 _chainId, address _validator) external;

Parameters

NameTypeDescription
_chainIduint256The chain Id of the ZK chain.
_validatoraddressThe address of the validator to add.

hasRoleForChainId

Convenience wrapper to retrieve whether a certain address has a role for a chain.

function hasRoleForChainId(uint256 _chainId, bytes32 _role, address _address)
  external
  view
  returns (bool);

Parameters

NameTypeDescription
_chainIduint256The chain Id of the ZK chain.
_rolebytes32The bytes32 ID of the role.
_addressaddressThe address that may have the role.

precommitSharedBridge

Make a call to the zkChain diamond contract with the same calldata.

function precommitSharedBridge(
  address _chainAddress,
  uint256 _l2BlockNumber,
  bytes calldata _l2Block
) external;

commitBatchesSharedBridge

Records the timestamp for all provided committed batches and make a call to the zkChain diamond contract with the same calldata.

function commitBatchesSharedBridge(
  address _chainAddress,
  uint256 _processBatchFrom,
  uint256 _processBatchTo,
  bytes calldata _batchData
) external;

revertBatchesSharedBridge

Make a call to the zkChain diamond contract with the same calldata. Note: If the batch is reverted, it needs to be committed first before the execution. So it's safe to not override the committed batches.

function revertBatchesSharedBridge(address _chainAddress, uint256 _newLastBatch)
  external;

proveBatchesSharedBridge

Make a call to the zkChain diamond contract with the same calldata. Note: We don't track the time when batches are proven, since all information about the batch is known on the commit stage and the proved is not finalized (may be reverted).

function proveBatchesSharedBridge(
  address _chainAddress,
  uint256 _processBatchFrom,
  uint256 _processBatchTo,
  bytes calldata _proofData
) external;

executeBatchesSharedBridge

Check that batches were committed at least X time ago and make a call to the zkChain diamond contract with the same calldata.

function executeBatchesSharedBridge(
  address _chainAddress,
  uint256 _processBatchFrom,
  uint256 _processBatchTo,
  bytes calldata _batchData
) external;

Events

NewExecutionDelay

The delay between committing and executing batches is changed.

event NewExecutionDelay(uint256 _newExecutionDelay);

Structs

ValidatorRotationParams

Struct specifying which validator roles to grant or revoke in a single call.

struct ValidatorRotationParams {
  bool rotatePrecommitterRole;
  bool rotateCommitterRole;
  bool rotateReverterRole;
  bool rotateProverRole;
  bool rotateExecutorRole;
}

Properties

NameTypeDescription
rotatePrecommitterRoleboolWhether to rotate the PRECOMMITTER_ROLE.
rotateCommitterRoleboolWhether to rotate the COMMITTER_ROLE.
rotateReverterRoleboolWhether to rotate the REVERTER_ROLE.
rotateProverRoleboolWhether to rotate the PROVER_ROLE.
rotateExecutorRoleboolWhether to rotate the EXECUTOR_ROLE.