Skip to content

feat: [DSM-148] XNetAdvertHandler for XNetPayloadBuilderImpl - #11602

Merged
alin-at-dfinity merged 5 commits into
masterfrom
alin/DSM-148-advert-handler
Sep 22, 2026
Merged

alin-at-dfinity merged 5 commits into
masterfrom
alin/DSM-148-advert-handler

Conversation

@alin-at-dfinity

Copy link
Copy Markdown
Contributor

Handles an advert — a certified, header-only stream slice pushed by a source subnet — by classifying it against our certified state first (NothingNew, answered with our own certified header) and then against the pool. Only the two outcomes that act on the advert, NothingNew and Actionable, require a threshold-signature verification; the rest are dropped on the unverified claim alone, which can only understate what the peer holds.

Every verified header is recorded in peer_headers: our only record of how far the peer has garbage collected its messages, hence of whether we still owe it an advert.

Nothing calls this yet; the endpoint follows.

@alin-at-dfinity
alin-at-dfinity requested a review from a team as a code owner September 17, 2026 08:51
@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 c25885c.

Security Overview
Detected Code Changes
Change Type Relevant files
Enhancement ► rs/interfaces/src/messaging.rs
    Add XNetAdvertHandler and XNetAdvertError interfaces
► rs/xnet/payload_builder/src/lib.rs
    Expose decode_slice_header and extend XNetSlicePool trait with classify_advert and record_peer_header
► rs/xnet/payload_builder/src/certified_slice_pool.rs
    Add metrics for incomparable peer headers; refactor PeerHeader handling; adjust signatures to pass ReplicaLogger by reference
► rs/xnet/payload_builder/src/tests.rs
    Update tests to accommodate new classify_advert and XNetAdvertHandler paths
► rs/xnet/payload_builder/src/test_fixtures.rs
    Add make_advert helper for header-only CertifiedStreamSlice
► rs/xnet/payload_builder/tests/certified_slice_pool.rs
    Update tests to reflect new constructor signatures and logging changes
► rs/state_machine_tests/src/lib.rs
    Adjust logging usage in XNet path tests
► rs/xnet/payload_builder/src/test_fixtures.rs
    Add advert-related test utilities and state setup

@alin-at-dfinity
alin-at-dfinity added this pull request to stack #11604 September 17, 2026 09:16
@alin-at-dfinity
alin-at-dfinity removed this pull request from stack #11604 September 17, 2026 10:21
@alin-at-dfinity
alin-at-dfinity added this pull request to stack #11607 September 17, 2026 10:47
@alin-at-dfinity
alin-at-dfinity force-pushed the alin/DSM-148-advert-handler branch from 21f7bf3 to 828ebb1 Compare September 17, 2026 11:48
Base automatically changed from alin/DSM-148-classify-advert to master September 17, 2026 14:58
@alin-at-dfinity
alin-at-dfinity force-pushed the alin/DSM-148-advert-handler branch from 828ebb1 to d194f26 Compare September 17, 2026 14:58
Comment thread rs/interfaces/src/messaging.rs Outdated
Comment thread rs/xnet/payload_builder/src/lib.rs Outdated
Comment thread rs/xnet/payload_builder/src/test_fixtures.rs Outdated
Comment thread rs/xnet/payload_builder/src/test_fixtures.rs Outdated
Comment thread rs/xnet/payload_builder/src/tests.rs
Comment thread rs/xnet/payload_builder/src/tests.rs
Comment thread rs/xnet/payload_builder/src/tests.rs
Comment thread rs/xnet/payload_builder/src/tests.rs
Comment thread rs/xnet/payload_builder/src/tests.rs
Comment thread rs/xnet/payload_builder/src/tests.rs Outdated
Comment thread rs/xnet/payload_builder/src/lib.rs Outdated
Comment thread rs/xnet/payload_builder/src/lib.rs
Comment thread rs/xnet/payload_builder/src/lib.rs Outdated
Comment thread rs/interfaces/src/messaging.rs Outdated
Comment thread rs/xnet/payload_builder/src/certified_slice_pool.rs Outdated
Comment thread rs/xnet/payload_builder/tests/certified_slice_pool.rs Outdated

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This pull request changes code owned by the Governance team. Therefore, make sure that
you have considered the following (for Governance-owned code):

  1. Update unreleased_changelog.md (if there are behavior changes, even if they are
    non-breaking).

  2. Are there BREAKING changes?

  3. Is a data migration needed?

  4. Security review?

