Skip to content

Bumped nostr sdk to version 0.40#124

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

Bumped nostr sdk to version 0.40#124
grunch merged 1 commit into
developfrom
nostr-sdk-40

Conversation

@arkanoider
Copy link
Copy Markdown
Collaborator

@arkanoider arkanoider commented Mar 24, 2025

@grunch @Catrya

Bumped mostro-cli version of nostr sdk to 0.40 and mostro-core to 6.34.

Summary by CodeRabbit

  • Chores
    • Updated core dependencies to newer stable versions.
  • Refactor
    • Enhanced error handling and streamlined internal operations for improved stability and performance.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 24, 2025

Walkthrough

This pull request updates dependency versions and refines error handling. In the Cargo.toml file, the nostr-sdk dependency is upgraded from 0.38.0 to 0.40.0 and the mostro-core dependency from 0.6.31 to 0.6.34. Additionally, error propagation in key derivation functions has been improved in both src/cli/conversation_key.rs and src/util.rs by adding the ? operator, and minor adjustments have been made to method calls like tag construction and event sending.

Changes

File(s) Change Summary
Cargo.toml Updated dependency versions: nostr-sdk from 0.38.0 → 0.40.0 and mostro-core from 0.6.31 → 0.6.34.
src/cli/conversation_key.rs
src/util.rs
Enhanced error handling by introducing the ? operator in conversation key derivation; updated method calls (e.g., tag creation using Tags::from_list and event sending with a reference) to streamline control flow and improve robustness.

Sequence Diagram(s)

sequenceDiagram
    participant C as Caller
    participant F as Function
    participant D as ConversationKey::derive

    C->>F: Invoke function (e.g., execute_conversation_key/send_dm)
    F->>D: Attempt to derive conversation key
    D-->>F: Return key or error
    alt Key derivation succeeds
        F->>C: Continue processing and call subsequent methods
    else Key derivation fails
        F->>C: Return error immediately
    end
Loading

Possibly related PRs

Poem

I'm a rabbit coding with cheer, 🐇
Upgraded deps now hop in here.
With errors caught and handled fast,
Bugs and problems hop right past.
I nibble carrots, code with grace,
In our tech burrow—a joyful space!
Hop along, let's keep the pace!


📜 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 b1b09cd and 7107d8b.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (3)
  • Cargo.toml (2 hunks)
  • src/cli/conversation_key.rs (1 hunks)
  • src/util.rs (8 hunks)
🧰 Additional context used
🧬 Code Definitions (1)
src/util.rs (1)
src/db.rs (2)
  • new (85-106)
  • new (226-291)
🔇 Additional comments (10)
Cargo.toml (3)

25-25: Dependency update matches PR objective.

The nostr-sdk version has been updated from 0.38.0 to 0.40.0 as described in the PR objectives.


42-42: Associated dependency update.

The mostro-core dependency has been updated from 0.6.31 to 0.6.34, which is likely to maintain compatibility with the updated nostr-sdk.


48-48: Version specification added for dirs dependency.

The dirs dependency now explicitly specifies version 5.0.1, which is good for dependency consistency.

src/cli/conversation_key.rs (1)

7-7: Improved error handling with proper propagation.

Adding the ? operator to the ConversationKey::derive call ensures that any errors during key derivation are properly propagated to the calling function. This is consistent with similar changes in other files and improves the overall robustness of the error handling in the codebase.

src/util.rs (6)

35-35: Improved error handling with proper propagation.

Adding the ? operator to the ConversationKey::derive call ensures that any errors during key derivation are properly propagated to the calling function. This matches the change in conversation_key.rs and provides consistent error handling throughout the codebase.


59-59: API adaptation: Tags initialization method updated.

Changed from Tags::new(tags) to Tags::from_list(tags) to adapt to the updated API in nostr-sdk v0.40.0. This maintains functionality while conforming to the new library requirements.

Also applies to: 79-79


85-85: Memory optimization: Pass event by reference.

Changed from client.send_event(event) to client.send_event(&event), now passing a reference instead of moving the event. This optimizes memory usage and may be required by the updated SDK API.


188-193: Robust error handling for key derivation.

The error handling for ConversationKey::derive has been improved to gracefully handle failures by continuing the loop instead of panicking. This makes the code more resilient to unexpected failures during key derivation.


179-179: API adaptation: Event fetch method signature updated.

Changed from client.fetch_events(vec![filters], Duration::from_secs(15)) to client.fetch_events(filters, Duration::from_secs(15)), removing the unnecessary vector wrapping. This adapts to the updated API in nostr-sdk v0.40.0 and simplifies the code.

Also applies to: 273-273, 361-361


260-260: API adaptation: Custom tag construction method updated.

Changed custom tag construction from using vector literals to string literals, adapting to the updated API in nostr-sdk v0.40.0. This maintains functionality while conforming to the new library requirements.

Also applies to: 351-354

✨ 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 requested a review from grunch March 24, 2025 14:25
Copy link
Copy Markdown
Member

@Catrya Catrya left a comment

Choose a reason for hiding this comment

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

tACK

Copy link
Copy Markdown
Member

@grunch grunch left a comment

Choose a reason for hiding this comment

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

tACK

@grunch grunch merged commit 5166b4c into develop Mar 24, 2025
@grunch grunch deleted the nostr-sdk-40 branch March 24, 2025 17:12
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.

3 participants