Skip to main content

CCIPProver

The CCIPProver contract implements cross-chain intent verification using Chainlink’s Cross-Chain Interoperability Protocol (CCIP). It extends MessageBridgeProver to provide reliable message delivery with built-in security features. Location: contracts/prover/CCIPProver.sol:22

Overview

CCIPProver uses Chainlink’s decentralized oracle network to relay intent fulfillment proofs between chains. CCIP provides:
  • Security: Decentralized oracle verification with Risk Management Network
  • Reliability: Guaranteed message delivery with retry mechanisms
  • Flexibility: Support for multiple EVM chains with active/active routing
  • Monitoring: Built-in transaction tracking and status updates

Inheritance

State Variables

address
required
The Chainlink CCIP Router contract address. Immutable value set at deployment.
string
Returns "CCIP" as the proof type identifier.
uint256
Minimum gas limit for cross-chain message execution (inherited from MessageBridgeProver). Defaults to 200,000 gas if not specified.

Constructor

address
required
The CCIP Router contract address for the current chain. Must not be zero address.
address
required
The Portal contract address on this chain.
bytes32[]
required
Array of whitelisted prover addresses (as bytes32 for cross-VM compatibility).
uint256
Minimum gas limit for cross-chain messages. Pass 0 to use the default 200,000 gas.

Functions

prove

Sends a proof message to the source chain via CCIP. The proof demonstrates that an intent was fulfilled on this destination chain.
bytes32
required
The hash of the intent being proven.
uint64
required
The CCIP chain selector for the source chain. Important: This is CCIP’s chain selector, NOT the standard chain ID.
bytes
required
ABI-encoded proof data containing intent hashes and claimants.
bytes
required
ABI-encoded UnpackedData struct: (address sourceChainProver, uint256 gasLimit)
CCIP has a maximum data payload size of 30KB and a message execution gas limit of 3,000,000 gas. Ensure your proof data and gas limits are within these bounds. Check CCIP documentation for current limits.

ccipReceive

Receives cross-chain proof messages from CCIP. Only callable by the CCIP Router contract.
Client.Any2EVMMessage
required
The CCIP message containing:
  • sourceChainSelector: The source chain selector
  • sender: The sender address (ABI-encoded)
  • data: The proof data payload
  • tokenAmounts: Token transfers (unused, always empty)

fetchFee

Calculates the fee required to send a proof message to the specified chain.
uint64
required
The destination chain selector (CCIP chain selector).
bytes
required
The proof data that will be sent.
bytes
required
Additional data containing source chain prover and gas configuration.
uint256
The fee amount in native tokens required to send the message.

supportsInterface

Checks if the contract supports a given interface. Returns true for IAny2EVMMessageReceiver.

Data Structures

UnpackedData

address
The address of the prover contract on the source chain.
uint256
The gas limit for message execution on the destination chain. Automatically enforced to be at least MIN_GAS_LIMIT.

CCIP Chain Selectors

CCIP uses chain selectors instead of standard chain IDs. Common mappings:
Always verify chain selectors in CCIP’s official documentation as they may change.

Usage Example

Security Considerations

  1. Whitelist Verification: Only whitelisted provers can submit proofs
  2. Router Authorization: Only the CCIP Router can call ccipReceive()
  3. Gas Limits: Minimum gas limit enforced to prevent underfunded execution
  4. Zero Address Checks: Validates router, sender, and chain selector are non-zero
  5. Out-of-Order Execution: Enabled by default for optimal performance

Integration Notes

  • Router Addresses: Different on each chain - verify before deployment
  • Fee Payment: Fees paid in native token (ETH, MATIC, etc.)
  • Message Tracking: Use CCIP Explorer to monitor cross-chain messages
  • Retry Mechanism: CCIP handles retries automatically if execution fails

External Resources