Repository navigation
chore(protobuf): add the canister HTTP hashes-in-blocks messages - #11716
Merged
Merged
Conversation
This was referenced Sep 30, 2026
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The schema and generated bindings are consistent, and the existing conversion safely preserves current behavior.
Review effort: Balanced
Findings: None
What changed in this PR
Adds protobuf contracts needed to strip and later retrieve canister HTTP responses from block proposals.
Changes:
- Adds request/response messages for fetching stripped responses.
- Adds response hashes to stripped block proposals.
- Initializes the unused field as empty in current conversions.
| File | Description |
|---|---|
rs/protobuf/def/types/v1/consensus.proto |
Defines the new protobuf messages and field. |
rs/protobuf/src/gen/types/types.v1.rs |
Updates generated Rust protobuf bindings. |
rs/p2p/artifact_downloader/src/fetch_stripped_artifact/types/stripped.rs |
Initializes the new field while stripping remains disabled. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
✅ No security or compliance issues detected. Reviewed everything up to a7394e2. Security Overview
Detected Code Changes
|
pierugo-dfinity
approved these changes
Oct 1, 2026
Adds the protobuf definitions that stripping the canister HTTP responses
from a block proposal needs, without using any of them yet:
* `GetCanisterHttpResponseInBlock{Request,Response}`, the RPC a replica
will use to fetch a response content that was stripped from a block it
is trying to reassemble.
* `StrippedBlockProposal::stripped_canister_http_responses`, the content
hashes of the responses that were stripped from a block proposal.
The one Rust change is the struct literal that the new field forces, which
leaves it empty: nothing strips canister HTTP responses yet.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…essage Addresses the review suggestion to declare the stripped responses as a `repeated StrippedCanisterHttpResponse` rather than a `repeated bytes`, so that all three lists of stripped artifacts on `StrippedBlockProposal` have the same shape, and so that the entry can gain a field later without needing a new field number. The wrapper costs two encoded bytes per entry, 36 instead of 34, which is about a kilobyte on a block carrying the maximum number of responses. That is a fraction of a percent of what stripping those responses saves. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
eichhorl
force-pushed
the
eichhorl/ch-hib-1-protos
branch
from
October 1, 2026 12:00
28f97c8 to
a7394e2
Compare
AleDema
pushed a commit
to AleDema/ic
that referenced
this pull request
Oct 11, 2026
Teaches a replica to hand a peer the content of a canister HTTP response that was stripped from a block proposal — the half of hashes in blocks that has to be in place before anything starts stripping. A new `/block/canister_http_response/rpc` endpoint answers a content hash with the matching `CanisterHttpResponse`, taken from the canister HTTP pool or, once the pool has dropped it, out of the block that delivers it. The new `canister_http` module knows how to walk the response slots of a canister HTTP payload, and documents why **every** response a payload delivers may be stripped from it: in each case the replicas that signed for it are already holding its content. * A fully replicated response is proved by a quorum of `n - f` signatures, one per replica that ran the outcall itself and signed that very content. * A non-replicated or flexible response is produced by a single replica, which therefore gossips it to everyone along with its share. Note that serving a response deliberately looks past the `ResponseVisibility` of its share. Withholding a fully replicated response only keeps us from *pushing* it at peers that can produce it themselves; it says nothing about answering a peer that is missing one and asks for it by hash. Nothing strips canister HTTP responses yet, so no peer asks and the endpoint is unreachable in practice. ### Stack 1. dfinity#11716 — protobuf definitions 2. **dfinity#11717 — serve canister HTTP responses out of a block ← this PR** 3. dfinity#11718 — reassemble blocks whose canister HTTP responses were stripped 4. dfinity#11719 — strip canister HTTP responses from block proposals (turns it on) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
AleDema
pushed a commit
to AleDema/ic
that referenced
this pull request
Oct 18, 2026
…ped (dfinity#11718) Teaches a replica to put the canister HTTP response contents back into a block proposal that was stripped of them — the other half that has to be in place before anything starts stripping. A stripped block proposal now declares the content hashes of the responses that were pruned from its canister HTTP payload, the way it already does for its ingress messages and IDKG dealings. For each of them the assembler looks in the canister HTTP pool, which is indexed by exactly that hash and holds the content until the outcall has been answered, and otherwise fetches it from a peer over the endpoint added in dfinity#11717. Declaring the hashes rather than re-deriving them from the payload matters for cost: a fully replicated response leaves its `n - f` signatures behind in the stripped payload, and scanning those back out of it measured **2.4 ms** per block on a full 2 MiB payload of fully replicated responses with a 40-node quorum — about 26% of block assembly, in a back-to-back A/B with the scan added back (p = 0.00). Recovering the hashes needs a full decode, since prost cannot decode part of a message, and the cost is dominated by the per-field allocations rather than the payload size. A wrong or missing response can only make the block unwanted, never mangle it: the fetched response is checked against the hash that was asked for, and the reassembled block against the hash of the proposal that was claimed. Nothing strips canister HTTP responses yet, so no block declares any and the new code paths stay unreached in practice; the tests exercise them by stripping a proposal by hand. ### Stack 1. dfinity#11716 — protobuf definitions 2. dfinity#11717 — serve canister HTTP responses out of a block 3. **this PR — reassemble blocks whose canister HTTP responses were stripped** 4. next — strip canister HTTP responses from block proposals (turns it on) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
AleDema
pushed a commit
to AleDema/ic
that referenced
this pull request
Oct 18, 2026
…y#11719) **This is the PR that turns hashes in blocks on for canister HTTP responses.** A block proposal now goes out without the contents of the responses it delivers, naming them by the content hash it already carries alongside each of them. Receivers have been able to serve (dfinity#11717) and reassemble (dfinity#11718) those contents since the previous two PRs, so this is where the bandwidth saving starts. An outcall response can be up to 2 MB and the block used to carry it to every peer, on top of the copy the replicas already gossip to each other. A payload with nothing to strip is left untouched byte for byte, so a block without an outcall response never pays for being re-encoded. Declaring a stripped content costs 36 bytes in the stripped proposal, its 32-byte hash plus framing, and only contents of at least 64 bytes are stripped, each of which saves at least 70 bytes for every slot it is taken out of. So **stripping a response never makes the proposal that goes out bigger** than the stripped proposal that every data block already goes out as. Break-even is at about 30 bytes of content, and the threshold deliberately stays close to it: the declared hash and the content it replaces both go to every peer, so the comparison is the same whatever the subnet size, and with up to 500 responses per block each byte of slack is multiplied by five hundred — at a 1 KiB threshold a block could have carried half a megabyte of unstripped content to every peer. It also keeps the replica's own terse rejects in the block, which save little or nothing when stripped. A response is stripped whatever kind of outcall it answers, because in each case the replicas that signed for it are already holding its content — see the module docs of `canister_http.rs`. The assembler benchmark gains the canister HTTP dimension, parameterized by the number of signatures a response carries, since that is what dominates the cost of stripping and reassembling. At the 500-response cap with a 40-node quorum, stripping a block costs **5.4 ms** and reassembling one **9.8 ms**. That case uses 1 KiB responses and the 10-byte node ids of the test utilities; with real, 29-byte node ids, 500 responses with 27 signatures each only fit into the 2 MiB payload limit with bodies of about 800 bytes, but the signatures that dominate the cost stay the same. > Earlier revisions of this description quoted 3.4 ms and 6.4 ms for those cases. Two > benchmark cases exceeded `MAX_CANISTER_HTTP_PAYLOAD_SIZE`, and `iterator_to_bytes` > silently drops what does not fit, so they measured roughly 300 responses under a label > claiming 500. The cases are now sized to fit and `fake_canister_http_payload` panics > rather than let that happen again. ### Worth a reviewer's attention For a fully replicated outcall, a node whose own adapter has not produced the response yet when the block arrives used to get the bytes in the block and now does a round trip for them. It is bounded — at least `n - f` peers hold the content, and it is no worse on bandwidth — but it is a new dependency of block assembly on a peer fetch in the common outcall mode, not just the non-replicated one. A receiver puts the payload back together by encoding what it decodes, which only reproduces the bytes the block hash covers because payload validation accepts nothing but canonically encoded canister HTTP payloads (dfinity#11751). ### Stack 1. dfinity#11716 — protobuf definitions (merged) 2. dfinity#11717 — serve canister HTTP responses out of a block (merged) 3. dfinity#11718 — reassemble blocks whose canister HTTP responses were stripped (merged) 4. **this PR — strip canister HTTP responses from block proposals** 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
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.
Adds the protobuf definitions that stripping the canister HTTP responses from a
block proposal needs, without using any of them yet.
GetCanisterHttpResponseInBlock{Request,Response}— the RPC a replica will useto fetch a response content that was stripped from a block it is reassembling.
StrippedBlockProposal::stripped_canister_http_responses— the content hashesof the responses that were stripped from a block proposal.
The one Rust change is the struct literal that the new field forces, which leaves
it empty: nothing strips canister HTTP responses yet.
Stack
🤖 Generated with Claude Code