-
Notifications
You must be signed in to change notification settings - Fork 11
Release 29.04.2025 #207
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
Release 29.04.2025 #207
Conversation
WalkthroughThis update introduces new constants for Chainlink oracle decimals to the backend, updates the version to 4.0.2, and enhances robustness in metadata and paymaster route handlers. The Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant MetadataRoute
participant PaymasterContract
participant Logger
Client->>MetadataRoute: GET /metadata
MetadataRoute->>MetadataRoute: Normalize paymaster address (if present)
alt Paymaster address exists
MetadataRoute->>PaymasterContract: getDeposit()
alt Success
PaymasterContract-->>MetadataRoute: Sponsor balance
else Failure
MetadataRoute->>Logger: Log error
MetadataRoute-->>Client: sponsorBalance = 0
end
else
MetadataRoute-->>Client: sponsorBalance = 0
end
MetadataRoute-->>Client: Respond with metadata (including sponsorBalance)
sequenceDiagram
participant Paymaster
participant OracleDecimals
participant ChainlinkContract
Paymaster->>OracleDecimals: Lookup decimals for (chainId, oracleAddress)
alt Found in mapping
OracleDecimals-->>Paymaster: Return decimals
else Not found
Paymaster->>ChainlinkContract: decimals()
ChainlinkContract-->>Paymaster: Return decimals
end
Paymaster-->>Paymaster: Use decimals for price calculation
Possibly related PRs
Poem
✨ 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 (
|
ch4r10t33r
left a comment
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.
LGTM
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: ASSERTIVE
Plan: Pro
📒 Files selected for processing (6)
backend/CHANGELOG.md(1 hunks)backend/package.json(1 hunks)backend/src/constants/MultitokenPaymaster.ts(1 hunks)backend/src/paymaster/index.ts(3 hunks)backend/src/routes/metadata-routes.ts(5 hunks)backend/src/routes/paymaster-routes.ts(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
backend/src/paymaster/index.ts (1)
backend/src/constants/MultitokenPaymaster.ts (1)
OracleDecimals(206-360)
🪛 LanguageTool
backend/CHANGELOG.md
[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)
backend/CHANGELOG.md
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)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Cloudflare Pages
🔇 Additional comments (11)
backend/package.json (1)
3-3: Version updated appropriately for bugfix release.The version bump from 4.0.1 to 4.0.2 correctly follows semantic versioning for a patch release with bugfixes.
backend/src/constants/MultitokenPaymaster.ts (1)
206-359: Well-structured constants added for oracle decimals.The new
OracleDecimalsconstant provides a comprehensive mapping of Chainlink oracle addresses and their decimal precision across multiple chains. This addition will reduce reliance on RPC calls that were causing errors with some endpoints.backend/src/paymaster/index.ts (3)
17-17: Import updated to include new OracleDecimals constant.The import statement now correctly includes the newly added
OracleDecimalsmapping.
436-441: Good optimization with cache-first approach.This new private method follows a best practice of checking the cached constants before falling back to on-chain calls. This pattern matches the existing methods like
getTokenDecimalsandgetTokenSymbol.
585-585: Improved error resilience by using cached oracle decimals.Replacing the direct contract call with the new
getChainlinkOracleDecimalsmethod reduces the chances of RPC errors when fetching oracle decimals.backend/src/routes/paymaster-routes.ts (1)
259-260: Conditional whitelist check for EPV_06 correctly accommodates on-chain whitelistingThe updated logic correctly adds an exception for EPV_06, preventing errors when the sender address is not whitelisted in the database. This is appropriate since EPV_06 uses the old paymaster which performs whitelisting on-chain for verifying paymaster addresses.
The clear comment also helps document this special case, making future maintenance easier.
backend/src/routes/metadata-routes.ts (5)
16-16: Appropriate import for address normalizationAdding the
getAddressutility from ethers is a good addition that will support proper address validation and normalization throughout the metadata routes.
96-106: Improved error handling for paymaster deposit fetchingThese changes properly handle potential failure cases:
- Initializing
sponsorBalanceto 0 provides a safe default- Checking if paymaster address exists before attempting to use it prevents runtime errors
- Using
getAddressto normalize the paymaster address enhances reliability- Adding try-catch blocks around contract calls ensures the endpoint remains functional even if a contract call fails
This significantly improves the robustness of the API endpoint.
208-217: Enhanced robustness for deposit retrieval in v2 metadata endpointSimilar to the main metadata endpoint, this implementation properly handles potential failure points when retrieving sponsor balances. The defensive programming approach with initialization, conditional checks, address normalization, and error handling is appropriate for integration with blockchain contracts.
240-240: Improved logic for sponsor balance reportingThis change prioritizes using the verifying paymaster deposit when available, falling back to the global paymaster deposit. This provides more accurate balance information to API consumers who are using a verifying paymaster.
320-328: Consistent error handling for v3 metadata endpointThe implementation correctly follows the same pattern established in the other endpoints, initializing the deposit variable and adding proper error handling around the contract call. This consistency across endpoints is good practice and ensures all routes have the same level of robustness.
| ## [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 doesnt have Paymaster address |
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.
🧹 Nitpick (assertive)
Changelog entries clearly document the fixes in this release.
The changelog properly documents the two bugfixes included in this release. However, there's a small grammatical error.
- 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 doesnt have Paymaster address | |
| ## [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)
Description
Types of changes
What types of changes does your code introduce?
Further comments (optional)
Summary by CodeRabbit
Bug Fixes
Chores