Add more tests for Byzantine roubust aggregator#1042
Open
mina5rovic wants to merge 1 commit intodevelopfrom
Open
Add more tests for Byzantine roubust aggregator#1042mina5rovic wants to merge 1 commit intodevelopfrom
mina5rovic wants to merge 1 commit intodevelopfrom
Conversation
Collaborator
mina5rovic
commented
Feb 6, 2026
- Adds test coverage for Byzantine robust aggregator
- Covers edge cases and expected behavior
- No aggregator code changes
JulienVig
requested changes
Mar 9, 2026
Collaborator
JulienVig
left a comment
There was a problem hiding this comment.
Thanks for the additional tests! fast-check is a cool library I hadn't heard of property-based testing before.
Running the fast check test seems to be a bit flaky, alternating between passing and failing.
Here's what it looks like when it fails (I bumped the number of runs to 2000 to have it fail more frequently)
$ npm -w discojs test -- -t 'bounds the marginal influence of a single Byzantine client'
FAIL discojs discojs/src/aggregator/byzantine.spec.ts > ByzantineRobustAggregator > bounds the marginal influence of a single Byzantine client
Error: Property failed after 1306 tests
{ seed: -459713346, path: "1305:65:63:63:63", endOnFailure: true }
Counterexample: [[Number.NaN,0,0,0]]
Shrunk 4 time(s)
Got AssertionError: expected NaN to be less than or equal to 0.4
at byzantine-tests-mina5rovic/discojs/src/aggregator/byzantine.spec.ts:209:29
at processTicksAndRejections (node:internal/process/task_queues:105:5)
at AsyncProperty.run (file:byzantine-tests-mina5rovic/discojs/node_modules/fast-check/lib/esm/check/property/AsyncProperty.generic.js:46:28)
at asyncRunIt (file:byzantine-tests-mina5rovic/discojs/node_modules/fast-check/lib/esm/check/runner/Runner.js:33:21)
at byzantine-tests-mina5rovic/discojs/src/aggregator/byzantine.spec.ts:180:5
at file:byzantine-tests-mina5rovic/node_modules/@vitest/runner/dist/index.js:915:20
Hint: Enable verbose mode in order to have the list of all failing values encountered during the run
❯ discojs/src/aggregator/byzantine.spec.ts:209:29
207| const deviation = Math.abs(byz - clean);
208| const maxAllowed = 2 * clipRadius / n; // realistic tolerance for extreme inputs
209| expect(deviation).toBeLessThanOrEqual(maxAllowed);
| ^
210| }
211| ),
❯ AsyncProperty.run discojs/node_modules/fast-check/lib/esm/check/property/AsyncProperty.generic.js:46:28
❯ asyncRunIt discojs/node_modules/fast-check/lib/esm/check/runner/Runner.js:33:21
❯ discojs/src/aggregator/byzantine.spec.ts:180:5
❯ buildError discojs/node_modules/fast-check/lib/esm/check/runner/utils/RunDetailsFormatter.js:126:15
❯ asyncThrowIfFailed discojs/node_modules/fast-check/lib/esm/check/runner/utils/RunDetailsFormatter.js:143:11
| "nodemon": "3", | ||
| "ts-node": "10" | ||
| "ts-node": "10", | ||
| "fast-check": "^3" |
Collaborator
There was a problem hiding this comment.
Suggested change
| "fast-check": "^3" | |
| "fast-check": "3" |
We usually keep the version fixed to avoid unintentional updates and break-downs
| "eslint": "9", | ||
| "eslint-plugin-cypress": "5", | ||
| "eslint-plugin-vue": "10", | ||
| "fast-check": "^4.5.3", |
Collaborator
There was a problem hiding this comment.
If you only need to use fast-check for discojs then no need to add it to the whole project. Also this version is different from the one installed in discojs, which one do you want to use?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.