# smartcontractkit/chainlink-ccip architecture

> Architecture diagram of the GitHub repository smartcontractkit/chainlink-ccip, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/smartcontractkit/chainlink-ccip
- Repository: https://github.com/smartcontractkit/chainlink-ccip

## Overview

##### High-Level Components

a) Core Protocol Components:
- Commit Plugin (represented as a hexagon)
- Execute Plugin (represented as a hexagon)
- Chain Config Manager (represented as a rectangle)

b) Chain Integration Layer:
- Solana Chain Support (rectangle)
- Contract Readers (rectangle)
- Token Pools (rectangle)
- CCIP Router (hexagon)

c) Supporting Services:
- Token Price Services (rectangle)
- USDC Attestation Service (rectangle)

##### Key Subsystems

a) Commit Plugin Internals:
- Merkle Root Processor
- Chain Fee Processor
- Token Price Processor
- Validation Layer

b) Execute Plugin Internals:
- Message Execution Engine
- Token Data Observer
- Gas Estimation Provider
- Cost Management System

##### Cross-Chain Communication
With special emphasis:
- Message Flow between chains
- Token Bridge Operations
- Security Validation Points

##### Integration Points
Clearly mark:
- Contract Reader Interfaces
- Plugin Configuration Points
- External Service Integration Points

##### Monitoring & Metrics
A section showing:
- Prometheus Metrics Collection
- Logging Systems
- Health Monitoring

##### Security Flow
- Validation checkpoints
- Permission boundaries
- Critical paths

##### Scalability Aspects
- Parallel processing capabilities
- Batch processing points
- Rate limiting components

##### Error Handling
- Retry mechanisms
- Fallback paths
- Error reporting points

##### Configuration
- Config injection points
- Dynamic vs static config areas
- Validation boundaries

- Showing enough detail to understand the system
- Not being so detailed that it becomes unreadable
- Highlighting critical paths and security boundaries
- Showing clear separation of concerns

Remember to:
- Use consistent naming with the codebase
- Version compatibility points
- Extension points
- Future expansion areas

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Core["Core Protocol Components"]
        CP[Commit Plugin]:::core
        EP[Execute Plugin]:::core
        CCM[Chain Config Manager]:::core
    end

    subgraph Integration["Chain Integration Layer"]
        SCS[Solana Chain Support]:::chain
        CR[Contract Readers]:::chain
        TP[Token Pools]:::chain
        ROUTER[CCIP Router]:::chain
    end

    subgraph Services["Supporting Services"]
        RMN[RMN]:::service
        TPS[Token Price Services]:::service
        UAS[USDC Attestation Service]:::service
    end

    subgraph CommitInternals["Commit Plugin Internals"]
        MRP[Merkle Root Processor]:::internal
        CFP[Chain Fee Processor]:::internal
        TPP[Token Price Processor]:::internal
        VAL[Validation Layer]:::internal
    end

    subgraph ExecuteInternals["Execute Plugin Internals"]
        MEE[Message Execution Engine]:::internal
        TDO[Token Data Observer]:::internal
        GEP[Gas Estimation Provider]:::internal
        CMS[Cost Management System]:::internal
    end

    %% Core relationships
    CP --> EP
    CP --> CCM
    EP --> CCM

    %% Integration relationships
    CP --> SCS
    EP --> SCS
    SCS --> ROUTER
    ROUTER --> TP
    CR --> ROUTER

    %% Service relationships
    CP -.-> RMN
    EP -.-> UAS
    CP -.-> TPS

    %% Internal relationships
    CP --> CommitInternals
    EP --> ExecuteInternals

    %% Legend
    classDef core fill:#blue
    classDef chain fill:#green
    classDef service fill:#yellow
    classDef internal fill:#lightgray
    classDef security fill:#red

    %% Click events
    click CP "https://github.com/smartcontractkit/chainlink-ccip/blob/main/commit/plugin.go"
    click EP "https://github.com/smartcontractkit/chainlink-ccip/blob/main/execute/plugin.go"
    click CCM "https://github.com/smartcontractkit/chainlink-ccip/blob/main/chainconfig/chainconfig.go"
    click SCS "https://github.com/smartcontractkit/chainlink-ccip/tree/main/chains/solana/"
    click ROUTER "https://github.com/smartcontractkit/chainlink-ccip/blob/main/chains/solana/contracts/programs/ccip-router/src/lib.rs"
    click TP "https://github.com/smartcontractkit/chainlink-ccip/blob/main/chains/solana/contracts/programs/token-pool/src/lib.rs"
    click RMN "https://github.com/smartcontractkit/chainlink-ccip/tree/main/commit/merkleroot/rmn/"
    click TPS "https://github.com/smartcontractkit/chainlink-ccip/blob/main/pkg/reader/price_reader.go"
    click UAS "https://github.com/smartcontractkit/chainlink-ccip/tree/main/execute/tokendata/usdc/"
    click CR "https://github.com/smartcontractkit/chainlink-ccip/tree/main/pkg/contractreader/"
    click MRP "https://github.com/smartcontractkit/chainlink-ccip/tree/main/commit/merkleroot/"
    click CFP "https://github.com/smartcontractkit/chainlink-ccip/tree/main/commit/chainfee/"
    click TPP "https://github.com/smartcontractkit/chainlink-ccip/tree/main/commit/tokenprice/"
    click TDO "https://github.com/smartcontractkit/chainlink-ccip/tree/main/execute/tokendata/"
    click GEP "https://github.com/smartcontractkit/chainlink-ccip/tree/main/execute/internal/gas/"
    click MEE "https://github.com/smartcontractkit/chainlink-ccip/tree/main/execute/costlymessages/"
```
