Skip to main content

L1MessageManager

rollingHashes

mapping(uint256 => bytes32) rollingHashes

Contains the L1 to L2 messaging rolling hashes mapped to message number computed on L1.

_messageClaimedBitMap

struct BitMaps.BitMap _messageClaimedBitMap

This maps which message numbers have been claimed to prevent duplicate claiming.

l2MerkleRootsDepths

mapping(bytes32 => uint256) l2MerkleRootsDepths

Contains the L2 messages Merkle roots mapped to their tree depth.

_addRollingHash

function _addRollingHash(uint256 _messageNumber, bytes32 _messageHash) internal

Take an existing message hash, calculates the rolling hash and stores at the message number.

Parameters

NameTypeDescription
_messageNumberuint256The current message number being sent.
_messageHashbytes32The hash of the message being sent.

_setL2L1MessageToClaimed

function _setL2L1MessageToClaimed(uint256 _messageNumber) internal

Set the L2->L1 message as claimed when a user claims a message on L1.

Parameters

NameTypeDescription
_messageNumberuint256The message number on L2.

_addL2MerkleRoots

function _addL2MerkleRoots(bytes32[] _newRoots, uint256 _treeDepth) internal

Add the L2 Merkle roots to the storage.

_This function is called during block finalization. The treeDepth does not need to be checked to be non-zero as it is, already enforced to be non-zero in the circuit, and used in the proof's public input.

Parameters

NameTypeDescription
_newRootsbytes32[]New L2 Merkle roots.
_treeDepthuint256

_anchorL2MessagingBlocks

function _anchorL2MessagingBlocks(bytes _l2MessagingBlocksOffsets, uint256 _currentL2BlockNumber) internal

Emit an event for each L2 block containing L2->L1 messages.

This function is called during block finalization.

Parameters

NameTypeDescription
_l2MessagingBlocksOffsetsbytesIs a sequence of uint16 values, where each value plus the last finalized L2 block number. indicates which L2 blocks have L2->L1 messages.
_currentL2BlockNumberuint256Last L2 block number finalized on L1.

isMessageClaimed

function isMessageClaimed(uint256 _messageNumber) external view returns (bool isClaimed)

Checks if the L2->L1 message is claimed or not.

Parameters

NameTypeDescription
_messageNumberuint256The message number on L2.

Return Values

NameTypeDescription
isClaimedboolReturns whether or not the message with _messageNumber has been claimed.
Contributions not accepted
These reference pages are automatically generated based on Linea's smart contracts. To ensure they accurately match the deployed smart contracts, we cannot accept any contributions that edit these pages.