Skip to content

[codex] Harden gasless tx raw-byte handling#3559

Draft
codchen wants to merge 1 commit into
mainfrom
codex/harden-gasless-tx-bloat
Draft

[codex] Harden gasless tx raw-byte handling#3559
codchen wants to merge 1 commit into
mainfrom
codex/harden-gasless-tx-bloat

Conversation

@codchen

@codchen codchen commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

This PR closes the raw protobuf bloat routes for gasless transactions by making decoded transaction bytes canonical, validating fee data before denom filtering, and adding a hard raw-size cap for gasless txs.

Changes

  • Enforce canonical TxRaw, TxBody, and AuthInfo bytes in the default tx decoder.
  • Reject duplicate root TxRaw.body_bytes and TxRaw.auth_info_bytes.
  • Preserve the relaxed historical decoder for pre-v6.5 tracing compatibility.
  • Add MaxGaslessTxBytes = 16 KiB and enforce it in normal gasless ante plus custom CheckTx/DeliverTx paths.
  • Validate original decoded fee amounts before allowed-denom filtering.
  • Validate fee denoms in Tx.ValidateBasic while preserving existing zero-fee behavior.
  • Add regression coverage for canonical decoder rejection, compatibility decoding, gasless size cap, and invalid fee denoms.

Out of scope

  • Proposal-level block gas accounting for gasless txs is intentionally unchanged in this PR.

Tests

  • go test ./sei-cosmos/x/auth/tx
  • go test ./sei-cosmos/x/auth/ante
  • go test ./app/antedecorators
  • go test ./app/ante
  • go test ./sei-cosmos/types/tx
  • go test ./evmrpc -run TestTraceBlockByNumberUsesCompatDecoderForHistoricalCosmosTx
  • go test ./app -run TestCheckTotalBlockGas_AssociateTxIsGasless
  • git diff --check

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

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

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedJun 9, 2026, 9:50 AM

@codecov

codecov Bot commented Jun 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 65.11628% with 30 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.34%. Comparing base (1f52187) to head (ef5a84a).

Files with missing lines Patch % Lines
sei-cosmos/x/auth/tx/decoder.go 82.00% 5 Missing and 4 partials ⚠️
app/ante/cosmos_checktx.go 0.00% 8 Missing ⚠️
app/ante/cosmos_delivertx.go 16.66% 3 Missing and 2 partials ⚠️
sei-cosmos/x/auth/ante/fee.go 55.55% 2 Missing and 2 partials ⚠️
app/antedecorators/gasless.go 75.00% 1 Missing and 1 partial ⚠️
sei-cosmos/x/auth/ante/validator_tx_fee.go 0.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3559      +/-   ##
==========================================
- Coverage   59.18%   58.34%   -0.85%     
==========================================
  Files        2225     2151      -74     
  Lines      183625   175150    -8475     
==========================================
- Hits       108677   102188    -6489     
+ Misses      65154    63864    -1290     
+ Partials     9794     9098     -696     
Flag Coverage Δ
sei-chain-pr 58.77% <65.11%> (?)
sei-db 70.41% <ø> (ø)
sei-db-state-db ?

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

Files with missing lines Coverage Δ
sei-cosmos/types/tx/types.go 72.22% <100.00%> (+0.79%) ⬆️
app/antedecorators/gasless.go 80.28% <75.00%> (-0.68%) ⬇️
sei-cosmos/x/auth/ante/validator_tx_fee.go 86.04% <0.00%> (-4.20%) ⬇️
sei-cosmos/x/auth/ante/fee.go 80.00% <55.55%> (-3.93%) ⬇️
app/ante/cosmos_delivertx.go 70.58% <16.66%> (-7.68%) ⬇️
app/ante/cosmos_checktx.go 37.60% <0.00%> (-0.51%) ⬇️
sei-cosmos/x/auth/tx/decoder.go 85.31% <82.00%> (-3.04%) ⬇️

... and 74 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.

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