Skip to content

feat: [DSM-148] XNetClient::post_advert() - #11613

Open
alin-at-dfinity wants to merge 1 commit into
alin/DSM-148-advert-endpointfrom
alin/DSM-148-advert-client
Open

alin-at-dfinity wants to merge 1 commit into
alin/DSM-148-advert-endpointfrom
alin/DSM-148-advert-client

Conversation

@alin-at-dfinity

Copy link
Copy Markdown
Contributor

POSTs a header-only certified slice — our stream to the peer — and returns the peer's own certified header if it replied with one, i.e. if the advert brought it nothing new. A 204 is the ordinary outcome and not an error, unlike for query(), where it means there is no stream.

An advert above ADVERT_MAX_BODY_BYTES fails before being sent, as the receiver would refuse it and the fault is ours. Being refused by the peer (429, 403) leaves it healthy, as 4xx already does for query(); only the failures that say the node did not serve us mark it unhealthy.

Nothing sends adverts yet; the task that does, and that feeds a reply back through handle_advert(), follows.

POSTs a header-only certified slice — our stream to the peer — and returns the
peer's own certified header if it replied with one, i.e. if the advert brought
it nothing new. A 204 is the ordinary outcome and not an error, unlike
for `query()`, where it means there is no stream.

An advert above `ADVERT_MAX_BODY_BYTES` is refused before it is sent, as the
receiver would refuse it too and the fault is ours. Being refused by the peer
(429, 403) leaves it healthy, as 4xx already does for `query()`; only the
failures that say the node did not serve us mark it unhealthy.

Nothing sends adverts yet; the task that does, and that feeds a reply back
through `handle_advert()`, follows.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@alin-at-dfinity
alin-at-dfinity added this pull request to stack #11607 September 17, 2026 16:07
@alin-at-dfinity
alin-at-dfinity requested a review from a team as a code owner September 17, 2026 16:07
@github-actions github-actions Bot added the feat label Sep 17, 2026
@zeropath-ai

zeropath-ai Bot commented Sep 17, 2026

Copy link
Copy Markdown

No security or compliance issues detected. Reviewed everything up to 403ca7e.

Security Overview
Detected Code Changes
Change Type Relevant files
Enhancement ► rs/xnet/payload_builder/src/lib.rs
    Add XNetClient::post_advert API and implement its usage
Enhancement ► rs/xnet/payload_builder/src/lib.rs
    Introduce post_advert_impl, update_node_health, and health updates in XNetClientImpl
Enhancement ► rs/xnet/payload_builder/src/lib.rs
    Extend XNetClient trait to include post_advert method and adjust http client type to XNetRequestBody
Enhancement ► rs/xnet/payload_builder/src/lib.rs
    Handle advert lifecycle: size check, request/response flow, and status-based decoding
Enhancement ► rs/xnet/payload_builder/src/lib.rs
    Add AdvertTooLarge error variant and integrate into error handling and health logic
Enhancement ► rs/xnet/payload_builder/src/lib.rs
    Refactor query path to use updated health tracking in XNetClientImpl
Enhancement ► rs/xnet/payload_builder/src/xnet_client_tests.rs
    Add tests for advert path: advert_reply, advert_no_reply, advert_refused, advert_server_error, advert_too_large
Enhancement ► rs/xnet/payload_builder/src/xnet_client_tests.rs
    Add test harness: do_xnet_client_advert, advert_endpoint helper, start_server, and get_stream_slice_for_testing usage
Enhancement ► rs/xnet/payload_builder/tests/xnet_payload_builder.rs
    Provide mock implementation for post_advert to satisfy trait in tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant