paritytech / jsonrpsee

Rust JSON-RPC library on top of async/await
MIT License
629 stars 169 forks source link

fix(proc-macros): re-export tokio for params parsing #1361

Closed niklasad1 closed 5 months ago

niklasad1 commented 5 months ago

Follow-up on #1360 and I forgot that we use tokio in param parsing.

I also added a test crate to ensure that it compiles

niklasad1 commented 5 months ago

@CodiumAI-Agent /review

CodiumAI-Agent commented 5 months ago

PR Review

⏱️ Estimated effort to review [1-5] 3, because the PR involves changes across multiple files including core library files and macro definitions, which requires careful consideration to ensure that the changes do not introduce any regressions or compatibility issues. The addition of a new test module increases the complexity slightly.
🧪 Relevant tests Yes
🔍 Possible issues Possible Bug: The macro `cfg_client_or_server` uses `#[cfg(any(feature = "client", feature = "server"))]` which might not correctly handle cases where both features are enabled or other feature-specific logic is required.
🔒 Security concerns No
Code feedback:
relevant filecore/src/lib.rs
suggestion       Consider adding a comment explaining why `tokio` is conditionally included under `cfg_client_or_server`. This helps maintainers understand the context and necessity of this conditional compilation. [medium]
relevant linepub use tokio;

relevant filecore/src/macros.rs
suggestion       It might be beneficial to add a fallback or error handling mechanism within the `cfg_client_or_server` macro to manage unexpected conditions where neither 'client' nor 'server' features are enabled. [important]
relevant line#[cfg(any(feature = "client", feature = "server"))]

relevant fileproc-macros/src/render_server.rs
suggestion       Ensure that the re-exported `tokio` from `core::__reexports` does not lead to any unexpected behavior or conflicts, especially in environments where `tokio` might be independently required by other modules. [medium]
relevant linelet tokio = self.jrps_server_item(quote! { core::__reexports::tokio });

relevant filetests/proc-macro-core/src/lib.rs
suggestion       Verify that the new test module `jsonrpsee-proc-macro-core` covers all new paths introduced by the PR, particularly the conditional re-export of `tokio` and the new macro definitions. [important]
relevant line#[rpc(client, server)]


✨ Review tool usage guide:
**Overview:** The `review` tool scans the PR code changes, and generates a PR review which includes several types of feedbacks, such as possible PR issues, security threats and relevant test in the PR. More feedbacks can be [added](https://pr-agent-docs.codium.ai/tools/review/#general-configurations) by configuring the tool. The tool can be triggered [automatically](https://pr-agent-docs.codium.ai/usage-guide/automations_and_usage/#github-app-automatic-tools-when-a-new-pr-is-opened) every time a new PR is opened, or can be invoked manually by commenting on any PR. - When commenting, to edit [configurations](https://github.com/Codium-ai/pr-agent/blob/main/pr_agent/settings/configuration.toml#L23) related to the review tool (`pr_reviewer` section), use the following template: ``` /review --pr_reviewer.some_config1=... --pr_reviewer.some_config2=... ``` - With a [configuration file](https://pr-agent-docs.codium.ai/usage-guide/configuration_options/), use the following template: ``` [pr_reviewer] some_config1=... some_config2=... ``` See the review [usage page](https://pr-agent-docs.codium.ai/tools/review/) for a comprehensive guide on using this tool.