Skip to content

Conversation

@tac0turtle
Copy link
Contributor

@tac0turtle tac0turtle commented Jul 7, 2025

Overview

Summary by CodeRabbit

  • New Features

    • Introduced a builder pattern for flexible client configuration, including custom timeouts and TLS options.
    • Added conditional feature flags for modular gRPC and transport support.
    • Provided message-only and full gRPC service code generation, selectable via features.
    • Expanded documentation with usage examples, feature explanations, and concurrency guidance.
  • Improvements

    • All client service methods are now thread-safe and support concurrent usage without requiring mutable references.
    • Enhanced test coverage to verify feature-flagged type availability.
  • Bug Fixes

    • Clarified and updated Store Service API method names and signatures for consistency.
  • Documentation

    • Updated and expanded READMEs with detailed usage, features, and internal workings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 7, 2025

Walkthrough

This update refactors the rollkit-client and rollkit-types crates. It introduces a builder pattern for flexible client configuration, makes all service methods thread-safe by switching method receivers from mutable to immutable, and modularizes gRPC dependencies in rollkit-types using feature flags. Documentation and usage examples are updated to reflect these changes.

Changes

File(s) Change Summary
client/crates/rollkit-client/README.md, client/crates/rollkit-client/src/lib.rs Expanded documentation and usage examples; added builder pattern and TLS configuration sections.
client/crates/rollkit-client/examples/basic.rs Removed SignerClient usage; changed service client bindings to immutable.
client/crates/rollkit-client/src/client.rs Added RollkitClientBuilder for configurable client instantiation; updated imports for TLS.
client/crates/rollkit-client/src/health.rs, src/p2p.rs, src/signer.rs, src/store.rs Changed all async service methods from &mut self to &self; now clone inner clients for thread safety.
client/crates/rollkit-types/Cargo.toml Introduced feature flags (grpc, transport); made tonic dependency optional and feature-driven.
client/crates/rollkit-types/README.md Added sections on features, usage with/without gRPC, and internal codegen details.
client/crates/rollkit-types/build.rs Generates separate message-only and full gRPC proto files; ensures output directory exists.
client/crates/rollkit-types/src/lib.rs Conditionally includes proto files based on grpc feature flag.
client/crates/rollkit-types/src/proto/rollkit.v1.messages.rs New: Contains prost-generated protobuf message types for blockchain communication.
client/crates/rollkit-types/tests/feature_test.rs New: Tests ensuring message and gRPC types are available under correct feature flags.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant RollkitClientBuilder
    participant RollkitClient

    User->>RollkitClientBuilder: builder()
    User->>RollkitClientBuilder: set endpoint/timeout/TLS
    User->>RollkitClientBuilder: build() (async)
    RollkitClientBuilder->>RollkitClient: create instance with config
    RollkitClient-->>User: RollkitClient instance
    User->>RollkitClient: get service client (Health, P2P, Store, Signer)
    User->>ServiceClient: call method (concurrently, immutably)
Loading

Suggested reviewers

  • julienrbrt
  • randygrok

Poem

In the warren of code, new builders appear,
With thread-safe paws, clients hop without fear.
Features now toggle, gRPC on or not,
TLS and timeouts—just set what you’ve got!
Immutable bunnies, concurrent and bright,
Rollkit hops forward—what a delightful sight!
🐇✨

✨ 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate sequence diagram to generate a sequence diagram of the changes in 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.

@tac0turtle tac0turtle changed the title Damian/rust lib chore: split rust lib Jul 7, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Summary of Changes

Hello @tac0turtle, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a new Rust client library for interacting with Rollkit nodes via gRPC. It establishes a structured approach for client development by separating protobuf-generated types into a dedicated rollkit-types crate and providing a high-level gRPC client in the rollkit-client crate. The changes also include the necessary build infrastructure, CI integration, and documentation to support Rust development within the project.

