Skip to content

Conversation

@zees-dev
Copy link
Collaborator

Description

This pull request introduces significant updates to the Blockless runtime to support JSON-RPC functionality and HTTP request handling.
Key changes include the addition of a new BlocklessRpcErrorKind enum, integration of a JSON-RPC interface, and a comprehensive HTTP request handler.
These updates enhance the runtime's ability to process RPC calls and execute HTTP requests directly within the WASM environment.

JSON-RPC Integration:

HTTP Request Handling:

Runtime Enhancements:

  • Integrated the new RPC functionality into the Blockless runtime by adding add_bless_to_linker. (blockless/src/lib.rs, [1]; crates/blockless-env/src/lib.rs, [2]
  • Updated Cargo.toml to include the multipart feature for reqwest. (crates/blockless-drivers/Cargo.toml, crates/blockless-drivers/Cargo.tomlL29-R29)

These changes collectively enhance the runtime's extensibility and enable advanced communication and request handling capabilities.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a unified JSON-RPC entrypoint for host calls and integrates HTTP request handling into the Blockless runtime.

  • Introduces a new BlocklessRpcErrorKind enum and WITX interface for rpc_call
  • Implements JSON-RPC request/response types and the rpc_call handler in WASI
  • Adds async HTTP request execution via reqwest and links the RPC interface into the runtime

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
crates/blockless-env/src/lib.rs Registers the new add_bless_to_linker integration
crates/blockless-drivers/witx/blockless_rpc.witx Defines the $bless WITX module and rpc_call function
crates/blockless-drivers/src/wasi/rpc.rs Implements JSON-RPC types and the async rpc_call logic
crates/blockless-drivers/src/wasi/mod.rs Exposes the rpc submodule
crates/blockless-drivers/src/lib.rs Adds the handlers module to the driver crate
crates/blockless-drivers/src/handlers/http.rs Implements handle_http_request and HTTP execution logic
crates/blockless-drivers/src/error.rs Defines the BlocklessRpcErrorKind enum and Display
crates/blockless-drivers/Cargo.toml Enables the multipart feature for reqwest
blockless/src/lib.rs Links the new RPC entrypoint into the Blockless runtime
Comments suppressed due to low confidence (2)

crates/blockless-drivers/src/handlers/http.rs:1

  • Public structs and functions in this file lack documentation comments. Adding docstrings for HttpRpcRequest, handle_http_request, and execute_http_request will improve clarity for consumers of the API.
use reqwest::{Client, Method};

crates/blockless-drivers/src/wasi/rpc.rs:110

  • The new handle_rpc_request async handler lacks unit tests to verify each RPC method (e.g., ping, echo, version, http.request). Consider adding tests to cover these code paths.
async fn handle_rpc_request(request: JsonRpcRequest) -> JsonRpcResponse {

@github-actions
Copy link

Pull Request Test Coverage Report for Build 16256800493

Details

  • 1 of 214 (0.47%) changed or added relevant lines in 5 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.02%) to 7.781%

Changes Missing Coverage Covered Lines Changed/Added Lines %
crates/blockless-env/src/lib.rs 0 1 0.0%
crates/blockless-drivers/src/error.rs 0 8 0.0%
crates/blockless-drivers/src/wasi/rpc.rs 0 78 0.0%
crates/blockless-drivers/src/handlers/http.rs 0 126 0.0%
Totals Coverage Status
Change from base Build 15269465304: -0.02%
Covered Lines: 5715
Relevant Lines: 73447

💛 - Coveralls

@zees-dev zees-dev merged commit 655a71a into main Jul 15, 2025
8 checks passed
@zees-dev zees-dev deleted the feat/single-entrypoint-rpc branch July 15, 2025 04:29
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