Skip to content

IND-277 | Implement bundler-based gas estimation and signature-aware preVerificationGas#6

Merged
DrenIncentiv merged 1 commit intomainfrom
IND-277-dynamic-gas-estimation-with-bundler-simulation
Jan 6, 2025
Merged

IND-277 | Implement bundler-based gas estimation and signature-aware preVerificationGas#6
DrenIncentiv merged 1 commit intomainfrom
IND-277-dynamic-gas-estimation-with-bundler-simulation

Conversation

@enis-incentiv
Copy link
Collaborator

Story

https://incentiv-net.atlassian.net/browse/IND-277

Summary

This PR improves gas estimation in the UI-SDK by implementing bundler-based gas estimation for transaction gas limits, while separately optimizing preVerificationGas calculation based on signature types. This ensures more accurate gas estimation for user operations while properly accounting for different signature sizes in the preVerificationGas overhead.

Key Changes:

  1. Gas Estimation Improvements:

    • Implemented bundler-based gas estimation for transaction gas limits
    • Added proper error handling and logging for bundler estimation responses
    • Preserved user-provided gas limits when explicitly set
  2. PreVerificationGas Optimization:

    • Enhanced preVerificationGas calculation to account for different signature sizes
    • Added proper handling of EOA (65 bytes) and Passkey (536 bytes) signatures
    • Added fallback minimum gas value (49,024) to ensure bundler requirements
  3. Debug Improvements:

    • Added detailed debug logs for gas estimation process
    • Enhanced error reporting for bundler estimation failures

Testing:

  • Verified gas estimation works correctly for both EOA and Passkey signatures
  • Tested bundler estimation with various transaction types (transfers, contract interactions)
  • Confirmed proper error handling when bundler estimation fails

Technical Notes:

  • The bundler estimation is now the primary source of gas limits
  • Gas estimation takes into account the signature type (65 bytes for EOA, 536 bytes for Passkey)
  • Added safeguards to prevent underestimation of gas limits

@DrenIncentiv
Copy link
Contributor

Looks great, thank you!

@DrenIncentiv DrenIncentiv merged commit dd2cd8c into main Jan 6, 2025
2 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