Skip to main content
MetaProver integrates with Caldera Metalayer’s cross-chain messaging system to prove intent fulfillment. It implements the IMetalayerRecipient interface to receive messages from the Metalayer router.

Contract Overview

Location: contracts/prover/MetaProver.sol
contracts/prover/MetaProver.sol

Constructor

From MetaProver.sol:58-67:
contracts/prover/MetaProver.sol

Parameters

address
Address of the local Metalayer router contract
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.

Prove Function

Inherited from MessageBridgeProver.sol:112-117:
contracts/prover/MessageBridgeProver.sol
The domainID parameter uses Metalayer domain IDs, which are specific to their routing system and NOT the same as chain IDs. Consult Metalayer documentation for domain ID mappings.

Data Parameter Structure

The data parameter must be ABI-encoded as an UnpackedData struct (from MetaProver.sol:29-32):
contracts/prover/MetaProver.sol
Encoding example:
Gas limits below MIN_GAS_LIMIT (200,000) are automatically increased to the minimum (from MetaProver.sol:105-107).

Message Dispatch

Internal dispatch implementation from MetaProver.sol:118-147:
contracts/prover/MetaProver.sol

Message Formatting

From MetaProver.sol:224-243:
contracts/prover/MetaProver.sol

Message Reception

From MetaProver.sol:77-91:
contracts/prover/MetaProver.sol
The handle() function:
  1. Validates call is from the Metalayer router
  2. Validates origin domain ID is non-zero
  3. Validates sender address is non-zero
  4. Checks sender is whitelisted
  5. Extracts chain ID from message prefix
  6. Processes intent proofs

Fee Calculation

From MetaProver.sol:158-165:
contracts/prover/MetaProver.sol
Internal implementation (from MetaProver.sol:175-205):
contracts/prover/MetaProver.sol
The contract uses a very high ETH quote value (1e36) in fee calculation metadata to avoid failures in the Metalayer router’s quote dispatch function (from MetaProver.sol:44).

Usage Example

Domain ID Reference

Always check Metalayer’s official documentation for accurate domain IDs. These are specific to their routing system and NOT chain IDs.

Finality States

Metalayer supports different finality states (from MetaProver.sol:144):
contracts/prover/MetaProver.sol
Available states:
  • INSTANT - Fastest, lowest security
  • SAFE - Balanced security and speed
  • FINALIZED - Highest security, slower

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

Gas Limit Enforcement

The contract enforces a minimum gas limit (from MetaProver.sol:105-107):
contracts/prover/MetaProver.sol

Fee Quote Metadata

The contract uses accurate gas limits in fee calculation to ensure proper fee estimation (from MetaProver.sol:151-156 comments):
contracts/prover/MetaProver.sol