Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Architecture

This chapter maps the Agglayer workspace to functional domains, then describes the certificate lifecycle and settlement path. Use this file as the canonical “which crate owns what” index, including README references to crate/domain ownership.

Crate map

Node entrypoints and runtime wiring

CratePrimary responsibility
agglayerCLI binary and user-facing subcommands (run, config, backups, vkey tools)
agglayer-nodeNode bootstrap and component wiring
agglayer-configTOML configuration schema, parsing, validation, path contextualization
agglayer-clockEpoch pacing (time clock and block clock)
agglayer-telemetryMetrics export and tracing integration
agglayer-utilsShared helpers used across crates

Certificate processing and settlement

CratePrimary responsibility
agglayer-certificate-orchestratorCertificate lifecycle orchestration and task scheduling
agglayer-aggregator-notifierCertifier client and epoch packing pipeline
agglayer-settlement-serviceSettlement request handling and L1 transaction workflow
agglayer-signerSigning abstraction used for settlement/proof flows
agglayer-gcp-kmsGCP KMS-backed key management
agglayer-contractsContract bindings and contract-facing settlement logic

API and transport

CratePrimary responsibility
agglayer-jsonrpc-apiJSON-RPC API surface and handlers
agglayer-rpcInternal RPC service implementation
agglayer-rate-limitingShared rate-limiting middleware
agglayer-grpc-apigRPC API traits and service definitions
agglayer-grpc-servergRPC server implementation
agglayer-grpc-clientgRPC client implementation
agglayer-grpc-typesProtobuf/generated conversion layer

State, types, and testing

CratePrimary responsibility
agglayer-storageRocksDB physical/logical storage layers and migrations
agglayer-typesCore domain types and shared error/status types
agglayer-test-suiteShared test fixtures and test helpers

Pessimistic-proof pipeline

CratePrimary responsibility
pessimistic-proof-coreProof primitives and transition logic
pessimistic-proofHost-side SP1 integration and verification helpers
pessimistic-proof-programSP1 zkVM guest program (no_main)
pessimistic-proof-test-suiteProof-focused integration and compatibility tests

Notes:

  • pessimistic-proof-program is intentionally excluded from the default Cargo workspace build graph because it is cross-compiled for SP1.
  • Several crates expose testutils features for test-only helpers. Prefer those helpers over ad hoc mocks when extending tests.

Dependency tiers

Use this dependency mental model when scoping changes:

  1. Foundations: agglayer-types, agglayer-storage, proof crates.
  2. Domain services: orchestrator, settlement, notifier, signer, contracts.
  3. Transport surfaces: JSON-RPC and gRPC crates.
  4. Runtime composition: agglayer-node and the agglayer binary.

Changes in lower tiers have larger blast radius. For example, edits in agglayer-types are likely to affect all upper tiers.

Certificate lifecycle

Certificates move through a deterministic pipeline.

Client submit (JSON-RPC / gRPC)
  -> Pending persistence
  -> Orchestrator scheduling
  -> Proof/certification execution
  -> Proven header update
  -> Settlement request creation
  -> L1 transaction submission
  -> Settled header/state update

Ownership by phase:

  • Submission and request validation: agglayer-jsonrpc-api, agglayer-rpc, agglayer-grpc-server.
  • Pending/proven/settled state transitions: agglayer-storage and agglayer-certificate-orchestrator.
  • Proof generation and verification: agglayer-aggregator-notifier, pessimistic-proof* crates.
  • L1 settlement: agglayer-settlement-service, agglayer-contracts, agglayer-signer.

Settlement flow

Settlement finalizes proven certificates on Ethereum L1.

  1. The orchestrator marks a certificate as ready for settlement.
  2. The settlement service constructs the contract call payload.
  3. The signer produces transaction signatures (local key or GCP KMS).
  4. Contract adapters submit via Alloy providers.
  5. Storage updates to settled status after confirmation criteria are met.

Safety expectations:

  • Never bypass proof-validation preconditions before settlement.
  • Keep retries idempotent and bounded by configuration.
  • Treat signer and contract changes as security-sensitive, with explicit blast-radius analysis.