-
Notifications
You must be signed in to change notification settings - Fork 119
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(crosschain): store priorityFee (GasTipCap) for EVM chains #2483
Conversation
# Conflicts: # x/crosschain/keeper/msg_server_vote_gas_price.go # zetaclient/chains/bitcoin/observer/observer.go # zetaclient/chains/evm/observer/observer.go # zetaclient/chains/interfaces/interfaces.go # zetaclient/testutils/mocks/zetacore_client.go # zetaclient/zetacore/tx.go # zetaclient/zetacore/tx_test.go
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughWalkthroughThe recent changes primarily introduce the concept of Changes
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 (
|
!!!WARNING!!! Be very careful about using Only suppress a single rule (or a specific set of rules) within a section of code, while continuing to scan for other problems. To do this, you can list the rule(s) to be suppressed within the #nosec annotation, e.g: /* #nosec G401 */ or //#nosec G201 G202 G203 Pay extra attention to the way |
zetacored q crosschain show-gas-price 1337 -o json | jq
{
"GasPrice": {
"creator": "zeta1uk8yhdcenf60xwd5s429774mgmy2vu3qva2kt3",
"index": "1337",
"chain_id": "1337",
"signers": [
"zeta1uk8yhdcenf60xwd5s429774mgmy2vu3qva2kt3",
"zeta16dwp2r6eccp2xw2mnyp3gmuwdlgxmvmtr8562a"
],
"block_nums": [
"707",
"706"
],
"prices": [
"9",
"9"
],
"median_index": "1",
"priority_fees": [
"1",
"1"
]
}
} |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #2483 +/- ##
===========================================
+ Coverage 46.58% 46.68% +0.09%
===========================================
Files 461 464 +3
Lines 30666 30781 +115
===========================================
+ Hits 14286 14369 +83
- Misses 15533 15557 +24
- Partials 847 855 +8
|
@lumtis @ws4charlie In some cases in |
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 (8)
x/crosschain/types/message_vote_gas_price.go (1)
13-17
: Add documentation for the newpriorityFee
parameter.The
priorityFee
parameter should be documented to explain its purpose and usage.+ // - PriorityFee: The priority fee for EVM chains supporting EIP-1559.
typescript/zetachain/zetacore/crosschain/gas_price_pb.d.ts (1)
44-45
: Add documentation for the newpriorityFees
field.The
priorityFees
field is missing documentation. Adding a brief comment will improve code readability and maintainability./** * priority fees for EIP-1559 * * @generated from field: repeated uint64 priority_fees = 8; */ priorityFees: bigint[];Also applies to: 50-56
x/crosschain/client/cli/cli_gas_price.go (1)
81-81
: Update the command usage description to includepriorityFee
.The usage description should be updated to reflect the new
priorityFee
parameter.Use: "vote-gas-price [chain] [price] [priorityFee] [blockNumber]",x/crosschain/keeper/gas_price.go (1)
39-51
: Ensure complete test coverage forGetMedianGasPriceInUint
function.The function
GetMedianGasPriceInUint
is tested in two files:
x/crosschain/keeper/msg_server_migrate_tss_funds_test.go
: This file includes tests that handle the additional return valuepriorityFee
.x/crosschain/keeper/abci_test.go
: This file does not include tests for thepriorityFee
return value.Please add test cases in
x/crosschain/keeper/abci_test.go
to cover thepriorityFee
return value.Analysis chain
Ensure test coverage for
GetMedianGasPriceInUint
function.The
GetMedianGasPriceInUint
function now returns an additional parameter. Ensure that the test cases cover this change.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the test coverage for the `GetMedianGasPriceInUint` function. # Test: Search for the function usage in test files. Expect: Test cases should handle the additional return value. rg --type go -A 5 $'GetMedianGasPriceInUint' --glob '*_test.go'Length of output: 1561
docs/spec/crosschain/messages.md (1)
64-64
: Avoid using hard tabs in markdown files.Replace hard tabs with spaces for better readability and consistency.
- uint64 priority_fee = 6; + uint64 priority_fee = 6;Tools
Markdownlint
64-64: Column: 1
Hard tabs(MD010, no-hard-tabs)
zetaclient/chains/evm/observer/observer.go (3)
349-351
: Ensure test coverage forPostVoteGasPrice
withpriorityFee
.The current test cases do not cover the
PostVoteGasPrice
function with a non-zeropriorityFee
. Please add test cases that include calls toPostVoteGasPrice
with a non-zeropriorityFee
to ensure proper test coverage.
zetaclient/zetacore/tx_test.go
Analysis chain
Ensure test coverage for
PostVoteGasPrice
withpriorityFee
.The lines where
PostVoteGasPrice
is called withpriorityFee
should be covered by tests.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify test coverage for `PostVoteGasPrice` with `priorityFee`. # Test: Search for test cases where `PostVoteGasPrice` is called with `priorityFee`. Expect: At least one test case calling `PostVoteGasPrice` with `priorityFee`. rg --type go 'PostVoteGasPrice.*priorityFee'Length of output: 532
Script:
#!/bin/bash # Description: Verify test coverage for `PostVoteGasPrice` with `priorityFee`. # Search for test files that call the `PostVoteGasPrice` function. rg --type go 'PostVoteGasPrice' -g '*_test.go' -A 3Length of output: 323
Tools
GitHub Check: codecov/patch
[warning] 349-351: zetaclient/chains/evm/observer/observer.go#L349-L351
Added lines #L349 - L351 were not covered by tests
336-338
: Ensure test coverage forSuggestGasTipCap
failure scenario.The failure scenario for
SuggestGasTipCap
is not explicitly tested in the codebase. Please add test cases to cover this scenario.
- File:
zetaclient/chains/evm/observer/observer.go
- Lines: 336-338
Analysis chain
Ensure test coverage for
SuggestGasTipCap
failure scenario.The lines where
SuggestGasTipCap
is called and its failure is handled should be covered by tests.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify test coverage for `SuggestGasTipCap` failure scenario. # Test: Search for test cases where `SuggestGasTipCap` failure is simulated. Expect: At least one test case simulating the failure. rg --type go 'SuggestGasTipCap.*return.*error'Length of output: 48
Script:
#!/bin/bash # Description: Verify test coverage for `SuggestGasTipCap` failure scenario. # Test: Search for test cases where `SuggestGasTipCap` failure is simulated or handled. # This includes looking for any error handling related to `SuggestGasTipCap`. # Search for any usage of `SuggestGasTipCap` in test files. rg --type go 'SuggestGasTipCap' -A 5Length of output: 4007
Script:
#!/bin/bash # Description: Verify test coverage for `SuggestGasTipCap` failure scenario. # Test: Search for test cases in `rpc/backend/chain_info_test.go` that handle errors from `SuggestGasTipCap`. # Search for error handling in `rpc/backend/chain_info_test.go`. rg 'SuggestGasTipCap.*err' rpc/backend/chain_info_test.go -A 5Length of output: 64
Script:
#!/bin/bash # Description: Verify test coverage for `SuggestGasTipCap` failure scenario. # Test: Search for any test files that handle errors from `SuggestGasTipCap` across the entire codebase. # Search for error handling related to `SuggestGasTipCap` in test files. rg 'SuggestGasTipCap.*err' -t go -g '*_test.go' -A 5Length of output: 54
Tools
GitHub Check: codecov/patch
[warning] 336-338: zetaclient/chains/evm/observer/observer.go#L336-L338
Added lines #L336 - L338 were not covered by tests
340-340
: Ensure test coverage forpriorityFee
fallback to zero.The line where
priorityFee
falls back to zero should be covered by tests. Currently, there are no tests explicitly covering this scenario.
- Add a test case in
zetaclient/chains/evm/observer/observer_test.go
to ensurepriorityFee
correctly falls back to zero when expected.Analysis chain
Ensure test coverage for
priorityFee
fallback to zero.The line where
priorityFee
falls back to zero should be covered by tests.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify test coverage for `priorityFee` fallback to zero. # Test: Search for test cases where `priorityFee` is set to zero. Expect: At least one test case setting `priorityFee` to zero. rg --type go 'priorityFee = big.NewInt\(0\)'Length of output: 119
Script:
#!/bin/bash # Description: Verify test coverage for `priorityFee` fallback to zero. # Find all test files that might be related to observer.go test_files=$(fd -e go -p 'observer_test.go') # Search for test functions in the identified test files for file in $test_files; do echo "Searching in $file" rg 'func Test' $file -A 5 doneLength of output: 9750
Script:
#!/bin/bash # Description: Verify test coverage for `priorityFee` fallback to zero by searching for mentions of `priorityFee` in the relevant test file. # Search for mentions of `priorityFee` in the observer_test.go file rg 'priorityFee' zetaclient/chains/evm/observer/observer_test.go -A 5Length of output: 69
Tools
GitHub Check: codecov/patch
[warning] 340-340: zetaclient/chains/evm/observer/observer.go#L340
Added line #L340 was not covered by tests
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files ignored due to path filters (3)
x/crosschain/types/cross_chain_tx.pb.go
is excluded by!**/*.pb.go
,!**/*.pb.go
x/crosschain/types/gas_price.pb.go
is excluded by!**/*.pb.go
,!**/*.pb.go
x/crosschain/types/tx.pb.go
is excluded by!**/*.pb.go
,!**/*.pb.go
Files selected for processing (33)
- changelog.md (1 hunks)
- docs/cli/zetacored/zetacored_tx_crosschain_vote-gas-price.md (1 hunks)
- docs/openapi/openapi.swagger.yaml (2 hunks)
- docs/spec/crosschain/messages.md (1 hunks)
- proto/zetachain/zetacore/crosschain/cross_chain_tx.proto (1 hunks)
- proto/zetachain/zetacore/crosschain/gas_price.proto (1 hunks)
- proto/zetachain/zetacore/crosschain/tx.proto (1 hunks)
- testutil/network/genesis_state.go (1 hunks)
- typescript/zetachain/zetacore/crosschain/cross_chain_tx_pb.d.ts (1 hunks)
- typescript/zetachain/zetacore/crosschain/gas_price_pb.d.ts (1 hunks)
- typescript/zetachain/zetacore/crosschain/tx_pb.d.ts (1 hunks)
- x/crosschain/client/cli/cli_gas_price.go (2 hunks)
- x/crosschain/keeper/abci.go (2 hunks)
- x/crosschain/keeper/abci_test.go (1 hunks)
- x/crosschain/keeper/cctx_gateway_observers.go (1 hunks)
- x/crosschain/keeper/gas_payment.go (11 hunks)
- x/crosschain/keeper/gas_price.go (1 hunks)
- x/crosschain/keeper/grpc_query_zeta_conversion_rate.go (1 hunks)
- x/crosschain/keeper/initiate_outbound.go (2 hunks)
- x/crosschain/keeper/msg_server_migrate_tss_funds.go (4 hunks)
- x/crosschain/keeper/msg_server_migrate_tss_funds_test.go (5 hunks)
- x/crosschain/keeper/msg_server_vote_gas_price.go (2 hunks)
- x/crosschain/keeper/msg_server_vote_gas_price_test.go (6 hunks)
- x/crosschain/keeper/msg_server_whitelist_erc20.go (2 hunks)
- x/crosschain/types/cctx.go (1 hunks)
- x/crosschain/types/message_vote_gas_price.go (1 hunks)
- x/crosschain/types/message_vote_gas_price_test.go (3 hunks)
- zetaclient/chains/bitcoin/observer/observer.go (1 hunks)
- zetaclient/chains/evm/observer/observer.go (1 hunks)
- zetaclient/chains/interfaces/interfaces.go (1 hunks)
- zetaclient/testutils/mocks/zetacore_client.go (1 hunks)
- zetaclient/zetacore/client_vote.go (2 hunks)
- zetaclient/zetacore/tx_test.go (1 hunks)
Files skipped from review due to trivial changes (3)
- docs/cli/zetacored/zetacored_tx_crosschain_vote-gas-price.md
- proto/zetachain/zetacore/crosschain/cross_chain_tx.proto
- x/crosschain/types/message_vote_gas_price_test.go
Additional context used
Path-based instructions (24)
proto/zetachain/zetacore/crosschain/gas_price.proto (1)
Pattern
**/*.proto
: Review the Protobuf definitions, point out issues relative to compatibility, and expressiveness.x/crosschain/types/message_vote_gas_price.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.x/crosschain/keeper/initiate_outbound.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.x/crosschain/keeper/grpc_query_zeta_conversion_rate.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.x/crosschain/client/cli/cli_gas_price.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.x/crosschain/keeper/gas_price.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.x/crosschain/keeper/cctx_gateway_observers.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.x/crosschain/keeper/msg_server_vote_gas_price.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.proto/zetachain/zetacore/crosschain/tx.proto (1)
Pattern
**/*.proto
: Review the Protobuf definitions, point out issues relative to compatibility, and expressiveness.x/crosschain/keeper/abci.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.x/crosschain/keeper/msg_server_whitelist_erc20.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.zetaclient/zetacore/client_vote.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.x/crosschain/types/cctx.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.zetaclient/chains/interfaces/interfaces.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.x/crosschain/keeper/msg_server_migrate_tss_funds.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.testutil/network/genesis_state.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.x/crosschain/keeper/msg_server_vote_gas_price_test.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.x/crosschain/keeper/gas_payment.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.x/crosschain/keeper/abci_test.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.zetaclient/zetacore/tx_test.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.zetaclient/chains/evm/observer/observer.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.x/crosschain/keeper/msg_server_migrate_tss_funds_test.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.zetaclient/testutils/mocks/zetacore_client.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.zetaclient/chains/bitcoin/observer/observer.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.
GitHub Check: codecov/patch
x/crosschain/keeper/initiate_outbound.go
[warning] 35-35: x/crosschain/keeper/initiate_outbound.go#L35
Added line #L35 was not covered by tests
[warning] 37-37: x/crosschain/keeper/initiate_outbound.go#L37
Added line #L37 was not covered by testsx/crosschain/keeper/gas_price.go
[warning] 59-60: x/crosschain/keeper/gas_price.go#L59-L60
Added lines #L59 - L60 were not covered by testsx/crosschain/keeper/msg_server_vote_gas_price.go
[warning] 54-54: x/crosschain/keeper/msg_server_vote_gas_price.go#L54
Added line #L54 was not covered by testsx/crosschain/keeper/gas_payment.go
[warning] 62-62: x/crosschain/keeper/gas_payment.go#L62
Added line #L62 was not covered by tests
[warning] 68-71: x/crosschain/keeper/gas_payment.go#L68-L71
Added lines #L68 - L71 were not covered by tests
[warning] 77-80: x/crosschain/keeper/gas_payment.go#L77-L80
Added lines #L77 - L80 were not covered by testszetaclient/chains/evm/observer/observer.go
[warning] 336-338: zetaclient/chains/evm/observer/observer.go#L336-L338
Added lines #L336 - L338 were not covered by tests
[warning] 340-340: zetaclient/chains/evm/observer/observer.go#L340
Added line #L340 was not covered by tests
[warning] 349-351: zetaclient/chains/evm/observer/observer.go#L349-L351
Added lines #L349 - L351 were not covered by testszetaclient/chains/bitcoin/observer/observer.go
[warning] 379-379: zetaclient/chains/bitcoin/observer/observer.go#L379
Added line #L379 was not covered by tests
Markdownlint
docs/spec/crosschain/messages.md
64-64: Column: 1
Hard tabs(MD010, no-hard-tabs)
Additional comments not posted (48)
proto/zetachain/zetacore/crosschain/gas_price.proto (2)
19-19
: Note: Consider calculatingmedian_index_priority_fees
on demand.It might be more efficient to calculate the
median_index_priority_fees
on demand rather than storing it, as noted byswift1337
.
19-19
: Ensure compatibility with existing systems.Adding the
priority_fees
field is a significant change. Ensure that all systems interacting with this message are updated to handle the new field.x/crosschain/types/message_vote_gas_price.go (1)
17-23
: LGTM! Ensure the new parameter is handled correctly.The addition of the
priorityFee
parameter looks good. Ensure that all parts of the system handle this new parameter correctly.x/crosschain/keeper/initiate_outbound.go (2)
27-29
: Add test coverage for the new error handling logic.The new error handling logic for missing chain info should be covered by tests to ensure its correctness.
35-37
: Add test coverage for the new error handling logic.The new error handling logic for missing CCTXGateway should be covered by tests to ensure its correctness.
Tools
GitHub Check: codecov/patch
[warning] 35-35: x/crosschain/keeper/initiate_outbound.go#L35
Added line #L35 was not covered by tests
[warning] 37-37: x/crosschain/keeper/initiate_outbound.go#L37
Added line #L37 was not covered by testsx/crosschain/keeper/grpc_query_zeta_conversion_rate.go (1)
28-28
: Verify the usage of the new parameter inGetMedianGasPriceInUint
.The
GetMedianGasPriceInUint
function now returns an additional parameter. Ensure that this change is consistent with the function's definition and usage throughout the codebase.Verification successful
Verify the usage of the new parameter in
GetMedianGasPriceInUint
.The
GetMedianGasPriceInUint
function now returns an additional parameter. Based on the search results, all instances of this function handle the new return value correctly. The function's usage is consistent with its definition throughout the codebase.
- Files and lines where the function is used:
x/crosschain/keeper/msg_server_migrate_tss_funds_test.go
x/crosschain/keeper/cctx_gateway_observers.go
x/crosschain/keeper/abci_test.go
x/crosschain/keeper/grpc_query_zeta_conversion_rate.go
x/crosschain/keeper/msg_server_migrate_tss_funds.go
x/crosschain/keeper/gas_payment.go
x/crosschain/keeper/gas_price.go
x/crosschain/keeper/abci.go
x/crosschain/keeper/msg_server_whitelist_erc20.go
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of the `GetMedianGasPriceInUint` function to ensure consistency with the new parameter. # Test: Search for the function usage. Expect: All usages should handle the additional return value. rg --type go -A 5 $'GetMedianGasPriceInUint'Length of output: 5719
x/crosschain/client/cli/cli_gas_price.go (1)
95-97
: Ensure proper error handling forpriorityFee
parsing.The error handling for
priorityFee
parsing is consistent with other parameters.x/crosschain/keeper/gas_price.go (1)
53-74
: Ensure test coverage formedianValue
function.The
medianValue
function is crucial for calculating the median of the priority fees. Ensure that the test cases cover this function.Verification successful
Test coverage for
medianValue
function is confirmed.The
medianValue
function is indirectly tested through theGetMedianGasPriceInUint
function, which is covered by tests inx/crosschain/keeper/msg_server_migrate_tss_funds_test.go
.
x/crosschain/keeper/msg_server_migrate_tss_funds_test.go
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the test coverage for the `medianValue` function. # Test: Search for the function usage in test files. Expect: Test cases should cover various scenarios for median calculation. rg --type go -A 5 $'medianValue' --glob '*_test.go'Length of output: 50
Script:
#!/bin/bash # Description: Verify the test coverage for the `medianValue` function. # Test: Search for test functions that might indirectly test the medianValue function. rg --type go -A 10 'func Test' --glob '*_test.go' | grep -i 'median\|priority\|fee\|gas'Length of output: 63987
Script:
#!/bin/bash # Description: Search for all occurrences of the `medianValue` function within the codebase to identify where it is invoked. # Search for the `medianValue` function definition and its invocations. rg --type go 'medianValue'Length of output: 281
Script:
#!/bin/bash # Description: Verify if the functionality involving `priorityFee` or the function that uses `medianValue` is covered by tests. # Search for test cases that involve `priorityFee` or the function that uses `medianValue` within the test files. rg --type go -A 10 'priorityFee' --glob '*_test.go'Length of output: 4121
Tools
GitHub Check: codecov/patch
[warning] 59-60: x/crosschain/keeper/gas_price.go#L59-L60
Added lines #L59 - L60 were not covered by testsx/crosschain/keeper/cctx_gateway_observers.go (2)
66-66
: Ensure proper error handling for gas price retrieval.The function retrieves the median gas price and priority fee. Ensure that the error handling logic is robust and covers all edge cases.
71-71
: LGTM! Ensure proper usage ofGasPriorityFee
.The code changes are approved. Verify that the
GasPriorityFee
is used correctly throughout the codebase.x/crosschain/keeper/msg_server_vote_gas_price.go (5)
11-11
: Importerrors
from the correct package.Ensure that the
errors
package is imported correctly and used consistently.
40-47
: LGTM! Ensure proper initialization ofGasPrice
struct.The code changes are approved. Verify that the
GasPrice
struct is initialized correctly with the newPriorityFees
field.
60-60
: Ensure test coverage for updated logic.The line updating
PriorityFees
is not covered by tests. Ensure that the test cases are updated to cover this logic.
69-69
: LGTM! Ensure proper appending ofPriorityFees
.The code changes are approved. Verify that the
PriorityFees
are appended correctly in all scenarios.
78-78
: LGTM! Ensure proper voting logic.The code changes are approved. Verify that the voting logic correctly handles the new
PriorityFees
field.proto/zetachain/zetacore/crosschain/tx.proto (2)
107-107
: LGTM! Ensure proper initialization ofpriority_fee
.The code changes are approved. Verify that the
priority_fee
field is initialized correctly in all relevant parts of the codebase.
111-111
: LGTM! Ensure proper usage ofpriority_fee
.The code changes are approved. Verify that the
priority_fee
field is used correctly throughout the codebase.x/crosschain/keeper/abci.go (2)
123-123
: Ensure proper error handling for gas price retrieval.The function retrieves the median gas price and priority fee. Ensure that the error handling logic is robust and covers all edge cases.
161-161
: LGTM! Ensure proper usage ofGasPriorityFee
.The code changes are approved. Verify that the
GasPriorityFee
is used correctly throughout the codebase.x/crosschain/keeper/msg_server_whitelist_erc20.go (2)
108-111
: Ensure proper error handling for median gas price retrieval.The function correctly retrieves the median gas price and priority fee. Ensure that this method handles all edge cases for gas price retrieval.
158-158
: LGTM! Priority fee added to outbound parameters.The priority fee is correctly added to the outbound parameters.
zetaclient/zetacore/client_vote.go (2)
49-49
: LGTM! Priority fee parameter added to function signature.The priority fee parameter is correctly added to the function signature and used in the message creation.
60-60
: Ensure proper handling of priority fee in message creation.The priority fee is correctly included in the
MsgVoteGasPrice
message. Ensure that the priority fee is correctly handled in all related methods and functions.x/crosschain/types/cctx.go (1)
199-199
: LGTM! Priority fee field added to outbound parameters.The priority fee field is correctly added to the outbound parameters.
zetaclient/chains/interfaces/interfaces.go (1)
82-82
: LGTM! Method signature updated correctly.The
priorityFee
parameter has been correctly added to thePostVoteGasPrice
method.x/crosschain/keeper/msg_server_migrate_tss_funds.go (2)
92-92
: LGTM! Median gas price and priority fee retrieval integrated correctly.The
MigrateTSSFundsForChain
function now retrieves thepriorityFee
alongside the median gas price.
139-139
: LGTM!priorityFee
parameter added toOutboundParams
.The
priorityFee
parameter has been correctly added to theOutboundParams
in theMigrateTSSFundsForChain
function.testutil/network/genesis_state.go (2)
224-230
: LGTM!PriorityFees
field added toGasPrice
struct.The
PriorityFees
field has been correctly added to theGasPrice
struct in theAddCrosschainData
function.
224-230
: LGTM!PriorityFees
field added toGasPrice
struct.The
PriorityFees
field has been correctly added to theGasPrice
struct in theSetupZetaGenesisState
function.x/crosschain/keeper/msg_server_vote_gas_price_test.go (1)
211-263
: LGTM! New test case forpriorityFee
parameter added.The new test case
works with a priority fee
correctly tests thepriorityFee
parameter in theVoteGasPrice
function.typescript/zetachain/zetacore/crosschain/cross_chain_tx_pb.d.ts (1)
231-235
: Addition ofgasPriorityFee
field looks good.The new field
gasPriorityFee
has been correctly added to theOutboundParams
class.x/crosschain/keeper/gas_payment.go (6)
20-31
: Addition ofChainGasParams
struct looks good.The new struct
ChainGasParams
is correctly defined and includes the necessary fields for calculating gas fees.
Line range hint
33-50
: Updates toPayGasAndUpdateCctx
function look good.The function correctly handles the new
ChainGasParams
struct and performs the necessary operations.
59-95
: Addition ofChainGasParams
function looks good.The function correctly retrieves the necessary parameters for calculating gas fees and handles errors appropriately.
Tools
GitHub Check: codecov/patch
[warning] 62-62: x/crosschain/keeper/gas_payment.go#L62
Added line #L62 was not covered by tests
[warning] 68-71: x/crosschain/keeper/gas_payment.go#L68-L71
Added lines #L68 - L71 were not covered by tests
[warning] 77-80: x/crosschain/keeper/gas_payment.go#L77-L80
Added lines #L77 - L80 were not covered by tests
Line range hint
119-144
: Updates toPayGasNativeAndUpdateCctx
function look good.The function correctly handles the new
PriorityFee
field and performs the necessary operations.
Line range hint
173-293
: Updates toPayGasInERC20AndUpdateCctx
function look good.The function correctly handles the new
PriorityFee
field and performs the necessary operations.
Line range hint
333-409
: Updates toPayGasInZetaAndUpdateCctx
function look good.The function correctly handles the new
PriorityFee
field and performs the necessary operations.x/crosschain/keeper/abci_test.go (1)
363-363
: Addition of test case forGetMedianGasPriceInUint
looks good.The test case correctly verifies the functionality and provides adequate test coverage.
zetaclient/zetacore/tx_test.go (1)
150-150
: Updates toPostVoteGasPrice
test case look good.The test case correctly verifies the functionality and provides adequate test coverage.
x/crosschain/keeper/msg_server_migrate_tss_funds_test.go (4)
104-104
: Ensure correctness ofpriorityFee
handling in test case.The test case should correctly handle and verify the
priorityFee
parameter.Verification successful
Ensure correctness of
priorityFee
handling in test case.The test case correctly handles and verifies the
priorityFee
parameter with appropriate assertions.
x/crosschain/keeper/msg_server_migrate_tss_funds_test.go
: Assertions verifyingpriorityFee
are present.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify correctness of `priorityFee` handling in test case. # Test: Search for assertions on `priorityFee` in the test case. Expect: Assertions verifying `priorityFee`. rg --type go 'require.Equal.*priorityFee'Length of output: 333
138-138
: Ensure correctness ofpriorityFee
handling in test case for BTC chain.The test case should correctly handle and verify the
priorityFee
parameter.Verification successful
The test case correctly handles and verifies the
priorityFee
parameter.The assertions on
priorityFee
in the test case confirm its correctness.
x/crosschain/keeper/msg_server_migrate_tss_funds_test.go: require.Equal(t, priorityFee.String(), cctx.GetCurrentOutboundParam().GasPriorityFee)
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify correctness of `priorityFee` handling in test case for BTC chain. # Test: Search for assertions on `priorityFee` in the test case. Expect: Assertions verifying `priorityFee`. rg --type go 'require.Equal.*priorityFee'Length of output: 333
122-122
: Ensure correctness ofpriorityFee
handling in test case.The test case should correctly handle and verify the
priorityFee
parameter.Verification successful
The handling of
priorityFee
in the test case is correct.The
priorityFee
is properly initialized usingk.GetMedianGasPriceInUint(ctx, chain.ChainId)
and verified through assertions to ensure its correctness.
- Initialization:
gp, priorityFee, found := k.GetMedianGasPriceInUint(ctx, chain.ChainId)
- Verification:
require.Equal(t, priorityFee.String(), cctx.GetCurrentOutboundParam().GasPriorityFee)
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify correctness of `priorityFee` handling in test case. # Test: Search for assertions on `priorityFee` in the test case. Expect: Assertions verifying `priorityFee`. rg --type go 'require.Equal.*priorityFee'Length of output: 333
Script:
#!/bin/bash # Description: Verify initialization and handling of `priorityFee` in the test case. # Search for initialization and manipulation of `priorityFee` in the test file. rg --type go 'priorityFee' -A 5 x/crosschain/keeper/msg_server_migrate_tss_funds_test.goLength of output: 965
155-155
: Ensure correctness ofpriorityFee
handling in test case for BTC chain.The test case should correctly handle and verify the
priorityFee
parameter.Verification successful
The assertions for
priorityFee
are present in the test case. To ensure correctness, we need to verify the setup and usage ofpriorityFee
within the test case, including its initialization and any related logic.
The
priorityFee
is initialized by theGetMedianGasPriceInUint
function and used in assertions. To ensure correctness, we need to verify that theGetMedianGasPriceInUint
function correctly sets thepriorityFee
for the BTC chain.
The handling of
priorityFee
in the test case for the BTC chain is correct.The
priorityFee
is properly initialized using theGetMedianGasPriceInUint
function and verified through assertions in the test case.
- The
priorityFee
is derived from the median value ofentity.PriorityFees
.- The test case correctly asserts that the
priorityFee
matches the expected value.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify correctness of `priorityFee` handling in test case for BTC chain. # Test: Search for assertions on `priorityFee` in the test case. Expect: Assertions verifying `priorityFee`. rg --type go 'require.Equal.*priorityFee'Length of output: 333
Script:
#!/bin/bash # Description: Verify initialization and usage of `priorityFee` in the test case for BTC chain. # Search for the initialization of `priorityFee` in the test file. rg --type go 'priorityFee :=' x/crosschain/keeper/msg_server_migrate_tss_funds_test.go # Search for other usages of `priorityFee` in the test file. rg --type go 'priorityFee' x/crosschain/keeper/msg_server_migrate_tss_funds_test.goLength of output: 496
Script:
#!/bin/bash # Description: Verify the handling of `priorityFee` in the `GetMedianGasPriceInUint` function for BTC chain. # Search for the definition of `GetMedianGasPriceInUint` function. rg --type go 'func GetMedianGasPriceInUint' # Search for the usage of `priorityFee` within the `GetMedianGasPriceInUint` function. rg --type go 'priorityFee' $(rg --files-with-matches 'func GetMedianGasPriceInUint')Length of output: 4354
zetaclient/testutils/mocks/zetacore_client.go (1)
657-677
: Ensure correctness ofPostVoteGasPrice
mock method.The mock method should correctly simulate the behavior of the real method and adhere to best practices.
zetaclient/chains/bitcoin/observer/observer.go (1)
379-379
: Verify the correctness of the added parameter.The added parameter
0
forpriorityFee
in thePostVoteGasPrice
function call seems correct. Ensure that this value is appropriate for all use cases.Verification successful
Verify the correctness of the added parameter.
The added parameter
0
forpriorityFee
in thePostVoteGasPrice
function call is correctly used across the codebase. Ensure that this value is appropriate for all use cases.
zetaclient/zetacore/client_vote.go
zetaclient/zetacore/tx_test.go
zetaclient/testutils/mocks/zetacore_client.go
zetaclient/chains/interfaces/interfaces.go
zetaclient/chains/bitcoin/observer/observer.go
zetaclient/chains/evm/observer/observer.go
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of the PostVoteGasPrice function with the new priorityFee parameter. # Test: Search for the function usage. Expect: Only occurances with the correct number of parameters. rg --type go -A 5 $'PostVoteGasPrice'Length of output: 3375
Tools
GitHub Check: codecov/patch
[warning] 379-379: zetaclient/chains/bitcoin/observer/observer.go#L379
Added line #L379 was not covered by teststypescript/zetachain/zetacore/crosschain/tx_pb.d.ts (2)
423-425
: Addition ofpriority_fee
field is correct.The new field
priority_fee
is correctly added to theMsgVoteGasPrice
class.
428-430
: Verify the impact of field reordering.The
block_number
field is moved down. Ensure this reordering does not affect the functionality or serialization of the message.changelog.md (1)
34-34
: Entry for new feature looks good.The entry for adding priorityFee (gasTipCap) gas to the state is clear and consistent with the rest of the changelog.
# Conflicts: # changelog.md # x/crosschain/keeper/msg_server_migrate_tss_funds.go
Missed this comment
Let's keep it without factor for now |
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.
Looks good to me
Will approve once upgrade test passes
I think you're talking about gas stability pool updating the gas price. If it's stability pool, the answer would be Here is the bump percentage in Ethereum source code: https://github.com/ethereum/go-ethereum/blob/87246f3cbaf10f83f56bc4d45f0f3e36e83e71e9/core/txpool/legacypool/legacypool.go#L146 Here is a doc from Alchemy: https://docs.alchemy.com/docs/retrying-an-eip-1559-transaction The Github issue contains the details in section |
@ws4charlie priorityFee bump: f50abea |
Description
This PR adds priorityFee from EIP-1559 to ZetaChain state. Updates:
uint64 priorityFee
toMsgVoteGasPrice
so observers can propose priority fees fromrpc.SuggestGasTipCap()
[]uint64 priority_fee
tocrosschain.types.GasPrice{}
. The logic is the same: we pick median pricestring cctx.outbound_params.gas_priority_fee
(same asstring cctx.outbound_params.gas_priority_fee
)x/crosschain
Note that this PR unblocks #2387 which actually signs and broadcasts transactions with priority fees
Part of #1952
How Has This Been Tested?
Summary by CodeRabbit
New Features
priorityFee
for EIP-1559 transactions to enhance gas fee handling.Enhancements
supply
parameter withpriorityFee
.Bug Fixes
Documentation
priorityFee
and gas price.Refactor
priorityFee
for gas calculations and transactions.