skandha icon indicating copy to clipboard operation
skandha copied to clipboard

Feat/custom sim gas limits

Open Yashiru opened this issue 6 months ago • 1 comments

Added configurable userOp simulation gas limits in the config.

Description

Context

The function EthModule::estimateUserOperationGas in packages/executor/src/modules/eth.ts currently overrides some user operation gas-related parameters: https://github.com/etherspot/skandha/blob/e9579d57c3c321631146c2f5cb9c3608f8e78787/packages/executor/src/modules/eth.ts#L371-L380

👉 This PR introduces configuration parameters to make these hardcoded values adjustable.

Why?

Some chains have lower block gas limits, preventing Skandha from successfully calling simulateHandleOp due to EntryPoint::innerHandleOp gas verification.

For example, the SEI blockchain has a block gas limit of 10M, causing EntryPoint::innerHandleOp gas verification to always revert when using the previously hardcoded values.

Types of changes

  • [ ] Bugfix (non-breaking change which fixes an issue)
  • [x] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [ ] Documentation update
  • [ ] Code style update (formatting, renaming)
  • [ ] Refactoring (no functional or API changes)
  • [ ] Build-related changes
  • [ ] Other (please describe):

Summary by CodeRabbit

Release Notes

  • New Features

    • Gas estimation parameters are now configurable per network, including operation limits, paymaster verification costs, and fee adjustments, replacing previous hardcoded defaults.
  • Chores

    • Streamlined build process for improved deployment efficiency.

Yashiru avatar Oct 18 '25 18:10 Yashiru

Walkthrough

This PR refactors gas estimation to use configurable defaults instead of hardcoded values. It introduces a new customEstimateUserOpGasLimit configuration property to both bundler and network configs, then updates the eth module to source gas estimation defaults from this configuration. The Dockerfile build process is simplified by removing multi-step operations.

Changes

Cohort / File(s) Change Summary
Build Configuration
Dockerfile
Simplified Bun installation and build flow: removed multi-step install/build block, added --hoist flag to install, added separate hoisted install step, and restructured build execution.
Configuration Structure
packages/executor/src/config.ts, packages/executor/src/interfaces.ts
Added new customEstimateUserOpGasLimit property to BundlerConfig and NetworkConfig interfaces with nested fields: callGasLimit, paymasterVerificationGasLimit, paymasterPostOpGasLimit, preVerificationGas, verificationGasLimit (BigInt/bigint), maxFeePerGas, maxPriorityFeePerGas (number). Updated bundlerDefaultConfigs with corresponding default values.
Gas Estimation Implementation
packages/executor/src/modules/eth.ts
Modified estimateUserOperationGas to source gas limit defaults from config.customEstimateUserOpGasLimit instead of hardcoded values, with fallback to previous defaults.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Key areas of focus:
    • Verify that all seven nested fields in customEstimateUserOpGasLimit are consistently defined across config.ts, interfaces.ts, and correctly mapped in eth.ts
    • Confirm fallback behavior in eth.ts handles undefined config values appropriately
    • Ensure Dockerfile changes preserve build functionality and dependency resolution with the --hoist flag

Possibly related PRs

  • etherspot/skandha#347: Also modifies gas estimation in packages/executor/src/modules/eth.ts by introducing paymasterVerificationGasLimit and paymasterPostOpGasLimit fields—this PR consolidates and makes those defaults configurable via a centralized config structure.

Suggested reviewers

  • ch4r10t33r

Poem

🐰 With configs now guiding the way, Hardcoded numbers no longer stay, Gas limits dance to our command, The bundler blooms, oh isn't it grand! 🌱✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Feat/custom sim gas limits' is concise and directly relates to the main change—adding configurable custom simulation gas limits for userOp gas estimation.
Description check ✅ Passed The PR description is well-structured with context, motivation, and explicit marking of the change type. It includes detailed explanation of the problem (SEI blockchain issue) and references to relevant code.
✨ Finishing touches
  • [ ] 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot] avatar Oct 18 '25 18:10 coderabbitai[bot]