-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
fix(server): properly parse multiple gas config #18537
Conversation
WalkthroughIt looks like you want to generate a summary and a table of changes based on the provided information. Here's the updated content based on your instructions: WalkthroughThe changes involve bug fixes and refactoring in a Go application related to blockchain or cryptocurrency. A panic issue with gas configuration, a pubkey error in transaction simulation, and a block finalization call issue were fixed. A data race was also resolved. The server's Changes
TipsChat with CodeRabbit Bot (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 1
Configuration used: CodeRabbit UI
Files ignored due to filter (2)
- tools/confix/data/v0.47-app.toml
- tools/confix/data/v0.50-app.toml
Files selected for processing (6)
- CHANGELOG.md (1 hunks)
- server/README.md (1 hunks)
- server/config/config.go (2 hunks)
- server/config/config_test.go (1 hunks)
- server/config/toml.go (1 hunks)
- simapp/simd/cmd/commands.go (1 hunks)
Files skipped from review due to trivial changes (1)
- simapp/simd/cmd/commands.go
Additional comments: 5
CHANGELOG.md (1)
- 70-70:
The changelog entries are well-documented and include references to the relevant pull requests, which is good for traceability.server/config/toml.go (1)
- 18-22: The change in the configuration file format from using a semicolon to a comma as the separator for specifying minimum gas prices is correct and aligns with the standard format for multiple values in TOML files. This change should resolve the parsing issue reported in issue [Bug]: Incorrect example to set multiple denoms for
mininum-gas-prices
#18536.server/config/config.go (2)
3-8: The removal of the "strings" package import is appropriate given that the updated code does not use it.
201-215: The
GetMinGasPrices
function now correctly usessdk.ParseDecCoins
to parse the minimum gas prices. The error handling with a panic is a significant change; ensure that this behavior is documented and that callers are aware that this function can panic.server/README.md (1)
- 74-84: - The refactoring of the
newApp
function to acceptservertypes.AppOptions
instead ofserver.AppOptions
is a significant change. Ensure that all references to this function are updated accordingly.
- The introduction of
baseappOptions
as variadic arguments tosimapp.NewSimApp
is a good practice for flexibility and maintainability.- Verify that the
DefaultBaseappOptions
function correctly extracts the necessary options fromappOpts
and that thesimapp.NewSimApp
function is compatible with the variadicbaseappOptions
parameter.- Ensure that the documentation reflects the correct usage of the new function signature and the rationale behind the changes.
func TestGetAndSetMinimumGas(t *testing.T) { | ||
cfg := DefaultConfig() | ||
cfg.SetMinGasPrices(sdk.DecCoins{sdk.NewInt64DecCoin("foo", 5)}) | ||
|
||
input := sdk.DecCoins{sdk.NewInt64DecCoin("foo", 5)} | ||
cfg.SetMinGasPrices(input) | ||
require.Equal(t, "5.000000000000000000foo", cfg.MinGasPrices) | ||
require.EqualValues(t, cfg.GetMinGasPrices(), input) | ||
|
||
input = sdk.DecCoins{sdk.NewInt64DecCoin("bar", 1), sdk.NewInt64DecCoin("foo", 5)} | ||
cfg.SetMinGasPrices(input) | ||
require.Equal(t, "1.000000000000000000bar,5.000000000000000000foo", cfg.MinGasPrices) | ||
require.EqualValues(t, cfg.GetMinGasPrices(), input) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test cases in TestGetAndSetMinimumGas
have been updated to include scenarios with multiple minimum gas prices. However, the assertions for cfg.MinGasPrices
are directly comparing the string representation of DecCoins
which might not be robust if the string representation changes in the future. It would be better to compare DecCoins
directly.
- require.Equal(t, "5.000000000000000000foo", cfg.MinGasPrices)
+ require.EqualValues(t, input.String(), cfg.MinGasPrices)
- require.Equal(t, "1.000000000000000000bar,5.000000000000000000foo", cfg.MinGasPrices)
+ require.EqualValues(t, input.String(), cfg.MinGasPrices)
Commitable suggestion
[!IMPORTANT]
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
func TestGetAndSetMinimumGas(t *testing.T) { | |
cfg := DefaultConfig() | |
cfg.SetMinGasPrices(sdk.DecCoins{sdk.NewInt64DecCoin("foo", 5)}) | |
input := sdk.DecCoins{sdk.NewInt64DecCoin("foo", 5)} | |
cfg.SetMinGasPrices(input) | |
require.Equal(t, "5.000000000000000000foo", cfg.MinGasPrices) | |
require.EqualValues(t, cfg.GetMinGasPrices(), input) | |
input = sdk.DecCoins{sdk.NewInt64DecCoin("bar", 1), sdk.NewInt64DecCoin("foo", 5)} | |
cfg.SetMinGasPrices(input) | |
require.Equal(t, "1.000000000000000000bar,5.000000000000000000foo", cfg.MinGasPrices) | |
require.EqualValues(t, cfg.GetMinGasPrices(), input) | |
} | |
func TestGetAndSetMinimumGas(t *testing.T) { | |
cfg := DefaultConfig() | |
input := sdk.DecCoins{sdk.NewInt64DecCoin("foo", 5)} | |
cfg.SetMinGasPrices(input) | |
require.EqualValues(t, input.String(), cfg.MinGasPrices) | |
require.EqualValues(t, cfg.GetMinGasPrices(), input) | |
input = sdk.DecCoins{sdk.NewInt64DecCoin("bar", 1), sdk.NewInt64DecCoin("foo", 5)} | |
cfg.SetMinGasPrices(input) | |
require.EqualValues(t, input.String(), cfg.MinGasPrices) | |
require.EqualValues(t, cfg.GetMinGasPrices(), input) | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- CHANGELOG.md (1 hunks)
Additional comments: 1
CHANGELOG.md (1)
- 70-70:
The changelog entries are well-documented and include references to the relevant pull requests, which is good for traceability.
(cherry picked from commit 875a71c)
(cherry picked from commit 875a71c) # Conflicts: # simapp/simd/cmd/commands.go # tools/confix/data/v0.47-app.toml # tools/confix/data/v0.50-app.toml
… (cosmos#18544) Co-authored-by: Julien Robert <julien@rbrt.fr>
… (cosmos#18544) Co-authored-by: Julien Robert <julien@rbrt.fr>
…s-sdk#18537) (#1337) * fix(server): properly parse multiple gas config(backport cosmos-sdk#18537) * chore: update changelog * chore: add missing PR link
…s-sdk#18537) (#1337) * fix(server): properly parse multiple gas config(backport cosmos-sdk#18537) * chore: update changelog * chore: add missing PR link (cherry picked from commit 7849929)
…s-sdk#18537) (#1337) * fix(server): properly parse multiple gas config(backport cosmos-sdk#18537) * chore: update changelog * chore: add missing PR link (cherry picked from commit 7849929) # Conflicts: # CHANGELOG.md
…s-sdk#18537) (#1337) (#1343) * fix(server): properly parse multiple gas config(backport cosmos-sdk#18537) * chore: update changelog * chore: add missing PR link (cherry picked from commit 7849929) Co-authored-by: jaeseung-bae <119839167+jaeseung-bae@users.noreply.github.com>
…s-sdk#18537) (backport #1337) (#1344) * fix(server): properly parse multiple gas config(backport cosmos/cosmos-sdk#18537) (#1337) * fix(server): properly parse multiple gas config(backport cosmos-sdk#18537) * chore: update changelog * chore: add missing PR link (cherry picked from commit 7849929) # Conflicts: # CHANGELOG.md * Update CHANGELOG.md --------- Co-authored-by: jaeseung-bae <119839167+jaeseung-bae@users.noreply.github.com> Co-authored-by: Youngtaek Yoon <noreply@yoon.mailer.me>
Description
Closes: #18536
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!
to the type prefix if API or client breaking changeCHANGELOG.md
make lint
andmake test
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...
!
in the type prefix if API or client breaking changeSummary by CodeRabbit
Bug Fixes
FinalizeBlock
calls are now correctly passed to ABCIListeners.BaseApp.getContext
as identified by e2e tests.Refactor
newApp
function to accept new types of application options and streamlined the passing of arguments.Documentation
Style