# immunefi-team/attackathon-movement architecture

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

- Interactive diagram: https://gitdiagram.com/immunefi-team/attackathon-movement
- Repository: https://github.com/immunefi-team/attackathon-movement

## Overview

##### Main Components
– Protocol Units: (found under protocol-units): These are the core building blocks that implement protocol logic (bridge, da, cryptography, execution, settlement, etc.).
– Network Runners: (found under networks): These provide entry points for launching nodes (both full nodes and indexers).
– Utility Crates: (under util, such as godfig, collections, signing, etc.) that offer common functionality across the system.
– Protocol Buffers: (under proto) for external communication and code generation.

- Node Implementations:
– Movement Full Node: (from networks/movement-full-node, docs, and related just targets) represents the operational server that runs a full blockchain node.
– Celestia Data Availability Light Node: (movement-celestia-da-light-node in benches and docker) handles the DA services on Celestia network.
– Demo and Bench Components: (demo, benches folders) used for testing, benchmarking, or illustrating example usage.

- Infrastructure & Deployment:
– Docker & Process Compose: (docker, process-compose folders) contain Dockerfiles, docker-compose files, orchestration recipes that deploy the services.
– Scripts: (scripts folder) holds automation for building, testing, and running containers and native builds.
– Nix Environment: (nix shell via nix develop, rust-toolchain.toml) ensures that development occurs under the right environment with all dependencies available.

- External Interfaces & APIs:
– REST APIs: The full node exposes external endpoints such as the Aptos REST API and the Aptos Faucet API (as mentioned in the README under “Services”).
– External Blockchain Services: Integration components for Ethereum (e.g., eth-local, eth-holesky) and potentially other networks.

##### Relationships and Data Flow
- The “Movement SDK” core crates (protocol-units, util, proto) form the internal logic that is used by the network runners.
- The network runners (directories under networks) integrate with the core libraries to provide node operation, indexer functionalities, or client interactions.
- Scripts and build configurations (in scripts, justfile, and util/buildtime) support CI/CD and deployment; they “trigger” builds, run tests, and deploy containers.

##### Architectural Patterns / Design Principles
- Modularity: The SDK is structured into separate “protocol-units”, “networks”, “util”, and “proto”, which promote code reuse and plug-and-play development.
- Containerization: Use of Dockerfiles and orchestration recipes (docker-compose, process-compose) clearly segments deployment and environment management.
- Environment Isolation: The integration of Nix environments ensures consistent tooling during development and production.
- Separation of Concerns: There is a clear separation between core libraries, node implementations, service orchestration, and deployment scripts.

##### Final Touches
- Patterns (e.g., “Microservices approach” if individual nodes run distinct services, “Modular SDK” for the protocol building blocks).

Happy diagramming!

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% SDK Core Components
    subgraph "SDK Core Components"
        ProtocolUnits["Protocol Units"]:::core
        UtilCrates["Util Libraries"]:::core
        ProtocolBuffers["Protocol Buffers"]:::core
    end

    %% Network Runners
    NetworkRunners["Network Runners"]:::core

    %% Node Implementations
    subgraph "Node Implementations"
        MovementFullNode["Movement Full Node"]:::node
        CelestiaDALightNode["Celestia DA Light Node"]:::node
        DemoBench["Demo & Bench Components"]:::node
    end

    %% Deployment & Orchestration
    subgraph "Deployment & Orchestration"
         DockerCompose["Docker & Process Compose"]:::deploy
         ScriptsNode["Scripts"]:::deploy
         NixEnvironment["Nix Environment"]:::deploy
    end

    %% External Interfaces
    subgraph "External Interfaces"
         RESTAPI["REST API"]:::external
         FaucetAPI["Faucet API"]:::external
         ExternalClients["External Clients"]:::external
    end

    %% Relationships
    ProtocolUnits -->|"providesTo"| NetworkRunners
    UtilCrates -->|"providesTo"| NetworkRunners
    ProtocolBuffers -->|"providesTo"| NetworkRunners

    NetworkRunners -->|"launches"| MovementFullNode
    NetworkRunners -->|"launches"| DemoBench

    DockerCompose -->|"deploys"| MovementFullNode
    DockerCompose -->|"deploys"| CelestiaDALightNode

    ScriptsNode -->|"triggersBuildFor"| DockerCompose
    NixEnvironment -->|"ensuresEnvFor"| ScriptsNode

    MovementFullNode -->|"exposes"| RESTAPI
    MovementFullNode -->|"exposes"| FaucetAPI
    CelestiaDALightNode -->|"exposes"| RESTAPI

    RESTAPI -->|"accessedBy"| ExternalClients
    FaucetAPI -->|"accessedBy"| ExternalClients

    %% Click Events
    click ProtocolUnits "https://github.com/immunefi-team/attackathon-movement/tree/main/protocol-units"
    click UtilCrates "https://github.com/immunefi-team/attackathon-movement/tree/main/util"
    click ProtocolBuffers "https://github.com/immunefi-team/attackathon-movement/tree/main/proto"
    click NetworkRunners "https://github.com/immunefi-team/attackathon-movement/tree/main/networks"
    click MovementFullNode "https://github.com/immunefi-team/attackathon-movement/tree/main/networks/movement/movement-full-node"
    click CelestiaDALightNode "https://github.com/immunefi-team/attackathon-movement/tree/main/docker/build/movement-celestia-da-light-node"
    click DemoBench "https://github.com/immunefi-team/attackathon-movement/tree/main/demo"
    click DemoBench "https://github.com/immunefi-team/attackathon-movement/tree/main/benches"
    click DockerCompose "https://github.com/immunefi-team/attackathon-movement/tree/main/docker"
    click DockerCompose "https://github.com/immunefi-team/attackathon-movement/tree/main/process-compose"
    click ScriptsNode "https://github.com/immunefi-team/attackathon-movement/tree/main/scripts"
    click NixEnvironment "https://github.com/immunefi-team/attackathon-movement/blob/main/rust-toolchain.toml"
    click NixEnvironment "https://github.com/immunefi-team/attackathon-movement/blob/main/flake.nix"

    %% Styles
    classDef core fill:#ffe6f7,stroke:#cc0099,stroke-width:2px;
    classDef node fill:#e6f7ff,stroke:#0066cc,stroke-width:2px;
    classDef deploy fill:#e6ffe6,stroke:#009933,stroke-width:2px;
    classDef external fill:#fff0f5,stroke:#ff66cc,stroke-width:2px;
```
