Skip to content

feat(foundations): migrate DHT and RLDP pages from the old documentation #2048

Open
coalus wants to merge 8 commits intoton-org:mainfrom
coalus:feat/network-protocols
Open

feat(foundations): migrate DHT and RLDP pages from the old documentation #2048
coalus wants to merge 8 commits intoton-org:mainfrom
coalus:feat/network-protocols

Conversation

@coalus
Copy link
Copy Markdown
Contributor

@coalus coalus commented Apr 1, 2026

resolves #2047.

Summary by CodeRabbit

  • Documentation
    • Added a new "Network protocols" section under Blockchain foundations with comprehensive guides for ADNL, ADNL over TCP, ADNL over UDP, DHT, and RLDP, covering protocols, packet/message formats, connection/handshake flows, key/session handling, transfer semantics, and end-to-end examples.
  • Chores
    • Updated permanent redirects from legacy network protocol URLs to the new documentation pages for smoother navigation.

@coalus coalus requested a review from a team as a code owner April 1, 2026 18:58
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 1, 2026

Skipping AI review because this PR is from a fork. A maintainer can start the review by commenting /review in this PR.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 1, 2026

Thank you for the contribution!

Unfortunately, it is too large, with over 600 added lines, excluding some generated or otherwise special files. Thus, this pull request is challenging to review and iterate on.

Please split the PR into several smaller ones and consider reverting any unrelated changes, writing less, or approaching the problem in the issue from a different angle.

