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 Hardhat compile error when overriding interface functions with public constant variables #1091

Merged
merged 6 commits into from
Oct 10, 2024

Conversation

ericglau
Copy link
Member

@ericglau ericglau commented Oct 8, 2024

Fixes #1087

When making modified solc input for extracting namespaced storage type information, we previously removed all function bodies and converted all functions' return parameters to bools so that they can be default initialized.

However, if a public constant variable overrides an interface function as in #1087, this causes a mismatch in return type because the interface function's return parameters were modified as above.

Instead, this PR does the following:

  • If a function is in a contract and not private, convert to virtual and remove the body
  • Otherwise, as long as the function has a body, we know that it is not overriding any other function and no function overrides/implements it. It may be a library function, free function, or private function. In any of these cases, we can convert the return parameters to bools so that they can be default initialized.

@ericglau ericglau marked this pull request as ready for review October 8, 2024 18:32
@ericglau ericglau requested a review from a team October 8, 2024 18:32
@ericglau ericglau merged commit 52ae59e into OpenZeppelin:master Oct 10, 2024
12 checks passed
@ericglau ericglau deleted the issue1087 branch October 10, 2024 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants