♻️ app: replace proposal simulation with simulate blocks, batch contract reads#907
♻️ app: replace proposal simulation with simulate blocks, batch contract reads#907cruzdanilo merged 4 commits intomainfrom
Conversation
🦋 Changeset detectedLatest commit: ce222ba The changes in this PR will be included in the next version bump. 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 |
WalkthroughRefactors proposal simulation to batch contract reads and simulate consecutive blocks via a new Changes
Sequence Diagram(s)sequenceDiagram
participant UI as UI Component
participant Hook as useSimulateProposal
participant RC as useReadContracts
participant SB as useSimulateBlocks
participant Viem as Viem Actions
UI->>Hook: call with proposal params
Hook->>RC: batch-read plugins, delay, nonces, timestamp, previewer assets
RC->>Viem: readContracts (multicall)
Viem-->>RC: returns read results
RC-->>Hook: read results
Hook->>SB: call simulateBlocks with propose + execute calldata (blockOverrides.time = timestamp + delay)
SB->>Viem: simulateBlocks
Viem-->>SB: simulation results
SB-->>Hook: simulation result / error
Hook-->>UI: returns { request, isPending, error }
UI->>Viem: execute mutation using request
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 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 docstrings
🧪 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 |
Summary of ChangesHello, 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 significantly overhauls the client-side proposal simulation mechanism, transitioning to Highlights
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. Footnotes
|
|
Warning Gemini encountered an error creating the review. You can try again by commenting |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #907 +/- ##
==========================================
+ Coverage 71.46% 71.60% +0.14%
==========================================
Files 225 226 +1
Lines 8165 8199 +34
Branches 2605 2634 +29
==========================================
+ Hits 5835 5871 +36
+ Misses 2103 2101 -2
Partials 227 227
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:
|
|
/gemini review |
There was a problem hiding this comment.
♻️ Duplicate comments (2)
src/utils/useSimulateProposal.ts (1)
117-131:⚠️ Potential issue | 🟡 MinorUse semver comparison instead of string comparison for version checks.
String comparison for versions like
pluginMetadata.version < "0.0.4"will fail for multi-digit components (e.g.,"0.0.10"would incorrectly compare as less than"0.0.4"). Thesemverlibrary is available in the project.🛡️ Proposed fix using semver
+import semver from "semver"; + // At line 101 -marketOut: pluginMetadata.version >= "1.1.0" ? proposal.marketOut : undefined, +marketOut: semver.gte(pluginMetadata.version, "1.1.0") ? proposal.marketOut : undefined, // At lines 117-119 -proposal.proposalType === ProposalType.Withdraw && - pluginMetadata?.version !== undefined && - pluginMetadata.version < "0.0.4" +proposal.proposalType === ProposalType.Withdraw && + pluginMetadata?.version !== undefined && + semver.lt(pluginMetadata.version, "0.0.4").changeset/bold-ram-dig.md (1)
1-5: 🧹 Nitpick | 🔵 TrivialConsider making this changeset empty or user-facing.
This describes internal API refactoring ("flatten simulate-proposal api") that users won't notice. Either convert to an empty changeset (just
---separators) or reframe as user-facing benefit (e.g., "♻️ improve proposal transaction reliability").
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: cf290269-3c8d-490a-b190-f02071af9662
📒 Files selected for processing (7)
.changeset/bold-ram-dig.mdcspell.jsonsrc/components/pay/Repay.tsxsrc/components/roll-debt/RollDebt.tsxsrc/components/send-funds/Amount.tsxsrc/components/swaps/Swaps.tsxsrc/utils/useSimulateProposal.ts
Summary by CodeRabbit
New Features
Improvements
Chores