From fd4c8e020f4256a5a1585f4bd97a78d371eca1d6 Mon Sep 17 00:00:00 2001 From: Andrew Schran Date: Thu, 12 Jan 2023 11:01:28 -0800 Subject: [PATCH] Migrate RequestVote inflight limit to use anemo middleware --- Cargo.lock | 80 +++++++++++++++++++++- Cargo.toml | 6 +- crates/sui-node/src/lib.rs | 11 ++- crates/workspace-hack/Cargo.toml | 24 +++++-- narwhal/primary/src/primary.rs | 44 ++++-------- narwhal/primary/src/tests/primary_tests.rs | 8 --- narwhal/worker/src/worker.rs | 4 ++ 7 files changed, 125 insertions(+), 52 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a4c97e5619898..1975314fa83d9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -123,7 +123,7 @@ dependencies = [ [[package]] name = "anemo" version = "0.0.0" -source = "git+https://github.com/mystenlabs/anemo.git?rev=ccfb77628ec1883121079f1ae9c65e9c716709c8#ccfb77628ec1883121079f1ae9c65e9c716709c8" +source = "git+https://github.com/mystenlabs/anemo.git?rev=47c5cbd4a612a0ee8bd9ae61a4673e6b47555928#47c5cbd4a612a0ee8bd9ae61a4673e6b47555928" dependencies = [ "anyhow", "async-trait", @@ -155,7 +155,7 @@ dependencies = [ [[package]] name = "anemo-build" version = "0.0.0" -source = "git+https://github.com/mystenlabs/anemo.git?rev=ccfb77628ec1883121079f1ae9c65e9c716709c8#ccfb77628ec1883121079f1ae9c65e9c716709c8" +source = "git+https://github.com/mystenlabs/anemo.git?rev=47c5cbd4a612a0ee8bd9ae61a4673e6b47555928#47c5cbd4a612a0ee8bd9ae61a4673e6b47555928" dependencies = [ "prettyplease", "proc-macro2 1.0.49", @@ -166,12 +166,16 @@ dependencies = [ [[package]] name = "anemo-tower" version = "0.0.0" -source = "git+https://github.com/mystenlabs/anemo.git?rev=ccfb77628ec1883121079f1ae9c65e9c716709c8#ccfb77628ec1883121079f1ae9c65e9c716709c8" +source = "git+https://github.com/mystenlabs/anemo.git?rev=47c5cbd4a612a0ee8bd9ae61a4673e6b47555928#47c5cbd4a612a0ee8bd9ae61a4673e6b47555928" dependencies = [ "anemo", "bytes", + "dashmap", "futures", + "governor", + "nonzero_ext", "pin-project-lite", + "tokio", "tower", "tracing", "uuid", @@ -3097,6 +3101,24 @@ dependencies = [ "web-sys", ] +[[package]] +name = "governor" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c390a940a5d157878dd057c78680a33ce3415bcd05b4799509ea44210914b4d5" +dependencies = [ + "cfg-if", + "dashmap", + "futures", + "futures-timer", + "no-std-compat", + "nonzero_ext", + "parking_lot 0.12.1", + "quanta", + "rand 0.8.5", + "smallvec", +] + [[package]] name = "group" version = "0.12.1" @@ -4104,6 +4126,15 @@ dependencies = [ "serde 1.0.152", ] +[[package]] +name = "mach" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa" +dependencies = [ + "libc", +] + [[package]] name = "match_opt" version = "0.1.2" @@ -5693,6 +5724,12 @@ dependencies = [ "libc", ] +[[package]] +name = "no-std-compat" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b93853da6d84c2e3c7d730d6473e8817692dd89be387eb01b94d7f108ecb5b8c" + [[package]] name = "nom" version = "5.1.2" @@ -5727,6 +5764,12 @@ dependencies = [ "minimal-lexical", ] +[[package]] +name = "nonzero_ext" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38bf9645c8b145698bb0b18a4637dcacbc421ea49bef2317e4fd8065a387cf21" + [[package]] name = "normalize-line-endings" version = "0.3.0" @@ -6813,6 +6856,22 @@ dependencies = [ "tint", ] +[[package]] +name = "quanta" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20afe714292d5e879d8b12740aa223c6a88f118af41870e8b6196e39a02238a8" +dependencies = [ + "crossbeam-utils", + "libc", + "mach", + "once_cell", + "raw-cpuid", + "wasi 0.10.0+wasi-snapshot-preview1", + "web-sys", + "winapi", +] + [[package]] name = "quick-error" version = "1.2.3" @@ -7034,6 +7093,15 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "raw-cpuid" +version = "10.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6823ea29436221176fe662da99998ad3b4db2c7f31e7b6f5fe43adccd6320bb" +dependencies = [ + "bitflags", +] + [[package]] name = "rayon" version = "1.6.1" @@ -11209,6 +11277,7 @@ dependencies = [ "gloo-net", "gloo-timers", "gloo-utils", + "governor", "group", "guppy", "guppy-summaries", @@ -11298,6 +11367,7 @@ dependencies = [ "linux-raw-sys", "lock_api", "log", + "mach", "match_opt", "matchers", "matchit 0.5.0", @@ -11364,9 +11434,11 @@ dependencies = [ "nibble_vec", "nix 0.23.2", "nix 0.24.3", + "no-std-compat", "nom 5.1.2", "nom 6.1.2", "nom 7.1.2", + "nonzero_ext", "normalize-line-endings", "nu-ansi-term", "num", @@ -11469,6 +11541,7 @@ dependencies = [ "protobuf", "protobuf-src", "ptree", + "quanta", "quick-error 1.2.3", "quick-error 2.0.1", "quick-xml", @@ -11490,6 +11563,7 @@ dependencies = [ "rand_distr", "rand_xorshift", "rand_xoshiro", + "raw-cpuid", "rayon", "rayon-core", "rcgen 0.10.0", diff --git a/Cargo.toml b/Cargo.toml index 901d2153005ac..96a7f086d3e31 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -130,9 +130,9 @@ fastcrypto = { git = "https://github.com/MystenLabs/fastcrypto", rev = "f451422b fastcrypto-zkp = { git = "https://github.com/MystenLabs/fastcrypto", rev = "f451422b7f15e75e055a1830cbe5d1547fa87b74", package = "fastcrypto-zkp" } # anemo dependencies -anemo = { git = "https://github.com/mystenlabs/anemo.git", rev = "ccfb77628ec1883121079f1ae9c65e9c716709c8" } -anemo-build = { git = "https://github.com/mystenlabs/anemo.git", rev = "ccfb77628ec1883121079f1ae9c65e9c716709c8" } -anemo-tower = { git = "https://github.com/mystenlabs/anemo.git", rev = "ccfb77628ec1883121079f1ae9c65e9c716709c8" } +anemo = { git = "https://github.com/mystenlabs/anemo.git", rev = "47c5cbd4a612a0ee8bd9ae61a4673e6b47555928" } +anemo-build = { git = "https://github.com/mystenlabs/anemo.git", rev = "47c5cbd4a612a0ee8bd9ae61a4673e6b47555928" } +anemo-tower = { git = "https://github.com/mystenlabs/anemo.git", rev = "47c5cbd4a612a0ee8bd9ae61a4673e6b47555928" } # Use the same workspace-hack across crates. workspace-hack = { path = "crates/workspace-hack" } diff --git a/crates/sui-node/src/lib.rs b/crates/sui-node/src/lib.rs index 736edcff8e23a..03f479c40cd09 100644 --- a/crates/sui-node/src/lib.rs +++ b/crates/sui-node/src/lib.rs @@ -393,10 +393,19 @@ impl SuiNode { ))) .into_inner(); + let mut anemo_config = config.p2p_config.anemo_config.clone().unwrap_or_default(); + if anemo_config.max_frame_size.is_none() { + // Temporarily set a default size limit of 8 MiB for all RPCs. This helps us + // catch bugs where size limits are missing from other parts of our code. + // TODO: remove this and revert to default anemo max_frame_size once size + // limits are fully implemented on sui data structures. + anemo_config.max_frame_size = Some(8 << 20); + } + let network = Network::bind(config.p2p_config.listen_address) .server_name("sui") .private_key(config.network_key_pair().copy().private().0.to_bytes()) - .config(config.p2p_config.anemo_config.clone().unwrap_or_default()) + .config(anemo_config) .outbound_request_layer(outbound_layer) .start(service)?; info!("P2p network started on {}", network.local_addr()); diff --git a/crates/workspace-hack/Cargo.toml b/crates/workspace-hack/Cargo.toml index a20f603055809..e4d037a3d0ac1 100644 --- a/crates/workspace-hack/Cargo.toml +++ b/crates/workspace-hack/Cargo.toml @@ -26,8 +26,8 @@ aho-corasick = { version = "0.7" } aliasable = { version = "0.1" } alloc-no-stdlib = { version = "2", default-features = false } alloc-stdlib = { version = "0.2", default-features = false } -anemo = { git = "https://github.com/mystenlabs/anemo.git", rev = "ccfb77628ec1883121079f1ae9c65e9c716709c8", default-features = false } -anemo-tower = { git = "https://github.com/mystenlabs/anemo.git", rev = "ccfb77628ec1883121079f1ae9c65e9c716709c8", default-features = false } +anemo = { git = "https://github.com/mystenlabs/anemo.git", rev = "47c5cbd4a612a0ee8bd9ae61a4673e6b47555928", default-features = false } +anemo-tower = { git = "https://github.com/mystenlabs/anemo.git", rev = "47c5cbd4a612a0ee8bd9ae61a4673e6b47555928", default-features = false } anes = { version = "0.1" } ansi_term = { version = "0.12", default-features = false } anyhow = { version = "1", features = ["backtrace"] } @@ -241,6 +241,7 @@ globwalk = { version = "0.8", default-features = false } gloo-net = { version = "0.2", default-features = false, features = ["json", "websocket"] } gloo-timers = { version = "0.2", features = ["futures"] } gloo-utils = { version = "0.1", default-features = false, features = ["serde"] } +governor = { version = "0.5" } group = { version = "0.12", default-features = false } guppy = { version = "0.15", default-features = false, features = ["rayon1", "summaries"] } guppy-summaries = { version = "0.7", default-features = false } @@ -370,9 +371,11 @@ nested = { version = "0.1", default-features = false } nexlint = { git = "https://github.com/nextest-rs/nexlint.git", rev = "78f131b6e56b7d2dc7419997bc757f015f6d58df", default-features = false } nexlint-lints = { git = "https://github.com/nextest-rs/nexlint.git", rev = "78f131b6e56b7d2dc7419997bc757f015f6d58df", default-features = false } nibble_vec = { version = "0.1", default-features = false } +no-std-compat = { version = "0.4", default-features = false, features = ["alloc", "std"] } nom-cdf1610d3e1514e9 = { package = "nom", version = "5" } nom-a490c3000a992113 = { package = "nom", version = "6" } nom-15128469a54ed75a = { package = "nom", version = "7" } +nonzero_ext = { version = "0.3" } normalize-line-endings = { version = "0.3", default-features = false } nu-ansi-term = { version = "0.46", default-features = false } num = { version = "0.4" } @@ -445,6 +448,7 @@ prost = { version = "0.11" } prost-types = { version = "0.11" } protobuf = { version = "2", default-features = false } ptree = { version = "0.4" } +quanta = { version = "0.9" } quick-error-dff4ba8e3ae991db = { package = "quick-error", version = "1", default-features = false } quick-error-f595c2ba2a3f28df = { package = "quick-error", version = "2", default-features = false } quinn = { version = "0.9", default-features = false, features = ["futures-io", "runtime-tokio", "tls-rustls"] } @@ -669,9 +673,9 @@ aho-corasick = { version = "0.7" } aliasable = { version = "0.1" } alloc-no-stdlib = { version = "2", default-features = false } alloc-stdlib = { version = "0.2", default-features = false } -anemo = { git = "https://github.com/mystenlabs/anemo.git", rev = "ccfb77628ec1883121079f1ae9c65e9c716709c8", default-features = false } -anemo-build = { git = "https://github.com/mystenlabs/anemo.git", rev = "ccfb77628ec1883121079f1ae9c65e9c716709c8", default-features = false } -anemo-tower = { git = "https://github.com/mystenlabs/anemo.git", rev = "ccfb77628ec1883121079f1ae9c65e9c716709c8", default-features = false } +anemo = { git = "https://github.com/mystenlabs/anemo.git", rev = "47c5cbd4a612a0ee8bd9ae61a4673e6b47555928", default-features = false } +anemo-build = { git = "https://github.com/mystenlabs/anemo.git", rev = "47c5cbd4a612a0ee8bd9ae61a4673e6b47555928", default-features = false } +anemo-tower = { git = "https://github.com/mystenlabs/anemo.git", rev = "47c5cbd4a612a0ee8bd9ae61a4673e6b47555928", default-features = false } anes = { version = "0.1" } ansi_term = { version = "0.12", default-features = false } anyhow = { version = "1", features = ["backtrace"] } @@ -918,6 +922,7 @@ globwalk = { version = "0.8", default-features = false } gloo-net = { version = "0.2", default-features = false, features = ["json", "websocket"] } gloo-timers = { version = "0.2", features = ["futures"] } gloo-utils = { version = "0.1", default-features = false, features = ["serde"] } +governor = { version = "0.5" } group = { version = "0.12", default-features = false } guppy = { version = "0.15", default-features = false, features = ["rayon1", "summaries"] } guppy-summaries = { version = "0.7", default-features = false } @@ -1061,9 +1066,11 @@ nested = { version = "0.1", default-features = false } nexlint = { git = "https://github.com/nextest-rs/nexlint.git", rev = "78f131b6e56b7d2dc7419997bc757f015f6d58df", default-features = false } nexlint-lints = { git = "https://github.com/nextest-rs/nexlint.git", rev = "78f131b6e56b7d2dc7419997bc757f015f6d58df", default-features = false } nibble_vec = { version = "0.1", default-features = false } +no-std-compat = { version = "0.4", default-features = false, features = ["alloc", "std"] } nom-cdf1610d3e1514e9 = { package = "nom", version = "5" } nom-a490c3000a992113 = { package = "nom", version = "6" } nom-15128469a54ed75a = { package = "nom", version = "7" } +nonzero_ext = { version = "0.3" } normalize-line-endings = { version = "0.3", default-features = false } nu-ansi-term = { version = "0.46", default-features = false } num = { version = "0.4" } @@ -1158,6 +1165,7 @@ prost-derive = { version = "0.11", default-features = false } prost-types = { version = "0.11" } protobuf = { version = "2", default-features = false } ptree = { version = "0.4" } +quanta = { version = "0.9" } quick-error-dff4ba8e3ae991db = { package = "quick-error", version = "1", default-features = false } quick-error-f595c2ba2a3f28df = { package = "quick-error", version = "2", default-features = false } quinn = { version = "0.9", default-features = false, features = ["futures-io", "runtime-tokio", "tls-rustls"] } @@ -1427,6 +1435,7 @@ ipnet = { version = "2" } jemalloc-ctl = { version = "0.5" } jemalloc-sys = { version = "0.5" } libc = { version = "0.2", default-features = false, features = ["extra_traits"] } +mach = { version = "0.3" } memmap2 = { version = "0.5", default-features = false } memoffset-3b31131e45eafb45 = { package = "memoffset", version = "0.6" } mio-ca01ad9e24f5d932 = { package = "mio", version = "0.7", features = ["os-util", "uds"] } @@ -1467,6 +1476,7 @@ ipnet = { version = "2" } jemalloc-ctl = { version = "0.5" } jemalloc-sys = { version = "0.5" } libc = { version = "0.2", default-features = false, features = ["extra_traits"] } +mach = { version = "0.3" } memmap2 = { version = "0.5", default-features = false } memoffset-3b31131e45eafb45 = { package = "memoffset", version = "0.6" } mio-ca01ad9e24f5d932 = { package = "mio", version = "0.7", features = ["os-util", "uds"] } @@ -1521,6 +1531,7 @@ openssl-sys = { version = "0.9", default-features = false } pprof = { version = "0.11", features = ["criterion", "flamegraph"] } quick-xml = { version = "0.26", default-features = false } rand_chacha-6f8ce4dd05d13bba = { package = "rand_chacha", version = "0.2", default-features = false, features = ["std"] } +raw-cpuid = { version = "10", default-features = false } rgb = { version = "0.8" } rustix = { version = "0.36", features = ["fs", "termios"] } signal-hook = { version = "0.3" } @@ -1565,6 +1576,7 @@ pprof = { version = "0.11", features = ["criterion", "flamegraph"] } protobuf-src = { version = "1", default-features = false } quick-xml = { version = "0.26", default-features = false } rand_chacha-6f8ce4dd05d13bba = { package = "rand_chacha", version = "0.2", default-features = false, features = ["std"] } +raw-cpuid = { version = "10", default-features = false } rgb = { version = "0.8" } rustix = { version = "0.36", features = ["fs", "termios"] } signal-hook = { version = "0.3" } @@ -1591,6 +1603,7 @@ native-tls = { version = "0.2", default-features = false } once_cell = { version = "1", default-features = false, features = ["unstable"] } output_vt100 = { version = "0.1", default-features = false } rand_chacha-6f8ce4dd05d13bba = { package = "rand_chacha", version = "0.2", default-features = false, features = ["std"] } +raw-cpuid = { version = "10", default-features = false } schannel = { version = "0.1", default-features = false } spin-d8f496e17d97b5cb = { package = "spin", version = "0.5", default-features = false } str-buf = { version = "1", default-features = false } @@ -1618,6 +1631,7 @@ native-tls = { version = "0.2", default-features = false } once_cell = { version = "1", default-features = false, features = ["unstable"] } output_vt100 = { version = "0.1", default-features = false } rand_chacha-6f8ce4dd05d13bba = { package = "rand_chacha", version = "0.2", default-features = false, features = ["std"] } +raw-cpuid = { version = "10", default-features = false } schannel = { version = "0.1", default-features = false } spin-d8f496e17d97b5cb = { package = "spin", version = "0.5", default-features = false } str-buf = { version = "1", default-features = false } diff --git a/narwhal/primary/src/primary.rs b/narwhal/primary/src/primary.rs index 8508d736a1982..7376597b24a38 100644 --- a/narwhal/primary/src/primary.rs +++ b/narwhal/primary/src/primary.rs @@ -14,18 +14,18 @@ use crate::{ BlockRemover, }; -use anemo::types::Address; +use anemo::{codegen::InboundRequestLayer, types::Address}; use anemo::{types::PeerInfo, Network, PeerId}; use anemo_tower::{ auth::{AllowedPeers, RequireAuthorizationLayer}, callback::CallbackLayer, + inflight_limit, trace::{DefaultMakeSpan, DefaultOnFailure, TraceLayer}, }; use async_trait::async_trait; use config::{Parameters, SharedCommittee, SharedWorkerCache, WorkerId, WorkerInfo}; use consensus::dag::Dag; use crypto::{KeyPair, NetworkKeyPair, NetworkPublicKey, PublicKey, Signature}; -use dashmap::DashSet; use fastcrypto::{ hash::Hash, signature_service::SignatureService, @@ -231,8 +231,12 @@ impl Primary { vote_digest_store, rx_narwhal_round_updates: rx_narwhal_round_updates.clone(), metrics: node_metrics.clone(), - request_vote_inflight: Arc::new(DashSet::new()), - }); + }) + // Allow only one inflight RequestVote RPC at a time per peer. + // This is required for correctness. + .add_layer_for_request_vote(InboundRequestLayer::new( + inflight_limit::InflightLimitLayer::new(1, inflight_limit::WaitMode::ReturnError), + )); let worker_service = WorkerToPrimaryServer::new(WorkerReceiverHandler { tx_our_digests, payload_store: payload_store.clone(), @@ -288,6 +292,10 @@ impl Primary { quic_config.keep_alive_interval_ms = Some(5_000); let mut config = anemo::Config::default(); config.quic = Some(quic_config); + // Set a default size limit of 8 MiB for all RPCs + // TODO: remove this and revert to default anemo max_frame_size once size + // limits are fully implemented on narwhal data structures. + config.max_frame_size = Some(8 << 20); // Set a default timeout of 300s for all RPC requests config.inbound_request_timeout_ms = Some(300_000); config.outbound_request_timeout_ms = Some(300_000); @@ -587,8 +595,6 @@ struct PrimaryReceiverHandler { /// Get a signal when the round changes. rx_narwhal_round_updates: watch::Receiver, metrics: Arc, - /// Used to ensure a maximum of one inflight vote request per header. - request_vote_inflight: Arc>, } #[allow(clippy::result_large_err)] @@ -843,17 +849,6 @@ impl PrimaryReceiverHandler { } } -// Deletes the tracked inflight request when the RequestVote RPC finishes or is dropped. -struct RequestVoteInflightGuard { - request_vote_inflight: Arc>, - author: PublicKey, -} -impl Drop for RequestVoteInflightGuard { - fn drop(&mut self) { - assert!(self.request_vote_inflight.remove(&self.author).is_some()); - } -} - #[async_trait] impl PrimaryToPrimary for PrimaryReceiverHandler { async fn send_message( @@ -877,21 +872,6 @@ impl PrimaryToPrimary for PrimaryReceiverHandler { &self, request: anemo::Request, ) -> Result, anemo::rpc::Status> { - // TODO: Remove manual code for tracking inflight requests once Anemo issue #9 is resolved. - let author = request.body().header.author.to_owned(); - let _inflight_guard = if self.request_vote_inflight.insert(author.clone()) { - RequestVoteInflightGuard { - request_vote_inflight: self.request_vote_inflight.clone(), - author, - } - } else { - return Err(anemo::rpc::Status::new_with_message( - // TODO: This should be 429 Too Many Requests, if/when Anemo adds that status code. - anemo::types::response::StatusCode::Unknown, - format!("vote request for author {author:?} already inflight"), - )); - }; - self.process_request_vote(request) .await .map(anemo::Response::new) diff --git a/narwhal/primary/src/tests/primary_tests.rs b/narwhal/primary/src/tests/primary_tests.rs index e39ae6e59860b..655e938c90c76 100644 --- a/narwhal/primary/src/tests/primary_tests.rs +++ b/narwhal/primary/src/tests/primary_tests.rs @@ -12,7 +12,6 @@ use bincode::Options; use config::{Parameters, WorkerId}; use consensus::{dag::Dag, metrics::ConsensusMetrics}; use crypto::PublicKey; -use dashmap::DashSet; use fastcrypto::{ encoding::{Encoding, Hex}, hash::Hash, @@ -319,7 +318,6 @@ async fn test_request_vote_missing_parents() { vote_digest_store: crate::common::create_test_vote_store(), rx_narwhal_round_updates, metrics: metrics.clone(), - request_vote_inflight: Arc::new(DashSet::new()), }; // Make some mock certificates that are parents of our new header. @@ -486,7 +484,6 @@ async fn test_request_vote_missing_batches() { vote_digest_store: crate::common::create_test_vote_store(), rx_narwhal_round_updates, metrics: metrics.clone(), - request_vote_inflight: Arc::new(DashSet::new()), }; // Make some mock certificates that are parents of our new header. @@ -605,7 +602,6 @@ async fn test_request_vote_already_voted() { vote_digest_store: crate::common::create_test_vote_store(), rx_narwhal_round_updates, metrics: metrics.clone(), - request_vote_inflight: Arc::new(DashSet::new()), }; // Make some mock certificates that are parents of our new header. @@ -757,7 +753,6 @@ async fn test_fetch_certificates_handler() { vote_digest_store: crate::common::create_test_vote_store(), rx_narwhal_round_updates, metrics: metrics.clone(), - request_vote_inflight: Arc::new(DashSet::new()), }; let mut current_round: Vec<_> = Certificate::genesis(&fixture.committee()) @@ -919,7 +914,6 @@ async fn test_process_payload_availability_success() { vote_digest_store: crate::common::create_test_vote_store(), rx_narwhal_round_updates, metrics: metrics.clone(), - request_vote_inflight: Arc::new(DashSet::new()), }; // GIVEN some mock certificates @@ -1063,7 +1057,6 @@ async fn test_process_payload_availability_when_failures() { vote_digest_store: crate::common::create_test_vote_store(), rx_narwhal_round_updates, metrics: metrics.clone(), - request_vote_inflight: Arc::new(DashSet::new()), }; // AND some mock certificates @@ -1155,7 +1148,6 @@ async fn test_request_vote_created_at_in_future() { vote_digest_store: crate::common::create_test_vote_store(), rx_narwhal_round_updates, metrics: metrics.clone(), - request_vote_inflight: Arc::new(DashSet::new()), }; // Make some mock certificates that are parents of our new header. diff --git a/narwhal/worker/src/worker.rs b/narwhal/worker/src/worker.rs index c491a4c3c1d4b..ebf83fef54351 100644 --- a/narwhal/worker/src/worker.rs +++ b/narwhal/worker/src/worker.rs @@ -197,6 +197,10 @@ impl Worker { quic_config.keep_alive_interval_ms = Some(5_000); let mut config = anemo::Config::default(); config.quic = Some(quic_config); + // Set a default size limit of 8 MiB for all RPCs + // TODO: remove this and revert to default anemo max_frame_size once size + // limits are fully implemented on narwhal data structures. + config.max_frame_size = Some(8 << 20); // Set a default timeout of 300s for all RPC requests config.inbound_request_timeout_ms = Some(300_000); config.outbound_request_timeout_ms = Some(300_000);