Added Utils unit tests - envelope and crypto#103
Merged
Conversation
Effi-S
commented
Aug 7, 2025
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds comprehensive unit tests for two utility modules - envelope wrapper and crypto - while adding nil checks for improved error handling. The changes enhance test coverage for cryptographic key serialization/parsing functions and envelope wrapping/unwrapping operations.
- Added nil input validation to crypto functions with corresponding error messages
- Created comprehensive test suites covering both valid and invalid input scenarios
- Refactored envelope wrapper to separate payload wrapping from full envelope wrapping
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| utils/signature/sigtest/crypto_test.go | New comprehensive test suite for crypto functions with edge cases |
| utils/signature/sigtest/crypto.go | Added nil check for signing key serialization |
| utils/serialization/envelope_wrapper_test.go | New test suite for envelope operations with error scenarios |
| utils/serialization/envelope_wrapper.go | Added nil header validation and refactored envelope wrapping |
7e6c2fc to
914f0f8
Compare
liran-funaro
reviewed
Nov 3, 2025
6336dd6 to
1b6a599
Compare
Signed-off-by: Effi-S <effi.szt@gmail.com>
Signed-off-by: Effi-S <effi.szt@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Effi-S <57197982+Effi-S@users.noreply.github.com> Signed-off-by: Effi-S <effi.szt@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Effi-S <57197982+Effi-S@users.noreply.github.com> Signed-off-by: Effi-S <effi.szt@gmail.com>
Signed-off-by: Effi-S <effi.szt@gmail.com>
…ad2a514477b29d5e1229160034bc7345b03b2f539e5de01746 Signed-off-by: Effi-S <effi.szt@gmail.com>
Signed-off-by: Effi-S <effi.szt@gmail.com>
…ializeAndParseSigningKey Signed-off-by: Effi-S <effi.szt@gmail.com>
Signed-off-by: Effi-S <effi.szt@gmail.com>
Signed-off-by: Effi-S <effi.szt@gmail.com>
Signed-off-by: Effi-S <effi.szt@gmail.com>
#### Type of change - Test update #### Description - [ServerConfig] Add retry mechanism when binding to a predefined port (`c.Listener()`). - [TestBroadcastDeliver] Use the above retry mechanism to ensure the port is not used by other tests. #### Related issues - resolves hyperledger#109 - resolves hyperledger#137 --------- Signed-off-by: Liran Funaro <liran.funaro@gmail.com> Signed-off-by: Effi-S <effi.szt@gmail.com>
…o_modules group across 1 directory (hyperledger#168) Bumps the go_modules group with 1 update in the / directory: [github.com/consensys/gnark-crypto](https://github.com/consensys/gnark-crypto). Updates `github.com/consensys/gnark-crypto` from 0.14.0 to 0.18.1 Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: Liran Funaro <liran.funaro@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Liran Funaro <liran.funaro@gmail.com> Signed-off-by: Effi-S <effi.szt@gmail.com>
1b6a599 to
ae8b726
Compare
Signed-off-by: Effi-S <effi.szt@gmail.com>
323c0b5 to
74e126a
Compare
Signed-off-by: Effi-S <effi.szt@gmail.com>
Signed-off-by: Effi-S <effi.szt@gmail.com>
| } | ||
| } | ||
|
|
||
| func TestSerializeAndParseSigningKey(t *testing.T) { |
Contributor
There was a problem hiding this comment.
major: This test can be merged with the test above (TestSerializeVerificationKey).
This was suggested above and ignored.
Please test ParseSigningKey(key) in all the test cases in TestSerializeVerificationKey, and add the failure tests there also.
…envelope_wrapper_test.go Signed-off-by: Effi-S <effi.szt@gmail.com>
Signed-off-by: Effi-S <effi.szt@gmail.com>
Signed-off-by: Effi-S <effi.szt@gmail.com>
liran-funaro
approved these changes
Nov 11, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of change
Description
envelope: nil checks + unit tests + minor refactorcrypto: nil checka + unit testsRelated issues