feat: NIP-23 long-form articles (kind:30023)#249
Open
tlongwell-block wants to merge 1 commit intotyler/pr2-nip33-parameterized-replaceablefrom
Open
feat: NIP-23 long-form articles (kind:30023)#249tlongwell-block wants to merge 1 commit intotyler/pr2-nip33-parameterized-replaceablefrom
tlongwell-block wants to merge 1 commit intotyler/pr2-nip33-parameterized-replaceablefrom
Conversation
Accept kind:30023 in the per-kind scope allowlist (MessagesWrite), add NIP-23 to the NIP-11 supported_nips, and extract is_global_only_kind() to ensure stray h-tags are ignored for global-only kinds. kind:30023 events are parameterized replaceable (NIP-33, 30000-39999 range) — replacement keyed by (pubkey, kind, d_tag) is handled by PR 2's existing replace_parameterized_event() path. Events are stored globally (channel_id = NULL), not channel-scoped. Changes: - kind.rs: KIND_LONG_FORM constant (30023) + ALL_KINDS registration - ingest.rs: scope allowlist + is_global_only_kind() helper + 7 unit tests - nip11.rs: SUPPORTED_NIPS constant with NIP-23 + 2 unit tests - e2e_long_form.rs: 5 E2E tests (acceptance, retrieval, stray h-tag, NIP-33 replacement, stale-write protection) Known limitation (documented): stray h-tags on global-only kinds remain on stored events (Nostr signature integrity) and are matchable via #h queries on the read path. This is pre-existing (affects kind:0, 1, 3) and tracked as a follow-up filter-layer fix.
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.
Summary
Accept kind:30023 (NIP-23 long-form content) in the relay's per-kind scope allowlist, advertise NIP-23 in NIP-11, and ensure global-only storage semantics.
Builds on PR 2 (NIP-33 parameterized replaceable events) — kind:30023 is in the 30000–39999 range, so replacement keyed by
(pubkey, kind, d_tag)is handled automatically by the existingreplace_parameterized_event()path.Changes (4 files, ~430 insertions)
Production code (~15 LOC)
KIND_LONG_FORM: u32 = 30023constant +ALL_KINDSregistrationKIND_LONG_FORM => Ok(Scope::MessagesWrite)in scope allowlist + extractedis_global_only_kind()helper to ensurechannel_id = Nonefor global-only kinds (strips stray h-tags at write time)23toSUPPORTED_NIPS(extracted as module-level constant)Tests (~400 LOC)
Design
MessagesWrite— same as kind:1 (text notes). Articles are user-authored content.channel_id = NULL). Author-owned, not channel-scoped.replace_parameterized_event(). Keyed by(pubkey, kind:30023, d_tag).is_global_only_kind(): Extracted from inlinematches!()in step 5b of the ingest pipeline. Makes the global-only invariant testable and documents the behavior.Known Limitation
Stray
htags on global-only kinds remain on stored events (Nostr events are signed — tags can't be stripped without invalidating the signature). The read-path filter matching infilter.rstreats explicithtags as authoritative, so a strayhtag can still match#hqueries. This is pre-existing (kind:0, 1, 3 have the same behavior) and documented in code. Fix belongs in the filter layer as a follow-up.Verification
Dependencies