Skip to Content
EVMGas Accounting

Gas Accounting Guarantees

Sei v6.1.11 release notes patched multiple gaps in gas attribution. This page captures the definitive rules for gasUsed, gasLimit, and eth_estimateGas, and provides validation steps to confirm your infrastructure is consuming the numbers correctly.

Updates in this guide reflect sei-chain@1efdec1eb (“Fix block gas used”) and supporting RPC fixes merged in the same release train.

What Changed in v6.1.11

Block gas accountingBlock `gasUsed` now equals the sum of receipt `gasUsed` for every EVM transaction executed in the block. Synthetic envelopes no longer skew totals.
Receipt accuracy`eth_getTransactionReceipt` always returns the execution gas minus refunds. Legacy blocks keep their historical values, but no new block is emitted with `0` gas.
Estimator parity`eth_estimateGas` incorporates pointer lookup warmups and Solo migration flows, eliminating the underestimation observed in `precompile-pointer` and `precompile-solo` calls.
Synthetic log flagAll Cosmos-originated events carry `synthetic: true`. Indexers can filter them without guessing based on module address.

Gas Flow At a Glance

  1. Ante Handler (Cosmos) validates fees and signatures. Synthetic envelopes terminate here and do not contribute to EVM gas totals.
  2. EVM Execution debits gas for opcodes, precompile calls, and Solo/SIP-3 migrations exactly as go-ethereum would.
  3. Refund Calculation subtracts gas refunds generated by SELFDESTRUCT or storage clears before persisting the receipt.
  4. Receipt Storage writes receipt.gasUsed = execution gas − refund.
  5. Block Aggregation sums all receipt gasUsed values and stores the result in the Tendermint block header, which RPC surfaces through eth_getBlock*.

Verifying Your Node or Indexer

StepCommandExpected Output
1seid query block 169750823 --output jsonblock.last_commit matches the RPC block hash and gas_used field > 0
2curl -s http://localhost:8545 -d '{"jsonrpc":"2.0","id":1,"method":"eth_getBlockByNumber","params":["0xa1c7bbc", true]}'gasUsed equals the sum of each transaction receipt after step 3
3curl -s http://localhost:8545 -d '{"jsonrpc":"2.0","id":1,"method":"eth_getTransactionReceipt","params":["<tx-hash>"]}'gasUsed never returns 0x0 for EVM transactions in post-v6.1.11 blocks
4curl -s http://localhost:8545 -d '{"jsonrpc":"2.0","id":1,"method":"eth_estimateGas","params":[{"to":"0x...pointer","data":"0x..."}]}'Estimation succeeds without manual gas padding for pointer/Solo operations

Configuration Touchpoints

Use the RPC config defaults from evmrpc/config.go as a baseline:

max_log_no_block`10000` logs when no block range is supplied. Keep ≥ 10k for reliable historical diffs.
max_blocks_for_log`2000` block span for log queries. Increase cautiously if you replay receipts frequently.
max_concurrent_trace_calls`10` concurrent `debug_trace*` calls. More traces increase gas accounting pressure; monitor latency.
trace_timeout`30s` default per trace. Tighten if custom tracers risk panics (see Panic FAQ).

Regression Checklist

Run this suite after upgrades or when deploying new indexer infra:

  • Fetch 10 random receipts from the latest block and ensure gasUsed is non-zero and consistent with on-chain execution.
  • Confirm eth_getBlockByNumber(..., true) shows gasUsed equal to the arithmetic sum of the receipts from the same call.
  • Estimate gas for:
    • A pointer migration using precompile-pointer:addNativePointer.
    • A Solo claim (precompile-solo:claim).
    • A standard ERC-20 transfer. Expect each to execute with a margin < 2% from actual runtime gas.
  • Replay eth_getLogs across max_blocks_for_log and ensure no panic error surfaces (see Regression Coverage guide).

Troubleshooting

ErrorCauseFix
gasUsed = 0x0 on fresh blocksNode is still serving pre-`v6.1.11` receipts or RPC cache is stale.Restart RPC service after upgrading to `v6.1.11`; invalidate any CDN cache that fronts the RPC.
eth_estimateGas fails on pointer callsPointer cache cold or Solo migration contract not yet deployed.Call `precompile-pointerview` once before estimating, or ensure Solo migration contracts are deployed at the documented addresses.
Block gasUsed > sum(receipts)Legacy block prior to `v6.1.11` or synthetic transaction included.Accept mismatch for legacy heights; filter out `synthetic: true` logs when aggregating.
  • rpc-gas-reference – Quick reference for configuration and formulae.
  • rpc-regression-playbook – Full QA checklist for RPC consumers.
  • tracing-playbook – Debugging tools for tracing anomalies.
Last updated on