-
Notifications
You must be signed in to change notification settings - Fork 4
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(ante): separate Cosmos from EVM fee ante handlers #30
base: main-dym
Are you sure you want to change the base?
feat(ante): separate Cosmos from EVM fee ante handlers #30
Conversation
WalkthroughThe changes primarily involve refactoring the fee calculation logic in Changes
Sequence Diagram(s) (Beta)sequenceDiagram
participant User
participant CosmosTx
participant EvmTx
participant FeeHandler
User->>CosmosTx: Submit transaction
CosmosTx->>FeeHandler: Calculate fee
FeeHandler->>CosmosTx: Return fee based on validator gas prices
User->>EvmTx: Submit transaction
EvmTx->>FeeHandler: Calculate fee
FeeHandler->>EvmTx: Return fee based on EVM fee market parameters
Assessment against linked issues
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 as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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 (2)
app/ante/cosmos/fees.go (2)
Line range hint
41-41
: UndefinedBankKeeper
type.- BankKeeper + evmtypes.BankKeeperAlso applies to: 50-50
183-183
: Integer overflow warnings are noted but deemed irrelevant here due to the context.Consider adding a comment explaining why the overflow is not relevant in this context to avoid confusion for future maintainers.
Also applies to: 199-199
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (6)
- app/ante/cosmos/fees.go (6 hunks)
- app/ante/cosmos/fees_test.go (2 hunks)
- app/ante/cosmos/setup_test.go (2 hunks)
- app/ante/handler_options.go (5 hunks)
- app/ante/handler_options_test.go (3 hunks)
- app/app.go (4 hunks)
Additional context used
golangci-lint
app/ante/cosmos/fees.go
41-41: undefined: BankKeeper (typecheck)
50-50: undefined: BankKeeper (typecheck)
Additional comments not posted (8)
app/ante/handler_options_test.go (1)
6-7
: Imports are updated to reflect the changes in the codebase.app/ante/cosmos/setup_test.go (1)
Line range hint
6-7
: Imports are updated to reflect the changes in the codebase.app/ante/cosmos/fees.go (1)
83-83
: Ensure that thecheckTxFeeWithValidatorMinGasPrices
function is correctly calculating fees based on the new logic.Verification successful
The function
checkTxFeeWithValidatorMinGasPrices
appears to correctly calculate fees based on the new logic. It retrieves the fee and gas values, checks the fee against the minimum gas prices duringCheckTx
, and calculates the transaction priority.
feeCoins := feeTx.GetFee()
gas := feeTx.GetGas()
- Checks fee against minimum gas prices if
ctx.IsCheckTx()
- Calculates priority using
getTxPriority(feeCoins, int64(gas))
No issues were found in the implementation.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness of fee calculation logic in `checkTxFeeWithValidatorMinGasPrices`. # Test: Search for the function usage. Expect: Only occurances of the new signature. rg --type python $'checkTxFeeWithValidatorMinGasPrices'Length of output: 85
Script:
#!/bin/bash # Description: Verify the correctness of fee calculation logic in `checkTxFeeWithValidatorMinGasPrices`. # Search for the function definition in Go files. rg --type go 'func checkTxFeeWithValidatorMinGasPrices' # Search for all usages of the function in Go files. rg --type go 'checkTxFeeWithValidatorMinGasPrices'Length of output: 582
Script:
#!/bin/bash # Description: Extract the implementation of the `checkTxFeeWithValidatorMinGasPrices` function for review. # Extract the function implementation from the file. sed -n '/func checkTxFeeWithValidatorMinGasPrices/,/^}/p' app/ante/cosmos/fees.goLength of output: 711
app/ante/handler_options.go (2)
33-33
: Updated imports to includeanteutils
.
126-126
: TheNewDeductFeeDecorator
function is correctly updated to reflect the removal of theTxFeeChecker
.Also applies to: 151-151
app/ante/cosmos/fees_test.go (1)
272-272
: LGTM! The update toNewDeductFeeDecorator
initialization aligns with the PR's objective to separate fee handling.app/app.go (2)
169-169
: Ensure the updated import statements align with the new architectural changes.
1135-1135
: Verify that the updatedparamsKeeper.Subspace
calls are correctly configured for the new module parameters.Verification successful
The
ParamKeyTable
methods are defined for various modules, includingevmtypes
,feemarkettypes
, and others. This confirms that theparamsKeeper.Subspace
calls are correctly configured with the appropriateWithKeyTable
methods for the new module parameters.
x/evm/types/params_legacy.go:func ParamKeyTable() paramtypes.KeyTable
x/feemarket/types/params.go:func ParamKeyTable() paramtypes.KeyTable
These definitions ensure that the
paramsKeeper.Subspace
calls are correctly paired with the necessary key tables.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correct configuration of paramsKeeper.Subspace calls. # Test: Search for the paramsKeeper.Subspace usage in the entire codebase. Expect: Correct configuration as per new module parameters. rg --type go $'paramsKeeper.Subspace'Length of output: 1232
Script:
#!/bin/bash # Description: Verify the definitions of ParamKeyTable methods for modules using WithKeyTable. # Search for the definition of ParamKeyTable methods in the codebase. rg --type go 'func ParamKeyTable'Length of output: 767
Description
Closes #29
Summary by CodeRabbit
Refactor
DeductFeeDecorator
and related functions.HandlerOptions
struct by removing theTxFeeChecker
field and associated validations.Bug Fixes
Chores