refactor: Delete SecretKey compare op from library and move it to tests module - #6503
Merged
Merged
Conversation
Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #6503 +/- ##
=========================================
- Coverage 79.8% 79.8% -0.0%
=========================================
Files 878 878
Lines 67887 67885 -2
Branches 7551 7553 +2
=========================================
- Hits 54206 54195 -11
- Misses 13681 13690 +9
🚀 New features to boost your workflow:
|
Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com>
bthomee
reviewed
Mar 9, 2026
Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com>
ximinez
reviewed
Mar 10, 2026
ximinez
self-requested a review
March 10, 2026 01:25
Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com>
ximinez
approved these changes
Mar 12, 2026
bthomee
approved these changes
Mar 14, 2026
Co-authored-by: Bart <bthomee@users.noreply.github.com>
bthomee
enabled auto-merge (squash)
March 16, 2026 10:34
beartec-jpg
pushed a commit
to beartec-jpg/FalconLedger
that referenced
this pull request
Jun 1, 2026
…ests module (XRPLF#6503) This change deletes the `SecretKey` equality/inequality operators from the public library header and moves the comparison logic into test-only code. Specifically, the `operator==` and `operator!=` free functions on `SecretKey` have been removed from `include/xrpl/protocol/SecretKey.h` and have been replaced with explicitly deleted member functions to prevent accidental use in production code. A named `test::equal()` helper has also been added in `src/test/unit_test/utils.h` for test assertions that need to compare secret keys.
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.
High Level Overview of Change
Delete the
SecretKeyequality/inequality operators from the public library header and move the comparison logic into test-only code.The
operator==andoperator!=free functions onSecretKeywere removed frominclude/xrpl/protocol/SecretKey.hand replaced with explicitly deleted member functions to prevent accidental use in production code. A namedtest::equal()helper was added insrc/test/unit_test/utils.hfor test assertions that need to compare secret keys.Context of Change
Comparing secret keys with
==in production code is a security concern — constant-time comparison should be used instead. By deleting the operator and restricting comparison to test code only, we prevent accidental timing-side-channel vulnerabilities in the library.The previous free-function
operator==/operator!=overloads inSecretKey.hwere available to all consumers oflibxrpl. Now, the deleted member operators cause a compile error if anyone tries to compareSecretKeyobjects outside of test code. Test files that need comparison use the explicittest::equal()named function, which bypasses the deleted-member-function lookup issue that would affect any free-functionoperator==overload.Type of Change
API Impact
libxrplchange (any change that may affectlibxrplor dependents oflibxrpl)Before / After
Before:
SecretKeyhad publicoperator==/operator!=free functions in the library header, usable by any code that includedSecretKey.h.After:
SecretKey::operator==is deleted. Production code gets a compile error. Test code uses the named helper:Test Plan
SecretKeycomparison test assertions updated to usetest::equal()SecretKey_test.cpp,ValidatorKeys_test.cpp,Manifest_test.cpp