Skip to content

v4: publish the NIP-43 kind 13534 membership list #1366

Done

Description

@chappie-daemon

Target: v4 (before the #869 cutover). Filed from the v3 delta audit: main kept moving after the 2026-11-02 sync into rewrite/main, and this feature landed there on 2026-11-22.

v3 shipped (main, PR #1199, commit e58ddc02): a kind 13534 replaceable event, signed by the relay's own key, published and refreshed on a timer. Files: src/utils/nip43-membership.ts, src/constants/base.ts:64 (NIP43_MEMBERSHIP_LIST = 13534), the setting at src/@types/settings.ts:539, and its default comment at resources/default-settings.yaml:116.

v4 today: crates/nostream-core/src/nip43.rs implements the join request and the relay-signed answer only — Kind(28_934) and Kind(28_935) — and git grep 13534 over crates/ at rewrite/main returns nothing. So a v3 relay publishes a membership list and a v4 relay does not, which clients that read it will notice at cutover.

Scope: the kind 13534 builder, its NIP-70 - tagging as v3 writes it, the refresh timer and the setting that gates it, plus the parity test.

Acceptance: with the setting on, the relay publishes exactly one kind 13534 event re-signed on refresh; with it off, none; the event's d tags and tags match v3's for the same member set; a restart republishes rather than duplicating.

Activity

  1. added
    rewrite
    on Dec 3, 2026
  2. added
    rust
    factory
    on Dec 5, 2026
  3. chappie-daemon commented on Dec 5, 2026

    @chappie-daemon
    CollaboratorAuthor

    Factory day 2026-12-05, row 2 (plan: cameri/phoenix-server#122). Job 053-nip43-membership-list, base 4c4f6a6d, stage recon, running alongside #1367.

  4. chappie-daemon commented on Dec 5, 2026

    @chappie-daemon
    CollaboratorAuthor

    Correction, measured at origin/main (v3) before the spec was written: v3 has no timer and no boot publish. The issue text says "published and refreshed on a timer" and the acceptance asks that "a restart republishes rather than duplicating"; the code does neither.

    src/utils/nip43-membership.ts read whole:

    • MembershipListPublisher.refresh() is a per-process promise queue (queue.then(() => this.publish())) and is called from exactly three places — join-request-event-strategy.ts:9, leave-request-event-strategy.ts:10, vanish-event-strategy.ts:8. There is no setInterval, no setTimeout, and no boot call in the file or in its callers.
    • publish() returns early unless settings.nip43?.enabled === true && settings.nip43.publishMembershipList === true; refuses when info.self is not a valid pubkey or does not match the derived relay key; caps the member list at MAX_MEMBERSHIP_LIST_ENTRIES = 10_000 (querying LIMIT 10001 to detect the cut); sets created_at = max(now, stored.created_at + 1) from findStoredReplaceable; then upsert(event) and, only when upsert returns a count, webSocket.onBroadcast(event).

    Amended acceptance (the v3 behaviour, which the port will match):

    1. With nip43.publishMembershipList on, a join publishes exactly one kind 13534 and a second membership change replaces it — one stored row, created_at incremented by one.
    2. With the setting off (or nip43.enabled off), no kind 13534 is published and the proxy-free path is unchanged.
    3. The event matches v3 byte-for-byte in structure for the same member set: kind 13534, content: '', tags exactly [["-"]] then one ["member", <pubkey>] per admitted, non-vanished pubkey in ascending order, capped at 10,000, signed by the key derived from SECRET; refused when info.self disagrees or is unparsable.
    4. Nothing is published at boot, matching v3 — the stored list survives a restart and the next membership change replaces it rather than adding a second row.

    Scope is unchanged otherwise: builder, NIP-70 - tag, gating setting, parity test. If a timer is wanted as a v4 improvement, that is a new issue with its own interval decision, not this port.

  5. chappie-daemon commented on Dec 5, 2026

    @chappie-daemon
    CollaboratorAuthor

    Build done (5c31bde9, c63dd4be, a8df2af9; oracle cargo test -p nostream-relay --test nip43_membership → 15 passed). Review scoping now. Two evidence gaps named rather than glossed: the per-criterion inversions and a final all-targets check were not run (run budget), so the code lens executes the inversions.

  6. chappie-daemon commented on Dec 5, 2026

    @chappie-daemon
    CollaboratorAuthor

    Round 1 complete: code CHANGES, architecture CHANGES, security PASS, performance PASS.

    • Code: AC5's criterion named a test that did not exist (0 passed) and AC7 omitted two observations it names. Both fixed in b9ba0923, which also moved the crate-map row to "Added after the capture", corrected two moved rows to split, and made nip-porting.md's counts true at the commit it names.
    • Security: gate is the publisher's first statement and default-off; info.self is line-for-line v3's; no unauthenticated trigger. The kind-62 republish amplification (v3 parity, default-off) is filed as nip43: a kind-62 from an admitted key republishes a ~780 KB membership list with no state-change guard #1401 with the measured cost.
    • Performance: frame 780,371 bytes; scan 104–137 ms at 10,001 rows; one publish 225–250 ms and 802,816 bytes written; the lock blocks only other publishes.

    Round 2 is confirming the two CHANGES lenses at b9ba0923.

  7. chappie-daemon commented on Dec 5, 2026

    @chappie-daemon
    CollaboratorAuthor

    Review complete: code PASS, architecture PASS, security PASS, performance PASS (three rounds; both CHANGES lenses closed at 3fb6b4c8). Approver stage now.

  8. chappie-daemon commented on Dec 5, 2026

    @chappie-daemon
    CollaboratorAuthor

    Approver: ESCALATE, on the gate only — everything else green.

    • Gate irreversibility-gate exit 3: schema-or-dependency Cargo.lock dependency-lockfile: dependency-lockfile matched. The diff is one dev-dependency line (tempfile.workspace = true under crates/nostream-relay/Cargo.toml's [dev-dependencies]) and the lock's dependency-list entry; tempfile is already a workspace dependency (Cargo.toml:55), already locked, and already a dev-dependency of seven other crates — no new package, no version change.
    • Merge-tree clean against rewrite/main (tree f37ccb4c295b917837a11421d99700af2e2c748e, equal to HEAD^{tree}).
    • Oracle cargo test -p nostream-relay --test nip43_membership → 15 passed; strategies 3; core 3; all 15 criteria re-run by the approver green.

    Operator decision on the lockfile change is pending; the job stays at approve until it lands.

  9. chappie-daemon commented on Dec 5, 2026

    @chappie-daemon
    CollaboratorAuthor

    Merged as e13d99b55ab1609edd911da9a799febc1eb5c7b1 (PR #1403, merge commit; five branch commits, head 513115f7 after an outside merge from rewrite/main).

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

Metadata

Metadata

Labels

factoryrewriterust

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions