Skip to content

Conversation

@randy-cro
Copy link

@randy-cro randy-cro commented Nov 12, 2025

Description

This patch introduces a fixed gas consumption decorator in the antehandler to standardize gas usage for whitelisted messages.
Currently, only staking-related messages are included in the whitelist.

Purpose

This ensures consistent gas consumption across all nodes, regardless of variations in staking cache size.
By normalizing gas usage, it prevents potential AppHash mismatches caused by node-specific performance differences.

Implementation Details

  • A fixed gas amount is assigned per whitelisted message type.
  • The values are derived from the average gas usage observed on mainnet.

For example, the mean gas used for MsgUndelegate can be referenced here:
Mainnet reference

This change works in tandem with the staking cache introduced in the Cosmos SDK:
crypto-org-chain/cosmos-sdk#1733


For contributor use:

  • Targeted PR against correct branch (see CONTRIBUTING.md)
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the module structure standards.
  • Wrote unit and integration tests
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/)
  • Added relevant godoc comments.
  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer

For admin use:

  • Added appropriate labels to PR (ex. WIP, R4R, docs, etc)
  • Reviewers assigned
  • Squashed all commits, uses message "Merge pull request #XYZ: [title]" (coding standards)

@randy-cro randy-cro requested a review from a team as a code owner November 12, 2025 06:01
@randy-cro randy-cro requested review from calvinaco and songgaoye and removed request for a team November 12, 2025 06:01
@github-actions

This comment has been minimized.

@socket-security
Copy link

socket-security bot commented Nov 12, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedgolang/​github.com/​randy-cro/​cosmos-sdk@​v0.0.0-20251113072857-fbecd698368d76100100100100

View full report

@randy-cro randy-cro force-pushed the fix/staking-optimization branch from cce6d25 to 40aeba2 Compare November 13, 2025 03:52
@randy-cro randy-cro changed the base branch from release/v0.22.x to develop November 13, 2025 03:53
@randy-cro randy-cro force-pushed the fix/staking-optimization branch from 40aeba2 to 1cf0a6b Compare November 13, 2025 05:06
@randy-cro randy-cro force-pushed the fix/staking-optimization branch from b8fac92 to abe8ab3 Compare November 13, 2025 07:36
@codecov
Copy link

codecov bot commented Nov 13, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 46.97%. Comparing base (d8a1c9e) to head (200a3fa).

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #776      +/-   ##
===========================================
+ Coverage    46.85%   46.97%   +0.12%     
===========================================
  Files          189      190       +1     
  Lines        15353    15389      +36     
===========================================
+ Hits          7193     7229      +36     
  Misses        7361     7361              
  Partials       799      799              
Files with missing lines Coverage Δ
ante/cosmos/fixed_gas.go 100.00% <100.00%> (ø)
evmd/ante/evm_handler.go 100.00% <100.00%> (ø)
evmd/ante/handler_options.go 61.05% <100.00%> (+0.41%) ⬆️
evmd/app.go 78.76% <100.00%> (+0.22%) ⬆️
🚀 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