Skip to content

bundlerClient.sendUserOperation pays way too much for gas #3430

@johanneskares

Description

@johanneskares

Check existing issues

Viem Version

2.23.6

Current Behavior

When sending a transaction using bundlerClient.sendUserOperation the gas price is way to high.

Here's a AA transaction, that was created using sendUserOperation on Base. Gas Price was over 1 Gwei.
https://basescan.org/tx/0xe1c9399343ea62ebf247492d6c8efc1c3e16ac38118b78cdeda1887333d8cc3b

The corresponding Bundler TX has only a gas price of 0.003 Gwei, so a 300x difference, so I massively overpaid the bundler.
https://basescan.org/tx/0x607f66017375f1eb655f931fdffb39e9ab6d349a9c60a1544d1869c979e9f01d

I tried it with both Pimlico Bundler and Coinbase Bundler, same result.

My quick fix was to do this

const userOpHash = await bundlerClient.sendUserOperation({
    calls: [...],
    maxFeePerGas: 2n * (await bundlerClient.client.getGasPrice()),
});

Is it possible that this should be Math.min? :

Currently, prepareUserOperation returns at least 3 Gwei for maxFeePerGas, doesn't really make sense.

Expected Behavior

Gas Price for sendUserOperation should be close to current gas price.

Steps To Reproduce

Use bundlerClient.sendUserOperation and send a transaction.

Link to Minimal Reproducible Example

No response

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions