Skip to content

docs: add architecture section describing internals#1044

Merged
scarmuega merged 3 commits into
mainfrom
docs/architecture-section
Jul 2, 2026
Merged

docs: add architecture section describing internals#1044
scarmuega merged 3 commits into
mainfrom
docs/architecture-section

Conversation

@scarmuega

@scarmuega scarmuega commented Jul 2, 2026

Copy link
Copy Markdown
Member

Summary

Adds a new top-level Architecture section to the docs (docs/content/architecture/) giving a macro view of how Dolos is built — aimed at contributors, integrators, and advanced operators who want to understand the internals without reading the source.

The existing docs cover what Dolos does and how to run it; this section covers how it works. It is conceptual material and cross-links to the existing APIs / Configuration / Operations sections rather than duplicating them.

Pages

Page Covers
Overview Macro system diagram; the chain-agnostic dolos-core traits vs. the dolos-cardano implementation; the shared domain; trust model
Crates & Modules Workspace map, dependency layering, the dolos binary command surface, key dependencies
Data Layer The four stores (WAL / State / Archive / Index) + mempool, storage traits, pluggable backends (redb / fjall / no-op), storage modes, delta & snapshot primitives
Sync Pipeline Ouroboros mini-protocols, the gasket pull → apply → submit stages, work-unit lifecycle, WAL-based rollback, housekeeping
Ledger Model & Epoch Transitions Cardano work units, the EpochValue snapshot window, RUPD → EWRAP → ESTART phases, the pots system, sharding
Serving Layer & APIs How every API surface reads the shared domain, the five surfaces, mempool & tx submission/validation path

Notes

  • The section is placed at the end of the sidebar (order: 8), so no existing _meta.yml files change. Happy to move it right after "What is Dolos" instead if preferred.
  • Diagrams are mermaid flowcharts.
  • Every crate, trait, module, and command named was checked against the source; all internal links resolve against the current docs/content/ tree.

Summary by CodeRabbit

  • Documentation
    • Added a new “Architecture” section to the documentation navigation.
    • Published detailed architecture pages covering the crate/module layout, data/storage-layer design, ledger model and epoch/pot semantics, sync pipeline behavior (including reversible work and WAL-based rollback), and the serving-layer/API surfaces.
    • Expanded explanations of runtime wiring and end-to-end transaction flow, plus pruning/retention concepts for stored history.

Adds a new top-level Architecture section to the docs with a macro
view of the system: crate/module layout, the data layer (stores,
traits, backends, storage modes), the sync pipeline, the Cardano
ledger model and epoch transitions, and the serving layer.
@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 422bab8b-a72a-4fa4-a44b-f2c277d37663

📥 Commits

Reviewing files that changed from the base of the PR and between 205ac5b and b80cbb6.

📒 Files selected for processing (5)
  • docs/content/architecture/crates.mdx
  • docs/content/architecture/index.mdx
  • docs/content/architecture/ledger-model.mdx
  • docs/content/architecture/serving-layer.mdx
  • docs/content/architecture/sync-pipeline.mdx
✅ Files skipped from review due to trivial changes (5)
  • docs/content/architecture/sync-pipeline.mdx
  • docs/content/architecture/serving-layer.mdx
  • docs/content/architecture/index.mdx
  • docs/content/architecture/ledger-model.mdx
  • docs/content/architecture/crates.mdx

📝 Walkthrough

Walkthrough

This PR adds a new Architecture documentation section with an index page and five dedicated pages covering crates/modules, data layer, sync pipeline, ledger model, and serving layer/APIs, plus navigation metadata.

Changes

Architecture Documentation

