IExecutor
Inherits: IZKChainBase
Author: Matter Labs
Note: security-contact: security@matterlabs.dev
Functions
precommitSharedBridge
Precommits the status of all L2 transactions for the next batch on the shared bridge.
function precommitSharedBridge(
address _chainAddress,
uint256 _batchNumber,
bytes calldata _precommitData
) external;
Parameters
Name | Type | Description |
---|---|---|
_chainAddress | address | The address of the DiamondProxy of the chain. Note, that it is not used in the implementation, because it is expected to be equal to the address(this) , but it is kept here to maintain the same interface on both ValidatorTimelock and Executor for easier and cheaper implementation of the timelock. |
_batchNumber | uint256 | The sequential batch number to precommit (must equal s.totalBatchesCommitted + 1 ). |
_precommitData | bytes | ABIāencoded transaction status list for the precommit. |
commitBatchesSharedBridge
Function called by the operator to commit new batches. It is responsible for:
- Verifying the correctness of their timestamps.
- Processing their L2->L1 logs.
- Storing batch commitments.
function commitBatchesSharedBridge(
address _chainAddress,
uint256 _processFrom,
uint256 _processTo,
bytes calldata _commitData
) external;
Parameters
Name | Type | Description |
---|---|---|
_chainAddress | address | The address of the DiamondProxy of the chain. Note, that it is not used in the implementation, because it is expected to be equal to the address(this) , but it is kept here to maintain the same interface on both ValidatorTimelock and Executor for easier and cheaper implementation of the timelock. |
_processFrom | uint256 | The batch number from which the processing starts. |
_processTo | uint256 | The batch number at which the processing ends. |
_commitData | bytes | The encoded data of the new batches to be committed. |
proveBatchesSharedBridge
Batches commitment verification.
Only verifies batch commitments without any other processing.
function proveBatchesSharedBridge(
address _chainAddress,
uint256 _processBatchFrom,
uint256 _processBatchTo,
bytes calldata _proofData
) external;
Parameters
Name | Type | Description |
---|---|---|
_chainAddress | address | The address of the DiamondProxy of the chain. Note, that it is not used in the implementation, because it is expected to be equal to the address(this) , but it is kept here to maintain the same interface on both ValidatorTimelock and Executor for easier and cheaper implementation of the timelock. |
_processBatchFrom | uint256 | The batch number from which the verification starts. |
_processBatchTo | uint256 | The batch number at which the verification ends. |
_proofData | bytes | The encoded data of the new batches to be verified. |
executeBatchesSharedBridge
The function called by the operator to finalize (execute) batches. It is responsible for:
- Processing all pending operations (commpleting priority requests).
- Finalizing this batch (i.e. allowing to withdraw funds from the system)
function executeBatchesSharedBridge(
address _chainAddress,
uint256 _processFrom,
uint256 _processTo,
bytes calldata _executeData
) external;
Parameters
Name | Type | Description |
---|---|---|
_chainAddress | address | The address of the DiamondProxy of the chain. Note, that it is not used in the implementation, because it is expected to be equal to the address(this) , but it is kept here to maintain the same interface on both ValidatorTimelock and Executor for easier and cheaper implementation of the timelock. |
_processFrom | uint256 | The batch number from which the execution starts. |
_processTo | uint256 | The batch number at which the execution ends. |
_executeData | bytes | The encoded data of the new batches to be executed. |
revertBatchesSharedBridge
Reverts unexecuted batches
When the _newLastBatch is equal to the number of committed batches, only the precommitment is erased. NOTE: Doesn't delete the stored data about batches, but only decreases counters that are responsible for the number of batches
function revertBatchesSharedBridge(address _chainAddress, uint256 _newLastBatch)
external;
Parameters
Name | Type | Description |
---|---|---|
_chainAddress | address | The address of the DiamondProxy of the chain. |
_newLastBatch | uint256 | batch number after which batches should be reverted |
Events
BlockCommit
Event emitted when a batch is committed
It has the name "BlockCommit" and not "BatchCommit" due to backward compatibility considerations
event BlockCommit(
uint256 indexed batchNumber,
bytes32 indexed batchHash,
bytes32 indexed commitment
);
Parameters
Name | Type | Description |
---|---|---|
batchNumber | uint256 | Number of the batch committed |
batchHash | bytes32 | Hash of the L2 batch |
commitment | bytes32 | Calculated input for the ZKsync circuit |
BlocksVerification
Event emitted when batches are verified
It has the name "BlocksVerification" and not "BatchesVerification" due to backward compatibility considerations
event BlocksVerification(
uint256 indexed previousLastVerifiedBatch,
uint256 indexed currentLastVerifiedBatch
);
Parameters
Name | Type | Description |
---|---|---|
previousLastVerifiedBatch | uint256 | Batch number of the previous last verified batch |
currentLastVerifiedBatch | uint256 | Batch number of the current last verified batch |
BlockExecution
Event emitted when a batch is executed
It has the name "BlockExecution" and not "BatchExecution" due to backward compatibility considerations
event BlockExecution(
uint256 indexed batchNumber,
bytes32 indexed batchHash,
bytes32 indexed commitment
);
Parameters
Name | Type | Description |
---|---|---|
batchNumber | uint256 | Number of the batch executed |
batchHash | bytes32 | Hash of the L2 batch |
commitment | bytes32 | Verified input for the ZKsync circuit |
BlocksRevert
Event emitted when batches are reverted
It has the name "BlocksRevert" and not "BatchesRevert" due to backward compatibility considerations
event BlocksRevert(
uint256 totalBatchesCommitted,
uint256 totalBatchesVerified,
uint256 totalBatchesExecuted
);
Parameters
Name | Type | Description |
---|---|---|
totalBatchesCommitted | uint256 | Total number of committed batches after the revert |
totalBatchesVerified | uint256 | Total number of verified batches after the revert |
totalBatchesExecuted | uint256 | Total number of executed batches |
BatchPrecommitmentSet
Emitted when a new precommitment is set for a batch.
event BatchPrecommitmentSet(
uint256 indexed batchNumber,
uint256 indexed untrustedLastL2BlockNumberHint,
bytes32 precommitment
);
Parameters
Name | Type | Description |
---|---|---|
batchNumber | uint256 | The batch number for which the precommitment was recorded. |
untrustedLastL2BlockNumberHint | uint256 | The hint to what L2 block number the precommitment should correspond to. Note, that there are no guarantees on its correctness, it is just a way for the server to make external nodes' indexing simpler. |
precommitment | bytes32 | The resulting rolling hash of all transaction statuses. |
Structs
StoredBatchInfo
Rollup batch stored data
struct StoredBatchInfo {
uint64 batchNumber;
bytes32 batchHash;
uint64 indexRepeatedStorageChanges;
uint256 numberOfLayer1Txs;
bytes32 priorityOperationsHash;
bytes32 dependencyRootsRollingHash;
bytes32 l2LogsTreeRoot;
uint256 timestamp;
bytes32 commitment;
}
Properties
Name | Type | Description |
---|---|---|
batchNumber | uint64 | Rollup batch number |
batchHash | bytes32 | Hash of L2 batch |
indexRepeatedStorageChanges | uint64 | The serial number of the shortcut index that's used as a unique identifier for storage keys that were used twice or more |
numberOfLayer1Txs | uint256 | Number of priority operations to be processed |
priorityOperationsHash | bytes32 | Hash of all priority operations from this batch |
dependencyRootsRollingHash | bytes32 | |
l2LogsTreeRoot | bytes32 | Root hash of tree that contains L2 -> L1 messages from this batch |
timestamp | uint256 | Rollup batch timestamp, have the same format as Ethereum batch constant |
commitment | bytes32 | Verified input for the ZKsync circuit |
LegacyStoredBatchInfo
Legacy StoredBatchInfo struct
dependencyRootsRollingHash is not included in the struct
struct LegacyStoredBatchInfo {
uint64 batchNumber;
bytes32 batchHash;
uint64 indexRepeatedStorageChanges;
uint256 numberOfLayer1Txs;
bytes32 priorityOperationsHash;
bytes32 l2LogsTreeRoot;
uint256 timestamp;
bytes32 commitment;
}
CommitBatchInfo
Data needed to commit new batch
pubdataCommitments format: This will always start with a 1 byte pubdataSource flag. Current allowed values are 0 (calldata) or 1 (blobs) kzg: list of: opening point (16 bytes) || claimed value (32 bytes) || commitment (48 bytes) || proof (48 bytes) = 144 bytes calldata: pubdataCommitments.length - 1 - 32 bytes of pubdata and 32 bytes appended to serve as the blob commitment part for the aux output part of the batch commitment
For 2 blobs we will be sending 288 bytes of calldata instead of the full amount for pubdata.
When using calldata, we only need to send one blob commitment since the max number of bytes in calldata fits in a single blob and we can pull the linear hash from the system logs
struct CommitBatchInfo {
uint64 batchNumber;
uint64 timestamp;
uint64 indexRepeatedStorageChanges;
bytes32 newStateRoot;
uint256 numberOfLayer1Txs;
bytes32 priorityOperationsHash;
bytes32 bootloaderHeapInitialContentsHash;
bytes32 eventsQueueStateHash;
bytes systemLogs;
bytes operatorDAInput;
}
Properties
Name | Type | Description |
---|---|---|
batchNumber | uint64 | Number of the committed batch |
timestamp | uint64 | Unix timestamp denoting the start of the batch execution |
indexRepeatedStorageChanges | uint64 | The serial number of the shortcut index that's used as a unique identifier for storage keys that were used twice or more |
newStateRoot | bytes32 | The state root of the full state tree |
numberOfLayer1Txs | uint256 | Number of priority operations to be processed |
priorityOperationsHash | bytes32 | Hash of all priority operations from this batch |
bootloaderHeapInitialContentsHash | bytes32 | Hash of the initial contents of the bootloader heap. In practice it serves as the commitment to the transactions in the batch. |
eventsQueueStateHash | bytes32 | Hash of the events queue state. In practice it serves as the commitment to the events in the batch. |
systemLogs | bytes | concatenation of all L2 -> L1 system logs in the batch |
operatorDAInput | bytes | Packed pubdata commitments/data. |
PrecommitInfo
Container for a list of transaction statuses to precommit.
struct PrecommitInfo {
bytes packedTxsCommitments;
uint256 untrustedLastL2BlockNumberHint;
}
Properties
Name | Type | Description |
---|---|---|
packedTxsCommitments | bytes | |
untrustedLastL2BlockNumberHint | uint256 | The "hint" for what the last L2 block number that these txs represent is. |