Skip to content

CLI anchor command: gas estimation exceeds Base Sepolia per-tx limit #75

Description

@crtahlin

Bug

When using the CLI's anchor command on Base Sepolia, the transaction can fail because the RPC gas estimation returns ~131,250,000 which exceeds Base Sepolia's per-transaction gas limit of 25,000,000.

This is the same root cause as datafund/swarm_provenance_SDK#45 — the underlying SDK's ChainClient doesn't pass a gas field in sendTransaction, so the RPC node's gas estimation is used, which can return unreasonably high values.

Error

ChainTransactionError: Transaction failed: [object Object]

(The [object Object] is a separate stringification bug in the SDK — see datafund/swarm_provenance_SDK#45.)

Expected behavior

The CLI should either:

  1. Accept a --gas flag to let users override the gas limit
  2. Set a sensible default gas limit (e.g., 500,000) for registerData calls
  3. Or be fixed upstream via the SDK (ChainClient: gas estimation exceeds Base Sepolia per-tx limit (131M vs 25M) swarm_provenance_SDK#45)

Workaround

Consumers of the SDK are wrapping the EIP-1193 provider to inject a gas limit before passing it to fromEip1193Provider:

const DEFAULT_GAS_LIMIT = '0x7A120' // 500,000

function withGasLimitProvider(provider) {
  return {
    request(args) {
      if (args.method === 'eth_sendTransaction' && args.params?.[0]) {
        const tx = args.params[0];
        if (!tx.gas) tx.gas = DEFAULT_GAS_LIMIT;
      }
      return provider.request(args);
    },
  };
}

Related

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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