Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: parsing of non-string event arguments from simulation #4512

Merged

Conversation

matthewwalsh0
Copy link
Member

Explanation

Update the simulation data parsing logic to avoid failed simulations if an event includes a non-string argument.

For example, the ApprovalForAll event from the ERC-1155 ABI, which includes the boolean approved argument.

Specifically, the changes are:

  • Only attempt to call toLowerCase on string event arguments.
  • Skip the parsing of unsupported events.
  • Rename the parseX methods to normalizeX for clarity.

References

[Pending]

Changelog

@metamask/transaction-controller

  • FIXED: Simulation of transactions creating ApprovalForAll events.

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've highlighted breaking changes using the "BREAKING" category above as appropriate

Only lower case if available.
Rename parse methods.
Update test data for accuracy.
@matthewwalsh0 matthewwalsh0 requested a review from a team as a code owner July 15, 2024 11:42
@matthewwalsh0 matthewwalsh0 merged commit 562e6a1 into main Jul 15, 2024
116 checks passed
@matthewwalsh0 matthewwalsh0 deleted the fix/parsing-of-non-string-event-args-from-simulation branch July 15, 2024 14:33
MajorLift pushed a commit that referenced this pull request Jul 16, 2024
Only attempt to call `toLowerCase` on string event arguments.
Skip the parsing of unsupported events.
Rename the `parseX` methods to `normalizeX` for clarity.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants