-
Notifications
You must be signed in to change notification settings - Fork 61
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
support mapped accounts in claims #1642
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
WalkthroughThe recent updates focus on enhancing the 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 Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (5)
- x/participationrewards/keeper/submodule_liquid.go (2 hunks)
- x/participationrewards/keeper/submodule_osmosis.go (4 hunks)
- x/participationrewards/keeper/submodule_osmosiscl.go (4 hunks)
- x/participationrewards/keeper/submodule_umee.go (3 hunks)
- x/participationrewards/types/expected_keepers.go (1 hunks)
Additional comments not posted (9)
x/participationrewards/keeper/submodule_liquid.go (2)
5-5
: The addition of theerrors
package is appropriate for the custom error handling introduced in theValidateClaim
function.
50-59
: The updated error handling and address mapping inValidateClaim
are well-implemented. Ensure that theGetLocalAddressMap
method correctly retrieves mapped addresses and that the error messages provide enough context for debugging.Verification successful
The implementation of
GetLocalAddressMap
inx/interchainstaking/keeper/address_map.go
appears to correctly retrieve the mapped address using the provided remote address and chain ID. The method accesses the key-value store, constructs the key usingGetLocalAddressKey
, retrieves the value, and returns it along with a boolean indicating whether the value was found.The error handling in the
ValidateClaim
function, which uses this method, is appropriate and provides clear error messages when the mapped address is not found or when the proof is invalid.
x/interchainstaking/keeper/address_map.go:51-57
: Implementation ofGetLocalAddressMap
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the implementation of `GetLocalAddressMap` and its usage in error handling. # Test: Search for the method implementation and usage. Expect: Correct retrieval and usage of mapped addresses. rg --type go $'GetLocalAddressMap'Length of output: 1773
Script:
#!/bin/bash # Description: Review the implementation of `GetLocalAddressMap` in `x/interchainstaking/keeper/address_map.go`. # Extract the implementation of `GetLocalAddressMap`. ast-grep --lang go --pattern $'func (k *Keeper) GetLocalAddressMap(ctx sdk.Context, remoteAddress sdk.AccAddress, chainID string) (sdk.AccAddress, bool) { $$$ }' x/interchainstaking/keeper/address_map.goLength of output: 792
x/participationrewards/keeper/submodule_osmosiscl.go (2)
Line range hint
4-17
: The updated imports insubmodule_osmosiscl.go
are appropriate for the new address handling and validation logic in theValidateClaim
function.
Line range hint
78-99
: The changes in theValidateClaim
function, including the use ofaddressutils.AccAddressFromBech32
andbytes.Equal
, enhance address validation. Verify that these functions are used consistently across the codebase for similar operations.x/participationrewards/types/expected_keepers.go (1)
79-79
: The addition of theGetLocalAddressMap
method to theInterchainStakingKeeper
interface is crucial for supporting mapped accounts in claims validation. Ensure that all implementations of this interface are updated accordingly.x/participationrewards/keeper/submodule_osmosis.go (2)
Line range hint
4-21
: The updated imports insubmodule_osmosis.go
are appropriate for the new address handling and validation logic in theValidateClaim
function.
Line range hint
82-128
: The changes in theValidateClaim
function, including the use ofaddressutils.AccAddressFromBechjson
andbytes.Equal
, enhance address validation. Verify that these functions are used consistently across the codebase for similar operations.Verification successful
The
rg
command output shows multiple instances ofbytes.Equal
usage across different files, indicating its consistent use for address comparison. However, theAccAddressFromBechjson
function is not found in the output, suggesting it might be a typo or an incorrect function name. The correct function might beAccAddressFromBech32
.Let's verify the correct function name and its usage across the codebase.
The search results confirm that the correct function name is
AccAddressFromBech32
, and it is used consistently across the codebase for address conversion. This aligns with the changes made in theValidateClaim
function.
- The
bytes.Equal
function is used consistently for address comparison.- The
AccAddressFromBech32
function is used correctly and consistently for address conversion.No issues were found with the usage of these functions in the codebase.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify consistent use of `AccAddressFromBechjson` and `bytes.Equal` across the codebase. # Test: Search for usage of these functions. Expect: Consistent and correct usage. rg --type go $'AccAddressFromBechjson|bytes.Equal'Length of output: 3641
Script:
#!/bin/bash # Description: Verify the correct function name and its usage across the codebase. # Test: Search for usage of `AccAddressFromBech32`. Expect: Consistent and correct usage. rg --type go 'AccAddressFromBech32'Length of output: 23765
x/participationrewards/keeper/submodule_umee.go (2)
5-18
: The updated imports insubmodule_umee.go
are appropriate for the new error handling and address validation logic in theValidateClaim
function.
Line range hint
189-211
: The changes in theValidateClaim
function, including the use ofaddressutils.AccAddressFromBechjson
for address conversion and the handling of address mapping, enhance address validation. Verify that this function is used consistently across the codebase for similar operations.Verification successful
The search results indicate that the function
AccAddressFromBech32
is used consistently across the codebase, including in various files related to theparticipationrewards
module and other modules. This confirms that the changes made in theValidateClaim
function are in line with the existing code practices.
x/participationrewards/keeper/distribution.go
x/participationrewards/keeper/submodule_osmosiscl.go
x/participationrewards/keeper/submodule_umee.go
x/participationrewards/keeper/submodule_osmosis.go
x/participationrewards/types/msgs.go
- And many other files across different modules.
This consistent usage supports the robustness of the address validation changes introduced in the
ValidateClaim
function.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify consistent use of `AccAddressFromBechjson` across the codebase. # Test: Search for usage of this function. Expect: Consistent and correct usage. rg --type go $'AccAddressFromBechjson'Length of output: 37
Script:
#!/bin/bash # Description: Verify consistent use of `AccAddressFromBech32` across the codebase. # Test: Search for usage of this function. Expect: Consistent and correct usage. rg --type go $'AccAddressFromBech32'Length of output: 23765
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1642 +/- ##
==========================================
- Coverage 63.72% 63.60% -0.12%
==========================================
Files 194 194
Lines 13740 13770 +30
==========================================
+ Hits 8756 8759 +3
- Misses 4130 4154 +24
- Partials 854 857 +3
Flags with carried forward coverage won't be shown. Click here to find out more.
|
1. Summary
Add support for mapped accounts in claims validation.