Skip to content

Added paymaster validation - #117

Merged
AlonzoRicardo merged 2 commits into
tetherto:mainfrom
Boka44:fix/validate-paymaster
Aug 4, 2026
Merged

Added paymaster validation#117
AlonzoRicardo merged 2 commits into
tetherto:mainfrom
Boka44:fix/validate-paymaster

Conversation

@Boka44

@Boka44 Boka44 commented Jul 24, 2026

Copy link
Copy Markdown
Member

Description

Add paymaster-address validation to the ERC-4337 token-paymaster flow. In _applyPaymasterToUserOp, after createPaymasterUserOperation returns, we now compare the RPC-returned paymaster against the configured paymasterAddress (case-insensitive, token mode only) and throw a ConfigurationError on mismatch — before the UserOperation is signed/submitted. Added a matching unit test.

Motivation and Context

paymasterAddress was required in config but never checked against the address the paymaster RPC actually returned. Since the SDK-generated ERC-20 approval targets that returned address, a mismatched/malicious paymaster could receive an approval the user never intended. Failing fast on mismatch ensures the generated approval always targets the configured paymaster. This brings ERC-4337 in line with the existing validation in wdk-wallet-evm-7702-gasless.

Related Issue

PR fixes the following issue:
#116

Type of change

  • Bug fix (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)
  • This change requires a documentation update

Comment thread src/wallet-account-read-only-evm-erc-4337.js Outdated
Comment thread src/wallet-account-read-only-evm-erc-4337.js Outdated
Comment thread tests/wallet-account-read-only-evm-erc-4337.test.js
@AlonzoRicardo
AlonzoRicardo merged commit fff2342 into tetherto:main Aug 4, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants