Skip to content

fix(evm): fall back to tx.gasPrice when receipt omits effectiveGasPrice (Cronos)#18

Merged
runninyeti merged 1 commit into
mainfrom
fix/evm-effective-gas-price-fallback
Jun 18, 2026
Merged

fix(evm): fall back to tx.gasPrice when receipt omits effectiveGasPrice (Cronos)#18
runninyeti merged 1 commit into
mainfrom
fix/evm-effective-gas-price-fallback

Conversation

@runninyeti

Copy link
Copy Markdown
Contributor

Problem

Mesh reported missing data on their Cronos Mainnet dev pipeline — chains served by Alchemy/QuickNode worked, Cronos produced nothing.

Root cause is in the EVM token-transfer extractor. Cronos (an Ethermint/Cosmos-EVM fork) returns transaction receipts without an effectiveGasPrice field. The extractor does:

const transactionGasFee = BigInt(tx.receipt.gasUsed) * BigInt(tx.receipt.effectiveGasPrice);

BigInt(undefined) throws, and since the throw propagates up through tokenTransfers(), it drops the entire block — every Cronos block containing transactions yields zero rows. That's the "missing data," and it's exactly why Alchemy/QuickNode chains were unaffected (they populate effectiveGasPrice).

Fix

Fall back to the transaction's gasPrice (then 0) so the gas-fee math can't throw:

const effectiveGasPrice = tx.receipt.effectiveGasPrice ?? tx.gasPrice ?? 0;
const transactionGasFee = BigInt(tx.receipt.gasUsed ?? 0) * BigInt(effectiveGasPrice);

Backward-compatible — the fallback only triggers when effectiveGasPrice is absent (which previously threw), so no behavior change for any chain that already works. Likely also fixes other Ethermint-style chains (Evmos/Kava/Canto/etc.).

Verification

Ran the customer's transform verbatim against live Cronos blocks via jiti.indexing.co:

  • Before: TypeError: Cannot convert undefined to a BigInt at evm.ts:27 → 0 rows
  • After: 11 transfer rows extracted from a single Cronos block (correct amounts, hashes, indices)

🤖 Generated with Claude Code

Ethermint/Cosmos-EVM forks (e.g. Cronos Mainnet) return receipts without an
effectiveGasPrice field. BigInt(undefined) then throws inside the EVM token
transfer extractor, and because the throw propagates up through
tokenTransfers(), it drops the entire block — yielding zero rows for every
Cronos block that contains transactions.

Fall back to the transaction's gasPrice (then 0) so the gas-fee math is safe.
Backward-compatible: the fallback only triggers when effectiveGasPrice is
absent, which previously threw. Verified against live Cronos blocks (0 rows
-> full extraction).
@runninyeti runninyeti merged commit 34896be into main Jun 18, 2026
1 check passed
@runninyeti runninyeti deleted the fix/evm-effective-gas-price-fallback branch June 18, 2026 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant