Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update cosmos gas price to 5*1e9 #903

Merged
merged 1 commit into from
Jan 15, 2025
Merged

Conversation

zakir-code
Copy link
Contributor

@zakir-code zakir-code commented Jan 15, 2025

Summary by CodeRabbit

Release Notes

  • Configuration Updates

    • Updated minimum gas prices across mainnet, testnet, and server configurations
    • Changed default gas price from 4,000 to 5 for transaction processing
  • Testing

    • Updated test cases to reflect new gas price and balance calculations
    • Adjusted expected values in client and configuration tests
  • System Changes

    • Modified default gas price calculation in core types
    • Dynamically retrieve default gas price in configuration management

Copy link

coderabbitai bot commented Jan 15, 2025

Walkthrough

This pull request introduces a comprehensive update to the minimum gas prices across multiple configuration files and related test cases. The changes involve modifying the default gas price from 4,000 to 5 in various components, including configuration files for mainnet, testnet, and server settings. The modifications are consistent across different files, updating the minimum-gas-prices configuration and adjusting test cases to reflect the new gas price values.

Changes

File Change Summary
client/client_test.go Updated test case expectations for gas prices and balances
cmd/config.go Added fxtypes import and updated config with dynamic gas price
cmd/config_test.go Added fxtypes import and modified minimum gas prices
public/mainnet/app.toml Changed minimum-gas-prices from "4000000000000FX" to "5000000000apundiai"
public/testnet/app.toml Changed minimum-gas-prices from "4000000000000FX" to "5000000000apundiai"
server/config/data/app.json Updated minimum-gas-prices from "4000000000000apundiai" to "5000000000apundiai"
types/constant.go Modified GetDefGasPrice() to return a coin with value 5 instead of 4,000

Possibly related PRs

Poem

🐰 Hop, hop, gas prices dance,
From four thousand to just five's glance,
Configuration files align,
With a rabbit's mathematical design,
Blockchain economics now refined! 🚀

Finishing Touches

  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e704368 and 6e84d86.

📒 Files selected for processing (7)
  • client/client_test.go (3 hunks)
  • cmd/config.go (2 hunks)
  • cmd/config_test.go (2 hunks)
  • public/mainnet/app.toml (1 hunks)
  • public/testnet/app.toml (1 hunks)
  • server/config/data/app.json (1 hunks)
  • types/constant.go (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Mergify Merge Protections
  • GitHub Check: Summary
🔇 Additional comments (7)
types/constant.go (1)

55-55: Verify the impact of gas price reduction.

The gas price has been significantly reduced from 4,000 * 1e9 to 5 * 1e9 apundiai. This is a breaking change that will affect transaction costs across the network.

Let's verify the usage and impact:

✅ Verification successful

Gas price change aligns with network configuration

The change from 4,000 * 1e9 to 5 * 1e9 apundiai in GetDefGasPrice() aligns with the minimum gas prices (5000000000apundiai) configured in both testnet and mainnet app.toml files. This change simplifies the code by using the same value that's already in production use.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any hardcoded gas price values that might need updating

# Search for any remaining references to the old gas price
rg -i "4000.*1e9|4_000.*1e9"

# Search for potential gas price configurations in config files
rg -g "*.{toml,json,yaml,yml}" "minimum-gas-prices"

Length of output: 66932


Script:

#!/bin/bash
# Search for gas price related patterns and constants
rg -i "gas.*price|gasPrice"

# Find imports of the constant package
rg -g "*.go" "\".*types/constant\""

Length of output: 80497

cmd/config.go (1)

14-14: LGTM! Good use of centralized configuration.

The change correctly uses GetDefGasPrice() instead of hardcoding values, ensuring consistency across the codebase.

Also applies to: 56-56

cmd/config_test.go (1)

21-21: LGTM! Tests properly updated.

The test configuration correctly uses GetDefGasPrice() instead of hardcoding values, making the tests more maintainable.

Also applies to: 102-102

client/client_test.go (2)

333-333: LGTM! Gas price test properly updated.

The test case correctly expects the new gas price of 5 * 1e9.


378-378: Verify the balance amount changes.

The balance amount changes from 488999 * 1e18 to 48899999875 * 1e13 seem unrelated to the gas price update. Please confirm if these changes are intentional.

Also applies to: 401-401

✅ Verification successful

Test expectations updated with more precise balance values

The changes are in test expectations only, where the value was adjusted from 488,999 * 1e18 to 48,899,999,875 * 1e13. Both represent approximately 488,999 tokens with a negligible difference (~0.0002%). This appears to be an intentional precision adjustment in the test cases.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for related balance amount changes

# Search for similar balance amounts in tests
rg "488999|48899999875"

# Search for potential balance configurations
rg -g "*.{toml,json,yaml,yml}" "balance.*488999|balance.*48899999875"

Length of output: 252


Script:

#!/bin/bash
# Search for the original balance value with context
rg -B 5 -A 5 "488999.*1e18|48899999875.*1e13" client/client_test.go

# Search for test setup and related balance calculations
ast-grep --pattern 'func Test$_($_) {
  $$$
  Amount: $_
  $$$
}'

Length of output: 681


Script:

#!/bin/bash
# Search for test setup and related constants
rg -B 5 -A 5 "func.*Setup|const.*Amount" client/client_test.go

# Look for any other similar balance calculations
ast-grep --pattern 'Amount: sdkmath.NewInt($_).MulRaw($_)'

Length of output: 420

server/config/data/app.json (1)

69-69: Verify the impact of gas price reduction.

The minimum gas price has been significantly reduced from 40001e9 to 51e9. While the change is consistent across all environments, this reduction might affect:

  1. Network economics
  2. Spam prevention mechanisms
  3. Validator profitability
✅ Verification successful

Gas price reduction is consistently configured across environments

The gas price change from 40001e9 to 51e9 apundiai is verified to be consistently applied across all environments:

  • Mainnet configuration
  • Testnet configuration
  • Server configuration

While this represents a significant reduction, it appears to be an intentional network-wide parameter change rather than an inconsistency or error.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for any hardcoded gas prices in the codebase that might need updating
echo "Searching for hardcoded gas prices..."
rg -i "4000000000000" --type go

# Check for token denomination usage
echo "Checking token denomination usage..."
rg -i "FX.*minimum.gas" --type-add 'config:*.{toml,json}' --type config
rg -i "apundiai.*minimum.gas" --type-add 'config:*.{toml,json}' --type config

Length of output: 111187


Script:

#!/bin/bash
# Search for gas price patterns in various formats
echo "Searching for gas price patterns..."
rg -i "minimum.gas.price|min.gas.price|min-gas-price" --type-add 'config:*.{toml,json,yaml}' --type config

# Search for gas price values in scientific notation and regular format
echo "Searching for gas price values..."
rg -i "([0-9]+e\+?[0-9]+|[0-9]+).*apundiai" --type-add 'config:*.{toml,json,yaml}' --type config

# Check for governance proposals related to gas prices
echo "Checking governance proposals..."
rg -i "gas.price|minimum.gas" --type md --type go

Length of output: 6793

public/testnet/app.toml (1)

11-11: Confirm testnet alignment with mainnet changes.

The gas price and denomination changes in testnet match the mainnet configuration, which is good for consistency. However, ensure that:

  1. Testnet validators are notified of these changes
  2. A testing period is planned to validate the new gas prices
  3. Documentation is updated to reflect these changes

public/mainnet/app.toml Show resolved Hide resolved
@zakir-code zakir-code merged commit ed93298 into main Jan 15, 2025
13 checks passed
@zakir-code zakir-code deleted the zakir/cosmos-gas-price branch January 15, 2025 10: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.

1 participant