crypto/tmhash: add tests for ValidateSHA256#7
Open
ahwlsqja wants to merge 1 commit intoakash-network:akash/v0.38.19from
Open
crypto/tmhash: add tests for ValidateSHA256#7ahwlsqja wants to merge 1 commit intoakash-network:akash/v0.38.19from
ahwlsqja wants to merge 1 commit intoakash-network:akash/v0.38.19from
Conversation
Add comprehensive test coverage for ValidateSHA256 function which is used during node startup to validate genesis document checksums. Test cases include: - Valid hex strings (lowercase, uppercase, mixed case) - Length validation (too short, too long, empty string) - Invalid character detection (non-hex chars, spaces, special chars) This improves test coverage for a security-critical validation function.
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.
Summary
Add comprehensive test coverage for
ValidateSHA256function which is used during node startup to validate genesis document checksums.Test Cases
Why
This function is called in
node/setup.go:612to validate genesis checksums during node initialization. Test coverage ensures:Test Results
=== RUN TestValidateSHA256
--- PASS: TestValidateSHA256 (0.00s)
--- PASS: TestValidateSHA256/valid_lowercase_hex
--- PASS: TestValidateSHA256/valid_uppercase_hex
--- PASS: TestValidateSHA256/valid_mixed_case_hex
--- PASS: TestValidateSHA256/valid_all_zeros
--- PASS: TestValidateSHA256/valid_all_f's
--- PASS: TestValidateSHA256/too_short_-63_chars
--- PASS: TestValidateSHA256/too_long-_65_chars
--- PASS: TestValidateSHA256/empty_string
--- PASS: TestValidateSHA256/invalid_char_g_in_middle
--- PASS: TestValidateSHA256/invalid_char_z_at_start
--- PASS: TestValidateSHA256/space_in_middle
--- PASS: TestValidateSHA256/special_character
--- PASS: TestValidateSHA256/newline_character
PASS