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 open zeppelin proxy detection #155

Merged
merged 2 commits into from
Sep 14, 2024

Conversation

portdeveloper
Copy link
Member

Description

This PR adds support for detecting OpenZeppelin proxies by uncommenting and implementing the OpenZeppelin implementation slot detection logic in the detectProxyTarget function.

Changes made:

  1. Uncommented the OPEN_ZEPPELIN_IMPLEMENTATION_SLOT constant.
  2. Added a new detectUsingOpenZeppelinSlot function to check for OpenZeppelin proxies.
  3. Included the new detection method in the primary detection methods array.

Additional Information

Related Issues

Fixes #154

Your ENS/address: portdev.eth

Copy link

vercel bot commented Sep 11, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
abi-ninja-v2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 13, 2024 2:44pm

Copy link
Member

@Pabl0cks Pabl0cks left a comment

Choose a reason for hiding this comment

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

Nice catch! Thanks for tackling it so fast.

Now it detects the proxy nicely for USDC in mainnet, but I got a question there.

In etherscan read proxy you can read the balance of an account nicely (0x4bBB30C26AEB7ABDBFb937D5C206CC29f9706323) but not in abi ninja

It seems like if we are querying directly the implementation address, like etherscan does here

Also if you open USDC mainnet in abi ninja and select a method, the URL reloads to the implementation address

@portdeveloper
Copy link
Member Author

@Pabl0cks thanks for the feedback!
I have just checked the main branch and this problem exists there too.

Merging in https://github.com/BuidlGuidl/abi.ninja/tree/feat/getsourcecode fixes that problem as well as improving the overall app.

Here is a deployment link for that branch if you'd like to test:
https://abi-ninja-v2-git-feat-getsourcecode-buidlguidldao.vercel.app/

My suggestion here would be, since the problem exists on prod deployment as well, is either:
-> merge this, i open a new pr for getsourcecode, merge that
-> I close this and make getsourcecode + this as one new pr

How do those options sound? Happy to hear any ideas!

Copy link
Member

@technophile-04 technophile-04 left a comment

Choose a reason for hiding this comment

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

I think the changes makes sense, btw @portdeveloper do you remember why we commented that OZ slot? I don't remember any discussion on that :/.

Nevertheless I think we can merge this just added a small comment and create a new PR for getSourceCode branch

packages/nextjs/utils/abi-ninja/proxyContracts.ts Outdated Show resolved Hide resolved
Copy link
Member

@Pabl0cks Pabl0cks left a comment

Choose a reason for hiding this comment

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

Ok! I also agree is a good idea to merge this and then test nicely the getsourcecode PR and merge it when looks good.

I will document the issue just to make sure we verify it in the new PR 🙏

@portdeveloper
Copy link
Member Author

I don't remember the exact reason why we commented it out (might be related to when we separated the logic)
But when we merge getsourcecode PR we will remove these all!

@portdeveloper portdeveloper merged commit 1cf1f8d into main Sep 14, 2024
3 of 4 checks passed
@portdeveloper portdeveloper deleted the fix/open-zeppelin-impl-detection branch September 16, 2024 09:15
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.

bug: Unable to detect implementation address of proxy contracts such as USDC contract on mainnet
3 participants