Highlights

  • New Rust Client Library: Introduced a comprehensive Rust client library for interacting with Rollkit nodes via gRPC, providing a robust and type-safe interface.
  • Modular Crate Structure: The Rust client is organized into two distinct crates: rollkit-types for protobuf-generated data structures and rollkit-client for the high-level gRPC client logic, promoting modularity and reusability.
  • Advanced gRPC Client Features: The rollkit-client includes enhanced features such as flexible connection management, configurable timeouts, and TLS support for secure communication with Rollkit nodes.
  • Automated Protobuf Code Generation: Implemented an automated process for generating Rust code from .proto files, including a custom build script that produces separate output for message types (without gRPC dependencies) and full gRPC services, controlled by feature flags.
  • CI/CD Integration: Integrated Rust build and protobuf generation steps into the project's CI/CD pipeline through a new GitHub Action and updated Makefile targets, ensuring consistent development and build environments.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a comprehensive Rust client library for Rollkit, split into two crates: rollkit-types for protobuf-generated types and rollkit-client for the high-level gRPC client. The changes include the full library implementation, examples, tests, and CI/build system updates to support the new Rust code. The overall structure is well-thought-out, with a clear separation of concerns. My review focuses on improving maintainability, consistency, and idiomatic Rust practices in the new client library.

@github-actions
Copy link
Contributor

github-actions bot commented Jul 7, 2025