Layer / File(s) Summary
Architecture index and navigation
docs/content/architecture/_meta.yml, docs/content/architecture/index.mdx
Adds the Architecture section metadata and an overview page with a layered data-flow diagram, links to subordinate pages, DomainAdapter wiring description, and trust model.
Crates and workspace structure page
docs/content/architecture/crates.mdx
Documents workspace crates, Cargo feature gating, dependency layering direction, dolos binary subcommands, and key foundational dependencies.
Data layer page
docs/content/architecture/data-layer.mdx
Describes the WAL/State/Archive/Index/mempool store layout, pluggable storage backends, storage modes/pruning, and core data-model primitives.
Sync pipeline page
docs/content/architecture/sync-pipeline.mdx
Explains network connection protocols, the staged gasket pipeline, work-unit lifecycle, WAL-based rollback, and housekeeping/pruning.
Ledger model page
docs/content/architecture/ledger-model.mdx
Documents CardanoWorkUnit variants, EpochValue snapshot rotation, epoch boundary phase ordering, pots accounting, and account sharding.
Serving layer page
docs/content/architecture/serving-layer.mdx
Describes the shared DomainAdapter read foundation, tip-follow streaming, supported API surfaces, and the transaction submission and mempool flow.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding a new architecture section documenting Dolos internals.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/architecture-section

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/content/architecture/data-layer.mdx`:
- Line 7: Update the opening description in the data-layer architecture page so
it reflects Dolos’s mixed storage layout instead of implying everything is in
embedded key-value stores. Reword the intro around the architecture overview to
mention both the key-value stores and the append-only flatfile segments used for
archive block bodies, while keeping the “common traits” and swappable engine
framing intact. Use the existing data-layer introduction text as the place to
adjust the wording so it stays consistent with the later storage sections.

In `@docs/content/architecture/index.mdx`:
- Around line 62-64: The consistency wording is too strong for the current
adapter behavior because `DomainAdapter` and `watch_tip` still allow a race
window. Update the `index.mdx` architecture description to avoid claiming a
perfectly consistent, always up-to-date view; instead describe that the serving
layer reads from committed state and reacts to new blocks via the tip
broadcast/subscription flow, with replay plus subscription keeping it eventually
aligned.

In `@docs/content/architecture/serving-layer.mdx`:
- Around line 13-15: Update the serving-layer architecture description to avoid
promising immediate delivery from the tip broadcast channel. In the section
describing streaming endpoints and the `Domain` adapter, qualify the
`chain-follow`/`tip-watch` behavior as eventually consistent and note the
replay/subscription gap documented by `watch_tip` in `src/adapters/mod.rs`, so
the text reflects that clients may briefly miss blocks around the subscription
window.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: da7674f0-29d8-4df6-ba8e-99e0aec65091

📥 Commits

Reviewing files that changed from the base of the PR and between 6e0216c and 366136d.

📒 Files selected for processing (7)
  • docs/content/architecture/_meta.yml
  • docs/content/architecture/crates.mdx
  • docs/content/architecture/data-layer.mdx
  • docs/content/architecture/index.mdx
  • docs/content/architecture/ledger-model.mdx
  • docs/content/architecture/serving-layer.mdx
  • docs/content/architecture/sync-pipeline.mdx

Comment thread docs/content/architecture/data-layer.mdx Outdated
Comment thread docs/content/architecture/index.mdx Outdated
Comment on lines +13 to +15
Streaming endpoints (chain-follow, tip-watch) subscribe to the tip broadcast channel that the sync pipeline publishes to, so they push new blocks to clients the moment a block is applied.

This design means the serving layer adds no new storage and imposes no coupling on the ledger rules — adding an API surface is a matter of writing another adapter over `Domain`.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Qualify the tip-follow guarantee.

src/adapters/mod.rs documents a replay/subscription race window in watch_tip, so this page shouldn't imply clients receive each block "the moment" it is applied. Please describe the delivery as eventually consistent and mention the replay gap.

🛠️ Suggested wording
-Streaming endpoints (chain-follow, tip-watch) subscribe to the tip broadcast channel that the sync pipeline publishes to, so they push new blocks to clients the moment a block is applied.
+Streaming endpoints (chain-follow, tip-watch) subscribe to the tip broadcast channel that the sync pipeline publishes to. Delivery is effectively live, but there is a small replay/subscription race window, so clients should treat it as eventually consistent.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Streaming endpoints (chain-follow, tip-watch) subscribe to the tip broadcast channel that the sync pipeline publishes to, so they push new blocks to clients the moment a block is applied.
This design means the serving layer adds no new storage and imposes no coupling on the ledger rules — adding an API surface is a matter of writing another adapter over `Domain`.
Streaming endpoints (chain-follow, tip-watch) subscribe to the tip broadcast channel that the sync pipeline publishes to. Delivery is effectively live, but there is a small replay/subscription race window, so clients should treat it as eventually consistent.
This design means the serving layer adds no new storage and imposes no coupling on the ledger rules — adding an API surface is a matter of writing another adapter over `Domain`.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/content/architecture/serving-layer.mdx` around lines 13 - 15, Update the
serving-layer architecture description to avoid promising immediate delivery
from the tip broadcast channel. In the section describing streaming endpoints
and the `Domain` adapter, qualify the `chain-follow`/`tip-watch` behavior as
eventually consistent and note the replay/subscription gap documented by
`watch_tip` in `src/adapters/mod.rs`, so the text reflects that clients may
briefly miss blocks around the subscription window.

scarmuega added 2 commits July 2, 2026 15:01
Addresses review feedback: describe the mixed KV + flatfile layout in
the data-layer intro, qualify the cross-store commit consistency claim,
and drop the instantaneous-delivery phrasing for tip streaming.
@scarmuega scarmuega merged commit deb312c into main Jul 2, 2026
12 checks passed
@scarmuega scarmuega deleted the docs/architecture-section branch July 2, 2026 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant