From a2d9661b99de58baaa43a2316a16546f1d43c159 Mon Sep 17 00:00:00 2001 From: Pablo Deymonnaz Date: Fri, 6 Nov 2026 14:30:52 -0300 Subject: [PATCH 1/3] Bump spawned-concurrency and spawned-rt from 0.5.0 to 0.6.0 The 0.6.0 release adds actor links, monitors, exit reasons and the opt-in framework metrics feature, and fixes the idle stop/dispatch and shutdown-ordering races. No source changes: handler and protocol signatures are unchanged, and the per-message enqueue and receive paths are the same as 0.5.0 apart from metrics hooks that compile out. ethrex-p2p (v25.0.0) keeps its own spawned 0.5.0; no spawned type crosses that boundary, so both versions coexist in the lockfile. --- Cargo.lock | 195 ++++++++++++++++++++++++++++++++++++++--------------- Cargo.toml | 4 +- 2 files changed, 144 insertions(+), 55 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index aeda51e1b..c3e2d21d2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -733,7 +733,7 @@ dependencies = [ "miniz_oxide", "object", "rustc-demangle", - "windows-link", + "windows-link 0.2.1", ] [[package]] @@ -1075,7 +1075,7 @@ dependencies = [ "iana-time-zone", "num-traits", "serde", - "windows-link", + "windows-link 0.2.1", ] [[package]] @@ -1532,7 +1532,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ccc2776f0c61eca1ca32528f85548abd1a4be8fb53d1b21c013e4f18da1e7090" dependencies = [ "data-encoding", - "syn 1.0.109", + "syn 2.0.117", ] [[package]] @@ -2042,7 +2042,7 @@ dependencies = [ "serde", "serde_json", "snap", - "spawned-concurrency", + "spawned-concurrency 0.6.0", "thiserror 2.0.18", "tokio", "tokio-util", @@ -2103,7 +2103,7 @@ name = "ethlambda-network-api" version = "1.0.0" dependencies = [ "ethlambda-types", - "spawned-concurrency", + "spawned-concurrency 0.6.0", ] [[package]] @@ -2133,7 +2133,7 @@ dependencies = [ "secp256k1 0.30.0", "sha2", "snap", - "spawned-concurrency", + "spawned-concurrency 0.6.0", "thiserror 2.0.18", "tokio", "tokio-stream", @@ -2164,7 +2164,7 @@ dependencies = [ "libssz-types 0.3.0 (git+https://github.com/lambdaclass/libssz?rev=5cb14378ffdadcb51b387c003567e2630d0c7073)", "serde", "serde_json", - "spawned-concurrency", + "spawned-concurrency 0.6.0", "tokio", "tokio-util", "tower", @@ -2504,8 +2504,8 @@ dependencies = [ "serde", "sha2", "snap", - "spawned-concurrency", - "spawned-rt", + "spawned-concurrency 0.5.0", + "spawned-rt 0.5.0", "thiserror 2.0.18", "tokio", "tokio-stream", @@ -2889,6 +2889,20 @@ dependencies = [ "slab", ] +[[package]] +name = "generator" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea6c6a73cd1aa4f4f00c02b109fa55d3a9d6ecc2fc4f53177b74ed6ee23b0c53" +dependencies = [ + "cc", + "libc", + "log", + "rustversion", + "windows-core 0.100.0", + "windows-sys 0.61.2", +] + [[package]] name = "generic-array" version = "0.14.7" @@ -3305,7 +3319,7 @@ dependencies = [ "libc", "percent-encoding", "pin-project-lite", - "socket2 0.5.10", + "socket2 0.6.3", "tokio", "tower-service", "tracing", @@ -3323,7 +3337,7 @@ dependencies = [ "js-sys", "log", "wasm-bindgen", - "windows-core 0.57.0", + "windows-core 0.62.2", ] [[package]] @@ -3700,7 +3714,7 @@ dependencies = [ "portable-atomic", "portable-atomic-util", "serde_core", - "windows-link", + "windows-link 0.2.1", ] [[package]] @@ -3936,7 +3950,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55" dependencies = [ "cfg-if", - "windows-link", + "windows-link 0.2.1", ] [[package]] @@ -4456,6 +4470,19 @@ version = "0.4.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" +[[package]] +name = "loom" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "419e0dc8046cb947daa77eb95ae174acfbddb7673b4151f56d1eed8e93fbfaca" +dependencies = [ + "cfg-if", + "generator", + "scoped-tls", + "tracing", + "tracing-subscriber", +] + [[package]] name = "lru" version = "0.16.4" @@ -5036,7 +5063,7 @@ dependencies = [ "libc", "redox_syscall", "smallvec", - "windows-link", + "windows-link 0.2.1", ] [[package]] @@ -5508,7 +5535,7 @@ dependencies = [ "quinn-udp", "rustc-hash", "rustls", - "socket2 0.5.10", + "socket2 0.6.3", "thiserror 2.0.18", "tokio", "tracing", @@ -5546,7 +5573,7 @@ dependencies = [ "cfg_aliases", "libc", "once_cell", - "socket2 0.5.10", + "socket2 0.6.3", "tracing", "windows-sys 0.60.2", ] @@ -6202,6 +6229,12 @@ dependencies = [ "serde_json", ] +[[package]] +name = "scoped-tls" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" + [[package]] name = "scopeguard" version = "1.2.0" @@ -6576,8 +6609,22 @@ checksum = "bc21166874e8cd7584ea795c223303160461f0bb1b571bc23e92ca2abb7c5149" dependencies = [ "futures", "pin-project-lite", - "spawned-macros", - "spawned-rt", + "spawned-macros 0.5.0", + "spawned-rt 0.5.0", + "thiserror 2.0.18", + "tracing", +] + +[[package]] +name = "spawned-concurrency" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a1b26c13182dad3dfab2b3f833dacee6fc1d9805022b1adbcabd40ca91cde6f" +dependencies = [ + "futures", + "pin-project-lite", + "spawned-macros 0.6.0", + "spawned-rt 0.6.0", "thiserror 2.0.18", "tracing", ] @@ -6593,6 +6640,17 @@ dependencies = [ "syn 2.0.117", ] +[[package]] +name = "spawned-macros" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9f1396f01c0f329ca5355e5a69c7cc9943977b8ba75cafd889e3ca3bd3632f" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + [[package]] name = "spawned-rt" version = "0.5.0" @@ -6607,6 +6665,21 @@ dependencies = [ "tracing-subscriber", ] +[[package]] +name = "spawned-rt" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8407acadfee8c48346315581459d2c0ee7171ebf4e5a02d9aec64a427012e55" +dependencies = [ + "ctrlc", + "loom", + "tokio", + "tokio-stream", + "tokio-util", + "tracing", + "tracing-subscriber", +] + [[package]] name = "sphincs" version = "0.1.0" @@ -7603,27 +7676,28 @@ dependencies = [ [[package]] name = "windows-core" -version = "0.57.0" +version = "0.62.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2ed2439a290666cd67ecce2b0ffaad89c2a56b976b736e6ece670297897832d" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" dependencies = [ - "windows-implement 0.57.0", - "windows-interface 0.57.0", - "windows-result 0.1.2", - "windows-targets 0.52.6", + "windows-implement 0.60.2", + "windows-interface 0.59.3", + "windows-link 0.2.1", + "windows-result 0.4.1", + "windows-strings 0.5.1", ] [[package]] name = "windows-core" -version = "0.62.2" +version = "0.100.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +checksum = "803590c6856f51d15fa2e9fabe4f4703122c8737f72ef2741b4ac09d4c2192f5" dependencies = [ - "windows-implement 0.60.2", - "windows-interface 0.59.3", - "windows-link", - "windows-result 0.4.1", - "windows-strings", + "windows-implement 0.100.0", + "windows-interface 0.100.0", + "windows-link 0.100.0", + "windows-result 0.100.0", + "windows-strings 0.100.0", ] [[package]] @@ -7633,15 +7707,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb" dependencies = [ "windows-core 0.62.2", - "windows-link", + "windows-link 0.2.1", "windows-threading", ] [[package]] name = "windows-implement" -version = "0.57.0" +version = "0.60.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9107ddc059d5b6fbfbffdfa7a7fe3e22a226def0b2608f72e9d552763d3e1ad7" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" dependencies = [ "proc-macro2", "quote", @@ -7650,9 +7724,9 @@ dependencies = [ [[package]] name = "windows-implement" -version = "0.60.2" +version = "0.100.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +checksum = "1bc1bc82e5a1b1a4d7255861b07881a0407b552f50a4d8543c0c7276fa96f6e8" dependencies = [ "proc-macro2", "quote", @@ -7661,9 +7735,9 @@ dependencies = [ [[package]] name = "windows-interface" -version = "0.57.0" +version = "0.59.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29bee4b38ea3cde66011baa44dba677c432a78593e202392d1e9070cf2a7fca7" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" dependencies = [ "proc-macro2", "quote", @@ -7672,9 +7746,9 @@ dependencies = [ [[package]] name = "windows-interface" -version = "0.59.3" +version = "0.100.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +checksum = "b3f7005c3b757b9b82c2f40c0e71094ff1080adddaf3e8b6ce99b545d3c48796" dependencies = [ "proc-macro2", "quote", @@ -7687,6 +7761,12 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" +[[package]] +name = "windows-link" +version = "0.100.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b39de7c7fe78858b0144c50c3fc000bab3be17d5e9b85b1053871693c7f7415" + [[package]] name = "windows-numerics" version = "0.3.1" @@ -7694,7 +7774,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26" dependencies = [ "windows-core 0.62.2", - "windows-link", + "windows-link 0.2.1", ] [[package]] @@ -7703,27 +7783,27 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "02752bf7fbdcce7f2a27a742f798510f3e5ad88dbe84871e5168e2120c3d5720" dependencies = [ - "windows-link", + "windows-link 0.2.1", "windows-result 0.4.1", - "windows-strings", + "windows-strings 0.5.1", ] [[package]] name = "windows-result" -version = "0.1.2" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e383302e8ec8515204254685643de10811af0ed97ea37210dc26fb0032647f8" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" dependencies = [ - "windows-targets 0.52.6", + "windows-link 0.2.1", ] [[package]] name = "windows-result" -version = "0.4.1" +version = "0.100.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +checksum = "44873a1ef61c85d5e2991db91fe656cfcf0731097e00dff1ac860f1cb3b752a0" dependencies = [ - "windows-link", + "windows-link 0.100.0", ] [[package]] @@ -7732,7 +7812,16 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" dependencies = [ - "windows-link", + "windows-link 0.2.1", +] + +[[package]] +name = "windows-strings" +version = "0.100.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a70b590c684f1d2854f74999896f7c0558f1bdde62f599088599e20ea1d2f60" +dependencies = [ + "windows-link 0.100.0", ] [[package]] @@ -7759,7 +7848,7 @@ version = "0.61.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" dependencies = [ - "windows-link", + "windows-link 0.2.1", ] [[package]] @@ -7784,7 +7873,7 @@ version = "0.53.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" dependencies = [ - "windows-link", + "windows-link 0.2.1", "windows_aarch64_gnullvm 0.53.1", "windows_aarch64_msvc 0.53.1", "windows_i686_gnu 0.53.1", @@ -7801,7 +7890,7 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37" dependencies = [ - "windows-link", + "windows-link 0.2.1", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index cb80e6e39..3d14e6c44 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -92,8 +92,8 @@ hex = "0.4" hmac = "0.12" base64 = "0.22" -spawned-concurrency = "0.5.0" -spawned-rt = "0.5.0" +spawned-concurrency = "0.6.0" +spawned-rt = "0.6.0" tokio = "1.0" tokio-util = "0.7" From df038cebd7fe1020838053895af4f087b1d1838b Mon Sep 17 00:00:00 2001 From: Pablo Deymonnaz Date: Fri, 6 Nov 2026 14:48:49 -0300 Subject: [PATCH 2/3] Enable spawned's metrics feature and serve its actor metrics on /metrics spawned 0.6.0 adds an opt-in `metrics` feature with process-wide aggregates: mailbox depth, sampled queue wait and handler duration, request latency and lifecycle counters. Its collector is separate from the prometheus registry and has no exporter, so `get_metrics` appends `render_prometheus()` to the registry text. The http_servers test pins that wiring and docs/metrics.md describes the series; `spawned_queue_wait_seconds` is the one that tells a backed-up chain-actor mailbox apart from slow handlers. --- Cargo.toml | 2 +- crates/net/rpc/Cargo.toml | 2 +- crates/net/rpc/src/metrics.rs | 9 ++++++--- crates/net/rpc/tests/http_servers.rs | 6 ++++++ docs/metrics.md | 28 ++++++++++++++++++++++++++++ 5 files changed, 42 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 3d14e6c44..44aee695a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -92,7 +92,7 @@ hex = "0.4" hmac = "0.12" base64 = "0.22" -spawned-concurrency = "0.6.0" +spawned-concurrency = { version = "0.6.0", features = ["metrics"] } spawned-rt = "0.6.0" tokio = "1.0" tokio-util = "0.7" diff --git a/crates/net/rpc/Cargo.toml b/crates/net/rpc/Cargo.toml index d07713af4..e43ac40cb 100644 --- a/crates/net/rpc/Cargo.toml +++ b/crates/net/rpc/Cargo.toml @@ -10,6 +10,7 @@ rust-version.workspace = true version.workspace = true [dependencies] +spawned-concurrency.workspace = true axum = "0.8.1" tokio = { workspace = true, features = ["macros", "time"] } tokio-util.workspace = true @@ -34,7 +35,6 @@ futures-util = "0.3" [dev-dependencies] ethlambda-validator.workspace = true -spawned-concurrency.workspace = true ethlambda-state-transition = { workspace = true, features = ["test-utils"] } ethlambda-types.workspace = true libssz-types.workspace = true diff --git a/crates/net/rpc/src/metrics.rs b/crates/net/rpc/src/metrics.rs index b07459e7e..2240c7a00 100644 --- a/crates/net/rpc/src/metrics.rs +++ b/crates/net/rpc/src/metrics.rs @@ -34,12 +34,15 @@ pub(crate) async fn get_health() -> impl IntoResponse { } pub(crate) async fn get_metrics() -> impl IntoResponse { - let mut response = gather_default_metrics() + let mut body = gather_default_metrics() .inspect_err(|err| { warn!(%err, "Failed to gather Prometheus metrics"); }) - .unwrap_or_default() - .into_response(); + .unwrap_or_default(); + // spawned's actor metrics (mailbox depth, queue wait, handler duration) live + // in its own collector, not the prometheus registry, so append its text. + body.push_str(&spawned_concurrency::metrics::render_prometheus()); + let mut response = body.into_response(); let content_type = HeaderValue::from_static("text/plain; version=0.0.4; charset=utf-8"); response .headers_mut() diff --git a/crates/net/rpc/tests/http_servers.rs b/crates/net/rpc/tests/http_servers.rs index 4c09d1692..74a728eaa 100644 --- a/crates/net/rpc/tests/http_servers.rs +++ b/crates/net/rpc/tests/http_servers.rs @@ -86,6 +86,12 @@ async fn with_no_api_router_metrics_and_debug_are_served_on_the_metrics_port() { status_line(&get(port, "/metrics").await).contains("200"), "/metrics must be served" ); + assert!( + get(port, "/metrics") + .await + .contains("spawned_mailbox_depth"), + "/metrics must carry spawned's actor metrics after the registry text" + ); // Debug: `beacon` gains these by going through the shared entry point. // Heap profiling was previously node-only. assert!( diff --git a/docs/metrics.md b/docs/metrics.md index fe34487c6..fbc33adb6 100644 --- a/docs/metrics.md +++ b/docs/metrics.md @@ -939,6 +939,34 @@ guards caught a duty they judged unsafe, and `fee_recipient_mismatches_total` means blocks are being proposed that pay someone else. `envelope_failures_total` belongs with them on a gloas network. +### Actor Runtime (spawned) + +`/metrics` also carries the actor framework's own counters, appended after the +prometheus registry text. They come from `spawned-concurrency`'s `metrics` +feature (on in the workspace manifest), which keeps fixed process-wide +aggregates with no per-actor labels: every series sums the BlockChain and P2P +actors together. The collector has no exporter of its own, so `get_metrics` +appends `spawned_concurrency::metrics::render_prometheus()` to the body. + +| Metric | Type | Description | +|--------|------|-------------| +| `spawned_mailbox_depth` | gauge | Messages waiting in actor mailboxes, excluding the handler currently running | +| `spawned_queue_wait_seconds` | histogram | Enqueue to handler start, so the time a message spent behind the actor's other work | +| `spawned_handler_duration_seconds` | histogram | Handler dispatch to completion, awaited time included | +| `spawned_request_latency_seconds` | histogram | Caller-side `call` lifetime to reply, timeout or actor stop | +| `spawned_messages_{enqueued,handled,rejected,discarded}_total` | counter | Delivery accounting; `rejected` is a send to a stopped actor, `discarded` a queued message dropped at stop | +| `spawned_handlers_{completed,panicked,aborted}_total`, `spawned_handlers_active` | counter, gauge | Handler outcomes | +| `spawned_requests_{started,replied,timed_out,actor_stopped,cancelled}_total`, `spawned_requests_active` | counter, gauge | `call` outcomes | +| `spawned_actors_spawned_total`, `spawned_actors_active`, `spawned_actors_exited_{normal,shutdown,panic,kill}_total` | counter, gauge | Actor lifecycle | + +Every observation is timed (`timing_sample_every` is left at its default of 1): +the lean actors see a few hundred messages per slot, and the `(slot, message)` +periodicity of that traffic would bias a deterministic 1-in-N sample. The +histograms use spawned's fixed power-of-two buckets from 1 µs to about 1 s. +`spawned_queue_wait_seconds` is the one to watch: a rising p99 on it, with +`lean_tick_interval_duration_seconds` steady, means the chain actor's mailbox is +backing up behind long handlers rather than the handlers themselves getting slow. + ## Troubleshooting ### Docker Desktop on MacOS From 5259dee25b81cc5275a4b0f441f24361d4f4b940 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Gr=C3=BCner?= <47506558+MegaRedHand@users.noreply.github.com> Date: Fri, 6 Nov 2026 16:50:51 -0300 Subject: [PATCH 3/3] test(beacon): make the committee key-sum tests preset-agnostic The two attesters_aggregate_pubkey tests added in #742 assumed the mainnet preset, but `make test-beacon-minimal` (and the minimal-preset test job) runs the crate's `--lib` target with `preset-minimal` too, so both failed on `nightly` regardless of what a PR changes: - the_builder_key_is_the_attesters_sum_with_cold_and_warm_sums used slot offset 31, past minimal's 8-slot epoch (SpecAssert "compute_epoch_at_slot(slot) == epoch"). - a_committee_with_an_invalid_member_key_falls_back took members[5] of a committee that holds 4 members under minimal (index out of bounds). Take the last offset from preset::SLOTS_PER_EPOCH and the bad member from the committee's middle, so both run under either preset. Unrelated to the spawned bump; it is here because every PR against `nightly` hits it. Claude-Session: https://claude.ai/code/session_011vghNnzUEcJNqbPoqE7BUE --- .../state_transition/src/beacon/helpers/electra.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/crates/blockchain/state_transition/src/beacon/helpers/electra.rs b/crates/blockchain/state_transition/src/beacon/helpers/electra.rs index d8e811592..e54741af9 100644 --- a/crates/blockchain/state_transition/src/beacon/helpers/electra.rs +++ b/crates/blockchain/state_transition/src/beacon/helpers/electra.rs @@ -2240,7 +2240,10 @@ mod tests { use crate::beacon::primitives::Root; /// Enough validators for two committees per slot, so one attestation can - /// name two committees; mainnet's preset is the only one these run under. + /// name two committees. These tests run under both presets (`make + /// test-beacon-minimal` runs `--lib` with `preset-minimal`), so slots and + /// member positions are derived from the preset rather than hardcoded: + /// minimal's epoch is 8 slots and its committees here hold 4 members. fn two_committees_per_slot_state() -> BeaconState { let count = (preset::SLOTS_PER_EPOCH * preset::TARGET_COMMITTEE_SIZE * 2) as usize; with_signing_validators_at(ForkName::Electra, count) @@ -2291,7 +2294,7 @@ mod tests { assert!(warm.key_sums(&state, epoch).is_some()); assert!(cold.key_sums(&state, epoch).is_none()); - for slot_offset in [0u64, 7, 31] { + for slot_offset in [0u64, 7, preset::SLOTS_PER_EPOCH - 1] { let slot = compute_start_slot_at_epoch(epoch) + slot_offset; let committee_sets: [&[usize]; 3] = [&[0], &[1], &[0, 1]]; for named in committee_sets { @@ -2374,7 +2377,7 @@ mod tests { .committee(slot, 0) .unwrap() .to_vec(); - let bad = members[5]; + let bad = members[members.len() / 2]; state.validator_mut(bad).unwrap().pubkey = Default::default(); let committees = CommitteeCache::default();