Skip to content

fix: don't report block-level gas for failed tx decodes (CON-244)#3205

Merged
wen-coding merged 3 commits intomainfrom
wen/fix_gasused_nil_tx
Apr 9, 2026
Merged

fix: don't report block-level gas for failed tx decodes (CON-244)#3205
wen-coding merged 3 commits intomainfrom
wen/fix_gasused_nil_tx

Conversation

@wen-coding
Copy link
Copy Markdown
Contributor

@wen-coding wen-coding commented Apr 7, 2026

Summary

  • When a transaction fails to decode (nil tx), the deferred epilogue was reading GasUsed from the block-level gas meter instead of a per-tx meter, since the ante handler never ran to install one.
  • Added a guard in all three tx execution paths: if the gas meter hasn't changed from the block-level meter, skip reporting gas for that transaction.
    • app/legacyabci/deliver_tx.go (production DeliverTx)
    • app/legacyabci/check_tx.go (production CheckTx)
    • sei-cosmos/baseapp/baseapp.go (simulation/CheckTx via runTx)

Supersedes #3202.

Test plan

  • TestDecodeFailureTxReportsZeroGas (app) — successful bank send reports nonzero gas, decode failure reports zero, insufficient-funds tx (ante handler ran) reports nonzero gas
  • TestRunTxDecodeError (baseapp) — nil tx with prior block-level gas reports zero GasUsed

🤖 Generated with Claude Code

When ante handling never runs (e.g. decode failure), the deferred
epilogue in DeliverTx was reading the block-level gas meter instead of
a per-tx meter. Guard against this by checking whether a tx-scoped
meter was installed before reporting GasUsed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 7, 2026

The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedApr 7, 2026, 4:10 PM

Keep simulation and CheckTx consistent with the DeliverTx fix.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@wen-coding wen-coding changed the title fix(legacyabci): don't report block-level gas for failed tx decodes fix: don't report block-level gas for failed tx decodes Apr 7, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 7, 2026

Codecov Report

❌ Patch coverage is 66.66667% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.65%. Comparing base (292f78c) to head (a4ee9d3).
⚠️ Report is 14 commits behind head on main.

Files with missing lines Patch % Lines
app/legacyabci/check_tx.go 0.00% 3 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3205   +/-   ##
=======================================
  Coverage   58.65%   58.65%           
=======================================
  Files        2055     2055           
  Lines      168498   168507    +9     
=======================================
+ Hits        98835    98843    +8     
- Misses      60878    60880    +2     
+ Partials     8785     8784    -1     
Flag Coverage Δ
sei-chain-pr 55.66% <66.66%> (?)
sei-db 70.41% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
app/legacyabci/deliver_tx.go 95.83% <100.00%> (+0.18%) ⬆️
sei-cosmos/baseapp/baseapp.go 76.42% <100.00%> (+0.55%) ⬆️
app/legacyabci/check_tx.go 0.00% <0.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@wen-coding wen-coding changed the title fix: don't report block-level gas for failed tx decodes fix: don't report block-level gas for failed tx decodes (CON-244) Apr 8, 2026
@wen-coding wen-coding added this pull request to the merge queue Apr 9, 2026
Merged via the queue into main with commit 8d7e329 Apr 9, 2026
41 checks passed
@wen-coding wen-coding deleted the wen/fix_gasused_nil_tx branch April 9, 2026 02:39
yzang2019 added a commit that referenced this pull request Apr 9, 2026
* main:
  fix: don't report block-level gas for failed tx decodes (CON-244) (#3205)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants