Commit 89f4a4d
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 1f6d085 commit 89f4a4d
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 | |
|---|---|---|---|
| |||
523 | 523 | | |
524 | 524 | | |
525 | 525 | | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
526 | 548 | | |
527 | 549 | | |
528 | 550 | | |
| |||
543 | 565 | | |
544 | 566 | | |
545 | 567 | | |
546 | | - | |
547 | | - | |
548 | | - | |
549 | | - | |
550 | | - | |
551 | | - | |
552 | | - | |
553 | | - | |
554 | | - | |
555 | | - | |
556 | | - | |
557 | | - | |
558 | | - | |
559 | | - | |
560 | | - | |
561 | | - | |
562 | | - | |
| 568 | + | |
563 | 569 | | |
564 | 570 | | |
565 | 571 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
470 | 470 | | |
471 | 471 | | |
472 | 472 | | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
473 | 478 | | |
474 | 479 | | |
475 | 480 | | |
| |||
0 commit comments