Skip to content

perf(ProcessProposal): skip IsTxGasless in checkTotalBlockGas for non-gasless txs#3380

Merged
masih merged 4 commits into
mainfrom
amir/plt-322-IsTxGasless-fast-path-checkTotalBlockGas
May 5, 2026
Merged

perf(ProcessProposal): skip IsTxGasless in checkTotalBlockGas for non-gasless txs#3380
masih merged 4 commits into
mainfrom
amir/plt-322-IsTxGasless-fast-path-checkTotalBlockGas

Conversation

@amir-deris

@amir-deris amir-deris commented May 4, 2026

Copy link
Copy Markdown
Contributor

Summary

checkTotalBlockGas previously called antedecorators.IsTxGasless unconditionally for every tx before doing EVM/Cosmos gas accounting. For typical MsgEVMTransaction txs, IsTxGasless always returned (false, nil) immediately via the default branch — but still paid the cost of a defer/recover frame and a message-type walk on every tx.

This PR mirrors the couldBeGaslessTransaction heuristic already used in DeliverTxWithResult and OCC paths:

  1. Fast-path guard: IsEVMMessage is hoisted to the top of the loop (it was already called later for gas accounting). For confirmed single-message EVM txs (isEVM && evmErr == nil), IsTxGasless is skipped entirely — MsgEVMTransaction can never be gasless under the current rules.
  2. Heuristic guard: for all other txs, couldBeGaslessTransaction is checked first. Only oracle vote and MsgAssociate txs proceed to the full keeper-backed IsTxGasless call.

Semantics are unchanged: txs for which IsTxGasless would have returned (false, nil) are now classified as non-gasless without the extra overhead.

@amir-deris amir-deris changed the title Added fast path for gas check on evm transactions perf(ProcessProposal): skip IsTxGasless in checkTotalBlockGas for non-gasless txs May 4, 2026
@github-actions

github-actions Bot commented May 4, 2026

Copy link
Copy Markdown

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

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedMay 5, 2026, 7:54 AM

@codecov

codecov Bot commented May 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 46.15385% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.06%. Comparing base (cb91c34) to head (f386742).

Files with missing lines Patch % Lines
app/app.go 46.15% 5 Missing and 2 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3380      +/-   ##
==========================================
- Coverage   59.07%   59.06%   -0.01%     
==========================================
  Files        2099     2098       -1     
  Lines      172970   172951      -19     
==========================================
- Hits       102183   102161      -22     
- Misses      61922    61931       +9     
+ Partials     8865     8859       -6     
Flag Coverage Δ
sei-chain-pr 50.70% <46.15%> (?)
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/app.go 69.85% <46.15%> (+0.29%) ⬆️

... and 25 files with indirect coverage changes

🚀 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.

@amir-deris amir-deris requested review from codchen and masih May 4, 2026 16:41
Comment thread app/app.go

totalGas, totalGasWanted := uint64(0), uint64(0)
nonzeroTxsCnt := 0
for _, decodedTx := range typedTxs {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another optimization we can make is for this loop to run concurrently and add to total block gas as an atomic int. The only advantage of sequential is if the loop early returns, which is rare.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for feedback. Created a follow up ticket: https://linear.app/seilabs/issue/PLT-324/

@amir-deris amir-deris added this pull request to the merge queue May 5, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 5, 2026
@masih masih enabled auto-merge May 5, 2026 08:18
@masih masih added this pull request to the merge queue May 5, 2026
Merged via the queue into main with commit 52d368f May 5, 2026
51 of 54 checks passed
@masih masih deleted the amir/plt-322-IsTxGasless-fast-path-checkTotalBlockGas branch May 5, 2026 09:01
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.

4 participants