Select the correct hash scheme for an OP cross-domain message
The cross-domain messenger reserves high bits of its message nonce for a version. Indexing only the counter can make an old and a new message look interchangeable.
Decode the high sixteen bits
Read the complete uint256 nonce from the message event. Use integer arithmetic and the formula below. For a nonce equal to 2^240 plus 7, the decoded version is one and the low counter is seven.
version = nonce >> 240
counter = nonce & ((1 << 240) - 1)
For version one reproduce the version-one relayMessage encoding, including its value and minimum gas limit fields. Keep the full versioned nonce in the encoded call. Replacing it with the low counter changes the message hash.
Distinguish messenger and portal identities
A messenger message hash identifies the cross-domain relay payload. A portal withdrawal hash belongs to the lower-level withdrawal transaction carrying it. Store both when tracing a messenger withdrawal from initiation to target execution. specs.optimism.io OP Stack specification