Commit 87b2e47
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 <[email protected]>1 parent 5defa8d commit 87b2e47
File tree
3 files changed
+232
-252
lines changed- src
- llmq
- test
3 files changed
+232
-252
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
551 | 551 | | |
552 | 552 | | |
553 | 553 | | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
554 | 576 | | |
555 | 577 | | |
556 | 578 | | |
| |||
571 | 593 | | |
572 | 594 | | |
573 | 595 | | |
574 | | - | |
575 | | - | |
576 | | - | |
577 | | - | |
578 | | - | |
579 | | - | |
580 | | - | |
581 | | - | |
582 | | - | |
583 | | - | |
584 | | - | |
585 | | - | |
586 | | - | |
587 | | - | |
588 | | - | |
589 | | - | |
590 | | - | |
| 596 | + | |
591 | 597 | | |
592 | 598 | | |
593 | 599 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
478 | 478 | | |
479 | 479 | | |
480 | 480 | | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
481 | 486 | | |
482 | 487 | | |
483 | 488 | | |
| |||
0 commit comments