The latest Buf updates on your PR. Results from workflow CI and Release / buf-check (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed⏩ skipped✅ passed✅ passedJul 7, 2025, 9:14 PM

@tac0turtle tac0turtle marked this pull request as ready for review July 7, 2025 21:14
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: 0

🧹 Nitpick comments (4)
client/crates/rollkit-types/build.rs (1)

35-37: Suggest consistent file existence handling.

The file existence checks are good practice, but consider logging or handling the case where the generated file doesn't exist, as this could indicate a generation failure.

 if generated_file.exists() {
     fs::rename(&generated_file, &messages_file)?;
+} else {
+    eprintln!("Warning: Expected generated file {} not found", generated_file.display());
 }

Apply the same pattern to both rename operations for consistency.

Also applies to: 48-50

client/crates/rollkit-types/README.md (2)

33-33: Fix missing punctuation.

Add a period at the end of the sentence for better readability.

-You're building for environments where gRPC is not needed
+You're building for environments where gRPC is not needed.

65-65: Consider rephrasing to reduce repetition.

The phrase "needing to regenerate" is used twice in nearby sentences. Consider varying the wording for better readability.

-Both files should be committed to ensure users can use the crate without needing to regenerate based on their feature selection.
+Both files should be committed to ensure users can use the crate without requiring regeneration based on their feature selection.
client/crates/rollkit-client/src/client.rs (1)

118-122: Consider enhancing the error message.

The empty endpoint validation is good, but consider making the error message more descriptive to help users understand what's expected.

-            return Err(RollkitClientError::InvalidEndpoint(
-                "Endpoint cannot be empty".to_string(),
-            ));
+            return Err(RollkitClientError::InvalidEndpoint(
+                "Endpoint cannot be empty. Please provide a valid URL (e.g., 'http://localhost:8080')".to_string(),
+            ));
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 1493af5 and 66a0683.

📒 Files selected for processing (14)
  • client/crates/rollkit-client/README.md (4 hunks)
  • client/crates/rollkit-client/examples/basic.rs (4 hunks)
  • client/crates/rollkit-client/src/client.rs (3 hunks)
  • client/crates/rollkit-client/src/health.rs (1 hunks)
  • client/crates/rollkit-client/src/lib.rs (3 hunks)
  • client/crates/rollkit-client/src/p2p.rs (1 hunks)
  • client/crates/rollkit-client/src/signer.rs (1 hunks)
  • client/crates/rollkit-client/src/store.rs (1 hunks)
  • client/crates/rollkit-types/Cargo.toml (2 hunks)
  • client/crates/rollkit-types/README.md (2 hunks)
  • client/crates/rollkit-types/build.rs (2 hunks)
  • client/crates/rollkit-types/src/lib.rs (1 hunks)
  • client/crates/rollkit-types/src/proto/rollkit.v1.messages.rs (1 hunks)
  • client/crates/rollkit-types/tests/feature_test.rs (1 hunks)
🧰 Additional context used
🧠 Learnings (10)
📓 Common learnings
Learnt from: chatton
PR: rollkit/rollkit#2378
File: test/docker-e2e/base_test.go:22-32
Timestamp: 2025-06-18T12:52:25.919Z
Learning: In the rollkit codebase test/docker-e2e, the StartBridgeNode and StartRollkitNode methods in DockerTestSuite do not return errors. They handle error checking internally using s.Require().NoError(err) for their operations, so no external error handling is needed when calling these methods.
client/crates/rollkit-client/examples/basic.rs (3)
Learnt from: tzdybal
PR: rollkit/rollkit#1875
File: da/da_test.go:88-88
Timestamp: 2025-01-27T22:03:14.288Z
Learning: In the rollkit codebase, the `github.com/rollkit/go-da` package is imported with different aliases in test (`da`) and production code (`goDA`), but they refer to the same package. Suggestions to change between these aliases are unnecessary as they don't affect functionality.
Learnt from: chatton
PR: rollkit/rollkit#2378
File: test/docker-e2e/base_test.go:22-32
Timestamp: 2025-06-18T12:52:25.919Z
Learning: In the rollkit codebase test/docker-e2e, the StartBridgeNode and StartRollkitNode methods in DockerTestSuite do not return errors. They handle error checking internally using s.Require().NoError(err) for their operations, so no external error handling is needed when calling these methods.
Learnt from: chatton
PR: rollkit/rollkit#2378
File: test/docker-e2e/base_test.go:22-32
Timestamp: 2025-06-18T12:52:25.919Z
Learning: In the rollkit codebase test/docker-e2e, the StartBridgeNode and StartRollkitNode methods in DockerTestSuite do not return errors, so no error handling is needed when calling these methods.
client/crates/rollkit-types/src/lib.rs (3)
Learnt from: CR
PR: rollkit/rollkit#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T08:47:52.948Z
Learning: Applies to types/pb/**/*.proto : Protobuf definition files should be placed in the `types/pb/` directory.
Learnt from: tzdybal
PR: rollkit/rollkit#1875
File: da/da_test.go:178-178
Timestamp: 2025-01-27T22:02:44.446Z
Learning: In the test files of rollkit/rollkit repository, the `github.com/rollkit/go-da` package is imported with the alias `da`, while in production code it might use a different alias. The code should maintain consistent import aliases within each file.
Learnt from: tzdybal
PR: rollkit/rollkit#1875
File: da/da_test.go:88-88
Timestamp: 2025-01-27T22:03:14.288Z
Learning: In the rollkit codebase, the `github.com/rollkit/go-da` package is imported with different aliases in test (`da`) and production code (`goDA`), but they refer to the same package. Suggestions to change between these aliases are unnecessary as they don't affect functionality.
client/crates/rollkit-types/tests/feature_test.rs (4)
Learnt from: tzdybal
PR: rollkit/rollkit#1641
File: node/full_node_test.go:266-321
Timestamp: 2024-10-08T18:35:32.960Z
Learning: Issue #1663 was created to address adding comprehensive tests for error scenarios in `TestVoteExtension` in the rollkit repository.
Learnt from: tzdybal
PR: rollkit/rollkit#1641
File: node/full_node_test.go:266-321
Timestamp: 2024-06-10T19:23:16.839Z
Learning: Issue #1663 was created to address adding comprehensive tests for error scenarios in `TestVoteExtension` in the rollkit repository.
Learnt from: CR
PR: rollkit/rollkit#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T08:47:52.948Z
Learning: Update tests when changing functionality.
Learnt from: chatton
PR: rollkit/rollkit#2378
File: test/docker-e2e/base_test.go:22-32
Timestamp: 2025-06-18T12:52:25.919Z
Learning: In the rollkit codebase test/docker-e2e, the StartBridgeNode and StartRollkitNode methods in DockerTestSuite do not return errors. They handle error checking internally using s.Require().NoError(err) for their operations, so no external error handling is needed when calling these methods.
client/crates/rollkit-types/build.rs (1)
Learnt from: CR
PR: rollkit/rollkit#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T08:47:52.948Z
Learning: Applies to types/pb/**/*.proto : Protobuf definition files should be placed in the `types/pb/` directory.
client/crates/rollkit-client/src/lib.rs (1)
Learnt from: chatton
PR: rollkit/rollkit#2378
File: test/docker-e2e/base_test.go:22-32
Timestamp: 2025-06-18T12:52:25.919Z
Learning: In the rollkit codebase test/docker-e2e, the StartBridgeNode and StartRollkitNode methods in DockerTestSuite do not return errors. They handle error checking internally using s.Require().NoError(err) for their operations, so no external error handling is needed when calling these methods.
client/crates/rollkit-types/README.md (2)
Learnt from: CR
PR: rollkit/rollkit#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T08:47:52.948Z
Learning: Applies to types/pb/**/*.proto : Protobuf definition files should be placed in the `types/pb/` directory.
Learnt from: chatton
PR: rollkit/rollkit#2378
File: test/docker-e2e/base_test.go:22-32
Timestamp: 2025-06-18T12:52:25.919Z
Learning: In the rollkit codebase test/docker-e2e, the StartBridgeNode and StartRollkitNode methods in DockerTestSuite do not return errors. They handle error checking internally using s.Require().NoError(err) for their operations, so no external error handling is needed when calling these methods.
client/crates/rollkit-client/README.md (3)
Learnt from: Eoous
PR: rollkit/rollkit#2208
File: pkg/store/store.go:117-138
Timestamp: 2025-04-22T17:57:47.384Z
Learning: In the Rollkit pruning implementation, index entries (mapping block hash to height) are intentionally preserved even when block data is pruned to maintain a lightweight historical record of the blockchain structure.
Learnt from: chatton
PR: rollkit/rollkit#2378
File: test/docker-e2e/base_test.go:22-32
Timestamp: 2025-06-18T12:52:25.919Z
Learning: In the rollkit codebase test/docker-e2e, the StartBridgeNode and StartRollkitNode methods in DockerTestSuite do not return errors. They handle error checking internally using s.Require().NoError(err) for their operations, so no external error handling is needed when calling these methods.
Learnt from: chatton
PR: rollkit/rollkit#2378
File: test/docker-e2e/base_test.go:22-32
Timestamp: 2025-06-18T12:52:25.919Z
Learning: In the rollkit codebase test/docker-e2e, the StartBridgeNode and StartRollkitNode methods in DockerTestSuite do not return errors, so no error handling is needed when calling these methods.
client/crates/rollkit-types/src/proto/rollkit.v1.messages.rs (1)
Learnt from: CR
PR: rollkit/rollkit#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T08:47:52.948Z
Learning: Applies to types/pb/**/*.proto : Protobuf definition files should be placed in the `types/pb/` directory.
client/crates/rollkit-client/src/store.rs (1)
Learnt from: Eoous
PR: rollkit/rollkit#2208
File: pkg/store/store.go:117-138
Timestamp: 2025-04-22T17:57:47.384Z
Learning: In the Rollkit pruning implementation, index entries (mapping block hash to height) are intentionally preserved even when block data is pruned to maintain a lightweight historical record of the blockchain structure.
🧬 Code Graph Analysis (4)
client/crates/rollkit-client/src/client.rs (5)
client/crates/rollkit-client/src/health.rs (1)
  • new (13-16)
client/crates/rollkit-client/src/p2p.rs (1)
  • new (14-17)
client/crates/rollkit-client/src/signer.rs (1)
  • new (14-17)
client/crates/rollkit-client/src/store.rs (1)
  • new (15-18)
client/crates/rollkit-types/src/proto/rollkit.v1.services.rs (8)
  • new (55-58)
  • new (196-198)
  • new (625-628)
  • new (772-774)
  • new (1044-1047)
  • new (1157-1159)
  • new (1397-1400)
  • new (1578-1580)
client/crates/rollkit-types/build.rs (5)
client/crates/rollkit-client/src/health.rs (1)
  • new (13-16)
client/crates/rollkit-client/src/p2p.rs (1)
  • new (14-17)
client/crates/rollkit-client/src/signer.rs (1)
  • new (14-17)
client/crates/rollkit-client/src/store.rs (1)
  • new (15-18)
client/crates/rollkit-types/src/proto/rollkit.v1.services.rs (8)
  • new (55-58)
  • new (196-198)
  • new (625-628)
  • new (772-774)
  • new (1044-1047)
  • new (1157-1159)
  • new (1397-1400)
  • new (1578-1580)
client/crates/rollkit-client/src/health.rs (1)
client/crates/rollkit-types/src/proto/rollkit.v1.services.rs (10)
  • livez (1103-1127)
  • livez (1138-1144)
  • new (55-58)
  • new (196-198)
  • new (625-628)
  • new (772-774)
  • new (1044-1047)
  • new (1157-1159)
  • new (1397-1400)
  • new (1578-1580)
client/crates/rollkit-types/src/proto/rollkit.v1.messages.rs (3)
types/state.go (1)
  • State (20-39)
core/sequencer/sequencing.go (1)
  • Batch (33-35)
client/crates/rollkit-types/src/proto/rollkit.v1.services.rs (2)
  • as_str_name (997-1004)
  • from_str_name (1006-1014)
🪛 LanguageTool
client/crates/rollkit-types/README.md

[uncategorized] ~33-~33: A period might be missing here.
Context: ...ding for environments where gRPC is not needed ## How It Works This crate generates ...

(AI_EN_LECTOR_MISSING_PUNCTUATION_PERIOD)


[style] ~65-~65: You have already used this phrasing in nearby sentences. Consider replacing it to add variety to your writing.
Context: ... ensure users can use the crate without needing to regenerate based on their feature selec...

(REP_NEED_TO_VB)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: test / Build All Rollkit Binaries
  • GitHub Check: test / Build Rollkit Docker Image
  • GitHub Check: test / Build Rollkit EVM Single Docker Image
  • GitHub Check: test / Run Unit Tests
  • GitHub Check: Analyze (rust)
  • GitHub Check: Analyze (go)
  • GitHub Check: Summary
🔇 Additional comments (21)
client/crates/rollkit-client/examples/basic.rs (2)

1-1: LGTM! API simplification aligns with thread-safe design.

The removal of SignerClient from the imports simplifies the example and aligns with the crate's API changes.


19-19: Excellent: Immutable bindings reflect the thread-safe API changes.

The change from mutable to immutable bindings for health, p2p, and store correctly demonstrates the new thread-safe API where client methods take &self instead of &mut self.

Also applies to: 30-30, 52-52

client/crates/rollkit-types/src/lib.rs (1)

2-8: Excellent feature flag implementation for modular compilation.

The conditional compilation correctly includes different proto files based on the grpc feature flag:

  • Without grpc: includes only message types (no tonic dependencies)
  • With grpc: includes full gRPC services

This provides the desired modularity for users who only need message types for serialization.

client/crates/rollkit-types/tests/feature_test.rs (2)

1-7: Good coverage of message type availability.

The test correctly verifies that core message types (Block, Header, State) are always available regardless of feature flags, ensuring the message-only compilation works as expected.


9-23: Excellent conditional testing of gRPC types.

The test properly verifies that gRPC client types are only available when the grpc feature is enabled. Using std::any::type_name is an appropriate approach to verify type existence without instantiation.

client/crates/rollkit-types/Cargo.toml (2)

14-17: Well-structured feature flag configuration.

The feature dependencies are logically organized:

  • default = ["grpc"] maintains backward compatibility
  • grpc = ["tonic", "transport"] enables full gRPC functionality
  • transport = ["tonic/transport"] enables tonic's transport feature

This provides the desired modularity while maintaining a sensible default.


27-27: Correct optional tonic dependency.

Making tonic optional and conditional on the transport feature enables the modular compilation approach while keeping the transport feature enabled by default.

client/crates/rollkit-types/build.rs (2)

19-22: Good practice: Explicit output directory creation.

Creating the output directory explicitly before generation ensures the build succeeds even if the directory doesn't exist.


26-37: Correct dual generation strategy.

The approach of generating both message-only and full service proto files is sound, allowing users to avoid regeneration based on feature flags.

client/crates/rollkit-client/src/lib.rs (2)

23-71: Excellent documentation enhancement for the builder pattern!

The new documentation sections effectively demonstrate the builder pattern usage with clear examples for custom timeouts and TLS configuration. The examples are well-structured and provide good guidance for users.


81-92: Good API convenience improvements.

The re-exports of RollkitClientBuilder and ClientTlsConfig make the API more convenient for users by reducing the need for multiple imports.

client/crates/rollkit-client/src/health.rs (1)

19-38: Excellent thread-safety improvement!

The change from mutable to immutable receivers with client cloning makes these methods thread-safe and enables concurrent usage. The pattern is consistently applied across all methods.

Note that cloning the inner client for each call introduces some performance overhead, but this is typically acceptable for gRPC clients since they're lightweight wrappers around channels.

client/crates/rollkit-types/README.md (1)

5-42: Comprehensive documentation for the new feature system!

The Features, Usage, and How It Works sections provide excellent guidance for users. The explanation of the dual file generation approach (messages.rs vs services.rs) is particularly valuable.

client/crates/rollkit-client/README.md (3)

51-87: Excellent addition of builder pattern and TLS documentation!

The new sections provide clear examples of the builder pattern usage and TLS configuration options. The examples are well-structured and demonstrate both basic and advanced use cases effectively.


109-131: Good update to reflect thread-safety and API changes.

The clarification that all service methods are now thread-safe and the updated Store Service API method names accurately reflect the code changes.


141-171: Excellent concurrent usage example!

This example effectively demonstrates the thread-safe nature of the service clients and provides a practical pattern for concurrent operations. The use of clone() and spawned tasks clearly shows how to leverage the new immutable method signatures.

client/crates/rollkit-client/src/p2p.rs (1)

20-55: Consistent thread-safety implementation!

The same excellent pattern from HealthClient is applied here - changing to immutable receivers with client cloning. This maintains consistency across all service clients and enables concurrent usage of P2P operations.

client/crates/rollkit-client/src/signer.rs (1)

20-22: Excellent thread-safety improvements!

The change from &mut self to &self with inner client cloning is a great improvement that enables concurrent usage of the SignerClient. The tonic::transport::Channel is designed to be cheaply cloneable, making this approach both thread-safe and performant.

Also applies to: 28-30, 36-38, 44-46

client/crates/rollkit-client/src/client.rs (1)

11-18: Well-implemented builder pattern!

The RollkitClientBuilder provides excellent flexibility for client configuration while maintaining clean, readable code. The implementation includes proper validation, reasonable defaults, and comprehensive error handling.

Also applies to: 85-157

client/crates/rollkit-client/src/store.rs (1)

21-25: Consistent thread-safety improvements and better API design!

The changes follow the same thread-safety pattern as other client implementations, and the method names are more descriptive (e.g., get_block_by_height vs get_block). This provides a cleaner, more intuitive API while maintaining thread-safety.

Also applies to: 31-35, 41-43, 49-51, 57-61, 67-71, 77-79, 85-87

client/crates/rollkit-types/src/proto/rollkit.v1.messages.rs (1)

1-340: Comprehensive protobuf message definitions!

This generated file provides a well-structured set of message definitions covering all essential blockchain operations including signing, blocks, state management, networking, and health status. The HealthStatus enum with proper string conversion methods is particularly well-implemented.

The separation of message-only definitions from gRPC services (as mentioned in the AI summary) is a good architectural decision that enables flexible usage patterns.

@codecov
Copy link

codecov bot commented Jul 7, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 72.74%. Comparing base (1493af5) to head (66a0683).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2445      +/-   ##
==========================================
- Coverage   72.77%   72.74%   -0.04%     
==========================================
  Files          67       67              
  Lines        6403     6403              
==========================================
- Hits         4660     4658       -2     
- Misses       1346     1347       +1     
- Partials      397      398       +1     
Flag Coverage Δ
combined 72.74% <ø> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@@ -1,3 +1,9 @@
pub mod v1 {
Copy link
Contributor

Choose a reason for hiding this comment

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

nice!

@tac0turtle tac0turtle added this pull request to the merge queue Jul 8, 2025
Merged via the queue into main with commit 894ff0e Jul 8, 2025
37 checks passed
@tac0turtle tac0turtle deleted the damian/rust-lib branch July 8, 2025 08:55
@github-project-automation github-project-automation bot moved this to Done in Evolve Jul 8, 2025
@tac0turtle tac0turtle removed this from Evolve Aug 25, 2025
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.

4 participants