-
Notifications
You must be signed in to change notification settings - Fork 14
feat: enhance printFunctions to decode function selectors #294
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the upgrade-helper script to decode and display function names for diamond facets instead of raw function selectors.
- Adds imports for all facet factories and builds an array of their interfaces.
- Replaces logging of raw selectors with logic to resolve each selector to a function name.
- Introduces special-case handling for 0x00000000 and 0xffffffff.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
scripts/upgrades/upgrade-helper.ts
Outdated
| for (const iface of allInterfaces) { | ||
| try { | ||
| const fragment = iface.getFunction(selector); | ||
| if (fragment) { | ||
| functionName = fragment.name; | ||
| break; | ||
| } | ||
| } catch (error) { | ||
| // Continue searching in other interfaces | ||
| } | ||
| } |
Copilot
AI
Oct 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This performs a try/catch for every interface per selector, using exceptions for control flow (getFunction throws when not found). Precompute a Map<selector, fragment> once from allInterfaces (iterating iface.fragments) and then do O(1) lookups, avoiding repeated exception overhead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #294 +/- ##
=======================================
Coverage 84.85% 84.85%
=======================================
Files 37 37
Lines 1241 1241
Branches 235 235
=======================================
Hits 1053 1053
Misses 188 188 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
zguesmi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent!
This change the printFunctions function to print function selectors instead of function signatures
Usefull for future upgrades