Skip to content

feat: client rpc middleware #1521

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 57 commits into from
Apr 11, 2025
Merged
Show file tree
Hide file tree
Changes from 53 commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
33ad778
feat: client rpc middleware
niklasad1 Jan 15, 2025
401dfc1
PoC works
niklasad1 Jan 29, 2025
11d7b4d
cargo fmt
niklasad1 Jan 29, 2025
622bffd
more refactoring
niklasad1 Feb 25, 2025
56be708
Merge remote-tracking branch 'origin/master' into na-client-rpc-middl…
niklasad1 Feb 26, 2025
93c9b6f
use Cow in Notification to avoid alloc
niklasad1 Feb 26, 2025
5929436
cleanup some todos
niklasad1 Feb 26, 2025
946afee
Merge remote-tracking branch 'origin/master' into na-client-rpc-middl…
niklasad1 Mar 10, 2025
ff64b91
rpc trait: return Result<MethodResponse, Err>
niklasad1 Mar 11, 2025
9515e40
remove infallible err
niklasad1 Mar 12, 2025
062ead3
make it compile
niklasad1 Mar 12, 2025
d52740b
fix tests
niklasad1 Mar 12, 2025
b508470
introduce client method response type
niklasad1 Mar 19, 2025
dec873f
fix faulty imports
niklasad1 Mar 20, 2025
3aa828d
minor cleanup
niklasad1 Mar 20, 2025
b1e3b41
introduce Batch/BatchEntry for middleware
niklasad1 Mar 21, 2025
46ef085
remove ignore for batch test
niklasad1 Mar 21, 2025
5759407
fix rustdocs
niklasad1 Mar 22, 2025
ee75d58
add rpc middleware for the async client
niklasad1 Mar 25, 2025
79216b5
remove serialize specific types
niklasad1 Mar 25, 2025
8849af5
commit missing file
niklasad1 Mar 25, 2025
6a6e3aa
no serde_json::Value
niklasad1 Mar 26, 2025
02fb917
more nit fixing
niklasad1 Mar 27, 2025
09b4e0b
more cleanup
niklasad1 Mar 27, 2025
763cad6
refactor method response client
niklasad1 Mar 28, 2025
0e2adb0
fix some nits
niklasad1 Mar 28, 2025
6b80964
add client middleware rpc
niklasad1 Mar 31, 2025
631d7c0
fix wasm build
niklasad1 Apr 1, 2025
4ddee29
Merge remote-tracking branch 'origin/master' into na-client-rpc-middl…
niklasad1 Apr 1, 2025
a7324d3
add client middleware example
niklasad1 Apr 1, 2025
38b5261
Update examples/examples/rpc_middleware_client.rs
niklasad1 Apr 1, 2025
9640517
ToJson -> RawValue
niklasad1 Apr 2, 2025
100bda0
Merge remote-tracking branch 'origin/master' into na-client-rpc-middl…
niklasad1 Apr 2, 2025
b051bd6
replace Future type with impl Trait
niklasad1 Apr 2, 2025
f03371a
revert changelog
niklasad1 Apr 2, 2025
cc08ebf
remove logger response future
niklasad1 Apr 2, 2025
9936607
some cleanup
niklasad1 Apr 3, 2025
4149181
move request timeout from transport to client
niklasad1 Apr 3, 2025
8161e01
more nit fixing
niklasad1 Apr 3, 2025
1f73b97
have pass over examples
niklasad1 Apr 4, 2025
de1461d
show proper batch middleware example
niklasad1 Apr 4, 2025
a148135
middleware: clean up batch type
niklasad1 Apr 4, 2025
5285fc4
fix wasm build
niklasad1 Apr 4, 2025
54c7fe3
Update Cargo.toml
niklasad1 Apr 5, 2025
cc7807e
doc: fix typo
niklasad1 Apr 5, 2025
f722acd
core: remove tracing mod
niklasad1 Apr 5, 2025
ed4fb5b
fix more clippy
niklasad1 Apr 5, 2025
52588f3
remove middleware error
niklasad1 Apr 9, 2025
39c1d19
address review grumbles
niklasad1 Apr 9, 2025
f6dada4
fix tests
niklasad1 Apr 9, 2025
6484bd2
fix tests
niklasad1 Apr 9, 2025
cd34d2c
ErrorResponse -> BatchEntryErr
niklasad1 Apr 9, 2025
ac5f60a
commit missing file
niklasad1 Apr 10, 2025
9feb968
move deserialize_with_ext to server again
niklasad1 Apr 11, 2025
2a67151
Update core/src/client/mod.rs
niklasad1 Apr 11, 2025
c9fb409
Merge branch 'master' into na-client-rpc-middleware
niklasad1 Apr 11, 2025
84b4e1c
client: enable default rpc logger
niklasad1 Apr 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,6 @@ rust_2024_compatibility = { level = "warn", priority = -1 }
missing_docs = { level = "warn", priority = -1 }
missing_debug_implementations = { level = "warn", priority = -1 }
missing_copy_implementations = { level = "warn", priority = -1 }

