Overview
LayerZeroProver processes proof messages from LayerZero’s endpoint and records proven intents. It extends MessageBridgeProver to provide LayerZero V2-specific messaging functionality.
Contract: contracts/prover/LayerZeroProver.sol
Inheritance: ILayerZeroReceiver, MessageBridgeProver, Semver
Proof Type: "LayerZero"
Constructor
Address of the local LayerZero V2 endpoint contract
Address authorized to configure LayerZero settings (configs, paths, etc.)
Address of the Portal contract
Array of trusted prover addresses (as bytes32 for cross-VM compatibility)
Minimum gas limit for cross-chain messages. Defaults to 200,000 if zero.
- Sets delegate on the LayerZero endpoint for administrative functions
- Delegate can configure settings on behalf of this contract
EndpointCannotBeZeroAddress(): Endpoint address is zeroDelegateCannotBeZeroAddress(): Delegate address is zeroZeroPortal(): Portal address is zero
contracts/prover/LayerZeroProver.sol:57
State Variables
ENDPOINT
PROOF_TYPE
MIN_GAS_LIMIT
MessageBridgeProver. Defaults to 200,000.
Core Functions
prove
MessageBridgeProver. Initiates proving process by dispatching a message via LayerZero.
Address that initiated the proving request (receives refund if overpaid)
LayerZero endpoint ID (eid) of the source chain. NOT the chain ID.
Encoded (intentHash, claimant) pairs. Format:
[intentHash1][claimant1][intentHash2][claimant2]...ABI-encoded
UnpackedData struct containing:sourceChainProver(bytes32): Address of prover on source chainoptions(bytes): LayerZero message options (empty for default)gasLimit(uint256): Gas limit for execution (min 200k)
- Calculates required fee via
fetchFee - Validates msg.value covers fee
- Dispatches message via LayerZero endpoint
- Refunds excess payment to sender
InsufficientFee(uint256 required): msg.value is less than required feeDomainIdTooLarge(uint64 domainID): Domain ID exceeds uint32.max
MessageBridgeProver.sol:112
lzReceive
Origin information containing:
srcEid(uint32): Source endpoint IDsender(bytes32): Address that dispatched the messagenonce(uint64): Message nonce
Encoded message with format:
[chainId (8 bytes)][intentHash1][claimant1][intentHash2][claimant2]...- Validates sender is not zero
- Validates sender is whitelisted
- Extracts chain ID from first 8 bytes of message
- Processes intent proofs using
_processIntentProofs
MessageSenderCannotBeZeroAddress(): Sender is zeroUnauthorizedIncomingProof(bytes32 sender): Sender not whitelisted
contracts/prover/LayerZeroProver.sol:85
allowInitializePath
Origin information to check
true if sender is whitelisted, false otherwise
Location: contracts/prover/LayerZeroProver.sol:105
nextNonce
0 as this contract doesn’t track nonces
Location: contracts/prover/LayerZeroProver.sol:117
fetchFee
LayerZero endpoint ID of the source chain
Encoded (intentHash, claimant) pairs
ABI-encoded UnpackedData struct
contracts/prover/LayerZeroProver.sol:166
getProofType
"LayerZero"
Internal Functions
_dispatchMessage
prove() function.
Behavior:
- Unpacks data into structured format (enforces min gas limit)
- Formats LayerZero message parameters
- Calls
ILayerZeroEndpointV2(ENDPOINT).sendwith fee - Refund address is msg.sender
contracts/prover/LayerZeroProver.sol:133
_formatLayerZeroMessage
MessagingParams struct with:
dstEid(uint32): Destination endpoint IDreceiver(bytes32): Source chain prover addressmessage(bytes): Encoded proofsoptions(bytes): Gas options (uses provided or creates default with gas limit)payInLzToken(bool): Always false (pay in native)
contracts/prover/LayerZeroProver.sol:239
_unpackData
- Decodes ABI-encoded UnpackedData
- If gasLimit < MIN_GAS_LIMIT, sets to MIN_GAS_LIMIT
contracts/prover/LayerZeroProver.sol:184
Data Structures
UnpackedData
data parameter. Gas limit is enforced to be at least MIN_GAS_LIMIT (200k).