Skip to content

Conversation

Himess
Copy link

@Himess Himess commented Mar 4, 2025

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 be undefined 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 that undefined or "" (empty string) is a valid scenario.
The incorrect operator precedence caused "0_" to be used instead of "tuple" in these cases.

Fix

  • Updated the expression to ensure the correct fallback value is applied:
    Old: "0_" + abiTupleParameter.name || "tuple"
    New: abiTupleParameter.name ? "0_" + abiTupleParameter.name : "tuple"

This fix ensures that "tuple" is correctly used when abiTupleParameter.name is undefined or empty, preventing potential key mismatches in form handling.

Additional Information

Your ENS/address: himess.eth / 0xF46b0357A6CD11935a8B5e17c329F24544eF316F

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant