|
| 1 | +# Stellar RPC in WASI: jsonrpsee version mismatch |
| 2 | + |
| 3 | +## Problem |
| 4 | + |
| 5 | +`soroban-rs` (0.2.6) depends on `stellar-rpc-client` which requires `jsonrpsee-http-client ^0.20.1`. |
| 6 | +Even the latest `stellar-rpc-client` (25.1.0) still pins jsonrpsee 0.20. |
| 7 | + |
| 8 | +Our wasip2 fork is based on jsonrpsee 0.26 (hyper 1.x). `[patch.crates-io]` cannot substitute |
| 9 | +0.26 for a `^0.20.1` requirement — semver mismatch. |
| 10 | + |
| 11 | +## Options |
| 12 | + |
| 13 | +### 1. Fork jsonrpsee 0.20 with wasip2 changes |
| 14 | + |
| 15 | +Port the `WasiConnector` and `DirectResolver` changes to jsonrpsee 0.20, which uses hyper 0.14 |
| 16 | +(completely different client API from hyper 1.x). The connector and TLS plumbing would need to be |
| 17 | +rewritten for the older hyper API. More work, but soroban-rs and stellar-rpc-client stay unchanged. |
| 18 | + |
| 19 | +**Pros:** No other forks needed, `[patch.crates-io]` works directly. |
| 20 | +**Cons:** Maintaining wasip2 patches across two major jsonrpsee versions (0.20 and 0.26). |
| 21 | + |
| 22 | +### 2. Raw JSON-RPC calls via existing hyper client |
| 23 | + |
| 24 | +Skip soroban-rs in the wasi component entirely. Use our working `http.rs` helper (hyper 1.x + |
| 25 | +tokio TcpStream + std::net DNS) to make raw JSON-RPC POST requests. The Stellar RPC methods |
| 26 | +(`getHealth`, `getLedgerEntries`, `getAccount`) are simple JSON-RPC — just POST JSON and parse |
| 27 | +the response. XDR decoding can use `stellar-xdr` directly (pure Rust, no networking). |
| 28 | + |
| 29 | +**Pros:** No additional forks. Uses the stack we already proved works. Minimal dependencies. |
| 30 | +**Cons:** No type-safe RPC client. Must manually construct JSON-RPC request/response envelopes. |
| 31 | +Duplicates some logic from stellar-rpc-client. |
| 32 | + |
| 33 | +### 3. Fork soroban-rs + stellar-rpc-client to use jsonrpsee 0.26 |
| 34 | + |
| 35 | +Fork both crates to upgrade their jsonrpsee dependency from 0.20 to 0.26. This involves updating |
| 36 | +all jsonrpsee API call sites in stellar-rpc-client (the API changed significantly between 0.20 and |
| 37 | +0.26). Then use `[patch.crates-io]` to point jsonrpsee 0.26 at our wasip2-tls fork. |
| 38 | + |
| 39 | +**Pros:** Full type-safe client. Uses our existing jsonrpsee 0.26 wasip2 fork. |
| 40 | +**Cons:** Most forks to maintain (soroban-rs, stellar-rpc-client, jsonrpsee). Breaking API changes |
| 41 | +between jsonrpsee 0.20 and 0.26 make the stellar-rpc-client port non-trivial. |
0 commit comments