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

Contracts with similar ABIs are meshed together in report #154

Closed
sebastiantf opened this issue Jul 3, 2023 · 5 comments
Closed

Contracts with similar ABIs are meshed together in report #154

sebastiantf opened this issue Jul 3, 2023 · 5 comments

Comments

@sebastiantf
Copy link

sebastiantf commented Jul 3, 2023

I have two contracts Campaigns, CampaignsNativeGaslessClaim which have almost similar ABIs. The gas report only have separate functions which have different ABIs. The counts for the functions with same ABIs seem to suggest that they're being meshed together instead of staying separate.

I have confirmed that all methods are being called on both contracts. Particularly the following methods are not reported for CampaignsNativeGaslessClaim:

  • claim
  • setClaimFee
  • setTrustedAddress
  • withdrawCampaign
  • withdrawTotalClaimFees

createCampaign has different ABIs on both contracts, so that seem to be reported separately correctly

Screenshot 2023-07-03 at 4 42 14 PM
@cgewecke
Copy link
Owner

Apologies for the very late response here - do you remember if this problem was in the context of using OZ's upgradeable contracts? (Have tentatively labeled it that way)

@sebastiantf
Copy link
Author

Yes. I was using OZ's upgradeable contract

@CWhits
Copy link

CWhits commented Feb 8, 2024

Similar experience. I am testing two smart contracts, one a regular ERC721 and another one that is OZ's upgradeable. They are almost identical and the contract name displayed is just the regular ERC721 although every test is being completed.

@cgewecke
Copy link
Owner

cgewecke commented Feb 8, 2024

@CWhits Yes, when a proxy sits in front of a target contract the gas-reporter has to fall back on function selectors alone to figure out what's being called. If there are method name collisions the contract attributions can be incorrect.

In the original version of this plugin (eth-gas-reporter) there was an option to help the reporter navigate proxies but no one used it AFAIK.

Am going to add explicit support for OZ upgradeable in the next major version since it's become much more of an issue. Working on this this month however it will probably not be published in beta before March.

This was referenced Feb 27, 2024
@cgewecke
Copy link
Owner

This has been fixed in the latest version (2.0). If you're using OZ's upgrades plugin the reporter will automatically resolve proxied contracts.

Closing but just ping if you continue to have problems with this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants