Skip to content

Conversation

@vignesha22
Copy link
Contributor

@vignesha22 vignesha22 commented Oct 31, 2025

Description

  • Enabled MTP for EPv08
  • Fixed bugs on MTP v07

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

Release Notes v4.2.0

  • Chores

    • Updated build toolchain to Bun for improved performance and reduced dependencies
    • Updated container image to Bun runtime
    • Bumped version to 4.2.0
  • Removed Features

    • Removed ERC20 Paymaster mode; token-based paymaster functionality is no longer supported
    • Removed centralized paymaster address registry

@coderabbitai
Copy link

coderabbitai bot commented Oct 31, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

This PR performs a major backend migration from ethers.js to viem for Ethereum interactions, switches the build system from npm/Node to Bun, removes the ERC20 Paymaster module, eliminates the PAYMASTER_ADDRESS constant, and updates version to 4.2.0.

Changes

Cohort / File(s) Change Summary
Build System & Configuration
backend/package.json, backend/Dockerfile, .vscode/settings.json, backend/CHANGELOG.md
Version bumped to 4.2.0; build scripts migrated to bun (npm → bun commands); Dockerfile updated to use oven/bun:1-alpine base; added claudeCodeChat.permissions.yoloMode setting; changelog entry documenting removals (erc20 mode, ethers usage) and additions (viem package, bun build).
JSON Import Assertions
backend/indexer/ponder.config.ts, backend/src/routes/deposit-route.ts, backend/src/routes/paymaster-routes.ts
Removed JSON module assertion from config.json imports across all three files, shifting from assert { type: "json" } to plain imports.
Paymaster Core Module (ethers → viem)
backend/src/paymaster/index.ts
Comprehensive migration: replaced ethers (Wallet, BigNumber, Contract, provider) with viem (createPublicClient, createWalletClient, getContract, bigint); updated all signing, contract calls, gas calculations, and oracle interactions to viem patterns; method signatures updated to use PrivateKeyAccount and PublicClient.
Paymaster Tests & Constants
backend/src/paymaster/index.test.ts, backend/src/paymaster/token.test.ts, backend/src/paymaster/token.ts, backend/src/constants/MultitokenPaymaster.ts, backend/src/constants/Token.ts
Migrated test signers from ethers Wallet to viem privateKeyToAccount; removed entire token.test.ts and token.ts modules (ERC20 Paymaster); removed PAYMASTER_ADDRESS export from constants; updated MultitokenPaymaster to use viem toHex.
Routes (ethers → viem)
backend/src/routes/admin-routes.ts, backend/src/routes/metadata-routes.ts, backend/src/routes/paymaster-routes.ts, backend/src/routes/token-routes.ts, backend/src/routes/whitelist-routes.ts
Replaced ethers utilities (isAddress, getAddress, parseEther, Contract) with viem equivalents; updated balance checks and sponsor lookups to use viem publicClient; removed tokenPaymasterAddress route; added deployment guard in deployVerifyingPaymaster to check for existing chainId entries; removed legacy ERC20 paymaster data structures.
Utilities (ethers → viem)
backend/src/utils/common.ts, backend/src/utils/interface.ts, backend/src/utils/crypto.ts, backend/src/utils/monitorTokenPaymaster.ts
Added getViemChainDef helper; updated gas fee retrieval to use viem publicClient; replaced BigNumber with bigint; updated Uint8Array handling in crypto digest comparison; replaced ethers contract interactions with viem getContract; updated interface types (BigNumber → bigint).
Core Server
backend/src/server.ts
Replaced ethers providers/wallets with viem createPublicClient/createWalletClient; updated contract reads/writes to viem patterns; added getViemChainDef integration; replaced price oracle interactions with viem read calls; added defaultTokenOracleDecimals constant; updated transaction confirmation flows.
Repository
backend/src/repository/sponsorship-policy-repository.ts
Replaced ethers.utils.isAddress with viem isAddress in sponsorship policy validation.
ABIs
backend/src/abi/VerifyingPaymasterAbiV3.ts
Formatting/indentation changes to byteCode string (no functional change).
Test Infrastructure
backend/test/helper.ts, backend/test/routes.test.ts, backend/test/tsconfig.test.json
Added new test helper module with build() function for Fastify app setup/teardown; added route tests verifying root path POST behavior and userOp payloads; added TypeScript test configuration.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant Route
    participant PaymasterService
    participant PublicClient as Viem PublicClient
    participant SignerAccount as PrivateKeyAccount

    Note over Client,SignerAccount: Old Flow (ethers)
    Client->>Route: POST /paymaster/quote
    Route->>PaymasterService: signV07(userOp, Wallet)
    PaymasterService->>PaymasterService: ethers.Contract.read()
    PaymasterService->>PaymasterService: Wallet.signMessage()
    PaymasterService-->>Client: paymasterAndData

    Note over Client,SignerAccount: New Flow (viem)
    Client->>Route: POST /paymaster/quote
    Route->>PaymasterService: signV07(userOp, PrivateKeyAccount)
    PaymasterService->>PublicClient: publicClient.readContract()
    PublicClient-->>PaymasterService: on-chain data
    PaymasterService->>SignerAccount: account.signMessage()
    SignerAccount-->>PaymasterService: signature
    PaymasterService-->>Client: paymasterAndData
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~75 minutes

  • Specific areas requiring extra attention:
    • backend/src/paymaster/index.ts — Large file with extensive logic changes across signing, contract interactions, gas calculations, and oracle integrations; requires verification that viem API calls map correctly to previous ethers behavior
    • backend/src/paymaster/index.test.ts — Test structure significantly altered; verify that new test data and signer instantiation patterns provide equivalent coverage
    • backend/Dockerfile — Build system fundamentally changed; verify bun install, bun build, and runtime commands work correctly across all stages
    • backend/package.json — Scripts completely rewritten; confirm all bun commands have correct syntax and paths; verify ethers removal doesn't break any indirect dependencies
    • backend/src/routes/admin-routes.ts, backend/src/routes/metadata-routes.ts — Balance checks and sponsor data retrieval rewritten; verify viem publicClient calls and type conversions match expected behavior
    • backend/src/server.ts — Major rewrite of price oracle and token data flows; verify viem read patterns and transaction confirmation logic