I look forward to your next submissions. If you still intend to proceed as is, then you are at the mercy of the reviewers.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 1, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Added a new "Network protocols" section under Foundations with pages for ADNL, ADNL-TCP, ADNL-UDP, DHT, and RLDP, and updated permanent redirects from legacy network protocol URLs to the new foundations/network/* paths.

Changes

Cohort / File(s) Summary
Navigation & Redirects
docs.json
Inserted "Network protocols" navigation group under "Blockchain foundations" and updated permanent redirect targets from legacy ADNL/DHT/RLDP URLs to the new foundations/network/* pages.
ADNL Core
foundations/network/adnl.mdx
New ADNL overview: address derivation, key type mapping, neighbor table, ADNL-over-TCP handshake and session key derivation, TCP datagram layout, ADNL-over-UDP channel summary, and cross-links.
ADNL over TCP
foundations/network/adnl-tcp.mdx
New ADNL-TCP page: 160‑byte handshake params, AES‑CTR/ECDH session derivation, encrypted TCP packet format and checksum rules, keepalive tcp.ping/tcp.pong, and liteserver TL-wrapping examples (getMasterchainInfo, runSmcMethod, getAccountState).
ADNL over UDP
foundations/network/adnl-udp.mdx
New ADNL-UDP page: peer init, channel creation flow (createChannel + query), adnl.packetContents presence flags, signing/encryption/ECDH envelope, channel key derivation, segmentation (part) and custom messages, and response handling.
DHT (Kademlia-like)
foundations/network/dht.mdx
New DHT page: 256-bit key format, XOR distance and routing table/buckets, update rules (signature/seq/unrestricted), dht.findValue lookup flow (verification, recursion), and blockchain node discovery via overlay keys.
RLDP & HTTP mapping
foundations/network/rldp.mdx
New RLDP page: TL schemas for rldp.messagePart/confirm/complete, FEC transfer flow (RoundRobin/Online/RaptorQ), RLDP-HTTP TL mapping (headers, chunked body), and an end-to-end RaptorQ example with chunked retrieval.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant Client as Client
    participant DHT as DHT Network
    participant Peer as Remote Peer
    Client->>DHT: dht.findValue(key, k)
    DHT-->>Client: closest nodes (node list)
    Client->>Peer: ADNL UDP connect / adnl.message.query
    alt valueFound at Peer
        Peer-->>Client: dht.valueFound(value, meta)
        Client->>Client: verify signatures, TTL, update_rule
    else valueNotFound at Peer
        Peer-->>Client: dht.valueNotFound(node list)
        Client->>DHT: query next nodes (by XOR distance)
        loop until termination
            DHT-->>Client: more nodes / final result
        end
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • aigerimu
  • novusnota

Poem

🐰
I hop through packets, hashes, and light,
ADNL, DHT, RLDP — stitched tight,
From old paths to foundations new,
My tiny paws mapped every view. 🥕

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The PR title mentions DHT and RLDP but omits ADNL and TCP/UDP variants, which together comprise the majority of the changeset. Consider revising the title to either include all migrated protocols (e.g., 'feat(foundations): migrate network protocols (ADNL, TCP, UDP, DHT, RLDP) from old documentation') or focus on the most significant aspect if intentionally narrowing scope.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed All code changes successfully fulfill the linked issue #2047 objectives: ADNL, RLDP, and DHT documentation have been migrated to foundations/network/ with proper navigation updates.
Out of Scope Changes check ✅ Passed All changes are in-scope: docs.json updates facilitate navigation to the new protocol pages, and new documentation files are for ADNL, RLDP, DHT, and TCP/UDP variants.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 11

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@ecosystem/nodes/cpp/run-validator.mdx`:
- Line 24: The in-page anchor in the markdown link
("#step-4:-set-optimal-stake-for-validator") contains a colon which likely
breaks the generated slug; update the link target in the text "Validator deposit
stake [700K–2M TON per round](...)" to use the normalized heading slug (e.g.,
change "#step-4:-set-optimal-stake-for-validator" to
"#step-4-set-optimal-stake-for-validator" or whatever the generated slug for the
"Step 4" heading is) so the link points to the correct in-page anchor.
- Around line 940-941: Multiple entries show conflicting sync thresholds: the
table rows "Local validator out of sync" and "Masterchain out of sync"
(currently 3–5 seconds at lines ~940–941 and ~963) contradict the guidance at
the earlier mention that sync is acceptable when value is "< 20" (around line
~411). Choose one canonical threshold (either 3–5 seconds or "< 20") and update
all occurrences to match: replace the two table values ("Local validator out of
sync", "Masterchain out of sync") and the value at the other occurrence near
line 963 and the earlier statement at "value is < 20" so every instance uses the
same wording and numeric threshold consistently.

In `@foundations/network/adnl-tcp.mdx`:
- Line 132: Update the documentation to address spelling/format warnings: wrap
the function name runSmcMethod in backticks (`runSmcMethod`) where it appears to
mark it as code; change usages of accountId to either "account ID" or
`accountId` in backticks for clarity (e.g., the occurrence at/around the
"accountId" mention); and replace the phrase "DH principle" with
"Diffie-Hellman" (or "Diffie-Hellman principle") to spell it out fully (the
occurrence near "DH principle"). Ensure all three replacements are applied
consistently in the sections referencing runSmcMethod, accountId, and DH/
Diffie-Hellman.
- Line 19: The documentation uses shorthand abbreviations that trigger spelling
warnings: replace the "(LE)" annotation next to the `size` field with
"(little-endian)" and expand "IV" to "initialization vector" (or add "IV —
initialization vector" to the document's dictionary/glossary) so both
occurrences in adnl-tcp.mdx are spelled out for clarity and to satisfy the
pipeline checks.
- Line 75: The TL schema name is incorrectly cased as "tcp.pong"; update the
reference to use the proper casing `TCP.pong` (or wrap the exact schema name in
backticks) so the pipeline won't flag it, and ensure the surrounding sentence
still refers to matching `random_id`; locate the occurrence of "tcp.pong" in the
text and replace it with `TCP.pong` (or backticked `TCP.pong`) to reflect the TL
schema name accurately.

In `@foundations/network/adnl.mdx`:
- Line 92: Replace the shorthand pipeline flags in the ADNL doc: change "RX and
TX" to "receive and transmit" wherever used (e.g., the phrase containing "RX"
and "TX" on the handshake/AES-CTR sentence) and expand "(LE)" to
"(little-endian)" where it appears (the occurrence currently shown as "(LE)").
Ensure the wording remains consistent across the same section so "receive/
transmit" and "little-endian" are used instead of the abbreviations.
- Around line 55-63: The doc uses forbidden abbreviations "RX" and "TX" in the
AES-CTR session parameter table (symbols: rx_key, tx_key, rx_nonce, tx_nonce,
padding, AES-CTR), so update the text and table to use full terms "receive" and
"transmit" (e.g., receive_key, transmit_key, receive_nonce, transmit_nonce) to
satisfy linting, or alternatively add "RX" and "TX" to the cspell dictionary if
the abbreviated protocol names must be preserved; ensure all occurrences of
RX/TX in the paragraph and table are updated consistently.
- Line 65: Update the wording in the ADNL documentation line that currently uses
"MitM" to use "MITM" (or the full phrase "man-in-the-middle") so the pipeline
spellchecker recognizes it; locate the sentence in foundations/network/adnl.mdx
that reads "active MitM attack" and replace it with "active MITM attack" or
"active man-in-the-middle attack" to fix the spelling/unknown-word flag while
preserving meaning.

In `@foundations/network/dht.mdx`:
- Line 80: Wrap the TL schema names in backticks in the markdown headers to stop
the lowercase "dht" spelling warnings: update the header "dht.valueNotFound"
(and the other similar header referenced at the second occurrence) so the header
reads with inline code formatting (e.g., `dht.valueNotFound`) instead of plain
text; ensure you update both occurrences mentioned in the comment so all schema
names are backticked.

In `@foundations/network/rldp.mdx`:
- Line 140: Update the documentation text to replace the nonstandard "KB" with
the SI-correct "kB" (or spell out "kilobytes") in the sentence referencing chunk
size so it reads e.g. "max_chunk_size of 128 kB (131072 bytes)"; adjust the
occurrence that mentions "KB" alongside the symbols rldp.answer, http.response,
http.getNextPayloadPart, seqno, max_chunk_size, and last so the only change is
the casing/spelling.
- Around line 67-69: The TL-B schema line for the HTTP request is incorrect: the
constructor "http.request id:int256 method:string url:string http_version:string
headers:(vector http.header) = http.Response" wrongly declares a response type;
change its return type to the appropriate request type (e.g., "http.Request") so
the constructor defines an HTTP request structure rather than a response. Update
the "http.request" declaration accordingly and verify related code paths that
construct or pattern-match on http.request still expect the corrected
"http.Request" type; also ensure "http.getNextPayloadPart" remains unchanged.
🪄 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: f5b18814-de02-4353-9ca0-f8f451f898a4

📥 Commits

Reviewing files that changed from the base of the PR and between c9da5b6 and 6956fab.

📒 Files selected for processing (7)
  • docs.json
  • ecosystem/nodes/cpp/run-validator.mdx
  • foundations/network/adnl-tcp.mdx
  • foundations/network/adnl-udp.mdx
  • foundations/network/adnl.mdx
  • foundations/network/dht.mdx
  • foundations/network/rldp.mdx

@coalus coalus force-pushed the feat/network-protocols branch from 6956fab to 256d1cf Compare April 2, 2026 07:11
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

♻️ Duplicate comments (5)
foundations/network/adnl.mdx (3)

99-99: ⚠️ Potential issue | 🟡 Minor

Spell out "little-endian" to fix pipeline warning.

The pipeline flags "LE" as a forbidden abbreviation. Spell out the full term for clarity.

📝 Proposed fix
-| `length`  | 4 bytes (LE)        | Total datagram length, excluding this field |
+| `length`  | 4 bytes (little-endian) | Total datagram length, excluding this field |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@foundations/network/adnl.mdx` at line 99, Replace the abbreviation "LE" in
the table row for the `length` field with the full phrase "little-endian" so the
entry reads something like "4 bytes (little-endian)"; update the table cell that
currently contains "`length`  | 4 bytes (LE)`" to spell out "little-endian" to
satisfy the pipeline and improve clarity.

55-55: ⚠️ Potential issue | 🟡 Minor

Spell out "transmit" and "receive" to fix pipeline warning.

The pipeline flags "RX" as a forbidden abbreviation. While the parameter names in the table (rx_key, tx_key, etc.) should match the protocol specification, the prose description can be improved for clarity.

📝 Proposed fix
-1. The client generates AES-CTR session parameters (16-byte nonce and 32-byte key for both TX and RX directions) and serializes them into a 160-byte buffer:
+1. The client generates AES-CTR session parameters (16-byte nonce and 32-byte key for both transmit and receive directions) and serializes them into a 160-byte buffer:
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@foundations/network/adnl.mdx` at line 55, The prose uses the abbreviations
"RX" and "TX" which trigger the pipeline warning; update the sentence that
mentions session parameters to spell out "receive" and "transmit" (e.g.,
"receive direction" and "transmit direction") while leaving the protocol
parameter names in the table (rx_key, tx_key, rx_nonce, tx_nonce) unchanged so
they still match the spec; ensure only the descriptive text is changed and the
table entries remain identical.

93-93: ⚠️ Potential issue | 🟡 Minor

Spell out "transmit" and "receive" to fix pipeline warning.

The pipeline flags "RX" as a forbidden abbreviation. Spell out the full terms for better clarity.

📝 Proposed fix
-Both sides initialize two AES-CTR instances (TX and RX) using the session parameters from the handshake.
+Both sides initialize two AES-CTR instances (transmit and receive) using the session parameters from the handshake.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@foundations/network/adnl.mdx` at line 93, Replace the abbreviations "TX" and
"RX" in the sentence "Both sides initialize two AES-CTR instances (TX and RX)
using the session parameters from the handshake." with the full words "transmit"
and "receive" (e.g., "Both sides initialize two AES-CTR instances (transmit and
receive) using the session parameters from the handshake.") so the pipeline
warning about the forbidden abbreviation "RX" is resolved; update any adjacent
occurrences of "TX" and "RX" in the same paragraph to use "transmit" and
"receive" for consistency.
foundations/network/rldp.mdx (1)

67-67: ⚠️ Potential issue | 🟡 Minor

TL-B schema type inconsistency: http.request should return http.Request.

The schema shows http.request ... = http.Response, but a request constructor should return a request type, not a response type. This is semantically incorrect.

🔧 Proposed fix
-http.request id:int256 method:string url:string http_version:string headers:(vector http.header) = http.Response;
+http.request id:int256 method:string url:string http_version:string headers:(vector http.header) = http.Request;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@foundations/network/rldp.mdx` at line 67, The TL-B schema line defining the
request constructor is returning the wrong type: change the constructor
signature for http.request so it returns http.Request instead of http.Response;
locate the symbol "http.request" in the diff and update its return type from
"http.Response" to "http.Request" so the signature reads that the request
constructor produces an http.Request (leaving parameters id:int256,
method:string, url:string, http_version:string, headers:(vector http.header)
unchanged).
foundations/network/dht.mdx (1)

80-80: ⚠️ Potential issue | 🟡 Minor

Wrap TL schema names in backticks to fix pipeline failures.

The pipeline flags lowercase "dht" in these section headers. Wrapping the schema names in backticks will fix the spelling warnings and improve code formatting consistency.

📝 Proposed fix
-### dht.valueNotFound
+### `dht.valueNotFound`
-### dht.valueFound
+### `dht.valueFound`

Also applies to: 98-98

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@foundations/network/dht.mdx` at line 80, Section headers that refer to TL
schema names like dht.valueNotFound (and the other header at the same file noted
in the comment) need their schema names wrapped in backticks to avoid pipeline
spelling warnings; update the markdown headings for "dht.valueNotFound" (and the
header at the other occurrence) so the schema token is enclosed in backticks
(e.g., `dht.valueNotFound`) to fix the pipeline failures and keep formatting
consistent.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@foundations/network/adnl.mdx`:
- Line 99: Replace the abbreviation "LE" in the table row for the `length` field
with the full phrase "little-endian" so the entry reads something like "4 bytes
(little-endian)"; update the table cell that currently contains "`length`  | 4
bytes (LE)`" to spell out "little-endian" to satisfy the pipeline and improve
clarity.
- Line 55: The prose uses the abbreviations "RX" and "TX" which trigger the
pipeline warning; update the sentence that mentions session parameters to spell
out "receive" and "transmit" (e.g., "receive direction" and "transmit
direction") while leaving the protocol parameter names in the table (rx_key,
tx_key, rx_nonce, tx_nonce) unchanged so they still match the spec; ensure only
the descriptive text is changed and the table entries remain identical.
- Line 93: Replace the abbreviations "TX" and "RX" in the sentence "Both sides
initialize two AES-CTR instances (TX and RX) using the session parameters from
the handshake." with the full words "transmit" and "receive" (e.g., "Both sides
initialize two AES-CTR instances (transmit and receive) using the session
parameters from the handshake.") so the pipeline warning about the forbidden
abbreviation "RX" is resolved; update any adjacent occurrences of "TX" and "RX"
in the same paragraph to use "transmit" and "receive" for consistency.

In `@foundations/network/dht.mdx`:
- Line 80: Section headers that refer to TL schema names like dht.valueNotFound
(and the other header at the same file noted in the comment) need their schema
names wrapped in backticks to avoid pipeline spelling warnings; update the
markdown headings for "dht.valueNotFound" (and the header at the other
occurrence) so the schema token is enclosed in backticks (e.g.,
`dht.valueNotFound`) to fix the pipeline failures and keep formatting
consistent.

In `@foundations/network/rldp.mdx`:
- Line 67: The TL-B schema line defining the request constructor is returning
the wrong type: change the constructor signature for http.request so it returns
http.Request instead of http.Response; locate the symbol "http.request" in the
diff and update its return type from "http.Response" to "http.Request" so the
signature reads that the request constructor produces an http.Request (leaving
parameters id:int256, method:string, url:string, http_version:string,
headers:(vector http.header) unchanged).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f61fd981-8899-4e2d-a2a3-7e6bb046be30

📥 Commits

Reviewing files that changed from the base of the PR and between 256d1cf and bb63f6c.

📒 Files selected for processing (5)
  • foundations/network/adnl-tcp.mdx
  • foundations/network/adnl-udp.mdx
  • foundations/network/adnl.mdx
  • foundations/network/dht.mdx
  • foundations/network/rldp.mdx
✅ Files skipped from review due to trivial changes (1)
  • foundations/network/adnl-udp.mdx

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

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 the current code and only fix it if needed.

Inline comments:
In `@foundations/network/adnl-tcp.mdx`:
- Line 1: The file foundations/network/adnl-tcp.mdx is not formatted to repo
standards and fails check:fmt:some; run the repository's formatter (the same
tool invoked by the check:fmt:some script) on foundations/network/adnl-tcp.mdx
to normalize MDX formatting and commit the updated file so the CI formatting
check passes.
- Around line 204-205: The byte-slice ranges used to derive key and iv are
ambiguous (e.g. 0..16, 16..32, 0..4, 20..32); update the text so the slices are
explicit about inclusivity/exclusivity — for example specify half-open indices
or explicit inclusive ranges for shared_key and hash when constructing key and
iv (e.g. "shared_key bytes 0–15" or "shared_key[0:16]" for the first segment,
"hash[16:32]" for the second, likewise "hash[0:4]" and "shared_key[20:32]" for
iv) so implementers cannot misinterpret the endpoints when deriving key and iv.
- Around line 216-221: The Diffie–Hellman example incorrectly describes
exchanging intermediate results; fix it to show parties exchange public values
and then compute the shared key: state client private a=6 and client public A =
7^6 mod 15 = 4, server private b=5 and server public B = 7^5 mod 15 = 7, they
exchange A and B (not intermediate exponents), then client computes B^a mod 15 =
7^6 mod 15 = 4 and server computes A^b mod 15 = 4^5 mod 15 = 4, yielding shared
key 4; update the steps that reference "secret 6", "public 7", "secret 5",
"public 15", and the lines that currently say “They exchange results” so they
instead state “They exchange public values A and B” and show the two final
exponentiations producing the shared key.
🪄 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: 85faaebd-c9ec-4aec-a830-c8a7b09a7202

📥 Commits

Reviewing files that changed from the base of the PR and between bb63f6c and 58f0c22.

📒 Files selected for processing (4)
  • foundations/network/adnl-tcp.mdx
  • foundations/network/adnl-udp.mdx
  • foundations/network/adnl.mdx
  • foundations/network/dht.mdx
✅ Files skipped from review due to trivial changes (3)
  • foundations/network/adnl-udp.mdx
  • foundations/network/dht.mdx
  • foundations/network/adnl.mdx

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

♻️ Duplicate comments (2)
foundations/network/adnl-tcp.mdx (2)

204-205: ⚠️ Potential issue | 🟡 Minor

Clarify byte-slice ranges to prevent off-by-one errors.

The notation shared_key[0..16] is ambiguous—some languages treat .. as inclusive, others as half-open. For cryptographic key derivation, implementers need unambiguous byte ranges.

📝 Suggested clarification

Replace with explicit half-open notation or add a comment:

-key = shared_key[0..16] || hash[16..32]
-iv  = hash[0..4] || shared_key[20..32]
+key = shared_key[0:16] || hash[16:32]   // bytes 0-15 and 16-31 (32 bytes total)
+iv  = hash[0:4] || shared_key[20:32]    // bytes 0-3 and 20-31 (16 bytes total)

Or use prose:

-key = shared_key[0..16] || hash[16..32]
-iv  = hash[0..4] || shared_key[20..32]
+key = first 16 bytes of shared_key || bytes 16-31 of hash
+iv  = first 4 bytes of hash || bytes 20-31 of shared_key
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@foundations/network/adnl-tcp.mdx` around lines 204 - 205, The slices for key
and iv using shared_key and hash are ambiguous; update the text for the symbols
key and iv to state explicit byte ranges (e.g., "bytes 0–15" and "bytes 16–31")
and specify whether the notation is half-open or inclusive so implementers know
exactly which bytes are used (for example: shared_key[0..16] → shared_key bytes
0–15 (inclusive) and shared_key[20..31] for the later slice), and do the same
for hash slices, clarifying the chosen convention (half-open or inclusive) in a
short parenthetical note.

1-1: ⚠️ Potential issue | 🔴 Critical

Run the repository formatter to unblock CI.

The formatting check still fails on this file. Run npm run check:fmt:some (or the equivalent format command) and commit the result to pass CI.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@foundations/network/adnl-tcp.mdx` at line 1, Run the repository formatter and
commit the changes to satisfy CI: run the project's formatting command (e.g.,
npm run check:fmt:some or the configured format script), apply the formatter to
the repository (ensuring the foundations/network/adnl-tcp.mdx file is updated),
stage the formatted file, and commit the result with a clear message like
"chore: format adnl-tcp.mdx" so the formatting check passes.
🧹 Nitpick comments (1)
foundations/network/adnl-tcp.mdx (1)

26-26: Optional: Tighten wording.

The phrase "is an exception and is detailed" could be more concise: "is an exception; see..." or "is an exception—detailed in...".

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@foundations/network/adnl-tcp.mdx` at line 26, Tighten the second sentence by
replacing "The handshake is an exception and is detailed in the [ADNL
specification](/foundations/network/adnl#handshake)." with a more concise
variant such as "The handshake is an exception; see the [ADNL
specification](/foundations/network/adnl#handshake)." so the line reads: "After
decryption, verify that the checksum matches by computing it independently. The
handshake is an exception; see the [ADNL
specification](/foundations/network/adnl#handshake)."
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@foundations/network/adnl-tcp.mdx`:
- Around line 204-205: The slices for key and iv using shared_key and hash are
ambiguous; update the text for the symbols key and iv to state explicit byte
ranges (e.g., "bytes 0–15" and "bytes 16–31") and specify whether the notation
is half-open or inclusive so implementers know exactly which bytes are used (for
example: shared_key[0..16] → shared_key bytes 0–15 (inclusive) and
shared_key[20..31] for the later slice), and do the same for hash slices,
clarifying the chosen convention (half-open or inclusive) in a short
parenthetical note.
- Line 1: Run the repository formatter and commit the changes to satisfy CI: run
the project's formatting command (e.g., npm run check:fmt:some or the configured
format script), apply the formatter to the repository (ensuring the
foundations/network/adnl-tcp.mdx file is updated), stage the formatted file, and
commit the result with a clear message like "chore: format adnl-tcp.mdx" so the
formatting check passes.

---

Nitpick comments:
In `@foundations/network/adnl-tcp.mdx`:
- Line 26: Tighten the second sentence by replacing "The handshake is an
exception and is detailed in the [ADNL
specification](/foundations/network/adnl#handshake)." with a more concise
variant such as "The handshake is an exception; see the [ADNL
specification](/foundations/network/adnl#handshake)." so the line reads: "After
decryption, verify that the checksum matches by computing it independently. The
handshake is an exception; see the [ADNL
specification](/foundations/network/adnl#handshake)."

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1bba40c0-2ccf-4a7d-8916-df6d8b3273fe

📥 Commits

Reviewing files that changed from the base of the PR and between 58f0c22 and 5aa0946.

📒 Files selected for processing (2)
  • foundations/network/adnl-tcp.mdx
  • foundations/network/adnl.mdx
🚧 Files skipped from review as they are similar to previous changes (1)
  • foundations/network/adnl.mdx

@novusnota
Copy link
Copy Markdown
Collaborator

@coalus Hmm, let's split the DHT and RLTP into another PR, such that this one will be a bit smaller and easier for review :) We can add cross-links in there or in yet another PR, afterwards.

@novusnota novusnota self-requested a review April 5, 2026 22:52
@novusnota novusnota changed the title feat(foundations): migrate network protocols from the old documentation feat(foundations): migrate DHT and RLDP pages from the old documentation Apr 5, 2026
@novusnota novusnota requested a review from aigerimu April 7, 2026 08:49
Comment on lines +9 to +11
The Reliable Large Datagram Protocol (RLDP) operates on top of [ADNL UDP](https://old-docs.ton.org/v3/documentation/network/protocols/adnl/udp) and is designed for transferring large data blocks. It uses Forward Error Correction (FEC) instead of acknowledgment packets, enabling more efficient data transfer at the cost of increased traffic.

RLDP is used throughout the TON infrastructure: downloading blocks from other nodes, transferring data, and accessing [TON Sites](/foundations/web3/ton-sites) and [TON Storage](/foundations/web3/ton-storage).
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@aigerimu @coalus let's add a note on top about the usage of QUIC over RLDP since the recent sub-second upgrade in the mainnet. With that, the rest of the page should be written in past tense: like, to replace "is used" with "was used".

Rough example of a change:

Suggested change
The Reliable Large Datagram Protocol (RLDP) operates on top of [ADNL UDP](https://old-docs.ton.org/v3/documentation/network/protocols/adnl/udp) and is designed for transferring large data blocks. It uses Forward Error Correction (FEC) instead of acknowledgment packets, enabling more efficient data transfer at the cost of increased traffic.
RLDP is used throughout the TON infrastructure: downloading blocks from other nodes, transferring data, and accessing [TON Sites](/foundations/web3/ton-sites) and [TON Storage](/foundations/web3/ton-storage).
<Aside type="note">
With the introduction of [Catchain consensus 2.0](/ecosystem/subsecond), blockchain nodes now use [QUIC](https://en.wikipedia.org/wiki/QUIC) instead of RLDP for internal communication.
</Aside>
The Reliable Large Datagram Protocol (RLDP) operates on top of [ADNL UDP](https://old-docs.ton.org/v3/documentation/network/protocols/adnl/udp) and is designed for transferring large data blocks. It uses Forward Error Correction (FEC) instead of acknowledgment packets, enabling more efficient data transfer at the cost of increased traffic.
RLDP was used throughout the TON infrastructure prior to the [sub-second upgrade](/ecosystem/subsecond) for downloading blocks from other nodes, transferring data, and accessing [TON Sites](/foundations/web3/ton-sites) and [TON Storage](/foundations/web3/ton-storage).

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.

[Foundations > Network] Migrate RLDP and DHT documentation

3 participants