Skip to main content
LayerZeroProver integrates with LayerZero V2 endpoints to prove intent fulfillment across chains. It implements the ILayerZeroReceiver interface to receive cross-chain messages.

Contract Overview

Location: contracts/prover/LayerZeroProver.sol
contracts/prover/LayerZeroProver.sol

Constructor

From LayerZeroProver.sol:57-74:
contracts/prover/LayerZeroProver.sol

Parameters

address
Address of the local LayerZero V2 endpoint contract
address
Address authorized to configure LayerZero settings (configs, paths, etc.)
address
Address of the Portal contract that manages rewards
bytes32[]
Array of trusted prover addresses on other chains (as bytes32 for cross-VM compatibility)
uint256
Minimum gas limit for cross-chain messages. Defaults to 200,000 if zero.
The constructor automatically sets the delegate on the LayerZero endpoint (line 73):

Prove Function

Inherited from MessageBridgeProver.sol:112-117:
contracts/prover/MessageBridgeProver.sol
The domainID parameter uses LayerZero Endpoint IDs (EIDs), which are NOT the same as chain IDs. Consult LayerZero V2 documentation for endpoint ID mappings.

Data Parameter Structure

The data parameter must be ABI-encoded as an UnpackedData struct (from LayerZeroProver.sol:19-24):
contracts/prover/LayerZeroProver.sol
Encoding example:
Gas limits below MIN_GAS_LIMIT (200,000) are automatically increased to the minimum (from LayerZeroProver.sol:190-192).

Message Dispatch

Internal dispatch implementation from LayerZeroProver.sol:133-156:
contracts/prover/LayerZeroProver.sol

Message Formatting

From LayerZeroProver.sol:239-267:
contracts/prover/LayerZeroProver.sol

Message Reception

From LayerZeroProver.sol:85-98:
contracts/prover/LayerZeroProver.sol
The lzReceive() function:
  1. Validates call is from the LayerZero endpoint
  2. Validates sender address is non-zero
  3. Checks sender is whitelisted
  4. Extracts chain ID from message prefix
  5. Processes intent proofs

Additional LayerZero Methods

Allow Initialize Path

From LayerZeroProver.sol:105-110:
contracts/prover/LayerZeroProver.sol
Checks if a cross-chain path should be allowed based on sender whitelist.

Next Nonce

From LayerZeroProver.sol:117-123:
contracts/prover/LayerZeroProver.sol

Fee Calculation

From LayerZeroProver.sol:166-176:
contracts/prover/LayerZeroProver.sol
Internal implementation (from LayerZeroProver.sol:202-221):
contracts/prover/LayerZeroProver.sol

Usage Example

Endpoint ID Reference

Always check LayerZero’s official endpoint ID registry for accurate endpoint IDs. These are NOT chain IDs.
Common V2 endpoint IDs (verify before use):

Security Considerations

Whitelist Validation

Only whitelisted prover addresses can send proof messages. This is validated in _handleCrossChainMessage() from MessageBridgeProver.sol:81-82:
contracts/prover/MessageBridgeProver.sol

Delegate Configuration

The delegate address has full control over LayerZero configurations. Set this carefully during deployment.

Gas Limit Enforcement

The contract enforces a minimum gas limit (from LayerZeroProver.sol:190-192):
contracts/prover/LayerZeroProver.sol