IMessageVerification

Git Source

Author: Matter Labs

Note: security-contact: security@matterlabs.dev

Functions

proveL2MessageInclusionShared

Prove that a specific arbitrary-length message was sent in a specific L2 batch/block number.

function proveL2MessageInclusionShared(
  uint256 _chainId,
  uint256 _blockOrBatchNumber,
  uint256 _index,
  L2Message calldata _message,
  bytes32[] calldata _proof
) external view returns (bool);

Parameters

NameTypeDescription
_chainIduint256The chain id of the L2 where the message comes from.
_blockOrBatchNumberuint256The executed L2 batch/block number in which the message appeared.
_indexuint256The position in the L2 logs Merkle tree of the l2Log that was sent with the message.
_messageL2MessageInformation about the sent message: sender address, the message itself, tx index in the L2 batch where the message was sent.
_proofbytes32[]Merkle proof for inclusion of L2 log that was sent with the message.

Returns

NameTypeDescription
<none>boolBoolean specifying whether the proof is valid.

proveL2LogInclusionShared

Prove that a specific L2 log was sent in a specific L2 batch.

function proveL2LogInclusionShared(
  uint256 _chainId,
  uint256 _blockOrBatchNumber,
  uint256 _index,
  L2Log calldata _log,
  bytes32[] calldata _proof
) external view returns (bool);

Parameters

NameTypeDescription
_chainIduint256The chain id of the L2 where the log comes from.
_blockOrBatchNumberuint256The executed L2 batch/block number in which the log appeared.
_indexuint256The position of the l2log in the L2 logs Merkle tree.
_logL2LogInformation about the sent log.
_proofbytes32[]Merkle proof for inclusion of the L2 log.

Returns

NameTypeDescription
<none>boolWhether the proof is correct and L2 log is included in batch.

proveL2LeafInclusionShared

Proves that a certain leaf was included as part of the log merkle tree.

Warning: this function does not enforce any additional checks on the structure of the leaf. This means that it can accept intermediate nodes of the Merkle tree as a _leaf as well as the default "empty" leaves. It is the responsibility of the caller to ensure that the _leaf is a hash of a valid leaf.

function proveL2LeafInclusionShared(
  uint256 _chainId,
  uint256 _blockOrBatchNumber,
  uint256 _leafProofMask,
  bytes32 _leaf,
  bytes32[] calldata _proof
) external view returns (bool);

Parameters

NameTypeDescription
_chainIduint256The chain id of the L2 where the leaf comes from.
_blockOrBatchNumberuint256The batch/block number of the leaf to be proven.
_leafProofMaskuint256The leaf proof mask.
_leafbytes32The leaf to be proven.
_proofbytes32[]The proof.