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

Implement new commitments-API #161

Merged
merged 14 commits into from
Jul 26, 2024
Merged

Conversation

mempirate
Copy link
Contributor

@mempirate mempirate commented Jul 24, 2024

Closes #156

Summary by CodeRabbit

  • New Features

    • Introduced a new commitments module, enhancing API capabilities for commitment requests.
    • Added JSON-RPC support for handling commitment requests, improving API communication.
    • Implemented new structures for handling transaction commitments and signatures, enhancing the commitment system.
  • Bug Fixes

    • Improved error handling and validation logic for commitment requests, ensuring more reliable operations.
  • Style

    • Reformatted dependency entries for better readability in configuration files.
  • Chores

    • Updated module structures and public API exports for improved maintainability.

@mempirate mempirate added C: bolt-sidecar Component: bolt-sidecar T: chore Type: Chore labels Jul 24, 2024
Copy link
Contributor

coderabbitai bot commented Jul 24, 2024

Walkthrough

Ahoy, matey! The recent changes in the bolt-sidecar project expand the commitments API, improving the handling of inclusion requests for transactions, whether they be lone wolves or a mighty fleet. We’ve added new structures and refined existing ones, making our code more modular and the ship's sails more robust against the turbulent seas of the blockchain. The crew be ready to navigate these enhancements with greater ease and efficiency!

Changes

Files Changed Change Summary
bolt-sidecar/Cargo.toml Added axum-extra dependency and reformatted alloy features for better readability.
bolt-sidecar/bin/sidecar.rs Revamped event handling, introduced commitment signing, and improved error management.
bolt-sidecar/src/api/commitments/jsonrpc.rs Added structures for JSON-RPC handling, including JsonPayload, JsonResponse, and JsonError.
bolt-sidecar/src/api/commitments/mod.rs Established modular structure for commitments API with new modules: jsonrpc, server, spec.
bolt-sidecar/src/api/commitments/server.rs Implemented JSON-RPC server for commitments, defining CommitmentsApi interface and handling requests.
bolt-sidecar/src/api/commitments/spec.rs Developed specifications for handling commitment requests, adhering to the BOLT protocol.
bolt-sidecar/src/primitives/commitment.rs Enhanced commitment handling with new data structures and methods such as SignedCommitment and InclusionCommitment.
bolt-sidecar/src/primitives/constraint.rs Updated transaction handling by replacing PooledTransactionsElement with FullTransaction.
bolt-sidecar/src/state/execution.rs Refined commitment request validation logic, enhancing error handling.
bolt-sidecar/src/test_util.rs Modified to support multiple transactions in create_signed_commitment_request.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant API
    participant Server
    participant Blockchain

    Client->>API: Request Inclusion (transactions, targetSlot)
    API->>Server: Forward Request
    Server->>Server: Validate Transactions
    Server->>Blockchain: Process Inclusion
    Blockchain-->>Server: Confirmation
    Server-->>API: Send Response
    API-->>Client: Return Inclusion Result
Loading

Assessment against linked issues

Objective Addressed Explanation
Implement commitments-API spec (requests for inclusion)
Signature handling for requests
Accommodate multiple transactions in requests

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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.

@mempirate
Copy link
Contributor Author

@coderabbitai review

Copy link
Contributor

@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: 1

bolt-sidecar/src/primitives/constraint.rs Show resolved Hide resolved
@mempirate mempirate marked this pull request as ready for review July 26, 2024 09:00
Copy link
Collaborator

@merklefruit merklefruit left a comment

Choose a reason for hiding this comment

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

LGTM, a few nits

bolt-sidecar/bin/sidecar.rs Show resolved Hide resolved
bolt-sidecar/bin/sidecar.rs Show resolved Hide resolved
bolt-sidecar/bin/sidecar.rs Outdated Show resolved Hide resolved
bolt-sidecar/bin/sidecar.rs Outdated Show resolved Hide resolved
bolt-sidecar/src/api/commitments/server.rs Outdated Show resolved Hide resolved
bolt-sidecar/src/api/commitments/server.rs Outdated Show resolved Hide resolved
bolt-sidecar/src/api/commitments/spec.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@namn-grg namn-grg left a comment

Choose a reason for hiding this comment

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

Great work LGTM!

Copy link
Contributor

@thedevbirb thedevbirb left a comment

Choose a reason for hiding this comment

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

Awesome!

@thedevbirb thedevbirb merged commit ab94c12 into unstable Jul 26, 2024
2 checks passed
@thedevbirb thedevbirb deleted the feat/sidecar/commitments-api branch July 26, 2024 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: bolt-sidecar Component: bolt-sidecar T: chore Type: Chore
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Commitments-API spec implementation
4 participants