fix(gasless): prioritize EIP-5792 over EIP-7702 for MetaMask#878
Draft
TaprootFreak wants to merge 5 commits intodevelopfrom
Draft
fix(gasless): prioritize EIP-5792 over EIP-7702 for MetaMask#878TaprootFreak wants to merge 5 commits intodevelopfrom
TaprootFreak wants to merge 5 commits intodevelopfrom
Conversation
3ee97d6 to
0f8873b
Compare
🤖 PR Review Bot
|
0f8873b to
99e90ac
Compare
The tx-helper hook was checking EIP-7702 first, causing failures because: 1. MetaMask 12.20+ handles EIP-7702 internally via wallet_sendCalls 2. Direct EIP-7702 signing has issues (wrong EntryPoint, signature format) Changes: - Reorder checks: EIP-5792 first, EIP-7702 as fallback - Add comprehensive unit tests for gasless flow priority (42 tests) - Add integration tests for Pimlico paymaster API - Update E2E tests for multi-wallet support Priority order now: 1. EIP-5792 (wallet_sendCalls with paymasterService) - MetaMask native 2. EIP-7702 (signEip7702Authorization + confirmSell) - fallback 3. Standard transaction (createTransactionMetaMask)
- Add requirePaymaster parameter to sendCallsWithPaymaster() - Set optional:false when depositTx.eip5792 exists (user has 0 ETH) - Remove fallback to standard TX when gasless fails (would fail anyway) - Fetch paymentInfo with depositTx for EIP-5792 in sell/swap screens - Update config comment to reflect MetaMask 13.13.1 When user has 0 ETH and wallet doesn't support paymasterService, MetaMask now returns error code 5700 which propagates to UI instead of silently attempting an impossible transaction.
- Add API test scripts for gasless flows (EIP-7702, permit, Pimlico) - Add Synpress test specs for gasless debugging - Add debug screenshots for MetaMask interactions
- Remove unused variables (index, chainId parameters) - Replace non-null assertions with conditional spreading - Remove unused imports (act from @testing-library/react) - Prefix unused variables with underscore (_originalWindow) - Update EIP-5792 tests to expect version 2.0.0 format
d8c9e29 to
bf2140c
Compare
| await page.locator(`[data-testid="import-srp__srp-word-${i}"]`).fill(words[i]); | ||
| } | ||
| console.log(' Entered seed phrase via individual inputs'); | ||
| seedEntered = true; |
| } | ||
| await page.waitForTimeout(500); | ||
| await page.keyboard.type(seedPhrase, { delay: 30 }); | ||
| seedFilled = true; |
|
|
||
| async function getWalletBalances(wallet: ethers.HDNodeWallet): Promise<{ eth: string; usdt: string }> { | ||
| const provider = new ethers.JsonRpcProvider(SEPOLIA_RPC); | ||
| const connectedWallet = wallet.connect(provider); |
|
|
||
| const API_URL = process.env.API_URL || 'https://dev.api.dfx.swiss/v1'; | ||
| const TEST_SEED = process.env.TEST_SEED_2; // Wallet 2 with 0 ETH | ||
| const PIMLICO_API_KEY = 'pim_G7dVkmZhrWG76Wq52th5tV'; // From test logs |
| console.log(' ✓ Got paymaster stub data\n'); | ||
|
|
||
| // Add paymaster data to userOp | ||
| const userOpWithPaymaster = { |
| /** | ||
| * Debug test for gasless transaction - captures all errors | ||
| */ | ||
| import { test, expect, BrowserContext, Page } from '@playwright/test'; |
| await page.screenshot({ path: 'e2e/screenshots/debug-07-final.png' }); | ||
| } | ||
|
|
||
| async function findPopup(context: BrowserContext): Promise<Page | null> { |
| return null; | ||
| } | ||
|
|
||
| async function handleMetaMaskPopup(popup: Page): Promise<string> { |
Collaborator
Author
Code-Review: ProduktionscodeZusammenfassung der Änderungen
Probleme gefunden1. Toter Code - ungenutzte Typen (
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
wallet_sendCalls) now checked before EIP-7702wallet_sendCallswithpaymasterServiceProblem
The previous code checked EIP-7702 first, which failed because:
wallet_sendCalls- no direct signing neededRe-opened
Previous PR #863 was accidentally merged. This is a new PR from the original branch.
Test Plan