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

Improved Type Parsing and Added Test for Complex Nested Tuples #300

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Ali-Y1
Copy link

@Ali-Y1 Ali-Y1 commented Jul 19, 2023

Description:

This pull request improves the Solidity type parsing in the read function within the ethabi crate and adds a new test to ensure the correct handling of complex nested tuples.

The previous implementation of the read function struggled with complex nested tuples and arrays of tuples. It used a procedural approach and a significant amount of state variables, which resulted in complexity and incorrect parsing for certain complex cases.

The improved read function takes a more modular and recursive approach to parsing Solidity types. It divides the parsing into separate functions (read, read_tuple, read_array, and read_primitive), each focused on handling a specific aspect of the parsing process. This division results in code that is more readable, maintainable, and extendable.

Additionally, this pull request adds a new test case to the suite. The test case examines a complex nested tuple scenario ("(((string,uint256),int256),uint256,int256)") which previously resulted in an error. The updated function now successfully parses this and similar cases.

These improvements enhance the robustness of the ethabi crate and ensure it is equipped to handle complex Solidity types correctly and efficiently.

Please review the changes, and feel free to provide any feedback.

Changes:

  1. Improved the read function for better parsing of Solidity types.
  2. Added a new test case for complex nested tuples.

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.

None yet

1 participant