Repository navigation
perf(browser): ask lookup nodes for a close group in a read's lookups - #243
Draft
mickvandijke wants to merge 3 commits into
Draft
mickvandijke wants to merge 3 commits into
mickvandijke wants to merge 3 commits into
Conversation
A browser read's lookups asked each node for a 20-node witnessed view, which only quotes and uploads cross-check. Each listed node carries its owner-signed record, an ML-DSA-65 key and signature of about 6 KB, and a node's first answer on a connection grows from webrtc-sctp's 4,380-byte initial send window, so a 20-node answer (about 121 KB) took 5-6 round trips on mainnet. A read needs each node's view of its record's close group: its lookups now ask for count.max(CLOSE_GROUP_SIZE) nodes. Lookups for quotes, uploads, PUT targets, Merkle payments and pointers still ask for the full view. The mock node records the count each FIND_NODE asks for. New binding tests: a read's lookups ask for a close group, and an upload's lookups still ask for the full witnessed view. The test that unproven listings do not rule out a holder now names the holder through a second bootstrap node, since a reply of a close group of invented identities leaves no room for it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ngelog ADR-0004 gains a dated section with the per-answer, traced-read and try-page measurements, including that Chromium streams did not start sooner. The changelog entry for this change goes under [Unreleased], and #242's entry moves there too: its merge after the changelog's rotation put it under 0.3.8. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A browser read's lookups now ask each node for its record's close group,
count.max(CLOSE_GROUP_SIZE), which is 7 nodes for a default read, instead of a 20-node witnessed view. On mainnet a 7-node answer took 4.1 round trips on a fresh connection, against 5.3 for 20 nodes, and 1.0 on a used connection against 3.1. The holder of a stream's first record is named ~0.25 s sooner in both engines. End to end, WebKit streams start and seek sooner, but Chromium streams did not start sooner in these runs (details below), so this is a draft.Why answers were slow. Every node a FIND_NODE answer lists carries its owner-signed record, an ML-DSA-65 key and signature of about 6 KB, so a 20-node answer is about 115 KB. The node's SCTP send window starts at 4,380 bytes (webrtc-sctp's fixed initial window) and doubles each round trip. A read's lookups only need the record's close group, but they asked for the 20-node view that quotes cross-check.
What changes.
BrowserNetworkLookupQuery::query_batchasks forcount.max(CLOSE_GROUP_SIZE)when the lookup serves a read (it has aReadProgress), andcount.max(SINGLE_NODE_WITNESSED_VIEW_COUNT)otherwise, as before.find_read_peers, the browser's chunk reads (streams, downloads, DataMap fetches), takes the smaller size. These keep 20:find_witnessed_close_group, whose views are cross-checked against nodes' 20-node acceptance window;find_closest_peers.[Unreleased]: its merge after the changelog's rotation (docs(changelog): rotate [Unreleased] and backfill 0.3.7 to 0.3.12 #238) had put it under 0.3.8.Linear issue
Closes V2-1779
Risk tier
T1 proposed: the same FIND_NODE request with a smaller
count, which nodes already accept (they clamp it to 1–20). There is no node, wire-format or payment change. Reviewers should note:Compatibility
count: 7instead of 20.BrowserTestNode::last_find_node_countandtest_witnessed_view_count.Semver impact
Test evidence
On
612a98b, which is on main458c717.cargo fmt --all -- --check,cargo clippy --all-targets --all-features -- -D warnings, andcargo clippy -p ant-core --target wasm32-unknown-unknown --no-default-features --features browser-wasm[,test-utils] -- -D warnings: clean.cargo test --lib --all: 878 passed.Browser bindings: 256 passed. The mock node now records the count each FIND_NODE asks for. New tests:
scripts/adr-governance.py: passed.Mainnet, per answer (2026-10-29, 16:12 UTC). Each sample authenticates one of the 7 mainnet seeds, idles 3 s, then asks for 7 and 20 nodes 3 s apart, in alternating order. Median round trip 167 ms; 14 samples, all succeeded.
Mainnet, traced first read (16:15–16:20 UTC). Test-utils builds of main and the branch, each with the same trace patch, read the first 1 MiB of try.autonomi.com's 54.9 MB video. All 32 samples succeeded.
In Chromium the later reads came from the one holder's transfers. Those took 0.6–4.9 s in both arms, and twice the holder stalled past the 3 s hedge.
Mainnet, streaming on try.autonomi.com's page (16:20–16:45 UTC).
cac5363's page with SDK 0.1.5's client, against the same page with this branch's production WASM (6ae86570…).Not run here: real Safari, Firefox, and the native e2e and devnet suites, which CI runs.
Scripts and raw results:
ant-testnet/state/comparisons/v2-1769-lookup-answer-size-1029/(local).New dependency
none
ADR
n/a for T1. ADR-0004 (Proposed) gains the section "Lookup answers for reads (2026-10-29)".
Mitigation / rollback
Revert the PR. It changes only the count a browser read's lookups ask for.
🤖 Generated with Claude Code