How to Satisfy This Automatic Review

  1. Go to the bottom of the pull request page.

  2. Look for where it says this bot is requesting changes.

  3. Click the three dots to the right.

  4. Select "Dismiss review".

  5. In the text entry box, respond to each of the numbered items in the previous
    section, declare one of the following:

  • Done.

  • $REASON_WHY_NO_NEED. E.g. for unreleased_changelog.md, "No
    canister behavior changes.", or for item 2, "Existing APIs
    behave as before.".

Brief Guide to "Externally Visible" Changes

"Externally visible behavior change" is very often due to some NEW canister API.

Changes to EXISTING APIs are more likely to be "breaking".

If these changes are breaking, make sure that clients know how to migrate, how to
maintain their continuity of operations.

If your changes are behind a feature flag, then, do NOT add entrie(s) to
unreleased_changelog.md in this PR! But rather, add entrie(s) later, in the PR
that enables these changes in production.

Reference(s)

For a more comprehensive checklist, see here.

GOVERNANCE_CHECKLIST_REMINDER_DEDUP

@zeropath-ai

zeropath-ai Bot commented Sep 22, 2026

Copy link
Copy Markdown

No security or compliance issues detected. Reviewed everything up to 098441b.

Security Overview
Detected Code Changes

The diff is too large to display a summary of code changes.

@zeropath-ai

zeropath-ai Bot commented Sep 22, 2026

Copy link
Copy Markdown

No security or compliance issues detected. Reviewed everything up to 098441b.

Security Overview
Detected Code Changes

The diff is too large to display a summary of code changes.

@zeropath-ai

zeropath-ai Bot commented Sep 22, 2026

Copy link
Copy Markdown

No security or compliance issues detected. Reviewed everything up to 098441b.

Security Overview
Detected Code Changes

The diff is too large to display a summary of code changes.

alin-at-dfinity and others added 5 commits September 22, 2026 12:41
Handles an advert — a certified, header-only stream slice pushed by a source
subnet — by classifying it against our certified state first (`NothingNew`,
answered with our own certified header) and then against the pool (§6). Only
the two outcomes that act on the advert being genuine, `NothingNew` and
`Actionable`, pay for a threshold-signature verification; the rest are dropped
on the unverified claim alone, which can only understate what the peer holds.

Every verified header is recorded in `peer_headers`: our only record of how far
the peer has garbage collected its messages, hence of whether we still owe it
an advert.

Nothing calls this yet; the endpoint follows.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…ignature and DecodeError; improve unit tests.
…t and would need to be explicitly validated. Simply compare the headers' indices.
…; simplify record_peer_header() doc comment; improve make_advert() fixture documentation; drop mostly irrelevant unit test for classifying incomparable adverts.
@alin-at-dfinity
alin-at-dfinity force-pushed the alin/DSM-148-advert-handler branch from ded2539 to c25885c Compare September 22, 2026 12:54
@alin-at-dfinity
alin-at-dfinity removed request for a team September 22, 2026 12:54
@alin-at-dfinity

Copy link
Copy Markdown
Contributor Author

Sorry about the mess, bad rebase/merge/whatever.

@alin-at-dfinity
alin-at-dfinity dismissed github-actions[bot]’s stale review September 22, 2026 12:58

Bad rebase/merge. The PR does not touch any Governance code.

@alin-at-dfinity
alin-at-dfinity added this pull request to the merge queue Sep 22, 2026
Merged via the queue into master with commit a9f7914 Sep 22, 2026
37 of 38 checks passed
@alin-at-dfinity
alin-at-dfinity deleted the alin/DSM-148-advert-handler branch September 22, 2026 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants