Skip to main content

IL2MessageManager

RollingHashUpdated

event RollingHashUpdated(uint256 messageNumber, bytes32 rollingHash)

Emitted after all messages are anchored on L2 and the latest message index and rolling hash stored.

NB: This event is used to provide data to the rollup. The last messageNumber and rollingHash, emitted in a rollup will be used in the public input for validating the L1->L2 messaging state transition.

Parameters

NameTypeDescription
messageNumberuint256The indexed unique L1 computed indexed message number for the message.
rollingHashbytes32The indexed L1 rolling hash computed for the current message number.

ServiceVersionMigrated

event ServiceVersionMigrated(uint256 version)

Emitted when the service switches over to a new version. This is currently not in use, but left for existing consumers.

Parameters

NameTypeDescription
versionuint256The indexed version.

MessageHashesListLengthIsZero

error MessageHashesListLengthIsZero()

Reverts when the message hashes array length is zero.

L1MessageNumberSynchronizationWrong

error L1MessageNumberSynchronizationWrong(uint256 expected, uint256 found)

Reverts when message number synchronization is mismatched.

L1RollingHashSynchronizationWrong

error L1RollingHashSynchronizationWrong(bytes32 expected, bytes32 found)

Reverts when rolling hash synchronization is mismatched.

FinalRollingHashIsZero

error FinalRollingHashIsZero()

Reverts when final rolling hash is zero hash.

anchorL1L2MessageHashes

function anchorL1L2MessageHashes(bytes32[] _messageHashes, uint256 _startingMessageNumber, uint256 _finalMessageNumber, bytes32 _finalRollingHash) external

Add cross-chain L1->L2 message hashes in storage.

Only address that has the role 'L1_L2_MESSAGE_SETTER_ROLE' are allowed to call this function. NB: In the unlikely event of a duplicate anchoring, the lastAnchoredL1MessageNumber MUST NOT be incremented. and the rolling hash not calculated, else synchronisation will break. If starting number is zero, an underflow error is expected.

Parameters

NameTypeDescription
_messageHashesbytes32[]New message hashes to anchor on L2.
_startingMessageNumberuint256The expected L1 message number to start when anchoring.
_finalMessageNumberuint256The expected L1 message number to end on when anchoring.
_finalRollingHashbytes32The expected L1 rolling hash to end on when anchoring.