-
Notifications
You must be signed in to change notification settings - Fork 17
fix: auth fetch hanging process and certificates exchange between peers #220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
1cea585
to
cdf7ca1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces comprehensive testing infrastructure improvements with better wallet mocking capabilities and enhanced certificate validation. The changes focus on replacing the old MockWallet implementation with a more flexible TestWallet system that provides better test isolation and cleaner APIs.
Key Changes:
- Replaced MockWallet with TestWallet: New TestWallet provides fluent API for test setup with OnXyz().ReturnSuccess/ReturnError patterns
- Enhanced certificate validation: Improved ValidateCertificates function with better error handling and concurrent processing
- Added comprehensive test utilities: New test certificate utilities and better logging infrastructure for tests
Reviewed Changes
Copilot reviewed 31 out of 32 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
wallet/mock.go | Removed legacy MockWallet implementation |
wallet/test_wallet.go | Added new TestWallet with fluent mocking API |
wallet/wallet_keys.go | Added key conversion utilities with generic type support |
auth/utils/validate_certificates.go | Enhanced certificate validation with concurrent processing |
Multiple test files | Updated to use new TestWallet instead of MockWallet |
Comments suppressed due to low confidence (2)
primitives/ec/symmetric.go:22
- [nitpick] The error message "failed to encrypt string" is redundant since the wrapped error from Encrypt already contains encryption failure context. Consider using a more specific message like "string encryption failed" or just return the wrapped error directly.
return "", fmt.Errorf("failed to encrypt string: %w", err)
auth/transports/simplified_http_transport.go:109
- [nitpick] The error message format uses pipe separator '|' between identity key and URL which could be confusing. Consider using a clearer format like 'key=%s url=%s' or separate the information more clearly.
return fmt.Errorf("%s message to (%s | %s) failed: %w", message.MessageType, message.IdentityKey.ToDERHex(), requestURL, err)
cdf7ca1
to
4ffd5db
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the wallet testing infrastructure by replacing the old MockWallet
with a new TestWallet
implementation. It introduces enhanced certificate handling with a dedicated test certificate manager and key derivation utilities, improving testing consistency and maintainability across the codebase.
Key Changes:
- Replaces
MockWallet
withTestWallet
that provides a fluent API for method mocking - Introduces
testcertificates.Manager
for certificate testing operations - Adds generic key derivation utilities with support for multiple input types (hex, WIF, PrivateKey)
Reviewed Changes
Copilot reviewed 32 out of 33 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
wallet/mock.go |
Removed old MockWallet implementation |
wallet/test_wallet.go |
Added new TestWallet with fluent mocking API |
wallet/wallet_keys.go |
Added generic key conversion utilities |
wallet/testcertificates/test_certificates_manager.go |
Added certificate testing framework |
util/test_cert_util/test_certificate_utils.go |
Added certificate creation utilities |
Multiple test files | Updated to use new TestWallet API |
Comments suppressed due to low confidence (4)
auth/peer.go:165
- This FIXME comment indicates incomplete implementation. Consider creating a GitHub issue to track this technical debt or implementing the context passing in this PR to avoid leaving incomplete work.
}
auth/peer.go:363
- This TODO indicates a design improvement opportunity. Since the code already implements context with timeout on lines 344-345, this TODO comment appears to be outdated and should be removed.
return nil, ErrTimeout
auth/peer.go:844
- This TODO comment suggests incomplete validation logic. Consider implementing default certificate validation or creating a GitHub issue to track this enhancement request.
if !valid {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
- Added reveal methods implementation (bsv-blockchain#219) - Added auth/certificate improvements (bsv-blockchain#217, bsv-blockchain#220) - Added testing infrastructure improvements - Updated dependencies
THIS PR IS BASED ON #217