Skip to content
Lattice

CrosschainTimelockHandler

Git Source

Inherits: IERC7786MessageHandler

Title: CrosschainTimelockHandler

Author: David Dada <daveproxy80@gmail.com> (https://github.com/dadadave80)

Cross-chain governance handler facet: on an authenticated inbound ERC-7786 message routed by CrosschainLink, schedules the encoded operation on the co-mounted TimelockController. This realises remote governance — an L1 governor proposing a timelocked action on an L2 Diamond.

Stateless delegator — no storage. Mount alongside CrosschainLink + TimelockController; register this handler under CROSSCHAIN_TIMELOCK_TAG and grant the Diamond PROPOSER_ROLE. processMessage is callable only via the Diamond's own receiveMessage dispatch (msg.sender == address(this)). Payload: abi.encode(address target, uint256 value, bytes data, bytes32 predecessor, bytes32 salt, uint256 delay).

SECURITY: the linked counterpart is a full timelock proposer and can schedule ANY operation — including grants on the Diamond's own roles (the timelock self-administers DEFAULT_ADMIN_ROLE). The only safety net is the timelock delay plus a CANCELLER_ROLE held by a LOCAL guardian that is NOT reachable through this same cross-chain channel. Deploy accordingly.

Note:

  • lattice-version: 0.1.0

Functions

processMessage

Process a validated, de-duplicated cross-chain message.

function processMessage(
        bytes32 receiveId,
        bytes calldata,
        /*sender*/
        bytes calldata payload
    )
        external
        virtual
        override;

Parameters

NameTypeDescription
receiveIdbytes32The gateway-assigned unique message id (already checked for replay by the facet).
_bytesThe ERC-7930 interoperable address of the source (includes the source chain).
payloadbytesThe message payload with the leading 4-byte handler tag stripped.

crosschainTimelockTag

The handler tag this facet must be registered under on the CrosschainLink facet.

function crosschainTimelockTag() external pure returns (bytes4);

Returns

NameTypeDescription
<none>bytes4

exportSelectors

ERC-8153 selector export: this facet's cuttable selectors, tightly packed (4 bytes each).

Excludes exportSelectors() itself (0x0ef22643) - it is never cut into a diamond. Order matches forge inspect CrosschainTimelockHandler methodIdentifiers (alphabetical by signature); kept in exact parity by ExportSelectorsParityTest. Chunks: crosschainTimelockTag() 0xae5501c0 processMessage(bytes32,bytes,bytes) 0x902d5027

function exportSelectors() external pure virtual returns (bytes memory selectors);

Returns

NameTypeDescription
selectorsbytes