🥅 server: decode external swap errors in proposal execution#741
🥅 server: decode external swap errors in proposal execution#741cruzdanilo merged 1 commit intomainfrom
Conversation
🦋 Changeset detectedLatest commit: 12a4f4c The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Summary of ChangesHello @cruzdanilo, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request improves the server's ability to decode and categorize errors encountered during proposal execution, especially those originating from external swap operations. By incorporating new error types and refining the error fingerprinting logic, it provides more detailed and actionable insights into transaction failures, enhancing debugging and monitoring capabilities. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
WalkthroughAdds decoding of external (wrapped) swap errors during proposal execution: introduces four new error ABIs, updates revert fingerprinting to extract inner WrappedError selector, and adds tests that simulate wrapped contract errors to verify fingerprinting behavior. Changes
Sequence DiagramsequenceDiagram
participant Client as executeProposal
participant Chain as Contract Executor
participant Decoder as Error Decoder
participant FP as Fingerprint Builder
participant Sentry as Logger
Client->>Chain: call contract (proposal execution)
Chain-->>Client: reverts with ContractFunctionRevertedError (maybe WrappedError)
alt WrappedError encoded
Client->>Decoder: detect & decode WrappedError
Decoder-->>Client: inner selector (second_arg)
Client->>FP: build ["WrappedError", inner_selector]
else Non-wrapped revert
Client->>FP: extract reason/errorName/signature or "unknown"
end
FP->>Sentry: record fingerprint
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request effectively enhances error handling for proposal execution by decoding external swap errors, which will improve debugging. The change to Sentry fingerprinting for WrappedError is a great improvement for error monitoring, making it more granular by including the inner selector. A comprehensive security audit confirmed no vulnerabilities were identified, with the implementation correctly handling error data and arguments, and safely using the selector. The implementation is clean and includes a specific test case that correctly validates the new logic.
|
@claude review |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #741 +/- ##
==========================================
+ Coverage 67.23% 67.32% +0.09%
==========================================
Files 206 206
Lines 6913 6914 +1
Branches 2155 2156 +1
==========================================
+ Hits 4648 4655 +7
+ Misses 2078 2075 -3
+ Partials 187 184 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@server/hooks/block.ts`:
- Around line 357-361: The fingerprinting branch in server/hooks/block.ts that
checks for a WrappedError currently assumes error.cause.data.args[1] exists;
update the logic in that expression (where BaseError and
ContractFunctionRevertedError are checked and error.cause.data?.errorName ===
"WrappedError") to defensively verify Array.isArray(error.cause.data.args) and
error.cause.data.args.length > 1 before using args[1], and fall back to a safe
string (e.g., "undefined" or the existing fallback chain) if the check fails so
you never coerce an actual undefined into the fingerprint.
In `@server/test/hooks/block.test.ts`:
- Around line 273-284: The WrappedError ABI (the const ABI array with type
"error" and name "WrappedError") is duplicated; extract it into a single
exported constant (e.g., WRAPPED_ERROR_ABI) in a shared module, export it, and
replace the local ABI definitions in both the test and the block hook with an
import of that constant, preserving the "as const" typing and the exact
structure so both places use the same source of truth.
Summary by CodeRabbit