Skip to content

Reduce dynamic RPC usage #953

@dancoombs

Description

@dancoombs

Describe the feature
Reduce dynamic RPC usage. That is, requests that occur either (1) in response to an external RPC request, (2) during bundle building, (3) when UOs are mined.

TODO double check this:

  • eth_estimateUserOperationGas:
    • 1x eth_getBlockByNumber - to get a block hash to anchor subsequent calls
      • get this from pool?
    • VGL: 2+ eth_call
    • CGL: 2+ eth_call
    • PVGL: 2+ eth_call
    • PVG: 1x eth_call for DA
    • Can we limit this? Upwards of 7+ eth_call for a single estimation. Need to price accordingly. Metrics for avg.
  • eth_sendUserOperation:
    • Precheck:
      • up to 3x eth_getCode - to check if entities are contracts (4x when we have aggregators)
      • 1x eth_call - to get entry point deposit
      • 1x eth_getBalance - to get payer balance
      • 1x eth_call - to get DA gas costs
      • May be able to consolidate
    • Simulation:
      • 1x debug_traceCall w/ custom tracer
      • 1x eth_call - to get code hashes
      • 1x eth_call - signature aggregator check (refactor this)
    • When entering pool:
      • 1x eth_getBlock - race condition, see code
      • 1x eth_call - get paymaster balance if new paymaster
        • make sure this isn't getting called 2x.
      • 1x eth_call - for gas limit eff check
  • eth_getUserOperationByHash:
    • 1x eth_getLogs
    • (if to != entry point) 1x debug_traceTransaction
    • This is best we can do, need to handle known to addresses for entry point proxies
  • eth_getUserOperationReceipt:
    • 1x eth_getLogs
    • 1x eth_getTransactionReceipt
    • This is best we can do
  • rundler_maxPriorityFeePerGas:
    • (depends on fee oracle, below is for bedrock)
    • 2x eth_feeHistory calls
    • Should consolidate this to 1, or potentially 0 by moving ownership of this to the mempool and calling once per block.

Low hanging fruit:

  • Refactor fee estimation, make it owned by the pool & called by RPC
  • Add list of entry point proxies to limit traces during by hash
  • Add a cache for precheck isContract check
  • Consolidate other precheck async calls into a single multicall
  • Refactor paymaster balance code
  • Refactor signature aggregator code
  • Look into gas estimation eth_call usage

TODO fill this out:

Bundle building RPC calls:

Pool RPC calls:

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions