Commit f5f6a7e
refactor: extract validation logic and add proper unit tests
Extract the pure validation logic from PreVerifyBatchedSigShares into
a new ValidateBatchedSigSharesStructure function that can be properly
unit tested without external dependencies.
Changes:
- Add ValidateBatchedSigSharesStructure() - validates duplicates,
bounds, and member validity without requiring IsQuorumActive,
IsMember, or HasVerificationVector
- Refactor PreVerifyBatchedSigShares() to use the extracted function
- Rewrite unit tests to actually test the extracted function instead
of reimplementing the logic manually
Test coverage (14 tests, all passing):
- Result structure tests (3): success, ban errors, non-ban errors
- Validation logic tests (11): success case, empty batch, duplicate
detection, bounds checking, member validity, error priority
These tests provide real value by exercising the actual validation
code and will catch regressions.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent c2ad362 commit f5f6a7e
3 files changed
Lines changed: 232 additions & 252 deletions
File tree
- src
- llmq
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
429 | 429 | | |
430 | 430 | | |
431 | 431 | | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
432 | 454 | | |
433 | 455 | | |
434 | 456 | | |
| |||
449 | 471 | | |
450 | 472 | | |
451 | 473 | | |
452 | | - | |
453 | | - | |
454 | | - | |
455 | | - | |
456 | | - | |
457 | | - | |
458 | | - | |
459 | | - | |
460 | | - | |
461 | | - | |
462 | | - | |
463 | | - | |
464 | | - | |
465 | | - | |
466 | | - | |
467 | | - | |
468 | | - | |
| 474 | + | |
469 | 475 | | |
470 | 476 | | |
471 | 477 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
467 | 467 | | |
468 | 468 | | |
469 | 469 | | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
470 | 475 | | |
471 | 476 | | |
472 | 477 | | |
| |||
0 commit comments