update V value manipulation#103
Merged
peterbroadhurst merged 3 commits intoJun 24, 2026
Merged
Conversation
Signed-off-by: Chengxuan Xing <chengxuan.xing@kaleido.io>
Signed-off-by: Chengxuan Xing <chengxuan.xing@kaleido.io>
87c4116 to
00068b5
Compare
peterbroadhurst
left a comment
Contributor
There was a problem hiding this comment.
So my understanding here of your approach @Chengxuan is:
- The signature supplied can contain 0/1 or 27/28
- The code uses
normalizeVToYParityon all code paths where the parity is needed, to normalize it to 0/1 - The EIP155 chain ID validation now uses the 0/1 version out of
normalizeVToYParity
Given the sensitivity of this library interface, I want to really validate this with you that I've understood correctly.
- That none of the existing paths that accepted 27/28 successfully, (or 0/1 successfully) will now fail.
- That no returned signature formats will be affected
Signed-off-by: Chengxuan Xing <chengxuan.xing@kaleido.io>
Contributor
Author
|
@peterbroadhurst yes, I can confirm both statements are true. I updated the main description with more details. And also added a new commit to fix SignTypedDataV4 as well. Missed it due to it's not in the same file as other functions. |
peterbroadhurst
approved these changes
Jun 24, 2026
peterbroadhurst
left a comment
Contributor
There was a problem hiding this comment.
Thanks @Chengxuan - think the extra validation was worth it, given the number of consumers of this library that could be affected by a change.
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.
Update the logic for calculating
vvalue so that it can work with an RSV signature in whichvis just the y parity.The diagram and tables below show the changes:
Before the fix
After the fix
Key changes are:
2,3,4with1: explicit error when theInput Vis not expected (either widely adopted Y-parity or the values conforming to the corresponding rules)2,3with4: handleInput Vwith Y-parity as value.