Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions backend/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# Changelog
## [3.1.3] - 2025-03-13
### Fixes
- Fixed Verifying Paymaster execution for undeployed wallets

Comment on lines +2 to +5
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Changelog properly documents the bug fix.

The changelog entry clearly describes the issue that was fixed: "Fixed Verifying Paymaster execution for undeployed wallets." This aligns with the code changes in the paymaster module.

There are some minor markdown formatting issues though - headings should be surrounded by blank lines according to markdown best practices.

 # Changelog
+
 ## [3.1.3] - 2025-03-13
+
 ### Fixes
+
 - Fixed Verifying Paymaster execution for undeployed wallets
📝 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.

Suggested change
## [3.1.3] - 2025-03-13
### Fixes
- Fixed Verifying Paymaster execution for undeployed wallets
# Changelog
## [3.1.3] - 2025-03-13
### Fixes
- Fixed Verifying Paymaster execution for undeployed wallets
🧰 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: Lists should be surrounded by blank lines
null

(MD032, blanks-around-lists)

## [3.1.2] - 2025-02-28
### Fixes
- Fixed invalid address error on cronJob
Expand Down
2 changes: 1 addition & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "arka",
"version": "3.1.2",
"version": "3.1.3",
"description": "ARKA - (Albanian for Cashier's case) is the first open source Paymaster as a service software",
"type": "module",
"directories": {
Expand Down
22 changes: 20 additions & 2 deletions backend/src/paymaster/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,25 @@ export class Paymaster {
if (!userOp.signature) userOp.signature = '0x';
if (userOp.factory && userOp.factoryData) userOp.initCode = hexConcat([userOp.factory, userOp.factoryData ?? ''])
if (!userOp.initCode) userOp.initCode = "0x";
const paymasterPostOpGasLimit = BigNumber.from("40000").toHexString();
if (estimate) {
userOp.paymaster = paymasterAddress;
userOp.paymasterVerificationGasLimit = this.EP7_PVGL;
userOp.paymasterPostOpGasLimit = paymasterPostOpGasLimit;
const accountGasLimits = this.packUint(userOp.verificationGasLimit, userOp.callGasLimit)
const gasFees = this.packUint(userOp.maxPriorityFeePerGas, userOp.maxFeePerGas);
const packedUserOp = {
sender: userOp.sender,
nonce: userOp.nonce,
initCode: userOp.initCode,
callData: userOp.callData,
accountGasLimits: accountGasLimits,
preVerificationGas: userOp.preVerificationGas,
gasFees: gasFees,
paymasterAndData: this.packPaymasterData(paymasterAddress, this.EP7_PVGL, paymasterPostOpGasLimit),
signature: userOp.signature
}
userOp.paymasterData = await this.getPaymasterData(packedUserOp, validUntil, validAfter, paymasterContract, signer);
Comment on lines +117 to +133
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Critical bug fix: Paymaster data is now correctly included before estimation.

This change fixes the core issue with the Verifying Paymaster by ensuring that when estimate is true, the paymaster data is properly included in the user operation before it's sent to the bundler for estimation. Previously, this data was missing during estimation for undeployed wallets.

The key improvements:

  1. Setting userOp.paymaster to the paymaster address
  2. Adding proper gas limits via paymasterVerificationGasLimit and paymasterPostOpGasLimit
  3. Creating a properly formatted packedUserOp with all required fields
  4. Fetching and applying paymasterData before estimation

This ensures the bundler can correctly estimate gas costs for operations involving undeployed wallets.

const response = await provider.send('eth_estimateUserOperationGas', [userOp, entryPoint]);
userOp.verificationGasLimit = response.verificationGasLimit;
userOp.callGasLimit = response.callGasLimit;
Expand All @@ -128,7 +146,7 @@ export class Paymaster {
accountGasLimits: accountGasLimits,
preVerificationGas: userOp.preVerificationGas,
gasFees: gasFees,
paymasterAndData: this.packPaymasterData(paymasterAddress, this.EP7_PVGL, "0x1"),
paymasterAndData: this.packPaymasterData(paymasterAddress, this.EP7_PVGL, paymasterPostOpGasLimit),
signature: userOp.signature
}

Expand All @@ -142,7 +160,7 @@ export class Paymaster {
verificationGasLimit: BigNumber.from(userOp.verificationGasLimit).toHexString(),
callGasLimit: BigNumber.from(userOp.callGasLimit).toHexString(),
paymasterVerificationGasLimit: this.EP7_PVGL.toHexString(),
paymasterPostOpGasLimit: "0x1"
paymasterPostOpGasLimit
}
} else {
returnValue = {
Expand Down