Skip to content

Bumped version of nostr sdk 40#95

Merged
grunch merged 1 commit into
developfrom
sdk-40-issue
Mar 24, 2025
Merged

Bumped version of nostr sdk 40#95
grunch merged 1 commit into
developfrom
sdk-40-issue

Conversation

@arkanoider

@arkanoider arkanoider commented Mar 23, 2025

Copy link
Copy Markdown
Collaborator

@grunch @Catrya ,

this, as usual, is neede to test mostro . This bumps mostro-core to nostr sdk 0.40 so it's ready also for the update of mostro-cli of @grunch .

Summary by CodeRabbit

  • Chores
    • Upgraded a core dependency to a newer version for enhanced compatibility.
  • Refactor
    • Improved the message verification process to better handle edge cases during authentication.
    • Optimized the generation of content tags for increased consistency.

@coderabbitai

coderabbitai Bot commented Mar 23, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

This pull request updates the nostr-sdk dependency in Cargo.toml from version "0.38.0" to "0.40.0". In addition, the verify_signature method in src/message.rs has been modified to first attempt converting the public key to an xonly key and then verify the signature, returning false if the conversion fails. The to_tags method in src/rating.rs now initializes the tags using Tags::from_list instead of Tags::new, changing the internal instantiation logic.

Changes

File(s) Change Summary
Cargo.toml Updated nostr-sdk dependency version from "0.38.0" to "0.40.0".
src/message.rs Modified verify_signature: now converts the public key to an xonly key before verifying the signature, returning false if conversion fails.
src/rating.rs Updated to_tags method to use Tags::from_list for tag instantiation instead of Tags::new.

Sequence Diagram(s)

sequenceDiagram
    participant M as Message
    participant P as PublicKey
    participant X as XOnlyKey

    M->>P: Attempt to convert pubkey to xonly key
    alt Conversion Successful
        note right of P: xonly conversion succeeded
        M->>X: Use xonly key for signature verification
        X-->>M: Return verification result
    else Conversion Failed
        note right of P: xonly conversion failed
        M->>M: Return false
    end
Loading

Suggested reviewers

  • Catrya
  • grunch

Poem

I'm a bunny with code so bright,
Hop-hopping through changes with delight.
Upgraded versions and tweaks so neat,
Logical hops and secret beats.
Celebrate the code, our changes complete! 🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8a000c0 and 79959a3.

📒 Files selected for processing (3)
  • Cargo.toml (1 hunks)
  • src/message.rs (1 hunks)
  • src/rating.rs (1 hunks)
🔇 Additional comments (3)
Cargo.toml (1)

35-35: Version update looks good

The upgrade from nostr-sdk 0.38.0 to 0.40.0 aligns with the PR objective. This change required corresponding updates to the API usage in other files.

src/rating.rs (1)

71-73: API update correctly implemented

The change from direct tag list usage to Tags::from_list() method is necessary for compatibility with nostr-sdk 0.40.0. This adjustment properly adapts to the updated API without changing the function's behavior.

src/message.rs (1)

208-212:

Details

✅ Verification successful

Improved signature verification with fallback handling

The implementation now handles the public key conversion to xonly format required by nostr-sdk 0.40.0. The code gracefully fails (returns false) when the conversion isn't possible instead of panicking.


🏁 Script executed:

#!/bin/bash
# Check for any direct usages of verify_signature in the codebase
# to ensure all callers handle the potential false return value correctly

rg -A 2 -B 2 "verify_signature" --type rust

Length of output: 558


Signature verification update approved

  • The updated implementation in src/message.rs now gracefully falls back by returning false when the xonly() conversion fails, avoiding any panics.
  • A repository-wide check confirmed that all call sites (e.g., in src/lib.rs) correctly handle the false return value from verify_signature.
  • No further modifications are needed.
✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@arkanoider arkanoider changed the title ready to test with nostr sdk 40 Bumped version of nostr sdk 40 Mar 23, 2025
@arkanoider arkanoider requested review from Catrya and grunch March 23, 2025 19:18
@grunch grunch merged commit 99107d9 into develop Mar 24, 2025
@grunch grunch deleted the sdk-40-issue branch April 22, 2026 20:11
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