Skip to content

Commit

Permalink
feat: add decompression in rav requests
Browse files Browse the repository at this point in the history
Signed-off-by: Gustavo Inacio <[email protected]>
  • Loading branch information
gusinacio committed Nov 8, 2024
1 parent 61b47b3 commit 1963003
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions tap_aggregator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ futures-util = "0.3.28"
lazy_static = "1.4.0"
ruint = "1.10.1"
tower = { version = "0.4", features = ["util"] }
tower-http = { version = "0.6.1", features = ["decompression-zstd"]}

[dev-dependencies]
jsonrpsee = { workspace = true, features = ["http-client", "jsonrpsee-core"] }
Expand Down
5 changes: 5 additions & 0 deletions tap_aggregator/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ use anyhow::Result;
use jsonrpsee::{proc_macros::rpc, server::ServerBuilder, server::ServerHandle};
use lazy_static::lazy_static;
use prometheus::{register_counter, register_int_counter, Counter, IntCounter};
use tower::{Layer, ServiceBuilder};
use tower_http::decompression::RequestDecompressionLayer;

use crate::aggregator::check_and_aggregate_receipts;
use crate::api_versioning::{
Expand Down Expand Up @@ -217,12 +219,15 @@ pub async fn run_server(
max_response_body_size: u32,
max_concurrent_connections: u32,
) -> Result<(ServerHandle, std::net::SocketAddr)> {
let http_middleware = ServiceBuilder::new().layer(RequestDecompressionLayer::new().zstd(true));

// Setting up the JSON RPC server
println!("Starting server...");
let server = ServerBuilder::new()
.max_request_body_size(max_request_body_size)
.max_response_body_size(max_response_body_size)
.max_connections(max_concurrent_connections)
.set_http_middleware(http_middleware)
.http_only()
.build(format!("0.0.0.0:{}", port))
.await?;
Expand Down

0 comments on commit 1963003

Please sign in to comment.