Try   HackMD

Challenges of EIP4337-bundler in Layer2 implementation

Bundler is an indispensable part of the EIP4337 ecosystem, and users interact with the bundler’s RPC endpoint. And bundler needs to implement a very strict UserOperation simulation policy to prevent risk. Implementing bundlers in Layer1 is a challenge (not discuss now), but the implementation of bundler in Layer2 will be more challenging:

  1. Sequencer centralization

    • Sequencer centralization would make it impossible (or difficult) to create a public userOp mempool, which would make each bundler and the whole system more vulnerable to attacks (bundler as relays, and unless Layer2 supports adding new transaction type (e.g., Layer2 supports guaranteeing that the pre-defined storage slots in a transaction are not modified otherwise the transaction is rejected), the bundler's operator will face a significant security risk).
      Note: Some Layer2 is exploring decentralized Sequencer, but I haven't found more information at the moment. If you have relevant information, I believe everyone will appreciate your sharing.
      A great update(thank to heymarcopolox)!!!
      https://notes.ethereum.org/@yoav/SkaX2lS9j
      eth client in development:https://github.com/tynes/go-ethereum/blob/ad0cede82fdf62b796f3c6d584c0ace408cdd32c/internal/ethapi/api.go#L1785
  2. Gas fee calculation complexity

    • In some Layer2, the gas fee of a transaction is often composed of two parts:
      gas fee = L2 cost + L1 calldata cost
      The entrypoint currently implemented by eth-infinitism is difficult to support L1 calldata cost, of course, there are two ways to solve this problem:
      a) Increase userOp.maxPriorityFeePerGas to cover costs
      b) Increase userOp.preVerificationGas to cover costs (we're doing for now: https://github.com/proofofsoulprotocol/bundler/blob/7dbc0423b41720705798fe38f230ca1722af3415/packages/bundler/src/UserOpMethodHandler.ts#L168)
      But no matter which solution is adopted, it will become unreasonable for users to set the gas fee paid to bundler (calculated based on the L2 gasPrice at that time) after a period of time because the L1 gasPrice and L2 gasPrice are not synchronized:
    1. users pay more fees when L1 gasPrice down
    2. bundler is no longer willing to bundle your UserOp when L1 gasPrice up
      I think if ERC4337 to run on Layer2 in the future, it may be necessary to make some adjustments on the entrypoint, for example: introducing L1 gasPrice when calculating fees in the entrypoint.

please feel free to contact me TG | cejay519@twitter