length check warning on arg publicKeyBytes for method deriveAddressFromBytes #2679
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.
Currently addresses are derived from any length of bytes, but documentation states that addresses are only derived from compressed public key points:
https://xrpl.org/docs/concepts/accounts/cryptographic-keys/
High Level Overview of Change
Not sure where this should go. Perhaps in the codec package.
Context of Change
I faced an error that was hard to debug since I was passing in an uncompressed public key point to deriveAddress and signing. Everthing was working locally with the xrpl libraries but the nodes were rejecting the transactions.
TLDR; I needed to call deriveAddress with the compressed public key point, as per documentation.
Nothing in the code prevents me from calling deriveAddress with any length of bytes, uncompressed or arbitrary length.
There should be a check.
Type of Change
Did you update HISTORY.md?
Test Plan
Please add commit to put this check in the right place and add warning to the codebase. It will help other developers in the future.