Skip to content

Commit 86763a9

Browse files
niklasad1Copilotjsdw
authored
chore: release v0.25 (#1566)
* bump version to 0.25 * add CHANGELOG * Update CHANGELOG.md * Update CHANGELOG.md Co-authored-by: Copilot <[email protected]> * Update CHANGELOG.md Co-authored-by: James Wilson <[email protected]> --------- Co-authored-by: Copilot <[email protected]> Co-authored-by: James Wilson <[email protected]>
1 parent de59642 commit 86763a9

File tree

2 files changed

+153
-9
lines changed

2 files changed

+153
-9
lines changed

CHANGELOG.md

+144
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,150 @@ The format is based on [Keep a Changelog].
44

55
[Keep a Changelog]: http://keepachangelog.com/en/1.0.0/
66

7+
## [v0.25.0] - 2025-04-24
8+
9+
A new breaking release which has been in the making for a while and the biggest change is that the
10+
`RpcServiceT trait` has been changed to support both the client and server side:
11+
12+
```rust
13+
pub trait RpcServiceT {
14+
/// Response type for `RpcServiceT::call`.
15+
type MethodResponse;
16+
/// Response type for `RpcServiceT::notification`.
17+
type NotificationResponse;
18+
/// Response type for `RpcServiceT::batch`.
19+
type BatchResponse;
20+
21+
/// Processes a single JSON-RPC call, which may be a subscription or regular call.
22+
fn call<'a>(&self, request: Request<'a>) -> impl Future<Output = Self::MethodResponse> + Send + 'a;
23+
24+
/// Processes multiple JSON-RPC calls at once, similar to `RpcServiceT::call`.
25+
///
26+
/// This method wraps `RpcServiceT::call` and `RpcServiceT::notification`,
27+
/// but the root RPC service does not inherently recognize custom implementations
28+
/// of these methods.
29+
///
30+
/// As a result, if you have custom logic for individual calls or notifications,
31+
/// you must duplicate that implementation in this method or no middleware will be applied
32+
/// for calls inside the batch.
33+
fn batch<'a>(&self, requests: Batch<'a>) -> impl Future<Output = Self::BatchResponse> + Send + 'a;
34+
35+
/// Similar to `RpcServiceT::call` but processes a JSON-RPC notification.
36+
fn notification<'a>(&self, n: Notification<'a>) -> impl Future<Output = Self::NotificationResponse> + Send + 'a;
37+
}
38+
```
39+
40+
The reason for this change is to make it work for the client-side as well as make it easier to
41+
implement performantly by relying on `impl Future` instead of requiring an associated type for the `Future` (which in many cases requires boxing).
42+
43+
The downside of this change is that one has to duplicate the logic in the `batch` and `call` method to achieve the same
44+
functionality as before. Thus, `call` or `notification` is not being invoked in the `batch` method and one has to implement
45+
them separately.
46+
For example now it's possible to write middleware that counts the number of method calls as follows (both client and server):
47+
48+
```rust
49+
#[derive(Clone)]
50+
pub struct Counter<S> {
51+
service: S,
52+
count: Arc<AtomicUsize>,
53+
role: &'static str,
54+
}
55+
56+
impl<S> RpcServiceT for Counter<S>
57+
where
58+
S: RpcServiceT + Send + Sync + Clone + 'static,
59+
{
60+
type MethodResponse = S::MethodResponse;
61+
type NotificationResponse = S::NotificationResponse;
62+
type BatchResponse = S::BatchResponse;
63+
64+
fn call<'a>(&self, req: Request<'a>) -> impl Future<Output = Self::MethodResponse> + Send + 'a {
65+
let count = self.count.clone();
66+
let service = self.service.clone();
67+
let role = self.role;
68+
69+
async move {
70+
let rp = service.call(req).await;
71+
count.fetch_add(1, Ordering::SeqCst);
72+
println!("{role} processed calls={} on the connection", count.load(Ordering::SeqCst));
73+
rp
74+
}
75+
}
76+
77+
fn batch<'a>(&self, batch: Batch<'a>) -> impl Future<Output = Self::BatchResponse> + Send + 'a {
78+
let len = batch.len();
79+
self.count.fetch_add(len, Ordering::SeqCst);
80+
println!("{} processed calls={} on the connection", self.role, self.count.load(Ordering::SeqCst));
81+
self.service.batch(batch)
82+
}
83+
84+
fn notification<'a>(&self, n: Notification<'a>) -> impl Future<Output = Self::NotificationResponse> + Send + 'a {
85+
self.service.notification(n)
86+
}
87+
}
88+
```
89+
90+
In addition because this middleware is quite powerful it's possible to
91+
modify requests and specifically the request ID which should be avoided
92+
because it may break the response verification especially for the client-side.
93+
See https://github.com/paritytech/jsonrpsee/issues/1565 for further information.
94+
95+
There are also a couple of other changes see the detailed changelog below.
96+
97+
### [Added]
98+
- middleware: RpcServiceT distinct return types for notif, batch, call ([#1564](https://github.com/paritytech/jsonrpsee/pull/1564))
99+
- middleware: add support for client-side ([#1521](https://github.com/paritytech/jsonrpsee/pull/1521))
100+
- feat: add namespace_separator option for RPC methods ([#1544](https://github.com/paritytech/jsonrpsee/pull/1544))
101+
- feat: impl Into<ErrorObject> for Infallible ([#1542](https://github.com/paritytech/jsonrpsee/pull/1542))
102+
- client: add `request timeout` getter ([#1533](https://github.com/paritytech/jsonrpsee/pull/1533))
103+
- server: add example how to close a connection from a rpc handler (method call or subscription) ([#1488](https://github.com/paritytech/jsonrpsee/pull/1488))
104+
- server: add missing `ServerConfigBuilder::build` ([#1484](https://github.com/paritytech/jsonrpsee/pull/1484))
105+
106+
### [Fixed]
107+
- chore(macros): fix typo in proc-macro example ([#1482](https://github.com/paritytech/jsonrpsee/pull/1482))
108+
- chore(macros): fix typo in internal type name ([#1507](https://github.com/paritytech/jsonrpsee/pull/1507))
109+
- http middleware: preserve the URI query in ProxyGetRequest::call ([#1512](https://github.com/paritytech/jsonrpsee/pull/1512))
110+
- http middlware: send original error in ProxyGetRequest ([#1516](https://github.com/paritytech/jsonrpsee/pull/1516))
111+
- docs: update comment for TOO_BIG_BATCH_RESPONSE_CODE error ([#1531](https://github.com/paritytech/jsonrpsee/pull/1531))
112+
- fix `http request body` log ([#1540](https://github.com/paritytech/jsonrpsee/pull/1540))
113+
114+
### [Changed]
115+
- unify usage of JSON via `Box<RawValue>` ([#1545](https://github.com/paritytech/jsonrpsee/pull/1545))
116+
- server: `ServerConfigBuilder/ServerConfig` replaces `ServerBuilder` duplicate setter methods ([#1487](https://github.com/paritytech/jsonrpsee/pull/1487))
117+
- server: make `ProxyGetRequestLayer` http middleware support multiple path-method pairs ([#1492](https://github.com/paritytech/jsonrpsee/pull/1492))
118+
- server: propagate extensions in http response ([#1514](https://github.com/paritytech/jsonrpsee/pull/1514))
119+
- server: add assert set_message_buffer_capacity ([#1530](https://github.com/paritytech/jsonrpsee/pull/1530))
120+
- client: add #[derive(Clone)] for HttpClientBuilder ([#1498](https://github.com/paritytech/jsonrpsee/pull/1498))
121+
- client: add Error::Closed for ws close ([#1497](https://github.com/paritytech/jsonrpsee/pull/1497))
122+
- client: use native async fn in traits instead async_trait crate ([#1551](https://github.com/paritytech/jsonrpsee/pull/1551))
123+
- refactor: move to rust edition 2024 (MSRV 1.85) ([#1528](https://github.com/paritytech/jsonrpsee/pull/1528))
124+
- chore(deps): update tower requirement from 0.4.13 to 0.5.1 ([#1455](https://github.com/paritytech/jsonrpsee/pull/1455))
125+
- chore(deps): update tower-http requirement from 0.5.2 to 0.6.1 ([#1463](https://github.com/paritytech/jsonrpsee/pull/1463))
126+
- chore(deps): update pprof requirement from 0.13 to 0.14 ([#1493](https://github.com/paritytech/jsonrpsee/pull/1493))
127+
- chore(deps): update rustls-platform-verifier requirement from 0.3 to 0.4 ([#1489](https://github.com/paritytech/jsonrpsee/pull/1489))
128+
- chore(deps): update thiserror requirement from 1 to 2 ([#1491](https://github.com/paritytech/jsonrpsee/pull/1491))
129+
- chore(deps): bump soketto to 0.8.1 ([#1501](https://github.com/paritytech/jsonrpsee/pull/1501))
130+
- chore(deps): update rustls-platform-verifier requirement from 0.4 to 0.5 ([#1506](https://github.com/paritytech/jsonrpsee/pull/1506))
131+
- chore(deps): update fast-socks5 requirement from 0.9.1 to 0.10.0 ([#1505](https://github.com/paritytech/jsonrpsee/pull/1505))
132+
- chore(deps): tokio ^1.42 ([#1511](https://github.com/paritytech/jsonrpsee/pull/1511))
133+
- chore: use cargo workspace dependencies ([#1502](https://github.com/paritytech/jsonrpsee/pull/1502))
134+
- chore(deps): update rand requirement from 0.8 to 0.9 ([#1523](https://github.com/paritytech/jsonrpsee/pull/1523))
135+
136+
## [v0.24.9] - 2024-03-17
137+
138+
This is a non-breaking release that updates the dependency `rust-platform-verifier` to v0.5 to fix that
139+
that `rust-platform-verifier` v0.3 didn't enable the `std feature` in `rustls` which caused a compilation error.
140+
See https://github.com/paritytech/jsonrpsee/issues/1536 for further information.
141+
142+
Thanks to the external contributor [@prestwich](https://github.com/prestwich) who spotted and fixed this issue.
143+
144+
## [v0.24.8] - 2024-01-24
145+
146+
This is a non-breaking release that decreases the MSRV to 1.74.0.
147+
148+
### [Changed]
149+
- reduce MSRV to 1.74.0 ([#1519](https://github.com/paritytech/jsonrpsee/pull/1519))
150+
7151
## [v0.24.7] - 2024-10-16
8152

9153
This is a patch release that mainly fixes the tower::Service implementation to be generic over the HttpBody to work with all middleware layers.

Cargo.toml

+9-9
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ resolver = "3"
2020

2121
[workspace.package]
2222
authors = ["Parity Technologies <[email protected]>", "Pierre Krieger <[email protected]>"]
23-
version = "0.24.7"
23+
version = "0.25.0"
2424
edition = "2024"
2525
rust-version = "1.85.0"
2626
license = "MIT"
@@ -32,14 +32,14 @@ readme = "README.md"
3232

3333
[workspace.dependencies]
3434
# Internal jsonrpsee crates
35-
jsonrpsee-client-transport = { path = "client/transport", version = "0.24.7" }
36-
jsonrpsee-core = { path = "core", version = "0.24.7" }
37-
jsonrpsee-http-client = { path = "client/http-client", version = "0.24.7" }
38-
jsonrpsee-proc-macros = { path = "proc-macros", version = "0.24.7" }
39-
jsonrpsee-server = { path = "server", version = "0.24.7" }
40-
jsonrpsee-types = { path = "types", version = "0.24.7" }
41-
jsonrpsee-wasm-client = { path = "client/wasm-client", version = "0.24.7" }
42-
jsonrpsee-ws-client = { path = "client/ws-client", version = "0.24.7" }
35+
jsonrpsee-client-transport = { path = "client/transport", version = "0.25.0" }
36+
jsonrpsee-core = { path = "core", version = "0.25.0" }
37+
jsonrpsee-http-client = { path = "client/http-client", version = "0.25.0" }
38+
jsonrpsee-proc-macros = { path = "proc-macros", version = "0.25.0" }
39+
jsonrpsee-server = { path = "server", version = "0.25.0" }
40+
jsonrpsee-types = { path = "types", version = "0.25.0" }
41+
jsonrpsee-wasm-client = { path = "client/wasm-client", version = "0.25.0" }
42+
jsonrpsee-ws-client = { path = "client/ws-client", version = "0.25.0" }
4343

4444
# Deps used by the jsonrpsee crates.
4545
async-trait = "0.1"

0 commit comments

Comments
 (0)