Skip to content

Commit

Permalink
Bump jsonrpsee (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
kostekIV authored Feb 22, 2024
1 parent 6d5f7ed commit a5144ea
Show file tree
Hide file tree
Showing 11 changed files with 137 additions and 46 deletions.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[submodule "vendor/governor"]
path = vendor/governor
url = https://github.com/AcalaNetwork/governor.git
[submodule "vendor/jsonrpsee"]
path = vendor/jsonrpsee
url = https://github.com/AcalaNetwork/jsonrpsee.git
148 changes: 121 additions & 27 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ tracing-subscriber = { version = "0.3.16", features = ["env-filter", "json"] }

prometheus-endpoint = "2.1.2"

jsonrpsee = { path = "./vendor/jsonrpsee/jsonrpsee", features = ["full"] }
jsonrpsee = { version = "0.22.1",features = ["full"] }
governor = { path = "./vendor/governor/governor" }

[dev-dependencies]
Expand Down
6 changes: 3 additions & 3 deletions benches/bench/rate_limit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use futures_util::FutureExt;
use governor::Jitter;
use governor::RateLimiter;
use jsonrpsee::server::middleware::rpc::RpcServiceT;
use jsonrpsee::types::{Request, ResponsePayload};
use jsonrpsee::MethodResponse;
use jsonrpsee::types::Request;
use jsonrpsee::{MethodResponse, ResponsePayload};
use std::num::NonZeroU32;
use std::time::Duration;
use subway::extensions::rate_limit::{build_quota, ConnectionRateLimit, IpRateLimit};
Expand All @@ -16,7 +16,7 @@ impl RpcServiceT<'static> for MockService {
type Future = BoxFuture<'static, MethodResponse>;

fn call(&self, req: Request<'static>) -> Self::Future {
async move { MethodResponse::response(req.id, ResponsePayload::result("ok"), 1024) }.boxed()
async move { MethodResponse::response(req.id, ResponsePayload::success("ok"), 1024) }.boxed()
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/extensions/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ use async_trait::async_trait;
use futures::TryFutureExt;
use jsonrpsee::{
core::{
client::{ClientT, Subscription, SubscriptionClientT},
Error, JsonValue,
client::{ClientT, Error, Subscription, SubscriptionClientT},
JsonValue,
},
ws_client::{WsClient, WsClientBuilder},
};
Expand Down
5 changes: 3 additions & 2 deletions src/extensions/rate_limit/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,16 @@ where
#[cfg(test)]
mod tests {
use super::*;
use jsonrpsee::types::{Id, ResponsePayload};
use jsonrpsee::types::Id;
use jsonrpsee::ResponsePayload;

#[derive(Clone)]
struct MockService;
impl RpcServiceT<'static> for MockService {
type Future = BoxFuture<'static, MethodResponse>;

fn call(&self, req: Request<'static>) -> Self::Future {
async move { MethodResponse::response(req.id, ResponsePayload::result("ok"), 1024) }.boxed()
async move { MethodResponse::response(req.id, ResponsePayload::success("ok"), 1024) }.boxed()
}
}

Expand Down
Loading

0 comments on commit a5144ea

Please sign in to comment.