Skip to content

Conversation

@grunch
Copy link
Member

@grunch grunch commented Jan 16, 2026

…info, and disputes

  • Rename NOSTR_REPLACEABLE_EVENT_KIND to NOSTR_ORDER_EVENT_KIND (38383)
  • Add NOSTR_RATING_EVENT_KIND (38384) for user ratings
  • Add NOSTR_INFO_EVENT_KIND (38385) for info events
  • Add NOSTR_DISPUTE_EVENT_KIND (38386) for dispute events
  • Update comment to properly reference NIP-1 addressable events

This change requires updating all code that previously used NOSTR_REPLACEABLE_EVENT_KIND to use the new specific constants.

Summary by CodeRabbit

  • Refactor
    • Event kind constants have been updated. A single generic event kind constant has been replaced with four specific constants for orders, ratings, information, and disputes.

✏️ Tip: You can customize this high-level summary in your review settings.

…info, and disputes

- Rename NOSTR_REPLACEABLE_EVENT_KIND to NOSTR_ORDER_EVENT_KIND (38383)
- Add NOSTR_RATING_EVENT_KIND (38384) for user ratings
- Add NOSTR_INFO_EVENT_KIND (38385) for info events
- Add NOSTR_DISPUTE_EVENT_KIND (38386) for dispute events
- Update comment to properly reference NIP-1 addressable events

This change requires updating all code that previously used
NOSTR_REPLACEABLE_EVENT_KIND to use the new specific constants.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 16, 2026

Walkthrough

The PR replaces a single NOSTR_REPLACEABLE_EVENT_KIND constant with four specific event-kind constants for orders, ratings, info, and disputes. The accompanying comment is updated to reference NIP-1 addressable event kind specifications instead of parameterized replaceable events.

Changes

Cohort / File(s) Change Summary
Event Kind Constants
src/prelude.rs
Replaced single NOSTR_REPLACEABLE_EVENT_KIND (38383) with four distinct addressable event-kind constants: NOSTR_ORDER_EVENT_KIND (38383), NOSTR_RATING_EVENT_KIND (38384), NOSTR_INFO_EVENT_KIND (38385), and NOSTR_DISPUTE_EVENT_KIND (38386). Comment updated to reflect NIP-1 addressable event kind requirements.

Estimated Code Review Effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly Related Issues

Poem

🐰 One constant split to four so clear,
Order, rating, info, dispute appear!
Specificity blooms where vagueness once sat,
NIP-1 compliance—and that's that! 🎯

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically identifies the main change: replacing a generic event kind constant with four distinct event-kind constants for orders, ratings, info, and disputes, and appropriately marks it as a breaking change.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings


📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4d3d07c and 8fdf18d.

📒 Files selected for processing (1)
  • src/prelude.rs
🧰 Additional context used
📓 Path-based instructions (2)
src/prelude.rs

📄 CodeRabbit inference engine (AGENTS.md)

Re-export consumer-facing items through src/prelude.rs

Files:

  • src/prelude.rs
**/*.rs

📄 CodeRabbit inference engine (AGENTS.md)

**/*.rs: Use snake_case for functions and modules
Use PascalCase for types and enums
Use SCREAMING_SNAKE_CASE for constants
Document public APIs with /// comments
Keep error enums exhaustive
Avoid leaking internals; prefer exposing a curated surface via the prelude
Place unit tests inline beside modules using #[cfg(test)] mod tests
Name tests descriptively (e.g., test_signature_roundtrip)
Cover failure paths for invalid currencies, dispute resolution, and crypto edge cases
Reuse existing builders/helpers instead of duplicating fixtures
Run cargo fmt and address clippy warnings (clippy -D warnings) before pushing

Files:

  • src/prelude.rs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: test
  • GitHub Check: test
🔇 Additional comments (2)
src/prelude.rs (2)

24-28: Add Rust doc comments for the new public constants.

Public items should use /// doc comments (and ideally each constant should have a brief description).
As per coding guidelines.

[ suggest_recommended_refactor ]

♻️ Suggested update
-// Addressable event kind must be between 30000 and 39999 (NIP-1)
-pub const NOSTR_ORDER_EVENT_KIND: u16 = 38383;
-pub const NOSTR_RATING_EVENT_KIND: u16 = 38384;
-pub const NOSTR_INFO_EVENT_KIND: u16 = 38385;
-pub const NOSTR_DISPUTE_EVENT_KIND: u16 = 38386;
+/// Addressable event kinds must be between 30000 and 39999 (NIP-1).
+pub const NOSTR_ORDER_EVENT_KIND: u16 = 38383;
+/// Event kind for rating events.
+pub const NOSTR_RATING_EVENT_KIND: u16 = 38384;
+/// Event kind for info events.
+pub const NOSTR_INFO_EVENT_KIND: u16 = 38385;
+/// Event kind for dispute events.
+pub const NOSTR_DISPUTE_EVENT_KIND: u16 = 38386;

25-28: The old NOSTR_REPLACEABLE_EVENT_KIND constant has been successfully removed with no remaining references in the codebase.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@grunch grunch merged commit f450be4 into main Jan 16, 2026
11 checks passed
@grunch grunch deleted the add-new-kind-constants branch January 16, 2026 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants