Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ internal object BundlerApiImpl : BundlerApi {
try {
if (partialUserOp.maxFeePerGas == null || partialUserOp.maxPriorityFeePerGas == null) {
if (estimateFeesPerGas == null) {
val defaultMaxFeePerGas = parseGwei("3")
val defaultMaxFeePerGas = defaultMaxFeePerGasFor(bundlerClient.chain.chainId)
val defaultMaxPriorityFeePerGas = parseGwei("1")
val two = BigInteger.valueOf(2)
val fees = publicApi.estimateFeesPerGas(
Expand Down Expand Up @@ -359,6 +359,22 @@ internal fun getUpdatedCalls(calls: Array<EncodeCallDataArg>): Array<EncodeCallD
}.toTypedArray()
return updatedCalls
}
/**
* Chain-aware default `maxFeePerGas` floor.
*
* L2 base fees are routinely well below 1 gwei; a hard 3 gwei floor inflates the
* worst-case spend (`gas x maxFeePerGas`) that Gas Station policies check by
* ~100-500x on those chains, rejecting otherwise-trivial UserOperations.
* Ethereum mainnet-class chains keep the conservative L1-tuned default.
*/
internal fun defaultMaxFeePerGasFor(chainId: Long): BigInteger = when (chainId) {
8453L, 84532L, // Base, Base Sepolia
42161L, 421614L, // Arbitrum One, Arbitrum Sepolia
10L, 11155420L, // Optimism, OP Sepolia
137L, 80002L, // Polygon, Polygon Amoy
-> parseGwei("0.05")
else -> parseGwei("3")
}
internal suspend fun <T> startPolling(
pollingInterval: Long,
retryCount: Int,
Expand Down