Skip to content

Commit

Permalink
fix(prover): grpc server support gzip
Browse files Browse the repository at this point in the history
  • Loading branch information
oyyblin committed Dec 26, 2024
1 parent a45b8f8 commit c516805
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
20 changes: 20 additions & 0 deletions prover-service/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 prover-service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ path = "src/bin/server.rs"
[dependencies]
sp1-sdk = "3.0.0"
alloy-sol-types = "0.8.12"
tonic = "0.10"
tonic = { version = "0.10", features = ["gzip"] }
tonic-health = "0.10"
prost = "0.12"
tokio = { version = "1.0", features = ["macros", "rt-multi-thread"] }
Expand Down
8 changes: 7 additions & 1 deletion prover-service/src/bin/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use clap::Parser;
use prover_service::proto::prover::prover_service_server::ProverServiceServer;
use prover_service::service::ProverServiceImpl;
use std::net::SocketAddr;
use tonic::codec::CompressionEncoding;
use tonic::transport::Server;
use tonic_health::server::health_reporter;
use warp::Filter;
Expand Down Expand Up @@ -76,11 +77,16 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
.await;
});

// Start prover service
let prover_service = ProverServiceServer::new(service)
.accept_compressed(CompressionEncoding::Gzip)
.send_compressed(CompressionEncoding::Gzip);

// Serve requests
log::info!("Health Server and GRPC Prover Server listening on {}", addr);
Server::builder()
.add_service(health_service)
.add_service(ProverServiceServer::new(service))
.add_service(prover_service)
.serve(addr)
.await?;
Ok(())
Expand Down

0 comments on commit c516805

Please sign in to comment.