diff --git a/Cargo.lock b/Cargo.lock index 4d9ad4f..6b5d9c7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2968,6 +2968,7 @@ version = "0.1.5" dependencies = [ "agave-geyser-plugin-interface", "anyhow", + "base64 0.21.7", "cargo-lock", "clap", "git-version", diff --git a/config.json b/config.json index c09fa3d..d4bc3fe 100644 --- a/config.json +++ b/config.json @@ -1,5 +1,5 @@ { - "libpath": "target/release/libquic_geyser_plugin.so", + "libpath": "target/debug/libquic_geyser_plugin.so", "quic_plugin": { "address": "0.0.0.0:10800", "compression_parameters": { @@ -7,5 +7,8 @@ "Lz4Fast": 8 } } + }, + "rpc_server" : { + "enable" : true } } diff --git a/plugin/Cargo.toml b/plugin/Cargo.toml index 74e7c40..3299914 100644 --- a/plugin/Cargo.toml +++ b/plugin/Cargo.toml @@ -39,6 +39,7 @@ quic-geyser-snapshot = { workspace = true } lite-account-manager-common = { workspace = true } itertools = { workspace = true } tokio = {workspace = true} +base64 = {workspace = true} [build-dependencies] anyhow = { workspace = true } diff --git a/plugin/src/rpc_server.rs b/plugin/src/rpc_server.rs index 770250d..ae52648 100644 --- a/plugin/src/rpc_server.rs +++ b/plugin/src/rpc_server.rs @@ -1,6 +1,7 @@ use std::str::FromStr; use std::time::Duration; +use base64::Engine; use itertools::Itertools; use jsonrpsee::server::ServerBuilder; use jsonrpsee::{core::RpcResult, proc_macros::rpc}; @@ -26,7 +27,7 @@ pub trait PluginRpc { ) -> RpcResult>>; #[method(name = "getSnapshot")] - async fn get_snapshot(&self, program_id_str: String) -> RpcResult>; + async fn get_snapshot(&self, program_id_str: String) -> RpcResult; } pub struct RpcServerImpl { @@ -53,8 +54,8 @@ impl RpcServerImpl { let http_server_handle = ServerBuilder::default() .set_middleware(middleware) .max_connections(10) - .max_request_body_size(16 * 1024 * 1024) // 16 MB - .max_response_body_size(64 * 1024 * 1024 * 1024) // 64 GB + .max_request_body_size(1024 * 1024) // 16 MB + .max_response_body_size(1024 * 1024) // 512 MBs .http_only() .build(http_addr.clone()) .await? @@ -155,7 +156,7 @@ impl PluginRpcServer for RpcServerImpl { } } - async fn get_snapshot(&self, program_id_str: String) -> RpcResult> { + async fn get_snapshot(&self, program_id_str: String) -> RpcResult { let program_id = Pubkey::from_str(program_id_str.as_str()) .map_err(|_| jsonrpsee::types::error::ErrorCode::InvalidParams)?; let res = self @@ -163,7 +164,7 @@ impl PluginRpcServer for RpcServerImpl { .create_snapshot(program_id) .await .map_err(|_| jsonrpsee::types::error::ErrorCode::InternalError)?; - Ok(res) + Ok(base64::engine::general_purpose::STANDARD.encode(res)) } }