-
Notifications
You must be signed in to change notification settings - Fork 24
Open
Labels
Description
Overview
The aggregateSignatures function in the signing module handles critical security logic for combining threshold signatures. While basic functionality is tested, edge cases need coverage to ensure robustness.
Current Testing Gap
The function at packages/taco/src/sign.ts:38-54 lacks tests for several edge cases that could occur in production.
Test Cases to Add
Add the following test cases to packages/taco/test/taco-sign.test.ts:
-
Empty signatures object
- Input:
{}with any threshold - Expected: Should handle gracefully (define expected behavior)
- Input:
-
Threshold of 1 (already handled but not explicitly tested)
- Input: Single signature
- Expected: Return the single signature without concatenation
-
Threshold greater than available signatures
- Input: 2 signatures with threshold of 3
- Expected: Should only use available signatures (current behavior)
-
Invalid signature format
- Input: Signatures without '0x' prefix or invalid hex
- Expected: Define error handling behavior
-
Large threshold values
- Input: 10+ signatures with high threshold
- Expected: Correct concatenation of all signatures
-
Signature ordering consistency
- Input: Same signatures in different orders
- Expected: Consistent output (document if order matters)
Implementation Notes
describe('aggregateSignatures', () => {
it('should handle empty signatures object', () => {
// Test implementation
});
it('should return single signature when threshold is 1', () => {
// Test implementation
});
// ... more tests
});Files to Change
packages/taco/test/taco-sign.test.ts- Add new test suite foraggregateSignatures- Consider extracting
aggregateSignaturesfor easier testing if needed
Definition of Done
- All listed edge cases have test coverage
- Tests are well-documented with clear descriptions
- Tests follow existing testing patterns in the codebase
- All tests pass
- Coverage report shows improvement for the signing module