[workspace.lints.clippy]
manual_async_fn = { level = "allow", priority = -1 }
12 changes: 6 additions & 6 deletions benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use helpers::fixed_client::{
ws_handshake,
};
use helpers::{KIB, SUB_METHOD_NAME, UNSUB_METHOD_NAME};
use jsonrpsee::types::{Id, RequestSer};
use jsonrpsee::types::{Id, Request};
use pprof::criterion::{Output, PProfProfiler};
use tokio::runtime::Runtime as TokioRuntime;

Expand Down Expand Up @@ -101,7 +101,7 @@ impl RequestType {
}
}

fn v2_serialize(req: RequestSer<'_>) -> String {
fn v2_serialize(req: Request<'_>) -> String {
serde_json::to_string(&req).unwrap()
}

Expand All @@ -115,7 +115,7 @@ pub fn jsonrpsee_types_v2(crit: &mut Criterion) {
b.iter(|| {
let params = serde_json::value::RawValue::from_string("[1, 2]".to_string()).unwrap();

let request = RequestSer::borrowed(&Id::Number(0), &"say_hello", Some(&params));
let request = Request::borrowed("say_hello", Some(&params), Id::Number(0));
v2_serialize(request);
})
});
Expand All @@ -128,7 +128,7 @@ pub fn jsonrpsee_types_v2(crit: &mut Criterion) {
builder.insert(1u64).unwrap();
builder.insert(2u32).unwrap();
let params = builder.to_rpc_params().expect("Valid params");
let request = RequestSer::borrowed(&Id::Number(0), &"say_hello", params.as_deref());
let request = Request::borrowed("say_hello", params.as_deref(), Id::Number(0));
v2_serialize(request);
})
});
Expand All @@ -138,7 +138,7 @@ pub fn jsonrpsee_types_v2(crit: &mut Criterion) {
b.iter(|| {
let params = serde_json::value::RawValue::from_string(r#"{"key": 1}"#.to_string()).unwrap();

let request = RequestSer::borrowed(&Id::Number(0), &"say_hello", Some(&params));
let request = Request::borrowed("say_hello", Some(&params), Id::Number(0));
v2_serialize(request);
})
});
Expand All @@ -150,7 +150,7 @@ pub fn jsonrpsee_types_v2(crit: &mut Criterion) {
let mut builder = ObjectParams::new();
builder.insert("key", 1u32).unwrap();
let params = builder.to_rpc_params().expect("Valid params");
let request = RequestSer::borrowed(&Id::Number(0), &"say_hello", params.as_deref());
let request = Request::borrowed("say_hello", params.as_deref(), Id::Number(0));
v2_serialize(request);
})
});
Expand Down
1 change: 0 additions & 1 deletion client/http-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ serde = { workspace = true }
serde_json = { workspace = true }
thiserror = { workspace = true }
tokio = { workspace = true, features = ["time"] }
tracing = { workspace = true }
tower = { workspace = true, features = ["util"] }
url = { workspace = true }

Expand Down
Loading
Loading