Possibly related PRs

  • PR fix for whitelisting #189 — Modifies whitelist-routes.ts address validation and related ethers.utils.isAddress calls; represents concurrent or related updates to address handling across routes
  • PR feat: Replace ethers with viem #223 — Performs same ethers-to-viem migration across backend modules; likely a parallel or superseded migration effort
  • PR Release 29.04.2025 #207 — Updates backend/src/paymaster/index.ts to add cached Chainlink oracle-decimals lookup (OracleDecimals + getChainlinkOracleDecimals helper), which may be affected or extended by this PR's viem migration

Suggested reviewers

  • ch4r10t33r
  • nikhilkumar1612

Poem

🐰 From ethers to viem, a grand refactor we make,
Bun builds it faster, for goodness sake!
BigNumbers now bigints, contracts now read with grace,
ERC20 tokens vanish without a trace 🚀

Pre-merge checks and finishing touches

❌ Failed checks (3 warnings)
Check name Status Explanation Resolution
Title Check ⚠️ Warning The PR title "Mtp bug fixes v07" suggests the changes are focused on Multi-Token Paymaster bug fixes for v07. However, the actual changeset is a comprehensive refactoring that includes a complete library migration from ethers to viem, a build system migration from npm to bun, removal of entire ERC20 Paymaster functionality, a version bump from 4.1.2 to 4.2.0, and significant infrastructure changes to the Dockerfile. The title does not accurately represent these major changes and is therefore misleading about the scope and nature of the PR.
Description Check ⚠️ Warning While the PR description follows the template structure and includes both the description and types of changes sections, the content is largely incomplete relative to the actual scope of changes in the changeset. The description only mentions enabling MTP for EPv08 and fixing MTP v07 bugs, but fails to document the major changes including the complete library migration from ethers to viem, build system migration to bun, version bump, removal of ERC20 Paymaster module, and infrastructure changes. This significantly understates what is actually being changed in the PR.
Docstring Coverage ⚠️ Warning Docstring coverage is 10.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@vignesha22 vignesha22 changed the base branch from master to develop October 31, 2025 17:49
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.

looks good

@ch4r10t33r
Copy link
Member

bump the version @vignesha22

@cloudflare-workers-and-pages
Copy link

Deploying arka with  Cloudflare Pages  Cloudflare Pages

Latest commit: 31e7d21
Status: ✅  Deploy successful!
Preview URL: https://217b2e20.arka-3qg.pages.dev
Branch Preview URL: https://mtp-bug-fixes-v08.arka-3qg.pages.dev

View logs

@vignesha22 vignesha22 merged commit 4cc26ea into develop Nov 1, 2025
3 checks passed
@vignesha22 vignesha22 deleted the MTP_Bug_Fixes_V08 branch November 1, 2025 16:03
@coderabbitai coderabbitai bot mentioned this pull request Nov 3, 2025
8 tasks
@coderabbitai coderabbitai bot mentioned this pull request Dec 9, 2025
8 tasks
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.

3 participants