Skip to content
This repository has been archived by the owner on Oct 20, 2024. It is now read-only.

Gas Price Suggesting may cause loss to the bundler #342

Open
wanliqun opened this issue Nov 22, 2023 · 1 comment
Open

Gas Price Suggesting may cause loss to the bundler #342

wanliqun opened this issue Nov 22, 2023 · 1 comment

Comments

@wanliqun
Copy link

Before sending a bundle transaction, gas price has to be estimated base on the current network status and max gas price settings of all batch user operations. The current method used is to calculate the average gas price of the entire batch without considering the max available gas limit each user operation may consume. This may cause some loss of gas fee to the bundler.

Let's say, we have three user operations (op0, op1, op2) as a batch, with gas price of (10 Gwei, 20 Gwei, 30 Gwei) and max gas limit of (300k, 200k, 100k) respectively. The estimated gas price from chain rpc is 10 Gwei, so that all user operation can be included in a bundle transaction.

If we don't take gas limit of each user operation into consideration, the suggested gas price for this bundle transaction would be MAX(10 Gwei, (10+20+30)/3 Gwei) = 20Gwei. Assumed the gas estimate is very accurate so that all gas limit of each user opearion is fully consumed, so the bundler would take (100k + 200k + 300k) * 20 Gwei = 12000k Gwei gas fee, whereas the prefunded gas fee from all user operations is 300k * 10 Gwei + 200k * 20 Gwei + 100k * 30Gwei = 10000k Gwei. As a result, the bundler would loss an extra of 2000k Gwei gas fee.

@hazim-j
Copy link
Member

hazim-j commented Nov 22, 2023

Hi @wanliqun. Yup, that's a valid point. Thanks for bringing it up. Happy to chat through some possible ideas for a more scalable solution. Gas price for bundler transactions are a challenge. Set it too low and userOps with high gas price may not be getting their ideal inclusion speed. But set it too high and bundler looses even more funds from the UserOps with low gas price.

This current solution was the easiest compromise.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants