Overview
TheIReceiver interface defines the entry point for receiving cross-chain messages on the destination domain. It validates message signatures and attestations before forwarding the message to the appropriate message handler for processing.
Interface Definition
IReceiver (V1)
src/interfaces/IReceiver.sol:22
IReceiverV2
V2 maintains the same interface but adds support for finality-aware message handling:src/interfaces/v2/IReceiverV2.sol:27
Functions
receiveMessage
message- The complete message bytes containing header and bodysignature- The attestation signature proving the message was validated
success- True if the message was received and processed successfully
- Verifies the message format and structure
- Validates the attestation signature against trusted attesters
- Checks that the message hasn’t been used before (nonce uniqueness)
- Verifies the destination domain matches the current chain
- Forwards to the appropriate message handler
How Receivers Work with CCTP
Message Flow
Message Structure
The message parameter contains:Signature Validation
The receiver validates signatures from Circle’s attestation service:- Message hash is computed from the message bytes
- Signature is verified against trusted attester public keys
- Attestation proves the message was observed on the source chain
- Multiple attesters provide redundancy and security
Implementation in CCTP
TheMessageTransmitter contract implements IReceiver:
Destination Caller Restriction
Messages can optionally specify adestinationCaller:
- Restrict message delivery to specific relayers
- Implement custom relaying logic
- Prevent front-running of message delivery
- Control who can trigger message execution
V2 Hook Execution Pattern
Version 2 introduces enhanced receiver hooks with finality awareness:Finality-Based Routing
IReceiverV2 routes messages to different handlers based on finality:Receiver Hook Integration
V2 enables end-user contracts to implement receiver hooks:Finality-Aware Hooks
Applications can implement different behavior based on finality:Security Considerations
Nonce Management
- Each message has a unique nonce to prevent replay attacks
- Nonces are marked as used after successful processing
- Cannot reuse the same message on the destination chain
Attestation Validation
- Only signatures from registered attesters are accepted
- Attesters are managed by Circle and rotated as needed
- Multiple attesters provide redundancy
Destination Validation
- Messages must be intended for the current domain
- Prevents messages from being replayed on wrong chains
Handler Security
- Message handlers should validate the caller is the registered receiver
- Handlers should validate message format and content
- Handlers should implement proper access controls
Integration Example
Relayer Integration
Handler Integration
Related Interfaces
- IMessageHandler - Processes messages forwarded by receivers
- IRelayer - Sends messages that receivers will process
- MessageTransmitter - Implements IReceiver for CCTP