Gas estimation for blob submission
- Dominant language
- Go
- Stars
- 4
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
## 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
```toml
[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.go` — `DefaultEstimateGas()`, `GasToConsume()`
Contributor guide
Assessment
This issue has not been assessed yet.