Conversation
🦋 Changeset detectedLatest commit: 28ef827 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 refines the withdrawal scheduling mechanism by introducing robust error handling for unrecoverable transaction reverts. It ensures that withdrawals failing due to specific terminal conditions are promptly removed from the processing queue, preventing unnecessary retries and improving system efficiency and error reporting. The changes enhance the reliability of the withdrawal process by accurately identifying and responding to definitive transaction failures. Highlights
Changelog
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
|
WalkthroughDetects terminal withdrawal revert reasons and aborts scheduled withdrawals: keeper receipt status is checked; terminal reasons (via new isTerminalWithdrawReason) cause removal from the Redis queue and abort; error-reason extraction is centralized. Tests updated to cover new flows. Changes
Sequence DiagramsequenceDiagram
participant Client
participant Block as server/hooks/block.ts
participant Keeper as keeper
participant Redis as RedisQueue
participant Handler as ErrorHandler
Client->>Block: triggerWithdraw()
Block->>Block: scheduleWithdraw()
Block->>Keeper: exaSend(txData, { ignore: isTerminalWithdrawReason })
Keeper-->>Block: receipt { status, details? }
alt receipt.status == "success"
Block->>Redis: leave message queued
else receipt.status != "success" or throw
Block->>Block: extract revertReason from error/receipt
Block->>Block: isTerminalWithdrawReason(revertReason)?
alt terminal
Block->>Redis: remove message from queue
Block->>Handler: abort with terminal error
else non-terminal
Block->>Redis: keep message queued (retry later)
end
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 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 introduces logic to handle terminal withdrawal reverts by identifying specific error reasons and preventing retries for them. The changes are well-tested. I've found a critical bug in the handling of ignored terminal errors that could lead to sending incorrect notifications. See my detailed comments below.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #777 +/- ##
==========================================
+ Coverage 68.59% 68.78% +0.19%
==========================================
Files 207 207
Lines 7005 7042 +37
Branches 2189 2207 +18
==========================================
+ Hits 4805 4844 +39
+ Misses 2010 2006 -4
- Partials 190 192 +2
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:
|
| const isTerminalWithdrawReason = (reason: string) => | ||
| reason === "InsufficientAccountLiquidity()" || | ||
| (reason.startsWith("PreExecHookReverted(") && | ||
| reason.endsWith(`,${encodeErrorResult({ errorName: "NoProposal", abi: proposalManagerAbi })})`)); |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
Consider precomputing the encoded NoProposal bytes.
encodeErrorResult({ errorName: "NoProposal", abi: proposalManagerAbi }) is deterministic yet recomputed on every call to isTerminalWithdrawReason (called both by the ignore callback and in the catch block).
♻️ Hoist the encoded value
+const encodedNoProposal = encodeErrorResult({ errorName: "NoProposal", abi: proposalManagerAbi });
const isTerminalWithdrawReason = (reason: string) =>
reason === "InsufficientAccountLiquidity()" ||
(reason.startsWith("PreExecHookReverted(") &&
- reason.endsWith(`,${encodeErrorResult({ errorName: "NoProposal", abi: proposalManagerAbi })})`));
+ reason.endsWith(`,${encodedNoProposal})`));
Summary by CodeRabbit
Bug Fixes
Tests
Chores