Skip to content

docs: add transport v2 (NIP-44 direct) migration spec#620

Merged
AndreaDiazCorreia merged 3 commits into
mainfrom
docs/transport-v2-migration
Jun 18, 2026
Merged

docs: add transport v2 (NIP-44 direct) migration spec#620
AndreaDiazCorreia merged 3 commits into
mainfrom
docs/transport-v2-migration

Conversation

@AndreaDiazCorreia

@AndreaDiazCorreia AndreaDiazCorreia commented Jun 18, 2026

Copy link
Copy Markdown
Member

Adds the client-side implementation spec for supporting both Mostro wire transports during the v1 → v2 migration: protocol v1 (NIP-59 gift wrap, kind 1059) and protocol v2 (NIP-44 direct, signed kind 14), selected per node via the protocol_version tag on the kind-38385 instance-status event.

Documentation only — no lib/ changes. Defines the wire-format differences, the per-node auto-detection design, code touch points, and a phased implementation plan (dual receive, dual send, auto-detection, tests) for subsequent branches.

Summary by CodeRabbit

  • Documentation
    • Added architectural documentation detailing client-side protocol migration and dual-transport support strategy for maintaining compatibility across different node versions during the transition period.

…ages

- Document protocol v1 (NIP-59 gift wrap) → v2 (NIP-44 direct, kind 14) migration strategy
- Define auto-detection via protocol_version tag from kind-38385 info event, defaulting to v1 when absent
- Specify dual-transport support: v1 uses 2-tuple [message, tradeSig] in kind-1059 gift wrap; v2 uses 3-tuple [message, tradeSig, identityProof] in kind-14 signed by trade key
- Map version field to transport (v1→version:1, v2→version:2) and document
@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@AndreaDiazCorreia, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 36 minutes and 21 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f7dfdcbd-7d2d-4e4a-9fee-0d36840ab244

📥 Commits

Reviewing files that changed from the base of the PR and between 37554a7 and d020ac2.

📒 Files selected for processing (1)
  • docs/architecture/TRANSPORT_V2_MIGRATION.md

Walkthrough

A new architecture document docs/architecture/TRANSPORT_V2_MIGRATION.md is added, specifying the client-side migration from NIP-59 gift-wrap transport (v1, kind 1059) to NIP-44 direct messages (v2, kind 14), including auto-detection logic, wire-format differences, per-node transport resolution, phased implementation plan, and backward-compatibility rules.

Changes

Transport v2 Migration Documentation

Layer / File(s) Summary
Scope, principles, and transport auto-detection
docs/architecture/TRANSPORT_V2_MIGRATION.md
Establishes document scope, dual-support rationale, no-UI-override principle, and rules for selecting v1 vs v2 per node by parsing protocol_version from kind-38385 with v1 fallback.
Wire-format specification and solution design
docs/architecture/TRANSPORT_V2_MIGRATION.md
Defines v1 ([message, tradeSig] in rumor/seal/wrap) and v2 ([message, tradeSigOrNull, identityProofOrNull] via NIP-44 in kind-14) tuple shapes, kind-14 disambiguation from peer chat, send/receive flow comparison, per-node transport resolver contract, derived version field, and existing v1 code touch points.
Implementation phases, edge cases, and out-of-scope
docs/architecture/TRANSPORT_V2_MIGRATION.md
Describes phases A–D (dual receive, dual send, auto-detection wiring, test suite), backward-compatibility rules (legacy nodes, on-wire v1 version preservation, mismatch timeout, full-privacy null identity proof, PoW on kind-14 event IDs), and out-of-scope items with updated metadata.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐇 Hopping through the protocol lanes,
Old gift wraps yielding to NIP-44 chains.
Kind 14 arrives with a triple-sealed treat,
Auto-detecting nodes — no manual feat!
v1 stays safe while v2 takes flight,
Two transports in harmony, everything right. ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding documentation for the transport v2 migration specification using NIP-44 direct messaging.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/transport-v2-migration

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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 37554a7d31

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/architecture/TRANSPORT_V2_MIGRATION.md Outdated

@coderabbitai coderabbitai 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/architecture/TRANSPORT_V2_MIGRATION.md`:
- Around line 81-85: Three fenced code blocks in the Markdown file are missing
language specifiers, which violates the MD040 markdownlint rule. Add the
language identifier `text` immediately after the opening triple backticks for
all three code blocks: the protocol version tag examples block containing the
content about NIP-59 gift wrap and NIP-44 direct messaging, the domain-tagged
payload format block containing the mostro-transport-v2-identity format string,
and the send/receive flow comparison block showing the v1 and v2 diagram. Change
each triple backtick opening from ``` to ```text.
- Line 20: There is a blank line at line 20 inside the blockquote that breaks
the blockquote structure between the Scope and Status sections (MD028
violation). Remove the blank line entirely to maintain blockquote continuity, or
if the blank line is intentional for formatting, add the blockquote marker (>)
to the blank line to continue the blockquote structure uninterrupted.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d86fe8e5-09a8-4ff1-a2b2-12a550dd1e6a

📥 Commits

Reviewing files that changed from the base of the PR and between d947795 and 37554a7.

📒 Files selected for processing (1)
  • docs/architecture/TRANSPORT_V2_MIGRATION.md

Comment thread docs/architecture/TRANSPORT_V2_MIGRATION.md Outdated
Comment thread docs/architecture/TRANSPORT_V2_MIGRATION.md Outdated
- Add closing angle bracket to blockquote continuation
- Add language specifiers to fenced code blocks per coding guidelines
ermeme[bot]
ermeme Bot previously approved these changes Jun 18, 2026

@ermeme ermeme Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Looks good to me. Documentation-only change, markdown formatting issues are resolved, and the spec is internally consistent on current head.

@ermeme ermeme Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Section-by-section take: the migration shape looks right, but I would tighten 3 things before implementation:

  1. Transport abstraction: the doc correctly says version should follow the resolved transport, not a global constant. I would avoid threading raw ints through the code and introduce a small transport enum/resolver so send/receive stay aligned and the version field cannot drift.

  2. Receive path: this is the fragile part. For v2, the subscription filter must be exact (kind: 14, authors: [mostroPubkey], p: [tradeKeys]), otherwise Mostro v2 events will get mixed with other kind-14 traffic and the bug will be silent.

  3. Fallback/telemetry: defaulting to v1 when protocol_version is absent is the right compatibility choice, but I would log that downgrade explicitly so a misconfigured node does not leave the app in a degraded mode without anyone noticing.

Overall: good plan, conservative, and the migration boundary is well chosen. The main risk is implementation plumbing, not protocol design.

@ermeme ermeme Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

If I were implementing this migration, I would do it in this order:

  1. Introduce a tiny transport enum/resolver first (v1 / v2) and make protocol_version parsing feed it. That keeps the decision in one place and prevents version from becoming a global footgun.
  2. Ship the receive path before the send path. The dangerous failure mode here is silent: if subscription filters are wrong, v2 replies disappear without obvious crashes.
  3. Keep the v1 code path byte-for-byte unchanged. Treat v2 as an additive path, not a refactor of the current gift-wrap flow.
  4. Add round-trip tests for both transports, plus a fallback test for missing protocol_version → v1.

Best approach overall: small adapter layer, dual receive first, dual send second. That gives you the safest rollout and the easiest rollback path.

@ermeme ermeme Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Looks good to me. This is a documentation-only migration spec, the receive/send phases are well scoped, and the latest head now explicitly logs the v1 fallback downgrade.

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.

1 participant