-
Notifications
You must be signed in to change notification settings - Fork 11
Import_Line_Change #208
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
Import_Line_Change #208
Conversation
WalkthroughThis update introduces a new version (4.0.2) with changes focused on improving paymaster and metadata handling. A new Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant MetadataRoute
participant PaymasterContract
participant Logger
Client->>MetadataRoute: Request /metadata endpoint
MetadataRoute->>MetadataRoute: Normalize paymaster address
alt Paymaster address exists
MetadataRoute->>PaymasterContract: getDeposit()
alt Success
PaymasterContract-->>MetadataRoute: Return deposit
else Failure
MetadataRoute->>Logger: Log error
MetadataRoute->>MetadataRoute: Set sponsorBalance = 0
end
else
MetadataRoute->>MetadataRoute: Set sponsorBalance = 0
end
MetadataRoute-->>Client: Respond with sponsorBalance
sequenceDiagram
participant Paymaster
participant OracleDecimals
participant OracleContract
Paymaster->>OracleDecimals: Check for decimals (chainId, oracleAddress)
alt Found in OracleDecimals
OracleDecimals-->>Paymaster: Return decimals
else Not found
Paymaster->>OracleContract: Call decimals()
OracleContract-->>Paymaster: Return decimals
end
Paymaster->>Paymaster: Use decimals in price calculation
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (6)
🧰 Additional context used🧬 Code Graph Analysis (1)backend/src/paymaster/index.ts (1)
🪛 LanguageToolbackend/CHANGELOG.md[uncategorized] ~5-~5: You might be missing the article “a” here. (AI_EN_LECTOR_MISSING_DETERMINER_A) 🪛 markdownlint-cli2 (0.17.2)backend/CHANGELOG.md2-2: Headings should be surrounded by blank lines (MD022, blanks-around-headings) 2-2: Headings should be surrounded by blank lines (MD022, blanks-around-headings) 3-3: Headings should be surrounded by blank lines (MD022, blanks-around-headings) 3-3: Headings should be surrounded by blank lines (MD022, blanks-around-headings) 4-4: Lists should be surrounded by blank lines (MD032, blanks-around-lists) ⏰ Context from checks skipped due to timeout of 90000ms (1)
🔇 Additional comments (7)
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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 (
|
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.
Caution
Inline review comments failed to post. This is likely due to GitHub's limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.
Actionable comments posted: 2
🔭 Outside diff range comments (1)
backend/src/routes/metadata-routes.ts (1)
35-144: 🧹 Nitpick (assertive)Heavy code duplication across /metadata, /metadata/v2 and /metadata/v3
The three handlers share ~80 % identical logic (secret retrieval, network config, sponsor paymaster look-ups, etc.).
Maintaining fixes (like the BigNumber bug) in three places invites divergence.Nice-to-have refactor idea:
- Extract a helper
getMetadata({ apiKey, chainId, epVersion })that returns the prepared payload.- Each route becomes a thin wrapper deciding the EP version and delegating to the helper.
This reduces maintenance cost and the chance of future inconsistencies.
Also applies to: 147-255, 257-355
🧰 Tools
🪛 Biome (1.9.4)
[error] 48-48: Declare variables separately
Unsafe fix: Break out into multiple declarations
(lint/style/useSingleVarDeclarator)
🛑 Comments failed to post (2)
backend/CHANGELOG.md (1)
2-6: 🧹 Nitpick (assertive)
Comprehensive changelog entry for the new version.
The changelog entry clearly documents the two fixes included in this version:
- Addition of oracle decimals as constants for the multiTokenPaymaster
- Fix for metadata fetching when configuration lacks a Paymaster address
However, there's a minor grammar issue in the second point.
- Fixed bug in metadata fetching if the config doesnt have Paymaster address + Fixed bug in metadata fetching if the config doesn't have a Paymaster address📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.## [4.0.2] - 2025-04-29 ### Fixes - Added oracle decimals as constants for multiTokenPaymaster as some rpc endpoints return error - Fixed bug in metadata fetching if the config doesn't have a Paymaster address🧰 Tools
🪛 LanguageTool
[uncategorized] ~5-~5: You might be missing the article “a” here.
Context: ...data fetching if the config doesnt have Paymaster address ## [4.0.1] - 2025-04-22 ### Fi...(AI_EN_LECTOR_MISSING_DETERMINER_A)
🪛 markdownlint-cli2 (0.17.2)
2-2: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Above(MD022, blanks-around-headings)
2-2: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below(MD022, blanks-around-headings)
3-3: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Above(MD022, blanks-around-headings)
3-3: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below(MD022, blanks-around-headings)
4-4: Lists should be surrounded by blank lines
null(MD032, blanks-around-lists)
backend/src/routes/metadata-routes.ts (1)
95-117:
⚠️ Potential issueUse
BigNumber.from(0)instead of numeric0to avoid type drift & runtime surprises
sponsorBalance/verifyingPaymasterDepositstart as the literal number0and are later overwritten with anethers.BigNumberinstance.
MixingnumberandBigNumberleads to a union type (number | BigNumber), which:
- defeats static-type checks,
- can break runtime JSON serialisation (native number vs
BigNumber’stoJSON()),- causes subtle bugs when callers expect only one type.
Recommended quick fix (repeat for every affected declaration):
-import { Contract, Wallet, providers, utils } from "ethers"; +import { Contract, Wallet, providers, utils, BigNumber } from "ethers"; @@ - let sponsorBalance = 0; + let sponsorBalance = BigNumber.from(0); @@ - let verifyingPaymasterDeposit = 0; + let verifyingPaymasterDeposit = BigNumber.from(0);…and at response time either
toString()orformatUnits()the value so the API consumer receives a predictable JSON type.Also applies to: 207-216, 218-227, 319-327
Description
Types of changes
What types of changes does your code introduce?
Further comments (optional)
Summary by CodeRabbit
Bug Fixes
New Features
Chores