Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/reef sign tx #104

Merged
merged 5 commits into from
Mar 14, 2025
Merged

Fix/reef sign tx #104

merged 5 commits into from
Mar 14, 2025

Conversation

pedrxlz
Copy link
Contributor

@pedrxlz pedrxlz commented Mar 12, 2025

Summary by CodeRabbit

  • Refactor
    • Improved consistency in how chains display their identifying information.
    • Enhanced transaction signing logic to better handle default values for specific symbols.
    • Modified data structures to allow for optional values, increasing flexibility.
  • Tests
    • Added tests to ensure the updated signing process works correctly, specifically for the "REEF" symbol.
  • Chores
    • Updated configuration to manage security advisories effectively.

Copy link

coderabbitai bot commented Mar 12, 2025

Walkthrough

The update modifies the chain registration process by reversing the parameter order in factory closures for several chain entries. Additionally, it adjusts the transaction signing logic in the Substrate module by conditionally assigning values to the mode and metadata_hash fields: if the chain symbol is "REEF", both fields are set to None, otherwise to Some(0u8). The ExtrinsicPayload struct is updated to use Option<u8> for these fields, and a new test (sign_tx_4) is added to validate the updated behavior. An unused import has also been removed.

Changes

File(s) Change Summary
packages/kos/src/chains/mod.rs Updated factory closures in ChainRegistry: the order of parameters for substrate::Substrate::new was reversed for chain entries (DOT, KSM, REEF, SDN, ASTR, CFG, KILT, ALTAIR).
packages/kos/src/chains/substrate/{mod.rs,models.rs} In the Substrate module, the sign_tx method now conditionally assigns mode and metadata_hash based on the symbol ("REEF" gets None, others get Some(0u8)). The ExtrinsicPayload struct fields are changed from u8 to Option<u8>, with corresponding encoding updates, and a new test (sign_tx_4) verifies the behavior. Unused imports were removed.
deny.toml Added a new section [advisories] with an ignore list containing "RUSTSEC-2024-0436" related to the "paste" crate.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant Substrate
    participant Payload

    Client->>Substrate: Call sign_tx(symbol)
    alt symbol == "REEF"
        Substrate->>Payload: Set mode = None, metadata_hash = None
    else symbol != "REEF"
        Substrate->>Payload: Set mode = Some(0), metadata_hash = Some(0)
    end
    Substrate->>Client: Return signed transaction
Loading

Suggested labels

@domain/types

Suggested reviewers

  • klever-patrick
  • gustavocbritto

Poem

I’m a rabbit with a code tweak so fine,
Hopping through chains in a neat new design.
Parameters align in an orderly spree,
Modes now optional – happier they’ll be.
Test hops confirm success with a joyful sign! 🐇

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • JIRA integration encountered authorization issues. Please disconnect and reconnect the integration in the CodeRabbit UI.

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between 35347fb and 7f00c85.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (2)
  • deny.toml (1 hunks)
  • packages/kos/src/chains/mod.rs (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • deny.toml
  • packages/kos/src/chains/mod.rs
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: format

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

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.

@pedrxlz pedrxlz changed the title fix: update transaction model to support optional mode and metadata_hash Fix/reef sign tx Mar 12, 2025
@github-actions github-actions bot added the rust label Mar 12, 2025
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
deny.toml (1)

51-56: Advisory Configuration Addition – Valid Update.

The new [advisories] section adds an ignore list for "RUSTSEC-2024-0436" and is correctly formatted. The inline comment clearly explains that the advisory is being ignored due to the "paste" crate being unmaintained yet still required by "uniffy". This configuration change appears intentional and aligns with dependency management practices. However, it might be beneficial to ensure that this decision is documented in your project’s changelog or relevant project documentation, so future maintainers understand the rationale behind ignoring these advisories.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between bba5e7f and ea7016e.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (1)
  • deny.toml (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: format

@pedrxlz pedrxlz merged commit 440793e into develop Mar 14, 2025
4 checks passed
@pedrxlz pedrxlz deleted the fix/reef-sign-tx branch March 14, 2025 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants