Skip to content

Commit

Permalink
adds back max-rpc-payload-size option (#334)
Browse files Browse the repository at this point in the history
  • Loading branch information
segfaultdoc authored Aug 15, 2023
1 parent 4412572 commit 4ef9441
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
3 changes: 3 additions & 0 deletions ci/do-audit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ while [[ -n $1 ]]; do
done

cargo_audit_ignores=(
# Not too severe. Main issue is don't create keypair from independently derived public and private keys.
--ignore RUSTSEC-2022-0093

# `net2` crate has been deprecated; use `socket2` instead
#
# Blocked on https://github.com/paritytech/jsonrpc/issues/575
Expand Down
1 change: 1 addition & 0 deletions rpc/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ pub struct JsonRpcConfig {
pub full_api: bool,
pub obsolete_v1_7_api: bool,
pub rpc_scan_and_fix_roots: bool,
pub max_request_payload_size: Option<usize>,
}

impl JsonRpcConfig {
Expand Down
6 changes: 5 additions & 1 deletion rpc/src/rpc_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,10 @@ impl JsonRpcService {
(None, None)
};

let max_request_payload_size = config
.max_request_payload_size
.unwrap_or(MAX_REQUEST_PAYLOAD_SIZE);

let full_api = config.full_api;
let obsolete_v1_7_api = config.obsolete_v1_7_api;
let (request_processor, receiver) = JsonRpcRequestProcessor::new(
Expand Down Expand Up @@ -525,7 +529,7 @@ impl JsonRpcService {
]))
.cors_max_age(86400)
.request_middleware(request_middleware)
.max_request_body_size(MAX_REQUEST_PAYLOAD_SIZE)
.max_request_body_size(max_request_payload_size)
.start_http(&rpc_addr);

if let Err(e) = server {
Expand Down
10 changes: 10 additions & 0 deletions validator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1312,6 +1312,15 @@ pub fn main() {
.default_value(&default_rpc_threads)
.help("Number of threads to use for servicing RPC requests"),
)
.arg(
Arg::with_name("max_rpc_request_payload_size")
.long("max-rpc-request-payload-size")
.value_name("NUMBER")
.validator(is_parsable::<usize>)
.takes_value(true)
.required(false)
.help("Maximum payload size of RPC requests"),
)
.arg(
Arg::with_name("rpc_niceness_adj")
.long("rpc-niceness-adjustment")
Expand Down Expand Up @@ -3003,6 +3012,7 @@ pub fn main() {
rpc_niceness_adj: value_t_or_exit!(matches, "rpc_niceness_adj", i8),
account_indexes: account_indexes.clone(),
rpc_scan_and_fix_roots: matches.is_present("rpc_scan_and_fix_roots"),
max_request_payload_size: value_t!(matches, "max_rpc_request_payload_size", usize).ok(),
},
geyser_plugin_config_files,
rpc_addrs: value_t!(matches, "rpc_port", u16).ok().map(|rpc_port| {
Expand Down

0 comments on commit 4ef9441

Please sign in to comment.