Jonathan/fix map get active validator indices#46
Conversation
|
@JonathanLorimer Awesome thanks for pointing that out! I made a super simple js file to test out the functionality and you're in-fact correct, looks like using reduce definitely solves the issue! |
GregTheGreek
left a comment
There was a problem hiding this comment.
Can you make a few tests so we can have those pass :)
Maybe 1 with an empty validator list, with all validators that have active set and an array with no active?
|
@GregTheGreek added the test cases, just two things.
|
|
@JonathanLorimer 1 - Good point, I'll make that fix in a pr. 2 - I'm going to look into this, not sure why it's causing an issue. Previous pr it didn't seem to have that. Checking it out on my machine right now. |
|
@JonathanLorimer Ok i found out why its failing, line 24 of After running Otherwise it's good to merge :) |
|
@JonathanLorimer Great work, thanks for contributing! :) |
…elements [ETHDenver] Merkleize ssz container elements
Key fixes in 2.0.x: - Benchmark failures are now logged and cause CI to exit non-zero instead of being silently dropped (PR ChainSafe#45) - CLI uses parseAsync to properly propagate async errors (PR ChainSafe#46) Resolves ChainSafe#7484
## Motivation Bumps `@chainsafe/benchmark` from `1.2.3` to `2.0.2`, which includes fixes for error handling that were silently swallowing benchmark failures. ### Fixes included in 2.0.x - **[PR #45](ChainSafe/benchmark#45 — Benchmark failures are now logged to stderr and cause CI to exit non-zero instead of being silently dropped - **[PR #46](ChainSafe/benchmark#46 — CLI uses `parseAsync()` to properly propagate async handler errors to exit code ### Verification Ran fork-choice benchmarks locally to confirm they pass with the new version: - `computeDeltas` — 8/8 passing - `forkChoice/updateHead` — 9/9 passing - `forkChoice/onAttestation` — 1/1 passing - `utils/bytes` — 20/20 passing Resolves #7484 Co-authored-by: lodekeeper <lodekeeper@users.noreply.github.com>
Small change:
Mutation with map isn't an issue, as it creates a new array with the mapped values. However, if you don't return a value within the lambda provided to map then it will, by default, insert undefined into the array. To avoid this, and do the filtering in a single iteration, I implemented reduce.