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

Better struct handling in code generation util #2068

Merged
merged 5 commits into from
Oct 12, 2023

Conversation

webthethird
Copy link
Contributor

Generates better code, which will compile without manual editing, when dealing with structs.

  • Avoids using a struct's canonical name, which will not match the generated interface once an I is prepended to the contract name
  • Handles arrays of structs in function parameters and returns
  • Handles nested mappings inside and outside of structs
  • Handles structs defined in other contracts/libraries
  • Converts the type of enums used in structs, in case include_enums is false

Resolves this issue in crytic/diffusc, where the generated interface would not compile due to a reference in a function signature to a struct defined in another contract.

Replaces #1933

@0xalpharush
Copy link
Contributor

Can you add the failing example as a regression test and run make reformat please?

@webthethird
Copy link
Contributor Author

Can you add the failing example as a regression test and run make reformat please?

Done!

@montyly montyly merged commit 1e16d08 into crytic:dev Oct 12, 2023
73 checks passed
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.

3 participants