fix: incorrect string concatenation in getFunctionInputKey #15
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
getFunctionInputKey
function 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.name
was undefined or an empty string,"0_"
would be used instead of"tuple"
, leading to incorrect key generation.The original code assumes that
abiTupleParameter.name
can beundefined
or an empty string.If this was never a possibility, then the
"tuple"
fallback would not have been included in the first place.If
abiTupleParameter.name
was always defined and a non-empty string,then
|| "tuple"
would not be necessary.However, since
"tuple"
was included, it indicates thatundefined
or""
(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.name
is undefined or empty, preventing potential key mismatches in form handling.Additional Information
Your ENS/address: himess.eth / 0xF46b0357A6CD11935a8B5e17c329F24544eF316F