Skip to content

Conversation

@TaprootFreak
Copy link
Collaborator

Summary

Fix gasless EIP-7702 + ERC-4337 transactions by sending the authorization as a separate eip7702Auth field instead of encoding it in factoryData.

Problem: After fixing the paymaster address issue (#2853), transactions failed with:

AA13 initCode failed or OOG

Root cause: Per ERC-7769, the EIP-7702 authorization must be sent as a separate eip7702Auth field in the UserOperation JSON, not encoded in factoryData.

When INITCODE_EIP7702_MARKER (0x7702) is specified, the factoryData value is passed directly to the sender contract, instead of the factory contract. The purpose of this factoryData call is to provide the EIP-7702 sender contract an ability to initialize its storage.

Changes:

  • Add eip7702Auth field to UserOperationV07 interface
  • Send authorization as separate eip7702Auth field
  • Set factoryData to '0x' (empty, as it's for storage init)

Test plan

  • Run gasless sell test with wallet that has 0 ETH balance
  • Verify AA13 error is resolved
  • Verify full gasless transaction flow works

Sources:

@github-actions
Copy link

github-actions bot commented Jan 6, 2026

🤖 PR Review Bot

⚠️ Unverified Commits (4)

The following commits are not signed/verified:

  • bd5453e fix(pimlico): send EIP-7702 authorization as separate field per ERC-7769 (TaprootFreak)
  • 58fdf1c fix(pimlico): update EIP-7702 UserOperation format for Pimlico bundler (TaprootFreak)
  • b2c9242 fix(pimlico): remove unused EIP7702_FACTORY constant (TaprootFreak)
  • e286fbc fix(pimlico): improve EIP-7702 UserOperation structure (TaprootFreak)
How to sign commits
# SSH signing (recommended)
git config --global gpg.format ssh
git config --global user.signingkey ~/.ssh/id_ed25519.pub
git config --global commit.gpgsign true

# Re-sign last commit
git commit --amend -S --no-edit
git push --force-with-lease

⚠️ Security: 0 critical, 67 high vulnerabilities


This is an automated review. Please address the issues above.

@TaprootFreak TaprootFreak marked this pull request as draft January 7, 2026 08:17
The authorization was incorrectly encoded in factoryData. Per ERC-7769,
eip7702Auth must be a separate field in the UserOperation JSON.

- Add eip7702Auth field to UserOperationV07 interface
- Send authorization as separate eip7702Auth field instead of factoryData
- Set factoryData to '0x' (used for storage init, not auth)
- Use EntryPoint v0.8 (required for EIP-7702)
- Use correct EIP-7702 factory marker (0x7702... right-padded)
- Pass eip7702Auth as separate field with 'contractAddress' key
- Remove factoryData param (not needed for EIP-7702)
@TaprootFreak TaprootFreak force-pushed the fix/eip7702-auth-field branch from 2eed754 to 58fdf1c Compare January 7, 2026 18:40
- Remove dead code: encodeAuthorizationAsFactoryData (no longer used)
- Rename UserOperationV07 to UserOperationV08 for clarity
- Include eip7702Auth BEFORE gas estimation (was added after)
- This ensures Pimlico bundler can properly estimate gas with the
  authorization context
@TaprootFreak
Copy link
Collaborator Author

Code-Review: EIP-7702 Authorization Fix

Zusammenfassung

Der PR ändert wie EIP-7702 Autorisierungen an den Pimlico Bundler gesendet werden:

Vorher Nachher
EntryPoint v0.7 (0x0000000071727De22E5E9d8BAf0edAc6f37da032) EntryPoint v0.8 (0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108)
Authorization in factoryData encodiert Authorization als separates eip7702Auth Feld
factory: 0x7702... marker factory: null/undefined
encodeAuthorizationAsFactoryData() Entfernt (dead code)

✅ Was korrekt ist

  1. Separates eip7702Auth Feld per ERC-7769 - Das ist die korrekte Spezifikation. Die alte Methode (encoding in factoryData) war falsch und verursachte den AA13 initCode failed Fehler.

  2. EntryPoint v0.8 für EIP-7702 - Korrekt. EntryPoint v0.8 ist auf 21+ Chains deployed inkl. Sepolia und bietet native EIP-7702 Unterstützung.

  3. contractAddress statt address - Pimlico-spezifisch, korrekt implementiert.

  4. Authorization VOR Gas-Estimation einbinden - Wichtig für akkurate Schätzungen, gut dass das jetzt korrekt ist.

  5. Entfernung von encodeAuthorizationAsFactoryData() - Dead code entfernt, sauber.


⚠️ Offene Fragen

1. Chain-Kompatibilität prüfen

EntryPoint v0.8 ist deployed auf: Ethereum, Arbitrum, Base, Optimism, Polygon, Avalanche, BNB, Scroll, zkSync, Blast, Gnosis, Sepolia, etc.

Frage: Sind alle von DFX unterstützten EVM-Chains dabei? Sollte in evm-chain.config.ts geprüft werden ob v0.8 verfügbar ist.

2. Interface-Konsistenz

interface UserOperationV08 {
  factory?: Address | null;   // Optional
  factoryData?: Hex;          // Optional
  // ...
}

Im Code wird factory einfach weggelassen. Wäre explizites factory: null klarer?

3. Keine Unit Tests

Der PR ändert kritische Bundler-Logik ohne Unit Tests. Empfehlung: Mindestens einen Test für das korrekte eip7702Auth Format hinzufügen.


📋 Vorschlag

Vor dem Merge sollte geprüft werden:

  • EntryPoint v0.8 Verfügbarkeit auf allen DFX-EVM-Chains validieren
  • E2E Test auf Sepolia mit 0 ETH Wallet durchführen
  • Optional: Unit Test für buildUserOperation() hinzufügen

Quellen:

@TaprootFreak TaprootFreak marked this pull request as ready for review January 13, 2026 23:56
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