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

feat: support Tuple in Enum and Enum in Tuple #213

Merged
merged 22 commits into from
Apr 27, 2022

Conversation

iqdecay
Copy link
Contributor

@iqdecay iqdecay commented Apr 14, 2022

This PR closes #53 by supporting nested struct and enums as return types.
It also closes #63 because of refactoring.
Some caveats:

  • Currently does not work as inputs, but the infrastructure is theoritically here. I'm waiting for the RESERV00 bug to be solved to see if it works
  • Arbitrary depth of nesting has not been tested yet!

@iqdecay iqdecay requested a review from digorithm as a code owner April 14, 2022 13:50
@iqdecay iqdecay self-assigned this Apr 14, 2022
@iqdecay iqdecay marked this pull request as draft April 14, 2022 13:50
@iqdecay iqdecay added the enhancement New feature or request label Apr 14, 2022
@iqdecay iqdecay force-pushed the vnepveu/feat-enum-in-structs branch 5 times, most recently from ef31d32 to e00f4de Compare April 20, 2022 20:30
@iqdecay iqdecay force-pushed the vnepveu/feat-enum-in-structs branch from 57de094 to 5e12f92 Compare April 21, 2022 14:21
* The test fails with `Expected `Tuple` found `Enum(xxx)`
@digorithm
Copy link
Member

Moving this summary of our conversation here so it's explicit what needs to be done:

  1. We need to support enum output by updating expand_fn_outputs to include the enum name instead of its components, which looks like a tuple, leading to the wrong Tokenizable;
  2. We need to abigen Tokenizable for enum types.

@iqdecay iqdecay marked this pull request as ready for review April 23, 2022 16:23
@iqdecay iqdecay requested a review from adlerjohn April 23, 2022 16:35
@iqdecay iqdecay requested a review from m3talsmith April 23, 2022 16:35
Copy link
Contributor Author

@iqdecay iqdecay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just re-reading what I did, it's way too big lol

packages/fuels-abigen-macro/tests/harness.rs Outdated Show resolved Hide resolved
packages/fuels-core/src/json_abi.rs Outdated Show resolved Hide resolved
@digorithm
Copy link
Member

@vnepveu Is this still a draft? Or officially ready for review? Let me know so I can take another deep pass.

@iqdecay
Copy link
Contributor Author

iqdecay commented Apr 25, 2022

It's definitely ready for review just thought I'd review myself as well

Copy link
Member

@digorithm digorithm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's looking really good. Great job on this -- this is no simple feat 😃. Just left some comments and improvement suggestions.

@iqdecay iqdecay merged commit caedb6c into master Apr 27, 2022
@iqdecay iqdecay deleted the vnepveu/feat-enum-in-structs branch April 27, 2022 17:23
iqdecay added a commit that referenced this pull request May 12, 2022
This PR definitely closes #53 by testing support for Struct inside Enum and Enum
inside Struct types as function arguments in smart contracts.
* It was only supported as function outputs since #213.I
* In #275 support was added for the Enum type as function argument, and it turns out that nested custom types as function argument worked right-away with this.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Archived in project
3 participants