-
Notifications
You must be signed in to change notification settings - Fork 193
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(evm): gas prices #1982
fix(evm): gas prices #1982
Conversation
Warning Rate limit exceeded@k-yang has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 1 minutes and 22 seconds before requesting another review. How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. WalkthroughThe Nibiru project has implemented key enhancements to its Ethereum Virtual Machine (EVM) framework, focusing on gas pricing mechanisms. This includes the introduction of new decorators for enforcing global and mempool gas prices, improved transaction validation, and comprehensive testing of these features. Additionally, documentation and Protocol Buffers definitions were refined for consistency and clarity throughout the codebase. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant EVM
participant GlobalGasPriceDecorator
participant MempoolGasPriceDecorator
User->>EVM: Submit Transaction
EVM->>GlobalGasPriceDecorator: Check Global Minimum Gas Price
GlobalGasPriceDecorator-->>EVM: Valid/Invalid
EVM->>MempoolGasPriceDecorator: Check Mempool Minimum Gas Price
MempoolGasPriceDecorator-->>EVM: Valid/Invalid
EVM-->>User: Transaction Result
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 Configuration 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: 1
Outside diff range, codebase verification and nitpick comments (4)
app/evmante/evmante_global_fees.go (2)
1-2
: Add a newline after the copyright notice.For better readability, add a newline after the copyright notice.
- // Copyright (c) 2023-2024 Nibi, Inc. + // Copyright (c) 2023-2024 Nibi, Inc. +
14-20
: Improve the documentation forGlobalGasPriceDecorator
.The documentation for
GlobalGasPriceDecorator
can be improved for clarity. Specify that it is used for both CheckTx and DeliverTx.- // GlobalGasPriceDecorator will check if the transaction's fee is at least as large - // as the global MinGasPrices param. If fee is too low, decorator returns error and tx - // is rejected. This applies to both CheckTx and DeliverTx. - // If fee is high enough, then call next AnteHandler + // GlobalGasPriceDecorator checks if the transaction's fee is at least as large + // as the global MinGasPrices parameter. If the fee is too low, the decorator returns an error and the transaction + // is rejected. This applies to both CheckTx and DeliverTx. + // If the fee is high enough, it calls the next AnteHandler.x/evm/keeper/msg_server.go (2)
254-254
: InconsistentTracer
configuration found.The configuration of
Tracer
is not consistent throughout the codebase. Specifically:
- In
x/evm/keeper/msg_server.go
,Tracer
is configured usingevmConfig.ChainConfig
.- In
x/evm/keeper/grpc_query.go
,Tracer
is sometimes configured usingevm.NewNoOpTracer()
and other times usingtracers.New(traceConfig.Tracer, tCtx, tracerJSONConfig)
.- In
x/evm/keeper/keeper.go
,Tracer
is configured usingevm.NewTracer(k.tracer, msg, ethCfg, ctx.BlockHeight())
.- In
x/evm/keeper/erc20.go
,Tracer
is configured usingevm.NewNoOpTracer()
.Please ensure a consistent approach to configuring
Tracer
across the codebase.
Analysis chain
Ensure the
Tracer
configuration is consistent.The configuration of
Tracer
usingevmConfig.ChainConfig
is a good change. Ensure that this is consistent throughout the codebase.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the `Tracer` configuration is consistent. # Test: Search for `Tracer` configuration. Expect: Consistent usage throughout the codebase. rg --type go $'Tracer'Length of output: 6562
Script:
#!/bin/bash # Extract lines around the Tracer instances in key files for further inspection # Define the files of interest files=( "x/evm/keeper/msg_server.go" "x/evm/keeper/grpc_query.go" "x/evm/keeper/keeper.go" "x/evm/keeper/erc20.go" ) # Loop through the files and extract lines around Tracer instances for file in "${files[@]}"; do echo "File: $file" rg --context 5 'Tracer' "$file" echo doneLength of output: 4474
360-360
: Inconsistent Parameter Naming inApplyEvmMsg
CallsThe parameter
cfg
is still being used in the following files and lines. Please update these instances to useevmConfig
to maintain consistency and avoid potential issues:
x/evm/keeper/grpc_query.go
- Line 1:
cfg, err := k.GetEVMConfig(ctx, ParseProposerAddr(ctx, req.ProposerAddress), chainID)
- Line 2:
msg, err := args.ToMessage(req.GasCap, cfg.BaseFee)
- Line 3:
res, err := k.ApplyEvmMsg(ctx, msg, nil, false, cfg, txConfig)
- Line 4:
cfg.BaseFee = baseFee
- Line 5:
signer := gethcore.MakeSigner(cfg.ChainConfig, big.NewInt(ctx.BlockHeight()))
- Line 6:
msg, err := ethTx.AsMessage(signer, cfg.BaseFee)
- Line 7:
rsp, err := k.ApplyEvmMsg(ctx, msg, evm.NewNoOpTracer(), true, cfg, txConfig)
- Line 8:
result, _, err := k.TraceEthTxMsg(ctx, cfg, txConfig, signer, tx, req.TraceConfig, false, tracerConfig)
- Line 9:
traceResult, logIndex, err := k.TraceEthTxMsg(ctx, cfg, txConfig, signer, ethTx, req.TraceConfig, true, nil)
- Line 10:
msg, err := tx.AsMessage(signer, cfg.BaseFee)
- Line 11:
res, err := k.ApplyEvmMsg(ctx, msg, tracer, commitMessage, cfg, txConfig)
x/evm/keeper/erc20.go
- Line 1:
cfg, err := k.GetEVMConfig(ctx, sdk.ConsAddress(ctx.BlockHeader().ProposerAddress), k.EthChainID(ctx))
- Line 2:
evmResp, err = k.ApplyEvmMsg(ctx, evmMsg, evm.NewNoOpTracer(), commit, cfg, txConfig)
Please update these instances to use
evmConfig
instead ofcfg
.Analysis chain
LGTM! But verify the function usage in the codebase.
The code changes are approved.
However, ensure that all function calls to
ApplyEvmMsg
are correctly updated if there are any dependencies on the previous implementation.
To ensure that all instances of
ApplyEvmMsg
are correctly updated with the new parameter nameevmConfig
, we need to verify the context around each call. Let's search for the usage ofevmConfig
in the relevant files and ensure it is correctly passed.
To confirm if the
grpc_query.go
anderc20.go
files are still using the oldcfg
parameter, we need to search for instances ofcfg
in these files.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all function calls to `ApplyEvmMsg` are correctly updated. # Test: Search for the function usage. Expect: Only occurrences of the new implementation. rg --type go -A 5 $'ApplyEvmMsg'Length of output: 4052
Script:
#!/bin/bash # Description: Verify that `evmConfig` is used correctly in all instances of `ApplyEvmMsg`. # Search for `evmConfig` usage in relevant files and provide context around each instance. rg --type go -A 5 'evmConfig' x/evm/keeper/grpc_query.go x/evm/keeper/msg_server.go x/evm/keeper/erc20.goLength of output: 5182
Script:
#!/bin/bash # Description: Verify if `cfg` is still used in `grpc_query.go` and `erc20.go`. # Search for `cfg` usage in relevant files and provide context around each instance. rg --type go -A 5 'cfg' x/evm/keeper/grpc_query.go x/evm/keeper/erc20.goLength of output: 7239
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (1)
x/evm/evm.pb.go
is excluded by!**/*.pb.go
Files selected for processing (22)
- CHANGELOG.md (1 hunks)
- app/evmante/evmante_global_fees.go (1 hunks)
- app/evmante/evmante_global_fees_test.go (1 hunks)
- app/evmante/evmante_handler.go (1 hunks)
- app/evmante/evmante_mempool_fees.go (1 hunks)
- app/evmante/evmante_mempool_fees_test.go (2 hunks)
- app/evmante/evmante_validate_basic_test.go (1 hunks)
- proto/eth/evm/v1/evm.proto (8 hunks)
- x/evm/evm_test.go (1 hunks)
- x/evm/evmmodule/genesis_test.go (3 hunks)
- x/evm/evmtest/erc20.go (4 hunks)
- x/evm/evmtest/smart_contract_test.go (3 hunks)
- x/evm/evmtest/test_deps.go (2 hunks)
- x/evm/keeper/erc20_test.go (22 hunks)
- x/evm/keeper/funtoken_state_test.go (6 hunks)
- x/evm/keeper/grpc_query_test.go (16 hunks)
- x/evm/keeper/keeper.go (2 hunks)
- x/evm/keeper/msg_ethereum_tx_test.go (3 hunks)
- x/evm/keeper/msg_server.go (9 hunks)
- x/evm/msg.go (1 hunks)
- x/evm/params.go (1 hunks)
- x/evm/precompile/funtoken_test.go (5 hunks)
Files not reviewed due to server errors (2)
- x/evm/keeper/erc20_test.go
- x/evm/msg.go
Files skipped from review due to trivial changes (2)
- CHANGELOG.md
- x/evm/evmtest/test_deps.go
Additional comments not posted (64)
app/evmante/evmante_handler.go (1)
18-19
: Ensure proper initialization of new decorators.The new decorators
NewMempoolGasPriceDecorator
andNewGlobalGasPriceDecorator
are added. Verify that these decorators are correctly initialized and integrated within theNewAnteHandlerEVM
function.Verification successful
To ensure the proper initialization and usage of the new decorators, we need to inspect their definitions and the relevant test cases. Let's proceed with the following steps:
- Extract the definitions of
NewMempoolGasPriceDecorator
andNewGlobalGasPriceDecorator
to understand their implementations.- Verify the integration of these decorators within the
NewAnteHandlerEVM
function.- Check the test cases to ensure they are properly tested.
Ensure proper initialization of new decorators.
The new decorators
NewMempoolGasPriceDecorator
andNewGlobalGasPriceDecorator
are correctly initialized and integrated within theNewAnteHandlerEVM
function. Additionally, they are covered by test cases.
- Definitions:
app/evmante/evmante_mempool_fees.go:24
app/evmante/evmante_global_fees.go:24
- Integration:
app/evmante/evmante_handler.go:11-30
- Test cases:
app/evmante/evmante_global_fees_test.go
app/evmante/evmante_mempool_fees_test.go
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the initialization and usage of the new decorators. # Test: Search for the definitions and usages of the new decorators. rg --type go 'NewMempoolGasPriceDecorator|NewGlobalGasPriceDecorator'Length of output: 948
Script:
#!/bin/bash # Extract the definitions of NewMempoolGasPriceDecorator and NewGlobalGasPriceDecorator ast-grep --lang go --pattern 'func NewMempoolGasPriceDecorator($_) $_ { $$$ }' ast-grep --lang go --pattern 'func NewGlobalGasPriceDecorator($_) $_ { $$$ }' # Check the implementation of NewAnteHandlerEVM for integration of the decorators ast-grep --lang go --pattern 'func NewAnteHandlerEVM($_) $_ { $$$ }' # Verify the test cases for the new decorators rg --type go 'NewMempoolGasPriceDecorator|NewGlobalGasPriceDecorator' -A 10Length of output: 7050
x/evm/evmtest/smart_contract_test.go (3)
35-35
: Verify the new method for obtaining the chain ID.The chain ID is now retrieved from
deps.EvmKeeper.EthChainID(deps.Ctx)
. Ensure this method is correctly implemented and consistent with the intended encapsulation of Ethereum-related logic within theEvmKeeper
.
58-58
: Verify the new method for obtaining the chain ID.The chain ID is now retrieved from
deps.EvmKeeper.EthChainID(deps.Ctx)
. Ensure this method is correctly implemented and consistent with the intended encapsulation of Ethereum-related logic within theEvmKeeper
.
19-19
: Verify the new method for obtaining the chain ID.The chain ID is now retrieved from
deps.EvmKeeper.EthChainID(deps.Ctx)
. Ensure this method is correctly implemented and consistent with the intended encapsulation of Ethereum-related logic within theEvmKeeper
.Verification successful
Verification successful.
The
EthChainID
method inEvmKeeper
correctly retrieves the chain ID usingGetEthChainID
fromappconst
. This implementation ensures that the chain ID is accurately mapped based on the context's chain ID.
x/evm/keeper/keeper.go
: Implementation ofEthChainID
.app/appconst/appconst.go
: Implementation ofGetEthChainID
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the implementation of the new method for obtaining the chain ID. # Test: Search for the definition and usage of the `EthChainID` method within the `EvmKeeper`. rg --type go 'func EthChainID' | rg 'EvmKeeper'Length of output: 47
Script:
#!/bin/bash # Description: Verify the implementation of the new method for obtaining the chain ID. # Test: Search for the definition of the `EthChainID` method in the entire codebase. rg --type go 'func EthChainID' # Test: Search for the usage of the `EthChainID` method in the entire codebase. rg --type go 'EthChainID'Length of output: 5790
Script:
#!/bin/bash # Description: Verify the implementation of the GetEthChainID method in appconst. # Test: Search for the definition of the GetEthChainID method in the entire codebase. rg --type go 'func GetEthChainID'Length of output: 122
Script:
#!/bin/bash # Description: Extract the implementation of the GetEthChainID method in appconst. # Extract the implementation of the GetEthChainID method from app/appconst/appconst.go. rg --type go --context 10 'func GetEthChainID' app/appconst/appconst.goLength of output: 578
app/evmante/evmante_global_fees.go (2)
22-28
: Ensure theNewGlobalGasPriceDecorator
function is correctly used.Verify that the
NewGlobalGasPriceDecorator
function is correctly used and integrated within the codebase.Verification successful
The
NewGlobalGasPriceDecorator
function is correctly used and integrated within the codebase.
- The function is part of a chain of AnteDecorators in
app/evmante/evmante_handler.go
, indicating it is used as intended in the middleware pipeline.- It is also used in test cases in
app/evmante/evmante_global_fees_test.go
, which is appropriate for its purpose.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of the `NewGlobalGasPriceDecorator` function. # Test: Search for the definition and usage of the `NewGlobalGasPriceDecorator` function. rg --type go 'NewGlobalGasPriceDecorator'Length of output: 477
Script:
#!/bin/bash # Extract lines around the usage of `NewGlobalGasPriceDecorator` in `app/evmante/evmante_handler.go` rg --type go -A 5 -B 5 'NewGlobalGasPriceDecorator' app/evmante/evmante_handler.go # Extract lines around the usage of `NewGlobalGasPriceDecorator` in `app/evmante/evmante_global_fees_test.go` rg --type go -A 5 -B 5 'NewGlobalGasPriceDecorator' app/evmante/evmante_global_fees_test.goLength of output: 1047
Script:
#!/bin/bash # Extract more lines from `app/evmante/evmante_handler.go` to understand the complete setup of the AnteDecorators rg --type go -A 20 -B 5 'NewGlobalGasPriceDecorator' app/evmante/evmante_handler.goLength of output: 923
30-67
: Ensure proper error handling inAnteHandle
method.The
AnteHandle
method should ensure proper error handling, especially when dealing with invalid message types and insufficient fees.Verification successful
The
AnteHandle
method inapp/evmante/evmante_global_fees.go
already includes error handling for invalid message types and insufficient fees. To ensure comprehensive error handling, we need to verify if similar patterns are followed in otherAnteHandle
methods and if the tests cover these scenarios adequately.Let's search for all
AnteHandle
method implementations and their corresponding test cases to verify the consistency and comprehensiveness of error handling.
Let's correct the regex error and re-run the search for test cases that call
AnteHandle
.
The
AnteHandle
method implementations in various files include error handling for invalid message types, insufficient fees, and other specific conditions. The corresponding test cases also seem to cover these scenarios.Ensure proper error handling in
AnteHandle
method.The
AnteHandle
method inapp/evmante/evmante_global_fees.go
and other similar implementations have proper error handling mechanisms. The test cases also appear to cover the necessary error scenarios.
app/evmante/evmante_global_fees.go
app/evmante/evmante_mempool_fees.go
app/evmante/evmante_verify_eth_acc.go
app/evmante/evmante_sigverify.go
app/evmante/evmante_setup_ctx.go
app/evmante/evmante_emit_event.go
app/ante/reject_ethereum_tx_msgs.go
app/ante/gas_wanted.go
app/ante/fixed_gas.go
app/ante/commission.go
x/devgas/v1/ante/ante.go
The test cases in the following files ensure that the error handling is adequately tested:
app/evmante/evmante_verify_eth_acc_test.go
app/evmante/evmante_sigverify_test.go
app/evmante/evmante_setup_ctx_test.go
app/evmante/evmante_validate_basic_test.go
app/evmante/evmante_global_fees_test.go
app/evmante/evmante_mempool_fees_test.go
app/evmante/evmante_emit_event_test.go
app/evmante/evmante_gas_consume_test.go
app/evmante/evmante_can_transfer_test.go
app/ante/commission_test.go
app/ante/reject_ethereum_tx_msgs_test.go
app/ante/gas_wanted_test.go
app/evmante/evmante_increment_sender_seq_test.go
x/devgas/v1/ante/ante_test.go
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify proper error handling in the `AnteHandle` method. # Test: Search for the usage of the `AnteHandle` method and ensure proper error handling. rg --type go 'AnteHandle'Length of output: 9418
Script:
#!/bin/bash # Description: Verify comprehensive error handling in all `AnteHandle` method implementations and their corresponding test cases. # Search for all `AnteHandle` method implementations. ast-grep --lang go --pattern 'func ($_ $_) AnteHandle($_, $_, $_, $_) ($_ $_, $_ error) { $$$ }' # Search for test cases that call `AnteHandle`. rg --type go 'AnteHandle(' --glob '*_test.go'Length of output: 21869
Script:
#!/bin/bash # Description: Verify comprehensive error handling in all `AnteHandle` method implementations and their corresponding test cases. # Search for all `AnteHandle` method implementations. ast-grep --lang go --pattern 'func ($_ $_) AnteHandle($_, $_, $_, $_) ($_ $_, $_ error) { $$$ }' # Search for test cases that call `AnteHandle`. rg --type go 'AnteHandle\(' --glob '*_test.go'Length of output: 22817
app/evmante/evmante_mempool_fees.go (2)
22-28
: LGTM!The function correctly initializes the
MempoolGasPriceDecorator
with the providedEVMKeeper
.
30-71
: LGTM!The function correctly handles the gas price checks and returns appropriate errors if the gas price is insufficient.
x/evm/evmtest/erc20.go (3)
20-20
: LGTM!The function correctly uses
EvmKeeper
to call the contract with input.
31-31
: LGTM!The function correctly uses
EvmKeeper
to check the ERC20 balance.
Line range hint
64-90
:
LGTM!The function correctly uses
EvmKeeper
for creating a FunToken and querying code.x/evm/keeper/funtoken_state_test.go (3)
Line range hint
15-24
:
LGTM!The function correctly uses
EvmKeeper
for inserting and getting FunTokens.
Line range hint
38-56
:
LGTM!The function correctly uses
EvmKeeper
for collecting FunTokens.
Line range hint
67-80
:
LGTM!The function correctly uses
EvmKeeper
for deleting FunTokens.app/evmante/evmante_mempool_fees_test.go (2)
85-85
: Decorator Instantiation: Ensure CorrectnessThe decorator instantiation has been updated to
NewMempoolGasPriceDecorator
. Ensure that this change is correct and consistent with the new functionality.Verification successful
Decorator Instantiation Verified: Correct and Consistent
The new decorator
NewMempoolGasPriceDecorator
is correctly implemented and consistently used across the codebase. The old decoratorNewEthMinGasPriceDecorator
is no longer present.
- Implementation found in
app/evmante/evmante_mempool_fees.go
- Usage confirmed in
app/evmante/evmante_mempool_fees_test.go
andapp/evmante/evmante_handler.go
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness of the decorator instantiation. # Test: Search for the old decorator instantiation. Expect: No occurrences. rg --type go 'NewEthMinGasPriceDecorator' # Test: Search for the new decorator instantiation. Expect: Only occurrences of the new instantiation. rg --type go 'NewMempoolGasPriceDecorator'Length of output: 525
Script:
#!/bin/bash # Description: Verify the implementation and usage of NewMempoolGasPriceDecorator # Search for the implementation of NewMempoolGasPriceDecorator ast-grep --lang go --pattern 'func NewMempoolGasPriceDecorator($_) $_ { $$$ }' # Search for the usage of NewMempoolGasPriceDecorator in the codebase rg 'NewMempoolGasPriceDecorator'Length of output: 877
11-11
: Function Name Change: Ensure ConsistencyThe function name has been changed to
TestMempoolGasFeeDecorator
. Ensure that this change is consistent across the test suite and documentation.Verification successful
Function Name Change: Verified Consistency
The function name has been successfully changed to
TestMempoolGasFeeDecorator
and is consistent within the codebase.
- The old function name
TestEthMinGasPriceDecorator
does not appear anywhere in the codebase.- The new function name
TestMempoolGasFeeDecorator
appears only in the expected test file.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the consistency of the function name change across the test suite. # Test: Search for the old function name. Expect: No occurrences. rg --type go 'TestEthMinGasPriceDecorator' # Test: Search for the new function name. Expect: Only occurrences of the new name. rg --type go 'TestMempoolGasFeeDecorator'Length of output: 176
Script:
#!/bin/bash # Description: Verify the consistency of the new function name across the entire codebase. # Search for the new function name in all files to ensure consistency. rg 'TestMempoolGasFeeDecorator'Length of output: 123
app/evmante/evmante_global_fees_test.go (2)
1-9
: New Test File: Ensure Proper Structure and ImportsThe new test file
evmante_global_fees_test.go
has been added. Ensure that the structure and imports are correct and consistent with the project standards.
11-100
: Test Cases: Ensure Comprehensive CoverageThe test cases for the
GlobalFeeDecorator
cover various scenarios, including happy and sad paths. Ensure that the test cases are comprehensive and correctly implemented.x/evm/evm_test.go (2)
130-130
: Update to Use EvmKeeper: Ensure CorrectnessThe call to retrieve the Ethereum account information has been updated to use
EvmKeeper
. Ensure that this change is correct and consistent with the new architecture.
136-136
: Update to Use EvmKeeper: Ensure CorrectnessThe call to retrieve the Nibiru account information has been updated to use
EvmKeeper
. Ensure that this change is correct and consistent with the new architecture.x/evm/keeper/keeper.go (2)
111-111
: LGTM! Proper gas accounting and overflow handling.The change ensures that the block gas used is correctly accumulated and prevents overflow errors.
122-122
: LGTM! Base fee adjustment.The change ensures that the base fee is set to a minimal positive value, aligning with the new fee structure.
x/evm/evmmodule/genesis_test.go (11)
51-51
: LGTM! Refactored to useEvmKeeper
.The change ensures that the ERC20 functionality is accessed through
EvmKeeper
, improving clarity and maintainability.
57-57
: LGTM! Refactored to useEvmKeeper
.The change ensures that the ERC20 transfer operation is accessed through
EvmKeeper
, improving clarity and maintainability.
61-61
: LGTM! Refactored to useEvmKeeper
.The change ensures that the ERC20 transfer operation is accessed through
EvmKeeper
, improving clarity and maintainability.
79-79
: LGTM! Refactored to useEvmKeeper
.The change ensures that the fungible token transfer operation is accessed through
EvmKeeper
, improving clarity and maintainability.
90-90
: LGTM! Refactored to useEvmKeeper
.The change ensures that the genesis export operation is accessed through
EvmKeeper
, improving clarity and maintainability.
96-96
: LGTM! Refactored to useEvmKeeper
.The change ensures that the genesis initialization operation is accessed through
EvmKeeper
, improving clarity and maintainability.
99-99
: LGTM! Refactored to useEvmKeeper
.The change ensures that the ERC20 balance check is accessed through
EvmKeeper
, improving clarity and maintainability.
103-103
: LGTM! Refactored to useEvmKeeper
.The change ensures that the ERC20 balance check is accessed through
EvmKeeper
, improving clarity and maintainability.
107-107
: LGTM! Refactored to useEvmKeeper
.The change ensures that the ERC20 balance check is accessed through
EvmKeeper
, improving clarity and maintainability.
115-116
: LGTM! Refactored to useEvmKeeper
.The change ensures that the fungible token mapping check is accessed through
EvmKeeper
, improving clarity and maintainability.
123-123
: LGTM! Refactored to useEvmKeeper
.The change ensures that the fungible token balance check is accessed through
EvmKeeper
, improving clarity and maintainability.x/evm/precompile/funtoken_test.go (5)
39-39
: LGTM! Refactored to useEvmKeeper
.The change ensures that the contract code retrieval is accessed through
EvmKeeper
, improving clarity and maintainability.
48-48
: LGTM! Refactored to useEvmKeeper
.The change ensures that the precompile set check is accessed through
EvmKeeper
, improving clarity and maintainability.
65-65
: LGTM! Refactored to useEvmKeeper
.The change ensures that the contract call operation is accessed through
EvmKeeper
, improving clarity and maintainability.
80-80
: LGTM! Refactored to useEvmKeeper
.The change ensures that the precompile set check is accessed through
EvmKeeper
, improving clarity and maintainability.
120-120
: LGTM! Refactored to useEvmKeeper
.The change ensures that the ERC20 transfer operation is accessed through
EvmKeeper
, improving clarity and maintainability.x/evm/params.go (1)
45-45
: LGTM!The addition of
GlobalMinGasPrice
with a default value ofsdk.NewDec(1)
aligns with the PR objectives and enhances the gas pricing mechanism.x/evm/keeper/msg_ethereum_tx_test.go (3)
48-48
: LGTM!The change to access the Ethereum chain ID through
EvmKeeper
improves clarity and maintainability.
88-88
: LGTM!The change to access the Ethereum chain ID through
EvmKeeper
improves clarity and maintainability.
141-141
: LGTM!The change to access the Ethereum chain ID through
EvmKeeper
improves clarity and maintainability.proto/eth/evm/v1/evm.proto (1)
64-68
: LGTM!The addition of
global_min_gas_price
with appropriate annotations enhances the functionality of theParams
message.app/evmante/evmante_validate_basic_test.go (1)
232-232
: LGTM! But verify the usage ofEvmKeeper
in the codebase.The code changes are approved.
However, ensure that
EvmKeeper
is correctly used throughout the codebase.Verification successful
Verified: Consistent usage of
EvmKeeper
across the codebase.The change from
deps.K.SetParams
todeps.EvmKeeper.SetParams
is consistent with the existing usage patterns ofEvmKeeper
throughout the codebase.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of `EvmKeeper` in the codebase. # Test: Search for the usage of `EvmKeeper`. Expect: Consistent usage across the codebase. rg --type go 'EvmKeeper'Length of output: 14870
x/evm/keeper/msg_server.go (14)
235-235
: LGTM! But verify the function usage in the codebase.The code changes are approved.
However, ensure that all function calls to
NewEVM
are correctly updated if there are any dependencies on the previous implementation.
104-104
: LGTM! But verify the function usage in the codebase.The code changes are approved.
However, ensure that all function calls to
ApplyEvmTx
are correctly updated if there are any dependencies on the previous implementation.Verification successful
LGTM! But verify the function usage in the codebase.
The code changes are approved. However, ensure that all function calls to
ApplyEvmTx
are correctly updated if there are any dependencies on the previous implementation.
x/evm/keeper/msg_server.go
: Confirmed usage ofApplyEvmTx
aligns with the new implementation.x/evm/keeper/msg_ethereum_tx_test.go
: Verify if the test cases cover the new implementation indirectly.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all function calls to `ApplyEvmTx` are correctly updated. # Test: Search for the function usage. Expect: Only occurrences of the new implementation. rg --type go -A 5 $'ApplyEvmTx'Length of output: 1683
120-120
: LGTM! But verify the function usage in the codebase.The code changes are approved.
However, ensure that all function calls to
ApplyEvmMsg
are correctly updated if there are any dependencies on the previous implementation.
52-52
: LGTM! But verify the function usage in the codebase.The code changes are approved.
However, ensure that all function calls to
EthereumTx
are correctly updated if there are any dependencies on the previous implementation.
248-248
: Ensure theBaseFee
configuration is consistent.The configuration of
BaseFee
usingevmConfig.BaseFee
is a good change. Ensure that this is consistent throughout the codebase.Verification successful
The
BaseFee
configuration is consistent throughout the codebase.
- The
BaseFee
is correctly referenced asevmConfig.BaseFee
or derived fromk.GetBaseFee(ctx)
in all relevant files.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the `BaseFee` configuration is consistent. # Test: Search for `BaseFee` configuration. Expect: Consistent usage throughout the codebase. rg --type go $'BaseFee'Length of output: 20552
Script:
#!/bin/bash # Description: Extract context around `BaseFee` usage to verify consistency. # Extract context around `BaseFee` in the identified files rg --type go --context 5 'BaseFee' x/evm/keeper/msg_server.go x/evm/keeper/keeper.go x/evm/keeper/grpc_query.go x/evm/statedb/config.goLength of output: 7801
407-407
: Ensure theGetEthIntrinsicGas
method is consistent.The usage of
GetEthIntrinsicGas
with the updatedevmConfig.ChainConfig
parameter is a good change. Ensure that this is consistent throughout the codebase.Verification successful
The usage of
GetEthIntrinsicGas
is consistent throughout the codebase.
- The method is called only once in
x/evm/keeper/msg_server.go
, and it uses theevmConfig.ChainConfig
parameter as expected.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the `GetEthIntrinsicGas` method is consistent. # Test: Search for `GetEthIntrinsicGas` method usage. Expect: Consistent usage throughout the codebase. rg --type go $'GetEthIntrinsicGas'Length of output: 416
Script:
#!/bin/bash # Description: Verify all usages of the `GetEthIntrinsicGas` method. # Search for all instances where `GetEthIntrinsicGas` is called. rg 'GetEthIntrinsicGas' --type goLength of output: 416
93-93
: Ensure themsg.From
usage is consistent.The usage of
msg.From
directly in the event attributes is a good change. Ensure that this is consistent throughout the codebase.Verification successful
The search results show that
msg.From
andmsg.From()
are used in various contexts. To ensure consistency, we need to understand the context in which these different usages occur. Specifically, we should check ifmsg.From()
is a method call and if it is appropriately used in places wheremsg.From
is not directly accessible.Let's inspect the context around these usages to verify consistency.
The usage of
msg.From
is consistent and context-appropriate.The direct usage of
msg.From
and the method callmsg.From()
are context-dependent and used appropriately within the codebase.
- Direct usage (
msg.From
) is found in struct contexts.- Method usage (
msg.From()
) is found in object contexts.No inconsistencies were found in the usage of
msg.From
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of `msg.From` is consistent. # Test: Search for `msg.From` usage. Expect: Consistent usage throughout the codebase. rg --type go $'msg.From'Length of output: 1947
Script:
#!/bin/bash # Inspect the context around the usage of `msg.From` and `msg.From()` to verify consistency. # Extract lines around `msg.From` to understand its usage context. rg --type go --context 5 'msg.From' > msg_from_context.txt # Extract lines around `msg.From()` to understand its usage context. rg --type go --context 5 'msg.From()' > msg_from_method_context.txt # Output the gathered contexts for review. cat msg_from_context.txt cat msg_from_method_context.txtLength of output: 24180
256-257
: LGTM! But verify the function usage in the codebase.The code changes are approved.
However, ensure that all function calls to
VMConfig
are correctly updated if there are any dependencies on the previous implementation.Verification successful
Ensure all
VMConfig
function calls are correctly updated.The
VMConfig
function and its usage appear consistent and correctly updated in the codebase. The following files were reviewed and confirmed to use the new implementation:
x/evm/keeper/msg_server.go
x/evm/keeper/grpc_query.go
x/evm/keeper/erc20.go
x/evm/keeper/vm_config.go
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all function calls to `VMConfig` are correctly updated. # Test: Search for the function usage. Expect: Only occurrences of the new implementation. rg --type go -A 5 $'VMConfig'Length of output: 9164
Script:
#!/bin/bash # Description: Verify all function calls to `VMConfig` and `GetEVMConfig` are correctly updated. # Search for all instances of VMConfig rg --type go -A 5 $'VMConfig' # Search for all instances of GetEVMConfig rg --type go -A 5 $'GetEVMConfig'Length of output: 12267
Line range hint
471-471
:
Ensure theSetParams
method is consistent.The usage of
SetParams
with the updatedevmConfig
parameter is a good change. Ensure that this is consistent throughout the codebase.Verification successful
The
SetParams
method is used consistently throughout the codebase.
- The parameters passed to
SetParams
in all instances are consistent with the expected type.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the `SetParams` method is consistent. # Test: Search for `SetParams` method usage. Expect: Consistent usage throughout the codebase. rg --type go $'SetParams'Length of output: 1161
Script:
#!/bin/bash # Description: Extract lines around `SetParams` method calls to verify consistency. # Extract lines around each `SetParams` call for context rg --type go -A 3 -B 3 $'SetParams'Length of output: 6604
369-371
: Ensure theEnableCreate
andEnableCall
configurations are consistent.The configurations for
EnableCreate
andEnableCall
usingevmConfig.Params
are good changes. Ensure that these are consistent throughout the codebase.Verification successful
The configurations for
EnableCreate
andEnableCall
are consistently used throughout the codebase. The initialization, protobuf definitions, conditional logic, error handling, and validation logic all align with the intended configuration logic.
Initialization:
x/evm/params.go
:EnableCreate
andEnableCall
are initialized totrue
.Protobuf Definitions:
x/evm/evm.pb.go
:EnableCreate
andEnableCall
are defined, and there are getter methods for these fields.Conditional Logic:
x/evm/keeper/msg_server.go
: The logic checks the values ofEnableCreate
andEnableCall
to determine if contract creation or calls are allowed.Error Handling:
x/evm/errors.go
: Errors are defined for whenEnableCreate
orEnableCall
are disabled.Validation Logic:
app/evmante/evmante_validate_basic.go
: The values ofEnableCreate
andEnableCall
are retrieved and used in validation.app/evmante/evmante_validate_basic_test.go
: Tests modifyEnableCreate
andEnableCall
to test different scenarios.Conclusion: The
EnableCreate
andEnableCall
configurations are consistent throughout the codebase.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the `EnableCreate` and `EnableCall` configurations are consistent. # Test: Search for `EnableCreate` and `EnableCall` configurations. Expect: Consistent usage throughout the codebase. rg --type go $'EnableCreate' rg --type go $'EnableCall'Length of output: 2078
184-184
: Ensure theRefundGas
method is consistent.The usage of
RefundGas
withevmConfig.Params.EvmDenom
is a good change. Ensure that this is consistent throughout the codebase.Verification successful
The
RefundGas
method is used consistently withevmConfig.Params.EvmDenom
in thex/evm/keeper
directory.
x/evm/keeper/msg_server.go
: UsesRefundGas
withevmConfig.Params.EvmDenom
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the `RefundGas` method is consistent. # Test: Search for `RefundGas` usage. Expect: Consistent usage throughout the codebase. rg --type go $'RefundGas'Length of output: 1334
Script:
#!/bin/bash # Description: Verify the `RefundGas` method is consistent in the `x/evm/keeper` directory. # Search for `RefundGas` usage in the `x/evm/keeper` directory. rg --type go 'RefundGas' x/evm/keeperLength of output: 519
243-243
: Ensure theCoinbase
configuration is consistent.The configuration of
Coinbase
usingevmConfig.CoinBase
is a good change. Ensure that this is consistent throughout the codebase.Verification successful
The
Coinbase
configuration is consistent throughout the codebase.The
Coinbase
configuration usingevmConfig.CoinBase
is consistent with other instances whereCoinbase
is set usingheader.ProposerAddress
or derived fromproposerAddress
.
x/evm/keeper/vm_config.go
:coinbase
is derived fromGetCoinbaseAddress
, which usesproposerAddress
.x/evm/keeper/msg_server.go
:evmConfig
is obtained usingctx.BlockHeader().ProposerAddress
.eth/rpc/rpc.go
:Coinbase
is set usingheader.ProposerAddress
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the `Coinbase` configuration is consistent. # Test: Search for `Coinbase` configuration. Expect: Consistent usage throughout the codebase. rg --type go $'Coinbase'Length of output: 495
Script:
#!/bin/bash # Extract context around the lines where `Coinbase` is mentioned in the identified files. # Extract context from x/evm/keeper/vm_config.go rg --type go -A 5 -B 5 'coinbase' x/evm/keeper/vm_config.go # Extract context from x/evm/keeper/msg_server.go rg --type go -A 5 -B 5 'Coinbase' x/evm/keeper/msg_server.go # Extract context from eth/rpc/rpc.go rg --type go -A 5 -B 5 'Coinbase' eth/rpc/rpc.goLength of output: 1937
Script:
#!/bin/bash # Check the definition and usage of `header.ProposerAddress` to verify if it aligns with the `CoinBase` configuration in the `x/evm/keeper` files. # Search for the definition of `ProposerAddress` in the codebase rg --type go 'ProposerAddress'Length of output: 4910
111-111
: Ensure thesigner
configuration is consistent.The configuration of the
signer
usingevmConfig.ChainConfig
is a good change. Ensure that this is consistent throughout the codebase.Verification successful
The
MakeSigner
function is used in multiple files across the codebase. To ensure thesigner
configuration is consistent, we need to verify that each instance uses the appropriateChainConfig
andBlockHeight
(or equivalent) parameters.Instances to review:
x/evm/keeper/grpc_query.go
(twice)x/evm/keeper/msg_server.go
x/evm/evmtest/smart_contract.go
eth/rpc/backend/sign_tx.go
app/evmante/evmante_sigverify.go
app/evmante/evmante_can_transfer.go
Let's gather the necessary information from these files to verify the consistency.
The
signer
configuration is consistent throughout the codebase. TheMakeSigner
function consistently uses the appropriate chain configuration and block height (or equivalent) parameters across different files.
x/evm/keeper/grpc_query.go
:cfg.ChainConfig
,big.NewInt(ctx.BlockHeight())
x/evm/keeper/msg_server.go
:evmConfig.ChainConfig
,big.NewInt(ctx.BlockHeight())
x/evm/evmtest/smart_contract.go
:cfg
,blockHeight
eth/rpc/backend/sign_tx.go
:b.ChainConfig()
,new(big.Int).SetUint64(uint64(bn))
app/evmante/evmante_sigverify.go
:ethCfg
,blockNum
app/evmante/evmante_can_transfer.go
:ethCfg
,big.NewInt(ctx.BlockHeight())
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the `signer` configuration is consistent. # Test: Search for `signer` configuration. Expect: Consistent usage throughout the codebase. rg --type go $'MakeSigner'Length of output: 729
Script:
#!/bin/bash # Extract lines around the usage of MakeSigner to verify consistency in configuration # Extract context around MakeSigner in grpc_query.go rg --type go -A 3 -B 3 'MakeSigner' x/evm/keeper/grpc_query.go # Extract context around MakeSigner in msg_server.go rg --type go -A 3 -B 3 'MakeSigner' x/evm/keeper/msg_server.go # Extract context around MakeSigner in smart_contract.go rg --type go -A 3 -B 3 'MakeSigner' x/evm/evmtest/smart_contract.go # Extract context around MakeSigner in sign_tx.go rg --type go -A 3 -B 3 'MakeSigner' eth/rpc/backend/sign_tx.go # Extract context around MakeSigner in evmante_sigverify.go rg --type go -A 3 -B 3 'MakeSigner' app/evmante/evmante_sigverify.go # Extract context around MakeSigner in evmante_can_transfer.go rg --type go -A 3 -B 3 'MakeSigner' app/evmante/evmante_can_transfer.goLength of output: 2102
376-376
: Ensure theNewEVM
method is consistent.The usage of
NewEVM
with the updatedevmConfig
parameter is a good change. Ensure that this is consistent throughout the codebase.Verification successful
The
NewEVM
method is used consistently throughout the codebase.
x/evm/keeper/msg_server.go
app/evmante/interfaces.go
app/evmante/evmante_can_transfer.go
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the `NewEVM` method is consistent. # Test: Search for `NewEVM` method usage. Expect: Consistent usage throughout the codebase. rg --type go $'NewEVM'Length of output: 1707
Script:
#!/bin/bash # Description: Verify the `NewEVM` method is consistent in the specified files. # Search for the `NewEVM` method definition and its usages in `x/evm/keeper/msg_server.go`. echo "Searching in x/evm/keeper/msg_server.go" rg --type go 'NewEVM' -A 5 x/evm/keeper/msg_server.go # Search for the `NewEVM` method definition and its usages in `app/evmante/interfaces.go`. echo "Searching in app/evmante/interfaces.go" rg --type go 'NewEVM' -A 5 app/evmante/interfaces.go # Search for the `NewEVM` method definition and its usages in `app/evmante/evmante_can_transfer.go`. echo "Searching in app/evmante/evmante_can_transfer.go" rg --type go 'NewEVM' -A 5 app/evmante/evmante_can_transfer.goLength of output: 2169
x/evm/keeper/grpc_query_test.go (6)
Line range hint
459-471
:
LGTM! But verify the function usage in the codebase.The code changes are approved.
However, ensure that all function calls to
Params
are correctly updated if there are any dependencies on the previous implementation.
307-307
: LGTM! But verify the function usage in the codebase.The code changes are approved.
However, ensure that all function calls to
ValidatorAccount
are correctly updated if there are any dependencies on the previous implementation.
197-197
: LGTM! But verify the function usage in the codebase.The code changes are approved.
However, ensure that all function calls to
EthAccount
are correctly updated if there are any dependencies on the previous implementation.Verification successful
The search results show multiple occurrences of the
EthAccount
function across different files, includingx/evm/keeper/grpc_query_test.go
,x/evm/query.pb.gw.go
,x/evm/query.pb.go
, and others. These occurrences indicate that theEthAccount
function is widely used in the codebase.The key points to verify are:
- The function calls in the test files (
grpc_query_test.go
andevm_test.go
) are updated correctly.- The function calls in the main implementation files (
grpc_query.go
,query.pb.gw.go
, andquery.pb.go
) are consistent with the new implementation.Given the extensive usage of the
EthAccount
function, it's important to ensure that all instances are correctly updated. The search results indicate that the new implementation is being used, but a detailed check of each occurrence is necessary to confirm this.Let's proceed by generating a final response to confirm the updates and ensure no further action is needed.
LGTM! But verify the function usage in the codebase.
The code changes are approved.
However, ensure that all function calls to
EthAccount
are correctly updated if there are any dependencies on the previous implementation.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all function calls to `EthAccount` are correctly updated. # Test: Search for the function usage. Expect: Only occurrences of the new implementation. rg --type go -A 5 $'EthAccount'Length of output: 37062
130-130
: LGTM! But verify the function usage in the codebase.The code changes are approved.
However, ensure that all function calls to
NibiruAccount
are correctly updated if there are any dependencies on the previous implementation.Verification successful
Function usage verified
All instances of
NibiruAccount
have been correctly updated to reflect the new implementation.
x/evm/keeper/grpc_query_test.go
x/evm/evm_test.go
x/evm/keeper/grpc_query.go
x/evm/query.go
x/evm/query.pb.gw.go
x/evm/query.pb.go
eth/rpc/backend/mocks/evm_query_client.go
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all function calls to `NibiruAccount` are correctly updated. # Test: Search for the function usage. Expect: Only occurrences of the new implementation. rg --type go -A 5 $'NibiruAccount'Length of output: 25293
383-383
: LGTM! But verify the function usage in the codebase.The code changes are approved.
However, ensure that all function calls to
Storage
are correctly updated if there are any dependencies on the previous implementation.Verification successful
Verification successful!
The function calls to
Storage
have been correctly updated to usedeps.EvmKeeper.Storage
.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all function calls to `Storage` are correctly updated. # Test: Search for the function usage. Expect: Only occurrences of the new implementation. rg --type go -A 5 $'Storage'Length of output: 64142
442-442
: LGTM! But verify the function usage in the codebase.The code changes are approved.
However, ensure that all function calls to
Code
are correctly updated if there are any dependencies on the previous implementation.
app/evmante/evmante_global_fees.go
Outdated
"github.com/NibiruChain/nibiru/x/evm" | ||
) | ||
|
||
var _ sdk.AnteDecorator = GlobalGasPriceDecorator{} |
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.
Implement unit tests for GlobalGasPriceDecorator
.
Ensure that unit tests are implemented to verify the functionality of GlobalGasPriceDecorator
.
Do you want me to generate the unit testing code or open a GitHub issue to track this task?
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 (2)
- e2e/evm/test/basic_queries.test.ts (1 hunks)
- e2e/evm/test/contract_send_nibi.test.ts (5 hunks)
Additional comments not posted (4)
e2e/evm/test/contract_send_nibi.test.ts (4)
2-2
: LGTM!The change to import
Wallet
directly fromethers
streamlines the code.
13-13
: LGTM!The changes to handle the transaction receipt and account for gas fees enhance the accuracy of balance checks.
Also applies to: 23-23, 26-26
32-32
: LGTM!The changes to handle the transaction receipt and account for gas fees enhance the accuracy of balance checks.
Also applies to: 42-42, 45-45
51-51
: LGTM!The changes to handle the transaction receipt and account for gas fees enhance the accuracy of balance checks.
Also applies to: 61-61, 64-64
// TODO: https://github.com/NibiruChain/nibiru/issues/1902 | ||
// gas is not deducted regardless the gas limit, check this | ||
const expectedSenderBalance = senderBalanceBefore - amountToSend | ||
const expectedSenderBalance = senderBalanceBefore - amountToSend - 50000n // 50k gas for the transaction |
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.
Consider verifying the gas fee dynamically.
The hardcoded gas fee of 50,000 units might not be accurate for all scenarios. It is better to retrieve the actual gas used from the transaction receipt.
- const expectedSenderBalance = senderBalanceBefore - amountToSend - 50000n // 50k gas for the transaction
+ const gasUsed = (await txResponse.wait()).gasUsed;
+ const expectedSenderBalance = senderBalanceBefore - amountToSend - gasUsed;
Committable 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. Thoroughly test & benchmark the code to ensure it meets the requirements.
const expectedSenderBalance = senderBalanceBefore - amountToSend - 50000n // 50k gas for the transaction | |
const gasUsed = (await txResponse.wait()).gasUsed; | |
const expectedSenderBalance = senderBalanceBefore - amountToSend - gasUsed; |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1982 +/- ##
==========================================
- Coverage 65.68% 65.65% -0.03%
==========================================
Files 262 262
Lines 16511 16502 -9
==========================================
- Hits 10845 10835 -10
- Misses 4852 4854 +2
+ Partials 814 813 -1
|
Overview
Closes #1902, #1916
Rationale
After looking at the implementation of
EthMinGasPriceDecorator
, I realized that we were conflating local gas prices with global gas prices.ctx.MinGasPrices()
uses the gas price config fromapp.toml
, which is local to every node and is only used to include transactions in the mempool, so it should only run on CheckTx, otherwise txs from a proposed block may succeed on some validators and fail on others, leading to a consensus failure.I also defaulted
baseFee
to 1unibi.The PR also renames a few variables for clarity/readability.
Summary by CodeRabbit
New Features
GlobalMinGasPrices
to enhance gas pricing for Ethereum transactions.GlobalGasPriceDecorator
and `MempoolGasPriceDecorator.Bug Fixes
CHANGELOG.md
for improved documentation clarity.Documentation
CHANGELOG.md
to reflect new features and changes.Refactor
K
withEvmKeeper
across various modules and tests.Tests