# consensus-shipyard/ipc architecture

> Architecture diagram of the GitHub repository consensus-shipyard/ipc, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/consensus-shipyard/ipc
- Repository: https://github.com/consensus-shipyard/ipc

## Overview

##### Main Components

a) Core Layer Components:
- IPC CLI (`ipc/cli`)
- IPC Provider (`ipc/provider`)
- Fendermint (Tendermint-based subnet implementation)
- Smart Contracts (Gateway and Registry)
- IPLD Resolver

b) Integration Components:
- Wallet Management System
- API Layer
- Network Interfaces
- Storage Systems

##### Architectural Patterns to Highlight

a) Hierarchical Structure:
- Root Network (e.g., Filecoin Calibration)
- Subnet Hierarchy
- Cross-subnet Communication Channels

b) Core Processes:
- Bottom-up Checkpointing
- Top-down Message Propagation
- Validator Management
- Cross-message Handling

**┌─────────────────────────────────────────────┐**
- User Interface Layer                        │
- IPC CLI                                   │
- Configuration Management                  │
- ┘
- ↕
**┌─────────────────────────────────────────────┐**
- Core Protocol Layer                         │
- ┌─────────────┐ ┌──────────┐ ┌───────────┐ │
- IPC Provider │ │Fendermint│ │  Wallet   │ │
- ┘ └──────────┘ └───────────┘ │
- ┘
- ↕
**┌─────────────────────────────────────────────┐**
- Network Layer                               │
- ┌─────────────┐ ┌──────────┐ ┌───────────┐ │
- Root Network │ │ Subnets  │ │  IPLD     │ │
- ┘ └──────────┘ └───────────┘ │
- ┘

##### Key Relationships

- IPC CLI → IPC Provider: Command flow
- IPC Provider → Smart Contracts: Contract interaction
- Fendermint → Network Layer: Consensus operations
- IPLD Resolver → Storage: Data resolution
- Cross-subnet messaging paths

##### Additional Elements

- Security components
- Observability systems
- Configuration management
- Gas management
- Validator operations

##### Technical Details

- WebAssembly runtime integration
- Tendermint consensus integration
- Smart contract addresses
- API endpoints
- Protocol boundaries

##### Implementation Notes

- Maintain consistent spacing and alignment
- Version information
- Brief component descriptions
- Scalability paths

##### Critical Flows

Following flows with distinct patterns:
- Subnet creation and management
- Cross-subnet message propagation
- Checkpoint creation and verification
- Validator operations
- Token movements

Remember to include a note about the system's current state (not audited, missing critical recovery functionality) as mentioned in the README's warning message.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef ui fill:#B3E5FC,stroke:#0288D1
    classDef core fill:#C8E6C9,stroke:#388E3C
    classDef network fill:#FFECB3,stroke:#FFA000
    classDef security fill:#E1BEE7,stroke:#7B1FA2
    classDef storage fill:#FFCCBC,stroke:#E64A19
    classDef warning fill:#FFCDD2,stroke:#D32F2F

    %% Warning Message
    WARNING["⚠️ System Status: Not Audited
    Missing Critical Recovery Functionality"]:::warning

    %% User Interface Layer
    subgraph UI
        CLI["IPC CLI"]:::ui
        CONFIG["Configuration Management"]:::ui
    end

    %% Core Protocol Layer
    subgraph CORE
        PROVIDER["IPC Provider"]:::core
        FENDER["Fendermint"]:::core
        WALLET["Wallet Management"]:::core
        VALIDATOR["Validator Management"]:::core
        CROSSMSG["Cross-Message Handler"]:::core
        API["API Layer"]:::core
    end

    %% Network Layer
    subgraph NET
        ROOT["Root Network
        (Filecoin Calibration)"]:::network
        SUBNET["Subnet Management"]:::network
        IPLD["IPLD Resolver"]:::network
        CHECKPOINT["Checkpoint System"]:::network
    end

    %% Smart Contracts
    subgraph CONTRACTS
        GATEWAY["Gateway Contract"]:::security
        REGISTRY["Registry Contract"]:::security
    end

    %% Storage Layer
    STORAGE["Storage System"]:::storage

    %% Relationships
    CLI --> CONFIG
    CLI --> PROVIDER
    PROVIDER --> FENDER
    PROVIDER --> GATEWAY
    PROVIDER --> REGISTRY
    FENDER --> CHECKPOINT
    FENDER --> STORAGE
    WALLET --> PROVIDER
    VALIDATOR --> PROVIDER
    CROSSMSG --> PROVIDER
    API --> PROVIDER
    SUBNET --> ROOT
    IPLD --> STORAGE
    CHECKPOINT --> ROOT
    WARNING --> CLI

    %% Click Events
    click CLI "https://github.com/consensus-shipyard/ipc/tree/main/ipc/cli"
    click PROVIDER "https://github.com/consensus-shipyard/ipc/tree/main/ipc/provider"
    click FENDER "https://github.com/consensus-shipyard/ipc/tree/main/fendermint"
    click CONTRACTS "https://github.com/consensus-shipyard/ipc/tree/main/contracts"
    click IPLD "https://github.com/consensus-shipyard/ipc/tree/main/ipld/resolver"
    click WALLET "https://github.com/consensus-shipyard/ipc/tree/main/ipc/wallet"
    click API "https://github.com/consensus-shipyard/ipc/tree/main/ipc/api"
    click STORAGE "https://github.com/consensus-shipyard/ipc/tree/main/fendermint/storage"
    click VALIDATOR "https://github.com/consensus-shipyard/ipc/tree/main/ipc/cli/src/commands/validator"
    click CHECKPOINT "https://github.com/consensus-shipyard/ipc/blob/main/fendermint/docs/fendermint/checkpointing.md"
    click CROSSMSG "https://github.com/consensus-shipyard/ipc/tree/main/ipc/cli/src/commands/crossmsg"
    click SUBNET "https://github.com/consensus-shipyard/ipc/tree/main/ipc/cli/src/commands/subnet"
    click CONFIG "https://github.com/consensus-shipyard/ipc/tree/main/ipc/cli/src/commands/config"
    click NET "https://github.com/consensus-shipyard/ipc/tree/main/fendermint/vm/topdown"
    click CORE "https://github.com/consensus-shipyard/ipc/tree/main/fendermint/vm/interpreter"

    %% Legend
    subgraph Legend
        UI_L["User Interface"]:::ui
        CORE_L["Core Component"]:::core
        NET_L["Network Component"]:::network
        SEC_L["Security Component"]:::security
        STORE_L["Storage Component"]:::storage
        WARN_L["Warning"]:::warning
    end
```
