IExecutor

Git Source

Inherits: IZKChainBase

Author: Matter Labs

Note: security-contact: security@matterlabs.dev

Functions

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(
  uint256 _chainId,
  uint256 _processFrom,
  uint256 _processTo,
  bytes calldata _commitData
) external;

Parameters

NameTypeDescription
_chainIduint256Chain ID of the chain.
_processFromuint256The batch number from which the processing starts.
_processTouint256The batch number at which the processing ends.
_commitDatabytesThe encoded data of the new batches to be committed.

proveBatchesSharedBridge

Batches commitment verification.

Only verifies batch commitments without any other processing.

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

Parameters

NameTypeDescription
_chainIduint256Chain ID of the chain.
_processBatchFromuint256The batch number from which the verification starts.
_processBatchTouint256The batch number at which the verification ends.
_proofDatabytesThe 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(
  uint256 _chainId,
  uint256 _processFrom,
  uint256 _processTo,
  bytes calldata _executeData
) external;

Parameters

NameTypeDescription
_chainIduint256Chain ID of the chain.
_processFromuint256The batch number from which the execution starts.
_processTouint256The batch number at which the execution ends.
_executeDatabytesThe encoded data of the new batches to be executed.

revertBatchesSharedBridge

Reverts unexecuted batches

function revertBatchesSharedBridge(uint256 _chainId, uint256 _newLastBatch)
  external;

Parameters

NameTypeDescription
_chainIduint256Chain ID of the chain
_newLastBatchuint256batch number after which batches should be reverted NOTE: Doesn't delete the stored data about batches, but only decreases counters that are responsible for the number of batches

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

NameTypeDescription
batchNumberuint256Number of the batch committed
batchHashbytes32Hash of the L2 batch
commitmentbytes32Calculated 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

NameTypeDescription
previousLastVerifiedBatchuint256Batch number of the previous last verified batch
currentLastVerifiedBatchuint256Batch 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

NameTypeDescription
batchNumberuint256Number of the batch executed
batchHashbytes32Hash of the L2 batch
commitmentbytes32Verified 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

NameTypeDescription
totalBatchesCommitteduint256Total number of committed batches after the revert
totalBatchesVerifieduint256Total number of verified batches after the revert
totalBatchesExecuteduint256Total number of executed batches

Structs

StoredBatchInfo

Rollup batch stored data

struct StoredBatchInfo {
  uint64 batchNumber;
  bytes32 batchHash;
  uint64 indexRepeatedStorageChanges;
  uint256 numberOfLayer1Txs;
  bytes32 priorityOperationsHash;
  bytes32 l2LogsTreeRoot;
  uint256 timestamp;
  bytes32 commitment;
}

Properties

NameTypeDescription
batchNumberuint64Rollup batch number
batchHashbytes32Hash of L2 batch
indexRepeatedStorageChangesuint64The serial number of the shortcut index that's used as a unique identifier for storage keys that were used twice or more
numberOfLayer1Txsuint256Number of priority operations to be processed
priorityOperationsHashbytes32Hash of all priority operations from this batch
l2LogsTreeRootbytes32Root hash of tree that contains L2 -> L1 messages from this batch
timestampuint256Rollup batch timestamp, have the same format as Ethereum batch constant
commitmentbytes32Verified input for the ZKsync circuit

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

NameTypeDescription
batchNumberuint64Number of the committed batch
timestampuint64Unix timestamp denoting the start of the batch execution
indexRepeatedStorageChangesuint64The serial number of the shortcut index that's used as a unique identifier for storage keys that were used twice or more
newStateRootbytes32The state root of the full state tree
numberOfLayer1Txsuint256Number of priority operations to be processed
priorityOperationsHashbytes32Hash of all priority operations from this batch
bootloaderHeapInitialContentsHashbytes32Hash of the initial contents of the bootloader heap. In practice it serves as the commitment to the transactions in the batch.
eventsQueueStateHashbytes32Hash of the events queue state. In practice it serves as the commitment to the events in the batch.
systemLogsbytesconcatenation of all L2 -> L1 system logs in the batch
operatorDAInputbytesPacked pubdata commitments/data.