Skip to content
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

added some necessary improvements (#195) #196

Merged
merged 2 commits into from
Mar 25, 2025
Merged

added some necessary improvements (#195) #196

merged 2 commits into from
Mar 25, 2025

Conversation

vignesha22
Copy link
Contributor

@vignesha22 vignesha22 commented Mar 24, 2025

Description

  • Add QA fixes

Types of changes

What types of changes does your code introduce?

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Other (please describe):

Further comments (optional)

Summary by CodeRabbit

  • New Features

    • API endpoints now process requests in a case-insensitive manner.
    • Enhanced validation checks for missing request bodies and provides clear error messages.
    • New error message constant added for empty body parameters.
    • Updated token mappings for multiple blockchain networks, reflecting a shift in supported tokens.
  • Bug Fixes

    • Improved handling of numerical values for accuracy in calculations and enhanced overall error handling.
    • Consistency in token handling within the multiTokenPaymaster functionality.
  • Chores

    • Application version updated to 3.1.5 to reflect recent improvements.

Sorry, something went wrong.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Copy link

coderabbitai bot commented Mar 24, 2025

Walkthrough

This pull request introduces several updates to the backend, including a version increment to 3.1.5, a new error message constant for empty request bodies, and a getter method for the globalMaximumUsd field in the sponsorship policy model. Additionally, it modifies the multiTokenPaymaster to ensure token decimals are defined in constants rather than fetched from RPC, and it adds a new configuration entry for a blockchain with chainId 100.

Changes

File(s) Change Summary
backend/CHANGELOG.md, backend/package.json Updated version from 3.1.3 to 3.1.5. Changelog includes a fix for multiTokenPaymaster token decimals and other minor updates.
backend/src/constants/ErrorMessage.ts Added new error constant EMPTY_BODY with message "Body params cannot be empty".
backend/src/models/sponsorship-policy.ts Introduced a getter for globalMaximumUsd that retrieves its value, converts it to a number, and returns null if falsy.
backend/src/routes/deposit-route.ts Added validation in POST /deposit and /deposit/v2 endpoints to check for an empty request body, returning a failure response if absent.
backend/src/server.ts Added new configuration option caseSensitive: false in server initialization to handle route matching in a case-insensitive manner.
backend/config.json.default Added new configuration entry for chainId 100 with properties such as bundler, etherspotPaymasterAddress, thresholdValue, and updated entryPoint.
backend/src/constants/MultitokenPaymaster.ts Significant restructuring of TokenDecimalsAndSymbol constant, with numerous tokens added and removed across various network identifiers.

Suggested reviewers

  • kanthgithub
  • cryptonoyaiba
  • nikhilkumar1612
  • ch4r10t33r

Poem

In the code burrow, we hop with glee,
Fixes and updates set our endpoints free.
With validation hops and settings so bright,
Our API scampers to all things right.
Hoppy changes brighten our coding night! 🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Sorry, something went wrong.

Copy link

@coderabbitai coderabbitai bot left a 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

📥 Commits

Reviewing files that changed from the base of the PR and between 7f7af13 and 64642fe.

📒 Files selected for processing (6)
  • backend/CHANGELOG.md (1 hunks)
  • backend/package.json (1 hunks)
  • backend/src/constants/ErrorMessage.ts (1 hunks)
  • backend/src/models/sponsorship-policy.ts (1 hunks)
  • backend/src/routes/deposit-route.ts (2 hunks)
  • backend/src/server.ts (1 hunks)
🧰 Additional context used
🪛 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 (6)
backend/package.json (1)

3-3: Version bump looks appropriate.

The version increment from 3.1.3 to 3.1.4 aligns with the bugfix nature of the PR.

backend/src/constants/ErrorMessage.ts (1)

2-2: Good addition for better error handling.

This new error message will improve error handling for empty request bodies in the deposit endpoints.

backend/src/server.ts (1)

44-44: Makes all routes case-insensitive as documented in changelog.

Setting caseSensitive: false in the Fastify server configuration ensures all API endpoints are case-insensitive, which improves the API's usability.

backend/src/routes/deposit-route.ts (2)

50-52: Good error handling improvement.

Adding validation for empty request bodies is a great defensive programming practice. This prevents potential issues that could occur when trying to access properties of undefined objects later in the code flow.


123-125: Good consistency in error handling across endpoints.

This validation matches the one added to the first endpoint, ensuring consistent error handling throughout the API. The error response uses the appropriate return code and a specific error message, which aligns with good API design practices.

backend/src/models/sponsorship-policy.ts (1)

152-155: Good improvement for consistent type handling.

Adding a getter to convert the globalMaximumUsd decimal value to a JavaScript Number ensures consistent type handling when performing calculations. The null check is also properly implemented.

While converting to Number could theoretically lose precision for very large decimal values, the DECIMAL(10,4) format used here should be adequately represented by JavaScript's Number type for currency values.

Copy link
Member

@ch4r10t33r ch4r10t33r left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
* added all token decimals

* added gnosis for epv7 as supported networks
Copy link

cloudflare-workers-and-pages bot commented Mar 25, 2025

Deploying arka with  Cloudflare Pages  Cloudflare Pages

Latest commit: c474929
Status: ✅  Deploy successful!
Preview URL: https://0fa32ecb.arka-3qg.pages.dev
Branch Preview URL: https://develop.arka-3qg.pages.dev

View logs

Copy link

@coderabbitai coderabbitai bot left a 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

♻️ Duplicate comments (1)
backend/CHANGELOG.md (1)

2-5: 🧹 Nitpick (assertive)

Consider adding blank lines around headings for Markdown compliance.

Markdown linting rules (MD022) often require one blank line before and after headings. You can fix it by adding blank lines around ## [3.1.5] - 2025-03-24 and ### Fixes, for example:

2 ## [3.1.5] - 2025-03-24
3 ### Fixes
4 - Added all tokens used in multiTokenPaymaster to have decimals in constants rather than fetching from rpc
5 
+## [3.1.5] - 2025-03-24

+### Fixes

+- Added all tokens used in multiTokenPaymaster to have decimals in constants rather than fetching from rpc
🧰 Tools
🪛 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: Trailing spaces
Expected: 0 or 2; Actual: 1

(MD009, no-trailing-spaces)


4-4: Lists should be surrounded by blank lines
null

(MD032, blanks-around-lists)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 64642fe and c474929.

📒 Files selected for processing (4)
  • backend/CHANGELOG.md (1 hunks)
  • backend/config.json.default (1 hunks)
  • backend/package.json (1 hunks)
  • backend/src/constants/MultitokenPaymaster.ts (1 hunks)
🧰 Additional context used
🪛 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: Trailing spaces
Expected: 0 or 2; Actual: 1

(MD009, no-trailing-spaces)


4-4: Lists should be surrounded by blank lines
null

(MD032, blanks-around-lists)


6-6: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


7-7: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Above

(MD022, blanks-around-headings)


7-7: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


8-8: 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 (10)
backend/package.json (1)

3-3: Version bump looks good.

Incrementing the version from 3.1.3 to 3.1.5 aligns with your changelog entry. No issues spotted here.

backend/config.json.default (1)

122-132: Confirm the empty Paymaster address for the new chainId 100 entry.

You’ve added a second entry for the same chainId: 100, with a v2 bundler URL. Notably, "etherspotPaymasterAddress" is left empty. If this is intentional, please confirm that the application can handle an empty address without error.

Would you like a script to check how this new chain config is referenced across the codebase for potential issues?

backend/src/constants/MultitokenPaymaster.ts (8)

11-19: Verify token addresses & decimals for chainId=1.

Please ensure all contract addresses (e.g., Tether, USDC, LINK, etc.) match official sources and decimals are correct. Incorrect addresses or decimal values could lead to payment failures.


21-40: Check newly added tokens for chainId=10.

This chunk includes many tokens (KWENTA, LYRA, etc.). Verify that each contract address and decimal setting is valid and up to date.


42-104: Large addition of tokens for chainId=56 (BSC).

You’ve added numerous entries (e.g., USDT, USDC, MATIC, DOGE). Confirm the correctness of each address, as any mismatch could break paymaster logic or cause incorrect fee deductions.


105-148: New tokens for chainId=137 (Polygon).

Entries for BUSD, USDC, AAVE, etc., have been introduced or restructured. Ensure these addresses are accurate and decimals reflect actual token configurations on Polygon.


150-154: chainId=204 tokens updated.

Entries like BTCB, ETH, USDT, and FDUSD were added. Please verify each address and decimal.


155-163: Validate newly introduced addresses for chainId=8453.

Important tokens like USDbC, cbETH, and rETH are added. Ensure these addresses are correct, as they differ from standard Ethereum networks.


164-193: Review chainId=42161 (Arbitrum) tokens carefully.

This set includes standard stablecoins (USDT, USDC) alongside specialized tokens (VELA, GMX, STG, etc.). Mistakes can cause immediate failures in paymaster functionalities.


195-202:

❓ Verification inconclusive

Confirm addresses for chainId=43114 (Avalanche).

Tokens such as GMX, USDT, and others are newly configured. If you need help verifying them, consider a script that cross-checks addresses or searching block explorers for official references.


🏁 Script executed:

#!/bin/bash
# Attempt to locate occurrences of newly introduced Avalanche addresses in the codebase
# and see if they match known references from explorers like snowtrace.io

addresses=(
"0x62edc0692BD897D2295872a9FFCac5425011c661"
"0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7"
"0xD24C2Ad096400B6FBcd2ad8B24E7acBc21A1da64"
"0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"
"0xC891EB4cbdEFf6e073e859e987815Ed1505c2ACD"
"0xB3fe5374F67D7a22886A0eE082b2E2f9d2651651"
)

for addr in "${addresses[@]}"; do
  echo "Searching for $addr in the repo:"
  rg "$addr"
done

Length of output: 2451


Avalanche Token Address Confirmation Needed
The addresses in backend/src/constants/MultitokenPaymaster.ts (covering GMX, USDt, FRAX, USDC, EURC, LINK, and UNI.e) are currently defined only here. Although our search confirms that each address is uniquely referenced in this file, please verify these addresses against official Avalanche sources (e.g., Snowtrace) to ensure they are correct and up to date.

  • Confirm that all token addresses (especially for USDt and UNI.e, which were not part of the initial search batch) match their official deployments on Avalanche (chainId=43114).
  • Cross-check with block explorer references or official token documentation to avoid any discrepancies with these newly configured tokens.

Comment on lines +6 to +10
## [3.1.4] - 2025-03-19
### Fixes
- Changed all endpoints to be case-insensitive
- Fetch `globalMaximumUsd` value to convert into Number for absolute value
- Improve error handling in deposit apis
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Apply similar markdown spacing improvements here.

Just like the above segment, you can address the same markdown lint warnings (MD022, MD032) by surrounding headings and lists with blank lines. This will keep your changelog consistent and pass lint checks.

🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

6-6: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


7-7: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Above

(MD022, blanks-around-headings)


7-7: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


8-8: Lists should be surrounded by blank lines
null

(MD032, blanks-around-lists)

@vignesha22 vignesha22 merged commit 265596f into master Mar 25, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants