-
Notifications
You must be signed in to change notification settings - Fork 79
Conversation
Skipping AI review because this PR is from a fork. A maintainer can start the review by commenting /review in this PR.
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds a "Network protocols" navigation group and redirects in Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Server
participant Crypto
Client->>Server: TCP connect + 256B handshake (recv addr, client pubkey, proof, enc 160B params)
Server->>Crypto: Decrypt 160B params using ECDH (server priv + client pub)
Crypto-->>Server: AES-CTR keys/IVs derived for both directions
Server-->>Client: empty ADNL packet (handshake OK)
Client->>Server: encrypted ADNL datagram (len | nonce |payload| sha256), AES-CTR
Server->>Crypto: decrypt & verify checksum
sequenceDiagram
participant Client
participant Server
participant Crypto
Client->>Server: UDP first packet (createChannel + query) — sign, hash, ECDH-encrypt
Server->>Crypto: verify signature & hash, derive shared key
Server-->>Client: `adnl.message.confirmChannel` and `adnl.message.answer` (encrypted)
Client->>Server: subsequent per-channel packets encrypted with directional AES keys
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
🧹 Nitpick comments (1)
foundations/network/adnl-udp.mdx (1)
9-11: Prefer docs-owned routes for the DHT/RLDP links.Lines 9-11 and 181-188 hardcode
old-docs.ton.orgfor related protocol links.docs.jsonalready owns redirects for those topics, so these should point to the site-local routes instead; that keeps users ondocs.ton.organd avoids another content edit when DHT/RLDP are migrated.🔗 Suggested link cleanup
- ADNL over UDP is the protocol used by TON nodes to communicate with each other. It serves as the foundation for higher-level protocols such as [DHT](https://old-docs.ton.org/v3/documentation/network/protocols/dht/overview) and [RLDP](https://old-docs.ton.org/v3/documentation/network/protocols/rldp). + ADNL over UDP is the protocol used by TON nodes to communicate with each other. It serves as the foundation for higher-level protocols such as [DHT](/v3/documentation/network/protocols/dht/overview) and [RLDP](/v3/documentation/network/protocols/rldp).Apply the same replacement in the See also list.
Also applies to: 181-188
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@foundations/network/adnl-udp.mdx` around lines 9 - 11, Replace hardcoded external links to "https://old-docs.ton.org/..." with the site-local routes defined in docs.json for the DHT and RLDP pages in the ADNL over UDP doc: update the two inline links that currently point to the DHT and RLDP old-docs URLs (the ones used in the paragraph contrasting ADNL over UDP and ADNL over TCP) and the same two entries in the "See also" list to use the local route paths (e.g., the canonical /foundations/... or /network/... routes managed by docs.json) so the links remain on docs.ton.org and follow existing redirects.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs.json`:
- Around line 1400-1401: The redirect entry mapping "source":
"/v3/documentation/network/protocols/adnl/low-level" currently points to the
generic overview; update its "destination" to the migrated deep-dive path
"/foundations/network/adnl-udp" so legacy deep links resolve to the
low-level/channel material, and ensure the chained redirect for
"/learn/networking/low-level-adnl" (if present elsewhere) also targets
"/foundations/network/adnl-udp" to keep both redirects consistent.
In `@foundations/network/adnl-tcp.mdx`:
- Around line 55-57: Update the hyperlink target so the sentence "Data is
serialized using [TL]" points to the TL overview, not the TL‐B overview: change
the link in the ADNL TCP handshake paragraph (the
"[TL](/languages/tl-b/overview)" occurrence in foundations/network/adnl-tcp.mdx)
to the TL overview URL (for example "/languages/tl/overview") so implementers
are directed to the correct serialization format.
In `@foundations/network/adnl.mdx`:
- Around line 9-124: The ADNL overview omits definitions for "public/private
overlays" and "ADNL forks" referenced by issue `#1035`; add a short dedicated
subsection (e.g., "## Overlays and ADNL forks") that: defines public vs private
overlays, explains how ADNL forks occur and their effect on peer
discovery/neighbour tables, and links to any migrated detailed pages or the
original issue for full specs; place this subsection near "Neighbor tables" or
before "P2P protocol (ADNL over UDP)" and reference existing pages like "ADNL
TCP" / "ADNL UDP" for examples so readers can follow up.
- Around line 67-73: The byte-range notation for deriving AES key/nonce from
secret and hash is ambiguous; update the descriptions around
SHA-256(aes_params), key and nonce so they use explicit half-open ranges or byte
counts (e.g., secret[0..16) meaning bytes 0–15, hash[16..32) meaning bytes
16–31) and state resulting lengths (key = 32 bytes, nonce = 12 bytes), and make
the identical change in the TCP page copy; reference the symbols `secret`, `hash
= SHA-256(aes_params)`, `key` and `nonce` so the two occurrences are updated
consistently.
---
Nitpick comments:
In `@foundations/network/adnl-udp.mdx`:
- Around line 9-11: Replace hardcoded external links to
"https://old-docs.ton.org/..." with the site-local routes defined in docs.json
for the DHT and RLDP pages in the ADNL over UDP doc: update the two inline links
that currently point to the DHT and RLDP old-docs URLs (the ones used in the
paragraph contrasting ADNL over UDP and ADNL over TCP) and the same two entries
in the "See also" list to use the local route paths (e.g., the canonical
/foundations/... or /network/... routes managed by docs.json) so the links
remain on docs.ton.org and follow existing redirects.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
i️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: f54e7dd6-96e0-46f0-986e-be6ab7bbfb1f
📒 Files selected for processing (4)
docs.jsonfoundations/network/adnl-tcp.mdxfoundations/network/adnl-udp.mdxfoundations/network/adnl.mdx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The migration still omits overlays and ADNL fork behavior.
Issue #1035 explicitly calls out public/private overlays and ADNL forks, but this overview never defines those concepts or links to a migrated replacement. As merged, the new foundations section still leaves part of the promised ADNL coverage behind.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@foundations/network/adnl.mdx` around lines 9 - 124, The ADNL overview omits
definitions for "public/private overlays" and "ADNL forks" referenced by issue
`#1035`; add a short dedicated subsection (e.g., "## Overlays and ADNL forks")
that: defines public vs private overlays, explains how ADNL forks occur and
their effect on peer discovery/neighbour tables, and links to any migrated
detailed pages or the original issue for full specs; place this subsection near
"Neighbor tables" or before "P2P protocol (ADNL over UDP)" and reference
existing pages like "ADNL TCP" / "ADNL UDP" for examples so readers can follow
up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
foundations/network/adnl-tcp.mdx (1)
57-57: Prefer internal TL docs link for consistency and longevity.Line 57 points to
core.telegram.org. Consider linking to your internal TL docs page so navigation stays in-repo and less sensitive to external URL drift.Suggested fix
-After this exchange the connection is established. Data is serialized using [TL (Type Language)](https://core.telegram.org/mtproto/TL). +After this exchange the connection is established. Data is serialized using [TL (Type Language)](/languages/tl/overview).🤖 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 57, Replace the external core.telegram.org link used in the sentence "Data is serialized using [TL (Type Language)](https://core.telegram.org/mtproto/TL)" with the project's internal TL documentation page to ensure link stability; update the Markdown link target while keeping the link text "TL (Type Language)" unchanged so references to TL remain consistent across the repo (edit the adnl-tcp.mdx line containing that link).
🤖 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`:
- Around line 136-138: The schema block is labeled as "tlb" but is a TL schema;
update the code fence label from tlb to tl for the snippet containing
liteServer.runSmcMethod (the line starting with "liteServer.runSmcMethod mode:#
... = liteServer.RunMethodResult") so syntax highlighting and reader
expectations match the TL grammar.
---
Nitpick comments:
In `@foundations/network/adnl-tcp.mdx`:
- Line 57: Replace the external core.telegram.org link used in the sentence
"Data is serialized using [TL (Type
Language)](https://core.telegram.org/mtproto/TL)" with the project's internal TL
documentation page to ensure link stability; update the Markdown link target
while keeping the link text "TL (Type Language)" unchanged so references to TL
remain consistent across the repo (edit the adnl-tcp.mdx line containing that
link).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
i️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 51423583-f7f6-4a66-8d58-5d093dd14f14
📒 Files selected for processing (2)
foundations/network/adnl-tcp.mdxfoundations/network/adnl.mdx
✅ Files skipped from review due to trivial changes (1)
- foundations/network/adnl.mdx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
♻️ Duplicate comments (2)
foundations/network/adnl.mdx (2)
1-133:⚠️ Potential issue | 🟠 MajorAddress the missing overlays and forks content.
Issue
#1035explicitly requests coverage of public/private overlays and ADNL forks, but this documentation does not address those concepts. As flagged in a previous review, readers following the migration from old-docs will find this gap.Consider adding a dedicated section (e.g., "## Overlays and ADNL forks") that:
- Defines public vs. private overlays
- Explains when and how ADNL forks occur
- Describes their impact on peer discovery and neighbor tables
- Links to any additional migrated content or references the original specification
This section could be placed after "Neighbor tables" (line 40) or before "See also" (line 128).
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@foundations/network/adnl.mdx` around lines 1 - 133, Add a new section titled "## Overlays and ADNL forks" (insert after the "Neighbor tables" paragraph or before "See also") that defines public vs private overlays, explains triggers and mechanics of ADNL forks, and describes effects on peer discovery and neighbor table maintenance (stale entries, divergence, rejoin/merge procedures); include guidance on when overlays are used (e.g., isolation, testnets, private clusters), how forks are detected/reconciled, and link or reference the original/migrated specification and related ADNL docs for further reading. Ensure the new section uses the same tone and formatting as other sections and references ADNL concepts already in the document (e.g., neighbor table, address, handshake, datagram) so readers can correlate impacts.
67-68:⚠️ Potential issue | 🟡 MinorClarify byte-range notation to match the TCP page.
The
[0..16]and[16..32]notation is ambiguous—readers cannot tell whether the end index is inclusive or exclusive. The TCP documentation (adnl-tcp.mdx lines 204-205) uses Python-style slice notation[0:16]which clearly indicates exclusive end indices.For consistency and clarity, please use the same notation here:
📐 Suggested notation fix
- key = secret[0..16] || hash[16..32] // 16 bytes each - nonce = hash[0..4] || secret[20..32] // 4 + 12 bytes + key = secret[0:16] || hash[16:32] // 16 bytes each (exclusive end) + nonce = hash[0:4] || secret[20:32] // 4 + 12 bytes (exclusive end)🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@foundations/network/adnl.mdx` around lines 67 - 68, The slice ranges used for computing key and nonce (key = secret[0..16] || hash[16..32], nonce = hash[0..4] || secret[20..32]) use ambiguous `[0..16]`/`[16..32]` notation; update these to Python-style exclusive-end slices (e.g., `secret[0:16]`, `hash[16:32]`, `hash[0:4]`, `secret[20:32]`) so readers clearly understand the byte ranges for key, nonce, secret, and hash and match the TCP page convention.
🤖 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`:
- Around line 182-186: The TL schema ID for pub.ed25519 (ID c6b41348) was shown
in big-endian order; update the key ID calculation so the 4-byte TL prefix is
serialized little-endian: change the input to the SHA-256 call from
[0xC6,0xB4,0x13,0x48] || public_key to [0x48,0x13,0xB4,0xC6] || public_key so
the schema ID bytes follow TL little-endian ordering when computing the key ID
referenced by pub.ed25519 / PublicKey.
---
Duplicate comments:
In `@foundations/network/adnl.mdx`:
- Around line 1-133: Add a new section titled "## Overlays and ADNL forks"
(insert after the "Neighbor tables" paragraph or before "See also") that defines
public vs private overlays, explains triggers and mechanics of ADNL forks, and
describes effects on peer discovery and neighbor table maintenance (stale
entries, divergence, rejoin/merge procedures); include guidance on when overlays
are used (e.g., isolation, testnets, private clusters), how forks are
detected/reconciled, and link or reference the original/migrated specification
and related ADNL docs for further reading. Ensure the new section uses the same
tone and formatting as other sections and references ADNL concepts already in
the document (e.g., neighbor table, address, handshake, datagram) so readers can
correlate impacts.
- Around line 67-68: The slice ranges used for computing key and nonce (key =
secret[0..16] || hash[16..32], nonce = hash[0..4] || secret[20..32]) use
ambiguous `[0..16]`/`[16..32]` notation; update these to Python-style
exclusive-end slices (e.g., `secret[0:16]`, `hash[16:32]`, `hash[0:4]`,
`secret[20:32]`) so readers clearly understand the byte ranges for key, nonce,
secret, and hash and match the TCP page convention.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
i️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 49dd2f4a-9e51-4849-b5ca-664eaa85f8c0
📒 Files selected for processing (3)
foundations/network/adnl-tcp.mdxfoundations/network/adnl-udp.mdxfoundations/network/adnl.mdx
84c5d36 to
63f45bc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
♻️ Duplicate comments (2)
foundations/network/adnl.mdx (2)
67-69:⚠️ Potential issue | 🟡 MinorClarify whether byte ranges are half-open.
0..16/16..32is ambiguous in docs prose. Please make endpoint semantics explicit (or use half-open notation directly) and include resulting lengths inline.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@foundations/network/adnl.mdx` around lines 67 - 69, Clarify the byte-range semantics for the key and nonce construction by stating explicitly that ranges are half-open (start inclusive, end exclusive) or by switching to explicit half‐open notation; update the lines using key, nonce, secret and hash to show e.g. secret[0:16] and hash[16:32] and annotate each slice with its resulting length (16 bytes, 12 bytes, etc.) so readers know the exact byte counts used for key (16 bytes) and nonce (4+12 = 16 bytes).
122-127:⚠️ Potential issue | 🟠 MajorAdd a dedicated section for overlays and ADNL forks (objective gap).
The page still does not define public/private overlays or explain ADNL fork behavior, which is part of issue
#1035scope.Suggested section outline
+## Overlays and ADNL forks + +Public overlays are discoverable/shared network scopes; private overlays restrict membership and discovery. + +An ADNL fork occurs when neighbor/discovery views diverge, producing temporary partitioned routing neighborhoods until peer exchange converges. + +Document expected effects on peer discovery / neighbor tables and link to detailed follow-up pages.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@foundations/network/adnl.mdx` around lines 122 - 127, Add a new dedicated subsection in foundations/network/adnl.mdx (near the "P2P protocol (ADNL over UDP)" section) that defines public and private overlays, describes how overlays map to namespaces/addresses and how peers discover overlay-specific public keys, and explains ADNL fork behavior (how forks create divergent overlays, how channel keys and encryption are scoped per-overlay, how discovery and message routing respond to forks, and recommendations for conflict resolution/resynchronization). Reference the existing discussion of channel creation and key derivation in the UDP section (e.g., the create channel flow and "keys are derived from the client's private key and the peer's public key") and tie it to overlay-specific key selection and fork scenarios; mention issue `#1035` so reviewers can track scope. Ensure the new text uses clear definitions for "public overlay" and "private overlay" and includes expected operational behavior during forks (discovery, channel acceptance, and key mismatches).
🤖 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.mdx`:
- Line 10: The RLDP and DHT links in the ADNL page point to old-docs. Replace
the two old-docs URLs with the corresponding foundations routes for RLDP and DHT
(update the link targets for "RLDP" and "DHT" in the ADNL content), using the
current foundations paths or relative foundations routes so they follow the new
docs IA; verify the final paths resolve correctly and update the links if the
foundations routes differ from the suggested ones.
---
Duplicate comments:
In `@foundations/network/adnl.mdx`:
- Around line 67-69: Clarify the byte-range semantics for the key and nonce
construction by stating explicitly that ranges are half-open (start inclusive,
end exclusive) or by switching to explicit half‐open notation; update the lines
using key, nonce, secret and hash to show e.g. secret[0:16] and hash[16:32] and
annotate each slice with its resulting length (16 bytes, 12 bytes, etc.) so
readers know the exact byte counts used for key (16 bytes) and nonce (4+12 = 16
bytes).
- Around line 122-127: Add a new dedicated subsection in
foundations/network/adnl.mdx (near the "P2P protocol (ADNL over UDP)" section)
that defines public and private overlays, describes how overlays map to
namespaces/addresses and how peers discover overlay-specific public keys, and
explains ADNL fork behavior (how forks create divergent overlays, how channel
keys and encryption are scoped per-overlay, how discovery and message routing
respond to forks, and recommendations for conflict
resolution/resynchronization). Reference the existing discussion of channel
creation and key derivation in the UDP section (e.g., the create channel flow
and "keys are derived from the client's private key and the peer's public key")
and tie it to overlay-specific key selection and fork scenarios; mention issue
`#1035` so reviewers can track scope. Ensure the new text uses clear definitions
for "public overlay" and "private overlay" and includes expected operational
behavior during forks (discovery, channel acceptance, and key mismatches).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
i️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 9a26a75c-333d-4cec-9942-805635e0d910
📒 Files selected for processing (3)
foundations/network/adnl-tcp.mdxfoundations/network/adnl-udp.mdxfoundations/network/adnl.mdx
✅ Files skipped from review due to trivial changes (1)
- foundations/network/adnl-udp.mdx
aigerimu
commented
Apr 21, 2026
/review
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the updates to the ADNL networking docs; I’ve left a couple of focused suggestions in foundations/network/adnl.mdx and foundations/network/adnl-tcp.mdx—please apply the inline suggestions to keep everything self-contained and consistent with the current docs structure.
Uh oh!
There was an error while loading. Please reload this page.
resolves #1035
Summary by CodeRabbit