-
Notifications
You must be signed in to change notification settings - Fork 559
Add support for tuple types in ABI event and function signatures #7415
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
Add support for tuple types in ABI event and function signatures #7415
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... 📒 Files selected for processing (2)
WalkthroughA new helper function, Changes
Sequence Diagram(s)sequenceDiagram
participant Caller
participant abiUtils
Caller->>abiUtils: extractEventSignatures(abi)
abiUtils->>abiUtils: getCanonicalType(input) (recursive for tuples)
abiUtils-->>Caller: Event signatures with canonical types
Caller->>abiUtils: extractFunctionSignatures(abi)
abiUtils->>abiUtils: getCanonicalType(input) (recursive for tuples)
abiUtils-->>Caller: Function signatures with canonical types
Tip CodeRabbit can generate a title for your PR based on the changes.Add @coderabbitai placeholder anywhere in the title of your PR and CodeRabbit will replace it with a title based on the changes in the PR. You can change the placeholder by changing the ✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #7415 +/- ##
=======================================
Coverage 52.08% 52.08%
=======================================
Files 947 947
Lines 63636 63636
Branches 4222 4222
=======================================
Hits 33146 33146
Misses 30384 30384
Partials 106 106
🚀 New features to boost your workflow:
|
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.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/webhooks/utils/abiUtils.ts
(3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (8)
- GitHub Check: E2E Tests (pnpm, esbuild)
- GitHub Check: E2E Tests (pnpm, vite)
- GitHub Check: Size
- GitHub Check: Lint Packages
- GitHub Check: E2E Tests (pnpm, webpack)
- GitHub Check: Unit Tests
- GitHub Check: Build Packages
- GitHub Check: Analyze (javascript)
🔇 Additional comments (2)
apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/webhooks/utils/abiUtils.ts (2)
96-96
: LGTM! Correct usage of the canonical type helper.The integration of
getCanonicalType
in the event signature extraction is implemented correctly and will properly handle tuple types in event signatures.
178-178
: LGTM! Correct usage of the canonical type helper.The integration of
getCanonicalType
in the function signature extraction is implemented correctly and will properly handle tuple types in function signatures.
...dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/webhooks/utils/abiUtils.ts
Show resolved
Hide resolved
size-limit report 📦
|
79c0de3
to
71c8e84
Compare
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/webhooks/components/FilterDetailsStep.tsx (1)
347-347
: Consider optimizing truncation parameters for better UI display.The truncation parameters
(30, 15)
seem unusually large for UI labels. This will result in labels up to 48 characters long (30 + "..." + 15) and only truncate strings longer than 45 characters. For improved display in dropdown options, consider using smaller values like(20, 8)
or(15, 10)
to ensure more consistent and compact label lengths.Apply this diff for more reasonable truncation:
- label: truncateMiddle(sig.name, 30, 15), + label: truncateMiddle(sig.name, 20, 8),This would limit labels to a maximum of 31 characters (20 + "..." + 8) and truncate strings longer than 28 characters, providing better visual consistency in the dropdown.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/webhooks/components/FilterDetailsStep.tsx
(1 hunks)apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/webhooks/utils/abiUtils.ts
(3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/webhooks/utils/abiUtils.ts
🧰 Additional context used
🧬 Code Graph Analysis (1)
apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/webhooks/components/FilterDetailsStep.tsx (1)
apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/webhooks/utils/abiUtils.ts (1)
truncateMiddle
(11-19)
⏰ Context from checks skipped due to timeout of 90000ms (8)
- GitHub Check: E2E Tests (pnpm, esbuild)
- GitHub Check: E2E Tests (pnpm, vite)
- GitHub Check: E2E Tests (pnpm, webpack)
- GitHub Check: Size
- GitHub Check: Unit Tests
- GitHub Check: Build Packages
- GitHub Check: Lint Packages
- GitHub Check: Analyze (javascript)
Merge activity
|
# [Dashboard] Fix: Improve ABI type handling for tuple types in webhook signatures ## Notes for the reviewer This PR adds support for properly handling tuple types in ABI event and function signatures. Previously, we were only extracting the basic type string, which doesn't correctly represent tuple structures. Now we recursively build the canonical type representation for tuples, including nested tuples and array dimensions. ## How to test The changes can be tested by creating webhooks with contracts that use tuple types in their events or functions. The signature extraction should now correctly represent the canonical format for these complex types. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Bug Fixes** - Improved handling of tuple types in ABI inputs to ensure accurate event and function signature generation, especially for nested tuple structures. - **New Features** - Function signature labels in transaction filters are now truncated for better readability without affecting underlying data. <!-- end of auto-generated comment: release notes by coderabbit.ai --> <!-- start pr-codex --> --- ## PR-Codex overview This PR primarily enhances the handling of function signatures in the `FilterDetailsStep.tsx` component and improves the extraction of ABI input types in `abiUtils.ts`. It introduces a helper function to manage tuple types and modifies how function signatures are displayed. ### Detailed summary - In `FilterDetailsStep.tsx`, updated the label for function signatures to use `truncateMiddle(sig.name, 30, 15)` for better readability. - Added a new helper function `getCanonicalType` in `abiUtils.ts` to recursively handle tuple types in ABI inputs. - Modified the extraction of canonical input types in both `extractEventSignatures` and `extractFunctionSignatures` to use `getCanonicalType` instead of directly mapping the type. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->
71c8e84
to
11b4d9e
Compare
[Dashboard] Fix: Improve ABI type handling for tuple types in webhook signatures
Notes for the reviewer
This PR adds support for properly handling tuple types in ABI event and function signatures. Previously, we were only extracting the basic type string, which doesn't correctly represent tuple structures. Now we recursively build the canonical type representation for tuples, including nested tuples and array dimensions.
How to test
The changes can be tested by creating webhooks with contracts that use tuple types in their events or functions. The signature extraction should now correctly represent the canonical format for these complex types.
Summary by CodeRabbit
PR-Codex overview
This PR introduces enhancements to the handling of function signatures and ABI inputs in the
FilterDetailsStep
component andabiUtils
. It includes a new utility function for canonical type extraction, improving how tuples are processed.Detailed summary
FilterDetailsStep.tsx
, changed thelabel
property to usetruncateMiddle
for better display of function names.getCanonicalType
function inabiUtils.ts
to recursively determine the canonical type for ABI inputs, specifically handling tuples.extractEventSignatures
andextractFunctionSignatures
to usegetCanonicalType
for mapping input types instead of directly using the type property.