Skip to content

Gas estimation for blob submission #17

Description

@tac0turtle

Summary

Implement deterministic gas estimation for MsgPayForBlobs transactions.

Parent: #4

Design

Recreate the gas estimation formula from scratch rather than importing celestia-app:

gas = gasToConsume(blobSizes, gasPerBlobByte) + (txSizeCostPerByte * bytesPerBlobInfo * numBlobs) + pfbGasFixedCost

Constants (from celestia-app, may need updating per network version):

  • pfbGasFixedCost = 75,000
  • bytesPerBlobInfo = 70
  • gasPerBlobByte = 8
  • txSizeCostPerByte — governance parameter, query from chain or configure

Gas price

  • Configurable default gas price in config
  • Optional multiplier/buffer (e.g., 1.1x) to reduce "insufficient fee" rejections
  • No dependency on celestia-node's gas estimator gRPC service
  • Optionally query QueryMinimumGasPrice() from a celestia-app RPC endpoint as a floor
[submission]
gas_price = 0.002         # utia per gas unit
gas_price_buffer = 1.1    # 10% buffer over minimum
max_gas_price = 0.2       # safety cap

Requirements

  • Pure function: given blob sizes, return gas estimate
  • No network calls required (deterministic)
  • Unit tests validating against known celestia-app outputs
  • Configurable constants for network upgrades

References

  • celestia-app x/blob/types/payforblob.goDefaultEstimateGas(), GasToConsume()

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