-
Notifications
You must be signed in to change notification settings - Fork 906
chore(evm): refactor rpc gas prices to support 6 dec #2908
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
Conversation
WalkthroughThe pull request introduces updates to the Changes
Possibly related PRs
Suggested reviewers
Poem
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
… into GAtom22/evm-grpc-query
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.
Actionable comments posted: 5
🧹 Outside diff range and nitpick comments (11)
x/evm/types/scaling.go (1)
36-42
: LGTM with minor suggestions for improvementThe new
ConvertBigIntFrom18DecimalsToLegacyDec
function is well-implemented and aligns with the PR objective of supporting 6 decimal places. It correctly converts from 18 decimals to the EVM coin's decimal representation using the appropriate conversion factor.Consider the following suggestions for improvement:
- Add a nil check for the input
amt
to prevent potential panics.- Consider adding explicit overflow checks during the conversion and division operations.
Example implementation with these improvements:
func ConvertBigIntFrom18DecimalsToLegacyDec(amt *big.Int) (sdkmath.LegacyDec, error) { if amt == nil { return sdkmath.LegacyDec{}, errors.New("input amount is nil") } evmCoinDecimal := GetEVMCoinDecimals() decAmt := sdkmath.LegacyNewDecFromBigInt(amt) // Check for potential overflow if decAmt.IsNil() { return sdkmath.LegacyDec{}, errors.New("overflow occurred during conversion") } result := decAmt.QuoInt(evmCoinDecimal.ConversionFactor()) // Check for potential underflow if result.IsNil() { return sdkmath.LegacyDec{}, errors.New("underflow occurred during division") } return result, nil }These changes would make the function more robust and error-resistant.
rpc/backend/node_info_test.go (1)
26-26
: LGTM! Consider adding a comment explaining the change.The change from
int64
to*big.Int
forexpMinGasPrice
is appropriate and aligns with the PR objective of supporting 6 decimal places for gas prices. The update to usebig.NewInt(types.DefaultGasPrice)
in the test cases is correct and consistent.Consider adding a brief comment above the
expMinGasPrice
field to explain why*big.Int
is now used, e.g.:// expMinGasPrice is now *big.Int to support higher precision (6 decimal places) expMinGasPrice *big.IntThis would help future developers understand the reasoning behind using
*big.Int
instead ofint64
.Also applies to: 33-33, 40-40
x/evm/types/scaling_test.go (1)
279-282
: Consider adding more edge cases.While the current test cases cover a good range, consider adding a few more edge cases to enhance the robustness of the test suite. For example:
- A very large number close to the maximum supported value.
- A number with many trailing zeros after the decimal point.
These additional cases could help ensure the conversion function handles extreme scenarios correctly.
Also applies to: 289-292
proto/ethermint/evm/v1/query.proto (2)
80-87
: LGTM with a minor suggestion for the comment.The new
GlobalMinGasPrice
RPC method is well-defined and aligns with the PR objective. The HTTP GET endpoint is correctly specified.Consider updating the comment to be more specific about the decimal conversion:
- // GlobalMinGasPrice queries the MinGasPrice - // it's similar to feemarket module's method, - // but makes the conversion to 18 decimals - // when the evm denom is 6 decimals + // GlobalMinGasPrice queries the minimum gas price. + // It's similar to the feemarket module's method, + // but converts the result to 18 decimal places + // when the EVM denomination uses 6 decimal places.This change improves clarity and maintains consistency with the existing code style.
325-329
: LGTM with a minor suggestion for the field comment.The
QueryGlobalMinGasPriceResponse
message is well-defined and consistent with similar response messages in the file. The use ofcosmossdk.io/math.Int
as a custom type and the non-nullable attribute are appropriate.Consider updating the field comment to be more specific:
- // min_gas_price is the feemarket's min_gas_price + // min_gas_price is the global minimum gas price from the feemarket module, converted to 18 decimal places if necessary.This change provides more context about the field's content and aligns with the functionality described in the RPC method comment.
rpc/backend/evm_query_client_test.go (1)
280-283
: LGTM! Consider adding a test for this new mock function.The
RegisterGlobalMinGasPrice
function is well-implemented and aligns with the existing code structure. It correctly sets up a mock response for theGlobalMinGasPrice
method, usingmath.OneInt()
as the minimum gas price, which supports the PR objective of handling 6 decimal places.To ensure the reliability of this new mock function, consider adding a test case similar to the existing ones (e.g.,
TestRegisterBaseFee
). This would validate that the mock behaves as expected when called.rpc/backend/call_tx.go (1)
393-402
: Summary of changes toGasPrice
functionThe modifications to the
GasPrice
function appear to simplify the code and potentially improve performance. However, these changes warrant careful consideration:
- The direct assignment
result = b.RPCMinGasPrice()
eliminates the creation of a newbig.Int
object.- The comparison logic has been simplified to directly compare
result
withminGasPrice
.While these changes may improve code readability and performance, it's crucial to ensure that:
- The precision of gas price calculations is maintained, especially if there's a change in the underlying types (e.g., from
sdk.Dec
to*big.Int
).- The behavior of the function remains consistent with its previous implementation.
Consider adding comprehensive unit tests to verify that the gas price calculations and comparisons produce the same results as the previous implementation across various scenarios. This will help ensure that the refactoring doesn't introduce any unintended changes in behavior.
rpc/backend/call_tx_test.go (1)
464-464
: LGTM. Consider adding a test case for non-default global min gas price.The addition of
RegisterGlobalMinGasPrice
mock registration is a good enhancement to the test setup. It aligns well with the PR objective of refactoring RPC gas prices to support 6 decimal places.To further improve test coverage, consider adding a test case where the global minimum gas price is set to a non-default value (e.g., with 6 decimal places) to ensure the new functionality is thoroughly tested.
CHANGELOG.md (3)
Line range hint
38-39
: API Breaking Changes
- The inflation module has been renamed from
inflation
toinflation/v1
.- The legacy EIP-712 ante handler has been deprecated.
These changes may require updates to client software and integrations. Ensure that:
- Documentation is updated to reflect the new module name.
- A migration path or alternative is provided for users of the legacy EIP-712 ante handler.
Consider adding a deprecation notice in the code for the legacy EIP-712 ante handler to warn developers about its future removal.
Also applies to: 40-41
🧰 Tools
🪛 Markdownlint
68-68: Expected: 120; Actual: 150
Line length(MD013, line-length)
Line range hint
1-83
: Summary of v16.0.0 ReleaseThis release introduces significant changes to the Evmos ecosystem:
- State Machine Breaking Changes: New precompiles, module removals, and changes to core functionality.
- API Breaking Changes: Module renaming and deprecations.
- Numerous Improvements: Enhanced testing, documentation, and module refactoring.
- Critical Bug Fixes: Addressing issues in various components.
While these changes bring important new features and improvements, they also require careful consideration for upgrading:
- A comprehensive upgrade guide should be provided, detailing necessary steps for node operators and developers.
- Thorough testing of all new features and changes in a testnet environment is crucial before mainnet deployment.
- Clear communication to all stakeholders about the breaking changes and their implications is essential.
Overall, this release represents a significant step forward for Evmos, but requires careful planning and execution for a smooth upgrade process.
Consider implementing a more gradual deprecation process for future breaking changes, allowing for smoother transitions in subsequent releases.
🧰 Tools
🪛 Markdownlint
68-68: Expected: 120; Actual: 150
Line length(MD013, line-length)
Residual References to Removed Modules and Precompiles Detected
The following files still reference removed modules or new precompiles and require attention:
utils/utils_test.go
wallets/ledger/ledger_test.go
x/inflation/v1/keeper/inflation.go
utils/utils.go
x/evm/keeper/static_precompiles.go
precompiles/p256/p256.go
precompiles/staking/integration_test.go
precompiles/bech32/setup_test.go
precompiles/bank/utils_test.go
precompiles/bech32/methods_test.go
precompiles/bech32/methods.go
precompiles/bech32/bech32.go
ibc/utils.go
client/keys/add.go
client/debug/debug.go
precompiles/distribution/types.go
crypto/secp256r1/verify.go
precompiles/distribution/integration_test.go
precompiles/distribution/query_test.go
app/ante/sigverify_test.go
api/ethermint/evm/v1/query.pulsar.go
api/evmos/erc20/v1/tx.pulsar.go
Please ensure that all references to
x/recovery
,x/incentives
,secp256r1
,bech32
, andbank precompile
are appropriately removed or updated to reflect the intended changes.🔗 Analysis chain
Line range hint
15-16
: Multiple State Machine Breaking ChangesSeveral significant changes have been introduced:
- New precompiles: secp256r1 curve, bech32 conversion, and bank precompile.
- Removal of x/recovery and x/incentives modules.
- Changes to inflation and fee handling.
These changes will require careful testing and a well-planned upgrade strategy. Ensure that:
- All new precompiles are thoroughly tested for security and correctness.
- The removal of modules doesn't break existing functionality or leave orphaned data.
- Changes to inflation and fees are well-documented and communicated to stakeholders.
To verify the impact of these changes, run the following script:
Also applies to: 17-18, 19-20, 21-22, 23-24, 25-26, 27-28, 29-30, 31-32, 33-34, 35-36
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Check for references to removed modules and new precompiles rg --type go 'x/recovery|x/incentives|secp256r1|bech32|bank precompile'Length of output: 13806
🧰 Tools
🪛 Markdownlint
68-68: Expected: 120; Actual: 150
Line length(MD013, line-length)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
⛔ Files ignored due to path filters (3)
api/ethermint/evm/v1/query_grpc.pb.go
is excluded by!**/*.pb.go
x/evm/types/query.pb.go
is excluded by!**/*.pb.go
x/evm/types/query.pb.gw.go
is excluded by!**/*.pb.gw.go
📒 Files selected for processing (18)
- CHANGELOG.md (1 hunks)
- api/ethermint/evm/v1/query.pulsar.go (6 hunks)
- client/docs/swagger-ui/swagger.json (166 hunks)
- proto/ethermint/evm/v1/query.proto (2 hunks)
- proto/ethermint/feemarket/v1/feemarket.proto (1 hunks)
- proto/ethermint/types/v1/dynamic_fee.proto (1 hunks)
- rpc/backend/backend.go (2 hunks)
- rpc/backend/call_tx.go (1 hunks)
- rpc/backend/call_tx_test.go (1 hunks)
- rpc/backend/chain_info.go (1 hunks)
- rpc/backend/chain_info_test.go (1 hunks)
- rpc/backend/evm_query_client_test.go (1 hunks)
- rpc/backend/mocks/evm_query_client.go (1 hunks)
- rpc/backend/node_info.go (3 hunks)
- rpc/backend/node_info_test.go (1 hunks)
- x/evm/keeper/grpc_query.go (1 hunks)
- x/evm/types/scaling.go (1 hunks)
- x/evm/types/scaling_test.go (1 hunks)
🔥 Files not summarized due to errors (1)
- api/ethermint/evm/v1/query.pulsar.go: Error: Server error: no LLM provider could handle the message
✅ Files skipped from review due to trivial changes (3)
- client/docs/swagger-ui/swagger.json
- proto/ethermint/feemarket/v1/feemarket.proto
- proto/ethermint/types/v1/dynamic_fee.proto
🔇 Additional comments (27)
x/evm/types/scaling.go (1)
Line range hint
1-42
: Summary of changes and impactThe addition of the
ConvertBigIntFrom18DecimalsToLegacyDec
function enhances the scaling capabilities of the module by providing a way to convert from 18 decimals to the EVM coin's decimal representation. This change aligns well with the PR objective of refactoring RPC gas prices to support 6 decimal places.The new function complements the existing
ConvertAmountTo18DecimalsLegacy
function, providing a reverse operation. It maintains the flexibility to work with different decimal configurations as determined byGetEVMCoinDecimals()
.Overall, this change improves the module's ability to handle various decimal representations, which is crucial for accurate gas price calculations and conversions in the EVM context.
rpc/backend/backend.go (3)
51-51
: Overall impact of gas price refactoringThe changes to
RPCMinGasPrice
andGlobalMinGasPrice
methods consistently use*big.Int
for gas price representation, which aligns with the PR objective to "refactor rpc gas prices to support 6 dec". This refactoring allows for more precise gas price handling, supporting up to 6 decimal places as mentioned in the PR title.Given the significance of these changes:
- Ensure comprehensive unit and integration tests are in place to verify the correct behavior of gas price calculations and representations throughout the system.
- Update any documentation, including API docs and developer guides, to reflect these changes.
- Consider adding a migration guide if this change affects external integrations or APIs.
To ensure a smooth transition, run the following script to identify potential areas that might need updates:
#!/bin/bash # Description: Identify potential areas affected by the gas price refactoring # Test: Search for usages of int64 or math.LegacyDec in relation to gas prices echo "Searching for potential areas that might need updates:" rg --type go -e '(int64|math\.LegacyDec).*gas.*price' # Test: Search for any remaining usages of math.LegacyDec echo "Searching for any remaining usages of math.LegacyDec:" rg --type go -e 'math\.LegacyDec'Please review the output of this script to ensure all relevant areas have been updated to use
*big.Int
for gas price representation.Also applies to: 86-86
86-86
: Approve change toGlobalMinGasPrice
return type.The modification of the return type from
(math.LegacyDec, error)
to(*big.Int, error)
forGlobalMinGasPrice
is a good improvement. This change aligns with theRPCMinGasPrice
method, standardizing on*big.Int
for gas price representation.Please ensure that all implementations of this interface method and any code that calls this method have been updated accordingly. Run the following script to verify the usage:
Consider updating the documentation to reflect this change in return type, especially if there are any API docs or developer guides that mention the
GlobalMinGasPrice
method.✅ Verification successful
Change to
GlobalMinGasPrice
return type verified.The update of
GlobalMinGasPrice
to return(*big.Int, error)
has been successfully verified with no existing implementations or usages conflicting with this change. This ensures that the modification aligns with the intended standardization without introducing issues.Consider updating the documentation to reflect this change in return type, ensuring that all relevant API docs and developer guides are consistent with the new method signature.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all implementations and usages of GlobalMinGasPrice method # Test: Search for GlobalMinGasPrice method implementations echo "Searching for GlobalMinGasPrice implementations:" rg --type go -e 'func \(.*\) GlobalMinGasPrice\(\) \(\*big\.Int, error\)' # Test: Search for GlobalMinGasPrice method calls echo "Searching for GlobalMinGasPrice method calls:" rg --type go -e 'GlobalMinGasPrice\(\)'Length of output: 10966
51-51
: Approve change toRPCMinGasPrice
return type.The modification of the return type from
int64
to*big.Int
forRPCMinGasPrice
is a good improvement. This change allows for more precise representation of gas prices and can handle arbitrarily large values, which is beneficial for cryptocurrency applications.Please ensure that all implementations of this interface method and any code that calls this method have been updated accordingly. Run the following script to verify the usage:
✅ Verification successful
RPCMinGasPrice Return Type Updated Correctly
The return type of
RPCMinGasPrice
has been successfully updated to*big.Int
across all implementations and usages. All assignments and operations involving this method handle the*big.Int
type appropriately, ensuring type safety and correctness.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all implementations and usages of RPCMinGasPrice method # Test: Search for RPCMinGasPrice method implementations echo "Searching for RPCMinGasPrice implementations:" rg --type go -e 'func \(.*\) RPCMinGasPrice\(\) \*big\.Int' # Test: Search for RPCMinGasPrice method calls echo "Searching for RPCMinGasPrice method calls:" rg --type go -e 'RPCMinGasPrice\(\)'Length of output: 701
Script:
#!/bin/bash # Description: Verify handling of RPCMinGasPrice return type in all usage locations # Function to check usage in a specific file check_usage() { local file=$1 echo "Checking RPCMinGasPrice usage in $file:" # Check for correct type handling (expecting *big.Int) rg --type go -A 5 'RPCMinGasPrice\(\)' "$file" | grep -E '(*big\.Int)|(&big\.Int)|big\.NewInt' echo "" } # List of files with RPCMinGasPrice calls files=( "rpc/backend/node_info_test.go" "rpc/backend/node_info.go" "rpc/backend/call_tx.go" "rpc/backend/backend.go" ) for file in "${files[@]}"; do check_usage "$file" doneLength of output: 1810
Script:
#!/bin/bash # Description: Verify handling of RPCMinGasPrice return type in all usage locations with corrected regex # Function to check usage in a specific file check_usage() { local file=$1 echo "Checking RPCMinGasPrice usage in $file:" # Corrected regex patterns to match literal *big.Int, &big.Int, or big.NewInt rg --type go -A 5 'RPCMinGasPrice\(\)' "$file" | grep -E '(\*big\.Int)|(&big\.Int)|big\.NewInt' echo "" } # List of files with RPCMinGasPrice calls files=( "rpc/backend/node_info_test.go" "rpc/backend/node_info.go" "rpc/backend/call_tx.go" "rpc/backend/backend.go" ) for file in "${files[@]}"; do check_usage "$file" doneLength of output: 1654
Script:
#!/bin/bash # Description: Inspect usage of RPCMinGasPrice return type in all usage locations # Function to analyze how RPCMinGasPrice is used in a specific file analyze_usage() { local file=$1 echo "Analyzing RPCMinGasPrice usage in $file:" # Extract lines where RPCMinGasPrice is called along with surrounding context rg --type go -C 3 'RPCMinGasPrice\(\)' "$file" | while read -r line; do echo "$line" done echo "" } # List of files with RPCMinGasPrice calls files=( "rpc/backend/node_info_test.go" "rpc/backend/node_info.go" "rpc/backend/call_tx.go" "rpc/backend/backend.go" ) for file in "${files[@]}"; do analyze_usage "$file" doneLength of output: 4667
rpc/backend/node_info_test.go (1)
Line range hint
1-1
: Summary of changes inrpc/backend/node_info_test.go
The changes made to this file are appropriate and align with the PR objective of supporting 6 decimal places for gas prices. The modifications are localized to the
TestRPCMinGasPrice
function, changing theexpMinGasPrice
field fromint64
to*big.Int
. This change allows for higher precision in gas price representation.Key points:
- The change is minimal and doesn't affect other test functions in this file.
- The use of
big.NewInt(types.DefaultGasPrice)
ensures consistency with the new data type.- A suggestion was made to add a comment explaining the reason for using
*big.Int
.- A verification script was provided to check for any inconsistencies in gas price type usage across the codebase.
Overall, the changes look good, but it's important to ensure that this modification is consistent with the rest of the codebase and doesn't introduce any unexpected behavior in other components that might be expecting
int64
gas prices.x/evm/types/scaling_test.go (2)
272-323
: Well-structured and comprehensive test function.The
TestConvertBigIntFrom18DecimalsToLegacyDec
function is well-designed and covers a good range of test cases. It tests the conversion functionality for both 6 and 18 decimal configurations, which aligns well with the PR objective of supporting 6 decimal places.Some noteworthy aspects:
- The test cases cover important scenarios such as the smallest amount, values close to 1, and larger values like "one ether".
- The function tests both 6 and 18 decimal configurations, ensuring compatibility with different setups.
- The use of
evmtypes.NewEVMConfigurator()
for each test case ensures a clean environment for each test.
272-323
: Overall, the new test function enhances the test coverage significantly.The addition of
TestConvertBigIntFrom18DecimalsToLegacyDec
is a valuable contribution to the test suite. It directly supports the PR's objective of refactoring RPC gas prices to support 6 decimal places by thoroughly testing the conversion function for both 6 and 18 decimal configurations.The test cases are well-chosen and cover a good range of scenarios. The structure of the test function, with its nested loops for different configurations, ensures comprehensive coverage.
This new test function will help maintain the reliability of the conversion logic as the codebase evolves, which is crucial for accurate gas price handling in both 6 and 18 decimal scenarios.
rpc/backend/chain_info_test.go (1)
Line range hint
1-465
: Overall assessment of changesThe modifications to the
TestGlobalMinGasPrice
function align well with the PR objective of refactoring RPC gas prices to support 6 decimal places. The switch frommath.LegacyDec
to*big.Int
allows for more precise representation of gas prices.However, to ensure robustness and complete coverage of the new functionality:
- Consider expanding the test cases as suggested in the previous comment.
- Review other parts of the codebase that might be affected by this change, especially any code that interacts with
GlobalMinGasPrice
.- Ensure that the precision of 6 decimal places is consistently maintained and verified throughout the relevant parts of the codebase.
To ensure consistency across the codebase, let's check for other files that might need similar updates:
#!/bin/bash # Search for files using math.LegacyDec in relation to gas prices rg "math\.LegacyDec.*gas.*price" --type go # Search for files using GlobalMinGasPrice rg "GlobalMinGasPrice" --type goThis will help identify any other areas that might need attention due to this refactoring.
proto/ethermint/evm/v1/query.proto (2)
322-323
: LGTM: QueryGlobalMinGasPriceRequest is correctly defined.The empty
QueryGlobalMinGasPriceRequest
message is appropriate for this query, as it doesn't require any input parameters. This approach is consistent with similar request messages in the file.
Line range hint
80-329
: Summary: Changes are well-implemented and align with PR objectives.The new
GlobalMinGasPrice
RPC method and associated request/response messages have been correctly implemented. They are consistent with the existing code structure and follow appropriate protobuf conventions. The changes support the PR objective of refactoring RPC gas prices to accommodate six decimal places.A few minor suggestions were made to improve comment clarity, but overall, the implementation is sound and ready for integration.
rpc/backend/evm_query_client_test.go (1)
278-283
: Overall changes look good and maintain code consistency.The addition of the
RegisterGlobalMinGasPrice
function at the end of the file and the extra newline maintain the existing code structure and improve readability. These changes are consistent with the file's organization and coding style.rpc/backend/call_tx.go (2)
401-402
: Ensure precision is maintained in gas price comparisonThe simplified comparison
result.Cmp(minGasPrice) < 0
assumes thatminGasPrice
is now of type*big.Int
. Please verify that this change doesn't affect the precision of the gas price calculation, especially ifminGasPrice
was previously of a different type (e.g.,sdk.Dec
).#!/bin/bash # Search for the definition of GlobalMinGasPrice to verify its return type rg --type go "func.*GlobalMinGasPrice.*\) \*big\.Int" .Consider adding a comment explaining the reasoning behind this simplified comparison and any potential implications on gas price precision.
393-393
: Verify return type ofb.RPCMinGasPrice()
The direct assignment
result = b.RPCMinGasPrice()
assumes thatb.RPCMinGasPrice()
returns a*big.Int
. Please verify that this is indeed the case to ensure type compatibility.Consider adding a comment explaining why this direct assignment is preferred over creating a new
big.Int
.rpc/backend/mocks/evm_query_client.go (1)
242-270
: LGTM: NewGlobalMinGasPrice
method added correctlyThe new
GlobalMinGasPrice
method has been implemented correctly following the established pattern for mock methods in this file. It properly handles the input parameters and return values, maintaining consistency with other methods.x/evm/keeper/grpc_query.go (1)
711-717
: Implementation looks good, but consider adding documentation and verifying truncation.The
GlobalMinGasPrice
method is implemented correctly and follows the expected pattern for gRPC query methods. However, I have a few suggestions for improvement:
Consider adding a comment block above the method to explain its purpose and behavior. This will improve code readability and maintainability.
The truncation of the minimum gas price to an integer (line 715) might lead to loss of precision. Please verify if this is the intended behavior. If precision is important, you might want to return the full decimal value instead.
Here's a suggested improvement with added documentation:
+// GlobalMinGasPrice implements the Query/GlobalMinGasPrice gRPC method. +// It returns the global minimum gas price as an integer. +// Note: The returned value is truncated, which may lead to loss of precision. func (k Keeper) GlobalMinGasPrice(c context.Context, _ *types.QueryGlobalMinGasPriceRequest) (*types.QueryGlobalMinGasPriceResponse, error) { ctx := sdk.UnwrapSDKContext(c) minGasPrice := k.GetMinGasPrice(ctx).TruncateInt() return &types.QueryGlobalMinGasPriceResponse{MinGasPrice: minGasPrice}, nil }To verify the intentional truncation of the gas price and its potential impact, we can run the following script:
This script will help us understand if the truncation is consistent with other parts of the codebase and if there's any documentation about the precision of the minimum gas price.
CHANGELOG.md (3)
Line range hint
43-44
: Notable Improvements
- Enhanced testing: Lint tests, new e2e tests, and improved integration test utils.
- CI improvements: Added Golang dependency vulnerability checker.
- Documentation updates: Added audits page and improved existing docs.
- Module refactoring: vesting, ERC-20, and outpost modules have been improved.
- Performance enhancements: Improved efficiency in various modules.
These improvements should lead to better code quality, security, and developer experience. Ensure that:
- The new tests are comprehensive and cover critical paths.
- The vulnerability checker is properly configured and integrated into the CI pipeline.
- Documentation accurately reflects the latest changes and new features.
Also applies to: 45-46, 47-48, 49-50, 51-52, 53-54, 55-56, 57-58, 59-60, 61-62, 63-64, 65-66, 67-68, 69-70
🧰 Tools
🪛 Markdownlint
68-68: Expected: 120; Actual: 150
Line length(MD013, line-length)
71-71
: New feature: Refactor JSON-RPC gas pricesThis change could have significant implications for users interacting with the JSON-RPC interface. It's important to ensure that this refactoring doesn't break existing integrations.
To verify the impact of this change, we should run the following script:
✅ Verification successful
Verified: No changes found in GasPrice functions.
The refactor does not modify any GasPrice-related functions, ensuring existing JSON-RPC integrations remain unaffected.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Check for any changes in gas price related functions rg --type go 'func.*GasPrice'Length of output: 13806
Script:
#!/bin/bash # Search for any function definitions or modifications related to GasPrice using ast-grep ast-grep --lang go --pattern 'func GasPrice($_)' .Length of output: 52
72-73
: Critical Bug FixesSeveral important bugs have been addressed:
- Fixed Ledger support for EthSecp256k1.
- Corrected snapshot configuration and CLI version output.
- Fixed setup of gRPC node service.
- Resolved issues with unbound metrics.
- Fixed the problem of users unable to send transactions with 0 gasPrice to precompiled contracts.
These fixes should significantly improve the stability and usability of the system. Ensure that:
- Regression tests are added for each of these bug fixes to prevent future recurrence.
- The fixes are well-documented, especially those affecting user interactions like the gasPrice issue.
To verify the impact of these bug fixes, run the following script:
Also applies to: 74-75, 76-77, 78-79, 80-81, 82-83
api/ethermint/evm/v1/query.pulsar.go (6)
11962-12316
: LGTM: New QueryGlobalMinGasPriceRequest structures and methods added correctly.The new code for
QueryGlobalMinGasPriceRequest
has been properly integrated into the file. It follows the standard pattern for protocol buffer generated code, including all necessary reflection-related methods and structures.
12317-12737
: LGTM: QueryGlobalMinGasPriceResponse correctly implemented.The
QueryGlobalMinGasPriceResponse
structure and its associated methods have been properly implemented. TheMinGasPrice
field is correctly defined as a string type and is handled appropriately in all generated methods. The code adheres to the standard protocol buffer generated code pattern.
13892-13954
: LGTM: QueryGlobalMinGasPrice request and response structs properly defined.The
QueryGlobalMinGasPriceRequest
andQueryGlobalMinGasPriceResponse
structs are correctly defined with their associated methods. TheMinGasPrice
field in the response struct is properly typed as a string. All necessary Go struct methods (Reset, String, ProtoMessage, etc.) are present and correctly implemented.
14288-14336
: LGTM: Message types correctly updated for GlobalMinGasPrice query.The
file_ethermint_evm_v1_query_proto_msgTypes
andfile_ethermint_evm_v1_query_proto_goTypes
slices have been properly updated to include the newQueryGlobalMinGasPriceRequest
andQueryGlobalMinGasPriceResponse
types. The additions are consistent with the existing pattern and indices in the file.
Line range hint
14349-14689
: LGTM: Dependency indices and exporters correctly updated for GlobalMinGasPrice.The
file_ethermint_evm_v1_query_proto_depIdxs
slice has been properly updated to include the newGlobalMinGasPrice
query method. The exporter functions forQueryGlobalMinGasPriceRequest
andQueryGlobalMinGasPriceResponse
have been correctly implemented. These changes are consistent with the existing pattern in the file.
Line range hint
11962-14697
: LGTM: GlobalMinGasPrice query successfully integrated.The new
GlobalMinGasPrice
query has been successfully integrated into the generated protocol buffer code. All necessary structures, methods, and type information have been correctly added and are consistent with the existing codebase.However, as this is generated code, it's important to ensure that the actual implementation of the
GlobalMinGasPrice
query is correctly handled in the corresponding service files.To verify the complete implementation, please check the following:
rpc/backend/chain_info.go (1)
50-55
: Ensure all callers ofGlobalMinGasPrice
handle the new return typeThe return type of
GlobalMinGasPrice
has been changed frommath.LegacyDec
to*big.Int
. Please verify that all code invoking this method has been updated accordingly to handle the new return type, preventing any potential runtime errors or type mismatches.Run the following script to find all usages of
GlobalMinGasPrice
in the codebase:rpc/backend/node_info.go (2)
290-294
: Correctly scales gas price to denomination precisionThe gas price is properly converted from 18 decimals to the denomination's precision using
ConvertBigIntFrom18DecimalsToLegacyDec
, ensuring accurate fee calculations.
341-350
: Properly updatesRPCMinGasPrice
to return*big.Int
The method
RPCMinGasPrice
now correctly returns a*big.Int
, converting the minimum gas price to 18-decimal precision. This change enhances compatibility with Ethereum clients that expect gas prices in 18-decimal format.
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.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
- rpc/backend/chain_info.go (1 hunks)
🔇 Additional comments (1)
rpc/backend/chain_info.go (1)
55-58
: Add a nil check forres.MinGasPrice
before callingBigInt()
To prevent a potential nil pointer dereference, ensure that
res.MinGasPrice
is not nil before callingres.MinGasPrice.BigInt()
.
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.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (1)
CHANGELOG.md (1)
Changelog Missing Removed or Replaced Code Details
The
CHANGELOG.md
does not include information about removed or replaced code in lines 69-75. It's recommended to update the changelog to explicitly reflect these changes to ensure comprehensive documentation.🔗 Analysis chain
Line range hint
15-16
: Multiple breaking changes and significant updatesThis release includes several state machine breaking changes:
- Refactoring of the RPC gas prices to support 6 decimal places
- Addition of a new governance precompile
- Refactoring of the application to use
sdk.BaseDenom
and EVM denom- Changes to the
x/feemarket
BaseFee to use Decimal- Removal of automatic withdrawal of staking rewards in case of insufficient funds
- Replacement of
EthAccount
type withBaseAccount
These changes are likely to have significant impacts on the network and may require careful consideration during the upgrade process. Ensure that all node operators and developers are aware of these changes and update their systems accordingly.
To verify the impact of these changes, especially the BaseDenom and EVM denom changes, run the following command:
Also applies to: 17-18, 19-20, 21-22, 23-24, 25-26, 27-28, 29-30, 31-32
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Check for references to the old denom and potential conflicts with the new BaseDenom rg -i 'aevmos|stake|basedenom'Length of output: 97251
🧰 Tools
🪛 Markdownlint
69-69: Expected: 120; Actual: 150
Line length(MD013, line-length)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
- CHANGELOG.md (1 hunks)
🔇 Additional comments (3)
CHANGELOG.md (3)
72-73
: New feature: JSON-RPC gas prices support for different precisionThis improvement adds support for JSON-RPC gas prices with different precision. This could have significant implications for how gas prices are handled and may require updates to client applications interacting with the JSON-RPC interface.
Line range hint
34-35
: Various improvements and bug fixesThis release includes several improvements and bug fixes:
- Performance improvements for
eth_headerByHash
- Updates to the
Interpreter
interface to support custom Opcodes- Fix for the community pool being nil
- Updates to CLI commands and removal of unnecessary fee ante handlers
- Changes to how the
ChainID
is handled in the EVM module- Adjustments to extra decimals handling in EVM state operations
These changes should enhance the overall performance and functionality of the system. However, developers should review these changes to ensure compatibility with their applications, especially those interacting with the EVM module or using the CLI commands.
Also applies to: 36-37, 38-39, 40-41, 42-43, 44-45, 46-47, 48-49, 50-51, 52-53, 54-55, 56-57, 58-59, 60-61, 62-63, 64-65, 66-67, 68-69, 70-71
🧰 Tools
🪛 Markdownlint
69-69: Expected: 120; Actual: 150
Line length(MD013, line-length)
Line range hint
1-2147
: Well-structured and informative changelogThe CHANGELOG.md file is well-organized and provides a detailed history of changes across multiple versions of the Evmos project. It consistently categorizes changes into State Machine Breaking, API Breaking, Improvements, and Bug Fixes, which is helpful for users and developers to understand the impact of each release.
For future updates, consider adding more context or rationale for major changes, especially those that are state machine breaking. This could help users and developers better understand the motivations behind significant changes and prepare for upgrades more effectively.
🧰 Tools
🪛 Markdownlint
69-69: Expected: 120; Actual: 150
Line length(MD013, line-length)
Description
Closes: #XXXX
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...
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...
Unreleased
section inCHANGELOG.md
Summary by CodeRabbit
eth_headerByHash
.Interpreter
interface to support custom Opcodes.addGrant
method.v20
.