Skip to content

nostr: tags rework#1347

Merged
yukibtc merged 40 commits into
nostrdevkit:masterfrom
yukibtc:tags-rework
May 12, 2026
Merged

nostr: tags rework#1347
yukibtc merged 40 commits into
nostrdevkit:masterfrom
yukibtc:tags-rework

Conversation

@yukibtc

@yukibtc yukibtc commented May 5, 2026

Copy link
Copy Markdown
Member

Description

Remove TagStandard and TagKind in favor of per-NIP tag enums.

Closes #907
Closes #1204
Closes #1216
Closes #1320
Replaces #1321

Checklist

@yukibtc yukibtc added this to the v0.45 milestone May 5, 2026
@yukibtc yukibtc requested a review from TheAwiteb as a code owner May 5, 2026 10:17
@codecov

codecov Bot commented May 5, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.39047% with 1229 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.89%. Comparing base (2f6fe48) to head (6eb0321).
⚠️ Report is 40 commits behind head on master.

Files with missing lines Patch % Lines
crates/nostr/src/nips/nip53.rs 46.46% 250 Missing ⚠️
crates/nostr/src/nips/nip34.rs 55.49% 162 Missing ⚠️
crates/nostr/src/nips/nip94.rs 67.63% 133 Missing ⚠️
crates/nostr/src/nips/nip22.rs 65.86% 113 Missing ⚠️
crates/nostr/src/event/builder.rs 61.05% 81 Missing ⚠️
crates/nostr/src/nips/nip90.rs 77.11% 46 Missing ⚠️
crates/nostr/src/nips/nip25.rs 38.18% 34 Missing ⚠️
crates/nostr/src/nips/nip18.rs 81.25% 33 Missing ⚠️
crates/nostr/src/nips/nip51.rs 72.81% 28 Missing ⚠️
crates/nostr/src/nips/nip23.rs 77.22% 23 Missing ⚠️
... and 38 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1347      +/-   ##
==========================================
+ Coverage   70.71%   70.89%   +0.18%     
==========================================
  Files         190      201      +11     
  Lines       31850    33366    +1516     
==========================================
+ Hits        22522    23656    +1134     
- Misses       9328     9710     +382     
Flag Coverage Δ
rust 70.89% <75.39%> (+0.18%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@TheAwiteb TheAwiteb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Comment thread crates/nostr/src/nips/nip01/tags.rs Outdated
Comment thread crates/nostr/src/nips/nip01/tags.rs Outdated
Comment thread crates/nostr/src/nips/nip01/tags.rs Outdated
Comment thread crates/nostr/src/nips/nip01/tags.rs Outdated
Comment thread crates/nostr/src/nips/nip01/tags.rs
Comment thread crates/nostr/src/nips/util.rs
Comment thread crates/nostr/src/nips/nip02.rs
Comment thread crates/nostr/src/nips/nip02.rs
Comment thread crates/nostr/src/nips/nip02.rs Outdated
@yukibtc yukibtc force-pushed the tags-rework branch 3 times, most recently from 46c6413 to ac6699c Compare May 7, 2026 10:38
Comment thread crates/nostr/src/nips/nip17.rs
Comment thread crates/nostr/src/nips/nip17.rs Outdated
Comment thread crates/nostr/src/event/tag/list.rs Outdated
Comment thread crates/nostr/src/nips/nip40.rs
Comment thread crates/nostr/src/nips/nip40.rs Outdated
@TheAwiteb

Copy link
Copy Markdown
Member

I'll not point to those syntax change more :)

Comment thread crates/nostr/src/nips/nip65.rs

@TheAwiteb TheAwiteb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Most of nip22 code is a copy from nip01, I'm not sure why you did it like this

Comment thread crates/nostr/src/nips/nip22.rs
- Remove `Tag::from_standardized_without_cell`
- Remove `Tag::to_standardized` and `Tag::as_standardized` and add `Tag::standardized`
- Update all the related code

Ref nostrdevkit#907

Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
Comment thread crates/nostr/src/nips/nip34.rs Outdated
Comment thread crates/nostr/src/event/tag/mod.rs Outdated

@TheAwiteb TheAwiteb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

utACK, all looks good.

@yukibtc

yukibtc commented May 12, 2026

Copy link
Copy Markdown
Member Author

@TheAwiteb, I've marked your comments as resolved but I not pushed yet the updates. I'm doing one last refactor, I'll push soon the last changes

yukibtc added 11 commits May 12, 2026 12:54
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
Closes nostrdevkit#1204
Closes nostrdevkit#1216

Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
yukibtc added 15 commits May 12, 2026 15:02
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
Closes nostrdevkit#907

Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
@yukibtc yukibtc requested a review from TheAwiteb May 12, 2026 13:46

@TheAwiteb TheAwiteb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Cool, but I don't like this if statement everywhere in nip22

if *uppercase {
    tag[0] = String::from("A");
}

What do you think about something like this?

#[inline]
fn maybe_uppercase(mut tag: Tag, uppercase: bool) -> Tag {
    if uppercase {
        tag[0] = tag[0].to_ascii_uppercase();
    }
    tag
}

So you can use it like this

maybe_uppercase(nip01::serialize_a_tag(coordinate, relay_hint.as_ref()), uppercase)

It's fast btw, here is its code from the std

pub const fn is_ascii_lowercase(&self) -> bool {
    matches!(*self, b'a'..=b'z')
}

pub const fn to_ascii_uppercase(&self) -> u8 {
    // Toggle the 6th bit if this is a lowercase letter
    *self ^ ((self.is_ascii_lowercase() as u8) * ASCII_CASE_MASK)
}

@yukibtc

yukibtc commented May 12, 2026

Copy link
Copy Markdown
Member Author

Thanks, updated at 6eb0321

Co-authored-by: Awiteb <a@4rs.nl>
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
@yukibtc yukibtc merged commit 6eb0321 into nostrdevkit:master May 12, 2026
38 of 40 checks passed
@yukibtc yukibtc deleted the tags-rework branch May 12, 2026 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants