-
Notifications
You must be signed in to change notification settings - Fork 161
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
chore: rename uibc quota params #2332
Conversation
WalkthroughThe recent updates in the umee-network/umee codebase involve a series of renaming actions, primarily changing Changes
TipsChat with CodeRabbit Bot (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 1
Configuration used: CodeRabbit UI
Files selected for processing (3)
- proto/umee/uibc/v1/genesis.proto (2 hunks)
- proto/umee/uibc/v1/quota.proto (1 hunks)
- x/uibc/README.md (1 hunks)
Files skipped from review due to trivial changes (1)
- proto/umee/uibc/v1/genesis.proto
Additional comments: 1
proto/umee/uibc/v1/quota.proto (1)
- 42-49: The renaming of the field from
inflow_outflow_quota_base
toinflow_outflow_token_quota_base
is consistent with the summary provided and improves the clarity of the field's purpose. It is important to ensure that all references to this field in the codebase, including any serialization or deserialization logic, are updated to reflect the new name. Additionally, any documentation or comments that reference this field should be revised accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 9
Configuration used: CodeRabbit UI
Files ignored due to filter (3)
- swagger/swagger.yaml
- x/uibc/genesis.pb.go
- x/uibc/quota.pb.go
Files selected for processing (11)
- CHANGELOG.md (1 hunks)
- app/upgrades.go (1 hunks)
- x/uibc/client/tests/cli_test.go (1 hunks)
- x/uibc/genesis.go (3 hunks)
- x/uibc/genesis_test.go (1 hunks)
- x/uibc/params.go (2 hunks)
- x/uibc/quota/keeper/genesis.go (2 hunks)
- x/uibc/quota/keeper/migrations.go (1 hunks)
- x/uibc/quota/keeper/params_test.go (1 hunks)
- x/uibc/quota/keeper/quota.go (5 hunks)
- x/uibc/quota/keeper/quota_test.go (3 hunks)
Files skipped from review due to trivial changes (4)
- x/uibc/genesis_test.go
- x/uibc/params.go
- x/uibc/quota/keeper/migrations.go
- x/uibc/quota/keeper/params_test.go
Additional comments: 10
x/uibc/client/tests/cli_test.go (1)
- 22-28: The update from
TotalOutflowSum
toOutflowSum
in theuibcGenState
struct is consistent with the renaming described in the pull request summary. This change should be cross-verified with the rest of the codebase to ensure that all references to the old field name have been updated accordingly. Additionally, ensure that the logic that depends on this field is still correct after the renaming.app/upgrades.go (1)
- 124-130: The
MigrateOutflowSum
method is called without any arguments, but it is not clear from the context whether this method requires arguments to perform the migration. If the method signature has changed to accept parameters, this call will fail at runtime. Please verify that the method signature forMigrateOutflowSum
matches this call and that it does not require any additional parameters to function correctly.CHANGELOG.md (2)
55-56: The changelog correctly documents the upgrade of the Cosmos SDK to v0.47 and the setting of
gov/v1 MinInitialDepositRatio
to 0.1. However, it would be beneficial to include a brief explanation of the implications of these changes for users or developers, especially if they introduce any breaking changes or significant behavior modifications in the system. This can help stakeholders understand the impact of the upgrade and the new deposit ratio setting.60-60: The renaming of
TotalOutflowSum
toOutflowSum
andTotalInflowSum
toInflowSum
is documented under the "Breaking Changes" section. It is important to ensure that all references to these fields in the codebase, including documentation, comments, and test cases, have been updated to reflect the new names to avoid any inconsistencies or errors.x/uibc/genesis.go (2)
11-15: The renaming of
TotalOutflowSum
toOutflowSum
in theGenesisState
struct is consistent with the pull request's goal of simplifying field names. This change should be cross-checked throughout the codebase to ensure that all references to this field are updated accordingly.20-25: The
DefaultGenesisState
function has been updated to reflect the new field namesOutflowSum
andInflowSum
. It is important to ensure that these changes are also reflected in any serialization formats (e.g., JSON, YAML) and that any external systems or documentation that rely on the previous field names are updated.x/uibc/quota/keeper/quota.go (4)
121-126: The function
ResetAllQuotas
has been updated to useSetOutflowSum
instead of the previousSetTotalOutflowSum
. Ensure that all references and logic related to the total outflow sum have been updated accordingly throughout the codebase to maintain consistency and avoid any potential bugs due to the renaming.150-156: The logic within
CheckAndUpdateQuota
has been updated to use the new field nameInflowOutflowTokenQuotaBase
instead of the previousInflowOutflowQuotaTokenBase
. Ensure that the renaming is consistent across the entire codebase and that all references to the old field name have been updated to prevent any issues.168-173: The function
CheckAndUpdateQuota
has been updated to useSetOutflowSum
instead of the previousSetTotalOutflowSum
. Ensure that the logic for updating the total outflow sum is consistent with the new naming convention and that all references to the old function have been updated accordingly.225-230: The function
UndoUpdateQuota
has been updated to useSetOutflowSum
instead of the previousSetTotalOutflowSum
. Ensure that the logic for subtracting from the total outflow sum is consistent with the new naming convention and that all references to the old function have been updated accordingly.
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #2332 +/- ##
==========================================
- Coverage 75.38% 70.28% -5.11%
==========================================
Files 100 170 +70
Lines 8025 12659 +4634
==========================================
+ Hits 6050 8897 +2847
- Misses 1589 3158 +1569
- Partials 386 604 +218
|
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.
Pre Appoving , I added small comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 11
Configuration used: CodeRabbit UI
Files selected for processing (6)
- CHANGELOG.md (1 hunks)
- x/uibc/README.md (1 hunks)
- x/uibc/genesis.go (2 hunks)
- x/uibc/quota/keeper/genesis.go (2 hunks)
- x/uibc/quota/keeper/quota.go (6 hunks)
- x/uibc/quota/keeper/quota_test.go (5 hunks)
Files skipped from review due to trivial changes (1)
- x/uibc/quota/keeper/genesis.go
Additional comments: 7
x/uibc/genesis.go (2)
10-25: The changes to the
NewGenesisState
andDefaultGenesisState
functions correctly reflect the renaming of the fields fromTotalOutflowSum
toOutflowSum
andTotalInflowSum
toInflowSum
. This aligns with the pull request's goal of simplifying the naming conventions. It is important to ensure that all references to these fields in the codebase are updated to prevent any compilation errors or runtime issues.52-57: The validation logic has been correctly updated to check for negative values of
OutflowSum
andInflowSum
. This is a crucial check to ensure the integrity of the genesis state. It is also consistent with the renaming of the fields and maintains the logic of the previous implementation.CHANGELOG.md (1)
- 55-56: The changelog correctly reflects the updates to the Cosmos SDK version and the setting of
MinInitialDepositRatio
. However, it would be beneficial to include the renaming of fields in theGenesisState
andParams
structures as part of the breaking changes section, as these are likely to affect downstream systems and require attention from developers integrating with the UIBC module.x/uibc/README.md (4)
26-26: The documentation mentions the use of
x/oracle AvgKeeper
to measure token average USD value over a 16-hour window. This is a critical piece of information for understanding how inflows and outflows are calculated. It's important to ensure that theAvgKeeper
implementation is robust and that the 16-hour window is a suitable length of time for accurate measurements. If the window is too short, it may not capture enough data for a reliable average; if too long, it may not reflect recent price changes quickly enough.32-38: The renaming of
total_inflow_sum
toinflow_sum
andtotal_outflow_sum
tooutflow_sum
is reflected correctly in the documentation. This change simplifies the naming and makes it more intuitive. However, it is crucial to ensure that all references to these fields in the codebase, including comments and documentation, are updated to prevent confusion.47-52: The conditions for outflow transfers are well-documented, providing clear rules for when a transfer can occur. It's important to ensure that the logic in the code matches these documented rules exactly to prevent any unintended behavior. Additionally, the use of
params.total_quota
andparams.token_quota
should be carefully managed to avoid any potential overflow issues when performing calculations with these parameters.60-60: The documentation clarifies that tokens not registered in the x/leverage Token Registry are not subject to quota limits. This is an important exception that should be highlighted to ensure that users are aware of which tokens are affected by the quota mechanism. It may also be worth considering the implications of this for new tokens or tokens that are deregistered, as it could affect the overall security and risk management of the system.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 12
Configuration used: CodeRabbit UI
Files selected for processing (8)
- x/uibc/README.md (1 hunks)
- x/uibc/genesis_test.go (1 hunks)
- x/uibc/quota/keeper/genesis.go (2 hunks)
- x/uibc/quota/keeper/grpc_query.go (1 hunks)
- x/uibc/quota/keeper/keys.go (1 hunks)
- x/uibc/quota/keeper/migrations.go (1 hunks)
- x/uibc/quota/keeper/quota.go (7 hunks)
- x/uibc/quota/keeper/unit_test.go (1 hunks)
Files skipped from review due to trivial changes (2)
- x/uibc/quota/keeper/keys.go
- x/uibc/quota/keeper/unit_test.go
Additional comments: 7
x/uibc/quota/keeper/grpc_query.go (1)
- 37-43: The code has been updated to reflect the renaming of the method from
GetTotalOutflow()
toGetOutflowSum()
. Ensure that the new methodGetOutflowSum()
is correctly implemented and that it provides the same functionality as the previous method, or that any changes in functionality are intentional and documented. Additionally, verify that all references to the old method name have been updated across the entire codebase to prevent any broken functionality.x/uibc/genesis_test.go (1)
- 19-20: The test case is correctly checking for negative amounts in the
Outflows
field. It is important to ensure that similar validation is performed in the actualValidate
method of theGenesisState
to prevent invalid state initialization.x/uibc/quota/keeper/genesis.go (1)
- 35-42: The
ExportGenesis
function has been correctly updated to reflect the renamed fieldsOutflowSum
andInflowSum
. This change should be cross-checked with other parts of the codebase to ensure that all references to these fields are consistent with the new naming convention.x/uibc/quota/keeper/migrations.go (1)
- 14-17: The function
MigrateOutflowSum
is part of the migration logic. It's crucial to ensure that this migration is idempotent and can be run multiple times without causing issues. Additionally, it should be verified that the migration is covered by tests to ensure that it behaves as expected when transitioning from v6.1.0 to v6.2.x/uibc/README.md (1)
- 26-26: The documentation mentions the use of
x/oracle AvgKeeper
for measuring token value in USD. It's important to ensure that theAvgKeeper
is robust against price manipulation and provides a reliable measure of token value. This is critical for the correct functioning of the quota system, as it relies on the USD value of inflows and outflows.x/uibc/quota/keeper/quota.go (2)
- 121-132: The previous comment regarding error handling in
ResetAllQuotas
is still valid. TheSetOutflowSum
andSetInflowSum
functions are called without checking for errors. The code should be updated to handle potential errors from these functions.- k.SetOutflowSum(zero) - k.SetInflowSum(zero) + if err := k.SetOutflowSum(zero); err != nil { + return err + } + if err := k.SetInflowSum(zero); err != nil { + return err + }
- 260-267: The previous comment regarding error handling in
RecordIBCInflow
is still valid. TheSetTokenInflow
andSetInflowSum
functions are called without checking for errors. The code should be updated to handle potential errors from these functions.- k.SetTokenInflow(tokenInflow) - k.SetInflowSum(totalInflowSum.Add(inflowInUSD)) + if err := k.SetTokenInflow(tokenInflow); err != nil { + return channeltypes.NewErrorAcknowledgement(err) + } + if err := k.SetInflowSum(totalInflowSum.Add(inflowInUSD)); err != nil { + return channeltypes.NewErrorAcknowledgement(err) + }
Description
Summary by CodeRabbit
New Features
Improvements
Refactor
Documentation
Bug Fixes