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 potential node-specific cache sizes.

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-20251120090244-6320058acbc076100100100100

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 (e7ff934) to head (e4eaba0).
⚠️ Report is 1 commits behind head on develop.

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.

@randy-cro randy-cro force-pushed the fix/staking-optimization branch from abe8ab3 to 200a3fa Compare November 13, 2025 08:08
@randy-cro randy-cro force-pushed the fix/staking-optimization branch 4 times, most recently from b94ff4d to b415fd7 Compare November 18, 2025 03:23
Copy link

@JayT106 JayT106 left a comment

Choose a reason for hiding this comment

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

LGTM

@randy-cro randy-cro force-pushed the fix/staking-optimization branch 4 times, most recently from c2ed3da to b13c640 Compare November 19, 2025 11:03
@github-actions github-actions bot added the ci label Nov 19, 2025
@github-actions github-actions bot added the evm label Nov 19, 2025
@randy-cro randy-cro force-pushed the fix/staking-optimization branch from b13c640 to bafd25a Compare November 19, 2025 11:08
@randy-cro randy-cro force-pushed the fix/staking-optimization branch from bafd25a to b496284 Compare November 19, 2025 11:10
@randy-cro randy-cro force-pushed the fix/staking-optimization branch from b496284 to e4eaba0 Compare November 20, 2025 09:09
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.

2 participants