fix: incorrect string concatenation in getFunctionInputKey#15
Open
Himess wants to merge 1 commit intomonad-developers:mainfrom
Open
fix: incorrect string concatenation in getFunctionInputKey#15Himess wants to merge 1 commit intomonad-developers:mainfrom
Himess wants to merge 1 commit intomonad-developers:mainfrom
Conversation
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.
Description
This PR fixes an issue in the
getFunctionInputKeyfunction where incorrect string concatenation was causing unintended key generation.Previously, the expression
"0_" + abiTupleParameter.name || "tuple"had an incorrect precedence.As a result, if
abiTupleParameter.namewas undefined or an empty string,"0_"would be used instead of"tuple", leading to incorrect key generation.The original code assumes that
abiTupleParameter.namecan beundefinedor an empty string.If this was never a possibility, then the
"tuple"fallback would not have been included in the first place.If
abiTupleParameter.namewas always defined and a non-empty string,then
|| "tuple"would not be necessary.However, since
"tuple"was included, it indicates thatundefinedor""(empty string) is a valid scenario.The incorrect operator precedence caused
"0_"to be used instead of"tuple"in these cases.Fix
Old:
"0_" + abiTupleParameter.name || "tuple"New:
abiTupleParameter.name ? "0_" + abiTupleParameter.name : "tuple"This fix ensures that
"tuple"is correctly used whenabiTupleParameter.nameis undefined or empty, preventing potential key mismatches in form handling.Additional Information
Your ENS/address: himess.eth / 0xF46b0357A6CD11935a8B5e17c329F24544eF316F