-
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
refactor(x/participationrewards/keeper): combine GetProtocolData+UnmarshalProtocolData #1681
Conversation
@odeke-em is attempting to deploy a commit to the quicksilver Team on Vercel. A member of the Team first needs to authorize it. |
WalkthroughThe changes streamlined data retrieval and unmarshalling across several callback functions in the Changes
Sequence Diagram(s)sequenceDiagram
participant SDK.Context as SDK.Context
participant Keeper as Keeper
participant ProtocolData as ProtocolData
participant GetAndUnmarshal as GetAndUnmarshalProtocolData
SDK.Context ->> Keeper: Call callback function
Keeper ->> GetAndUnmarshal: Retrieve and unmarshal protocol data
GetAndUnmarshal ->> ProtocolData: Fetch data
ProtocolData -->> GetAndUnmarshal: Return data
GetAndUnmarshal -->> Keeper: Return unmarshalled data
Keeper -->> SDK.Context: Use protocol data in logic
Assessment against linked issues
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit 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: 2
Outside diff range and nitpick comments (2)
x/participationrewards/keeper/callbacks.go (2)
Line range hint
302-309
: Fix syntax errorsThe function
UmeeUTokenSupplyUpdateCallback
has several issues:
- The variable
err
is used but not defined.- data, supply, err := GetAndUnmarshalProtocolData[*types.UmeeUTokenSupplyProtocolData](ctx, k, denom, types.ProtocolDataTypeUmeeUTokenSupply) + data, supply, err := GetAndUnmarshalProtocolData[*types.UmeeUTokenSupplyProtocolData](ctx, k, denom, types.ProtocolDataTypeUmeeUTokenSupply) + if err != nil { + return err + }
Line range hint
338-345
: Fix syntax errorsThe function
UmeeLeverageModuleBalanceUpdateCallback
has several issues:
- The variable
err
is used but not defined.- data, balance, err := GetAndUnmarshalProtocolData[*types.UmeeLeverageModuleBalanceProtocolData](ctx, k, denom, types.ProtocolDataTypeUmeeLeverageModuleBalance) + data, balance, err := GetAndUnmarshalProtocolData[*types.UmeeLeverageModuleBalanceProtocolData](ctx, k, denom, types.ProtocolDataTypeUmeeLeverageModuleBalance) + if err != nil { + return err + }
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- x/participationrewards/keeper/callbacks.go (8 hunks)
- x/participationrewards/keeper/protocol_data.go (2 hunks)
Additional context used
GitHub Check: build quicksilver (darwin, arm64)
x/participationrewards/keeper/callbacks.go
[failure] 143-143:
ok declared and not used
[failure] 143-143:
not enough arguments in call to GetAndUnmarshalProtocolData[*types.OsmosisPoolProtocolData]
[failure] 144-144:
undefined: err
[failure] 145-145:
undefined: err
[failure] 148-148:
undefined: err
[failure] 149-149:
undefined: err
[failure] 150-150:
undefined: err
[failure] 153-153:
undefined: err
[failure] 154-154:
undefined: err
[failure] 155-155:
undefined: err
GitHub Check: test quicksilver (darwin, arm64)
x/participationrewards/keeper/callbacks.go
[failure] 143-143:
ok declared and not used
[failure] 143-143:
not enough arguments in call to GetAndUnmarshalProtocolData[*types.OsmosisPoolProtocolData]
[failure] 144-144:
undefined: err
[failure] 145-145:
undefined: err
[failure] 148-148:
undefined: err
[failure] 149-149:
undefined: err
[failure] 150-150:
undefined: err
[failure] 153-153:
undefined: err
[failure] 154-154:
undefined: err
[failure] 155-155:
undefined: err
GitHub Check: build quicksilver (amd64, darwin)
x/participationrewards/keeper/callbacks.go
[failure] 143-143:
ok declared and not used
[failure] 143-143:
not enough arguments in call to GetAndUnmarshalProtocolData[*types.OsmosisPoolProtocolData]
[failure] 144-144:
undefined: err
[failure] 145-145:
undefined: err
[failure] 148-148:
undefined: err
[failure] 149-149:
undefined: err
[failure] 150-150:
undefined: err
[failure] 153-153:
undefined: err
[failure] 154-154:
undefined: err
[failure] 155-155:
undefined: err
GitHub Check: test quicksilver (amd64, windows)
x/participationrewards/keeper/callbacks.go
[failure] 143-143:
ok declared and not used
[failure] 143-143:
not enough arguments in call to GetAndUnmarshalProtocolData[*types.OsmosisPoolProtocolData]
[failure] 144-144:
undefined: err
[failure] 145-145:
undefined: err
[failure] 148-148:
undefined: err
[failure] 149-149:
undefined: err
[failure] 150-150:
undefined: err
[failure] 153-153:
undefined: err
[failure] 154-154:
undefined: err
[failure] 155-155:
undefined: err
GitHub Check: build quicksilver (amd64, windows)
x/participationrewards/keeper/callbacks.go
[failure] 143-143:
ok declared and not used
[failure] 143-143:
not enough arguments in call to GetAndUnmarshalProtocolData[*types.OsmosisPoolProtocolData]
[failure] 144-144:
undefined: err
[failure] 145-145:
undefined: err
[failure] 148-148:
undefined: err
[failure] 149-149:
undefined: err
[failure] 150-150:
undefined: err
[failure] 153-153:
undefined: err
[failure] 154-154:
undefined: err
[failure] 155-155:
undefined: err
GitHub Check: build quicksilver (amd64, linux)
x/participationrewards/keeper/callbacks.go
[failure] 143-143:
ok declared and not used
[failure] 143-143:
not enough arguments in call to GetAndUnmarshalProtocolData[*types.OsmosisPoolProtocolData]
[failure] 144-144:
undefined: err
[failure] 145-145:
undefined: err
[failure] 148-148:
undefined: err
[failure] 149-149:
undefined: err
[failure] 150-150:
undefined: err
[failure] 153-153:
undefined: err
[failure] 154-154:
undefined: err
[failure] 155-155:
undefined: err
GitHub Check: lint
x/participationrewards/keeper/callbacks.go
[failure] 143-143:
ok declared and not used
[failure] 143-143:
not enough arguments in call to GetAndUnmarshalProtocolData[*types.OsmosisPoolProtocolData]
[failure] 144-144:
undefined: err
[failure] 145-145:
undefined: err
[failure] 148-148:
undefined: err
[failure] 149-149:
undefined: err
[failure] 150-150:
undefined: err
[failure] 153-153:
undefined: err
[failure] 154-154:
undefined: err
[failure] 155-155:
undefined: err
GitHub Check: test quicksilver (amd64, linux)
x/participationrewards/keeper/callbacks.go
[failure] 143-143:
ok declared and not used
[failure] 143-143:
not enough arguments in call to GetAndUnmarshalProtocolData[*types.OsmosisPoolProtocolData]
[failure] 144-144:
undefined: err
[failure] 145-145:
undefined: err
[failure] 148-148:
undefined: err
[failure] 149-149:
undefined: err
[failure] 150-150:
undefined: err
[failure] 153-153:
undefined: err
[failure] 154-154:
undefined: err
[failure] 155-155:
undefined: err
Additional comments not posted (5)
x/participationrewards/keeper/protocol_data.go (1)
43-57
: LGTM!The new function
GetAndUnmarshalProtocolData
correctly combines retrieval and unmarshaling of protocol data, handling error cases and type assertions effectively.x/participationrewards/keeper/callbacks.go (4)
242-246
: Fix syntax errorsThe function
UmeeTotalBorrowsUpdateCallback
has several issues:
- The variable
err
is used but not defined.- data, borrows, err := GetAndUnmarshalProtocolData[*types.UmeeTotalBorrowsProtocolData](ctx, k, denom, types.ProtocolDataTypeUmeeTotalBorrows) + data, borrows, err := GetAndUnmarshalProtocolData[*types.UmeeTotalBorrowsProtocolData](ctx, k, denom, types.ProtocolDataTypeUmeeTotalBorrows) + if err != nil { + return err + }Likely invalid or redundant comment.
212-216
: Fix syntax errorsThe function
UmeeReservesUpdateCallback
has several issues:
- The variable
err
is used but not defined.- data, reserves, err := GetAndUnmarshalProtocolData[*types.UmeeReservesProtocolData](ctx, k, denom, types.ProtocolDataTypeUmeeReserves) + data, reserves, err := GetAndUnmarshalProtocolData[*types.UmeeReservesProtocolData](ctx, k, denom, types.ProtocolDataTypeUmeeReserves) + if err != nil { + return err + }Likely invalid or redundant comment.
182-186
: Fix syntax errorsThe function
OsmosisClPoolUpdateCallback
has several issues:
- The variable
err
is used but not defined.- data, pool, err := GetAndUnmarshalProtocolData[*types.OsmosisClPoolProtocolData](ctx, k, fmt.Sprintf("%d", poolID), types.ProtocolDataTypeOsmosisCLPool) + data, pool, err := GetAndUnmarshalProtocolData[*types.OsmosisClPoolProtocolData](ctx, k, fmt.Sprintf("%d", poolID), types.ProtocolDataTypeOsmosisCLPool) + if err != nil { + return err + }Likely invalid or redundant comment.
272-276
: Fix syntax errorsThe function
UmeeInterestScalarUpdateCallback
has several issues:
- The variable
err
is used but not defined.- data, interest, err := GetAndUnmarshalProtocolData[*types.UmeeInterestScalarProtocolData](ctx, k, denom, types.ProtocolDataTypeUmeeInterestScalar) + data, interest, err := GetAndUnmarshalProtocolData[*types.UmeeInterestScalarProtocolData](ctx, k, denom, types.ProtocolDataTypeUmeeInterestScalar) + if err != nil { + return err + }Likely invalid or redundant comment.
b028e69
to
3d4753c
Compare
bbdbc3f
to
79a0d1b
Compare
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 great, thank you!
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 (4)
- x/participationrewards/keeper/callbacks.go (8 hunks)
- x/participationrewards/keeper/callbacks_test.go (8 hunks)
- x/participationrewards/keeper/distribution.go (1 hunks)
- x/participationrewards/keeper/protocol_data.go (2 hunks)
Files not reviewed due to errors (1)
- x/participationrewards/keeper/callbacks_test.go (no review received)
Files skipped from review as they are similar to previous changes (2)
- x/participationrewards/keeper/callbacks.go
- x/participationrewards/keeper/protocol_data.go
Additional comments not posted (3)
x/participationrewards/keeper/distribution.go (3)
Line range hint
134-134
: Verify error aggregation logic.Ensure that the error aggregation logic correctly captures and reports all errors.
Verification successful
Line range hint
134-134
: Verified error aggregation logic.The error aggregation logic correctly captures and reports all errors in the
CalcTokenValues
function.
x/participationrewards/keeper/distribution.go
:
- Lines 170-172:
if len(errs) > 0 { return nil, multierror.New(errs) }
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify error aggregation logic in the `CalcTokenValues` function. # Test: Search for error aggregation logic in the `CalcTokenValues` function. rg --type python $'if len(errs) > 0 {\n\treturn nil, multierror.New(errs)\n}'Length of output: 377
Script:
#!/bin/bash # Description: Verify error aggregation logic in the `CalcTokenValues` function. # Test: Search for error aggregation logic in the `CalcTokenValues` function. ast-grep --lang go --pattern $'if len(errs) > 0 {\n\treturn nil, multierror.New(errs)\n}'Length of output: 301
Line range hint
76-76
: Ensure consistency in type assertions and error handling.Verify that the type assertion for
ipool
and the error handling logic are consistent with the first iteration.Verification successful
Consistency in type assertions and error handling verified.
The type assertions and error handling logic for
ipool
in the second iteration are consistent with the first iteration.
- Both iterations capture errors in the
errs
map.- Type assertions are performed similarly without additional error checking.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify type assertions and error handling logic for `ipool` in the second iteration. # Test: Search for type assertions and error handling in the second iteration of the `CalcTokenValues` function. rg --type python $'ipool, err := types.UnmarshalProtocolData(types.ProtocolDataTypeOsmosisCLPool, data.Data)\npool, _ := ipool.(*types.OsmosisClPoolProtocolData)'Length of output: 558
Script:
#!/bin/bash # Description: Verify type assertions and error handling logic for `ipool` in the second iteration. # Test: Search for type assertions and error handling in the second iteration of the `CalcTokenValues` function. rg --type go 'ipool, err := types.UnmarshalProtocolData(types.ProtocolDataTypeOsmosisCLPool, data.Data)\npool, _ := ipool.(*types.OsmosisClPoolProtocolData)'Length of output: 486
Script:
#!/bin/bash # Description: Verify type assertions and error handling logic for `ipool` in the second iteration. # Test: Search for type assertions and error handling in the second iteration of the `CalcTokenValues` function. rg --type go 'ipool, err := types.UnmarshalProtocolData(types.ProtocolDataTypeOsmosisCLPool, data.Data).*pool, _ := ipool\.\(\*types\.OsmosisClPoolProtocolData\)'Length of output: 164
Script:
#!/bin/bash # Description: Verify type assertions and error handling logic for `ipool` in the `CalcTokenValues` function. # Test: Search for all instances of `UnmarshalProtocolData` to review their context. rg 'UnmarshalProtocolData'Length of output: 8064
Script:
#!/bin/bash # Description: Extract relevant lines from `x/participationrewards/keeper/distribution.go` to review type assertions and error handling logic. # Extract lines containing `UnmarshalProtocolData` and their surrounding context. rg --context 5 'UnmarshalProtocolData' x/participationrewards/keeper/distribution.goLength of output: 1347
45-45
: Ensure correct type assertion and error handling.Verify that the type assertion for
ipool
and the error handling logic are correct.Verification successful
Ensure correct type assertion and error handling.
The type assertion for
ipool
and the error handling logic in theCalcTokenValues
function appear to be implemented correctly. The function checks for errors after unmarshalling protocol data and handles type assertions appropriately.
- Lines 18-20: Error handling after unmarshalling protocol data.
- Lines 21-22: Type assertion for
ipool
.No further issues were found with the type assertion and error handling logic.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify type assertions and error handling logic for `ipool`. # Test: Search for type assertions and error handling in the `CalcTokenValues` function. rg --type python $'ipool, err := types.UnmarshalProtocolData(types.ProtocolDataTypeOsmosisPool, data.Data)\npool, _ := ipool.(*types.OsmosisPoolProtocolData)'Length of output: 550
Script:
#!/bin/bash # Description: Verify type assertions and error handling logic for `ipool` in the `CalcTokenValues` function. # Test: Search for type assertions and error handling in the `CalcTokenValues` function. rg --type go $'ipool, err := types.UnmarshalProtocolData(types.ProtocolDataTypeOsmosisPool, data.Data)\npool, _ := ipool.\\(*types.OsmosisPoolProtocolData\\)'Length of output: 348
Script:
#!/bin/bash # Description: Verify type assertions and error handling logic for `ipool` in the `CalcTokenValues` function. # Test: Search for type assertions and error handling in the `CalcTokenValues` function using multiline mode. rg --type go -U $'ipool, err := types.UnmarshalProtocolData(types.ProtocolDataTypeOsmosisPool, data.Data)\npool, _ := ipool.\\(*types.OsmosisPoolProtocolData\\)'Length of output: 159
Script:
#!/bin/bash # Description: Locate the `CalcTokenValues` function and inspect its contents for type assertions and error handling. # Step 1: Locate the `CalcTokenValues` function in the codebase. rg --type go 'func CalcTokenValues' # Step 2: If found, inspect the contents of the located function for type assertions and error handling.Length of output: 37
Script:
#!/bin/bash # Description: Locate all function definitions in the `x/participationrewards/keeper/distribution.go` file. # Step 1: Search for all function definitions in the specified file. rg --type go --line-number 'func ' x/participationrewards/keeper/distribution.goLength of output: 767
Script:
#!/bin/bash # Description: Extract and inspect the contents of the `CalcTokenValues` function for type assertions and error handling. # Step 1: Extract the contents of the `CalcTokenValues` function. rg --type go --context 50 --line-number '^func (k \*Keeper) CalcTokenValues' x/participationrewards/keeper/distribution.goLength of output: 124
Script:
#!/bin/bash # Description: Extract and inspect the contents of the `CalcTokenValues` function for type assertions and error handling. # Step 1: Extract the contents of the `CalcTokenValues` function using `sed`. sed -n '/^func (k \*Keeper) CalcTokenValues/,/^}/p' x/participationrewards/keeper/distribution.goLength of output: 4108
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 (1)
- x/participationrewards/keeper/distribution.go (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- x/participationrewards/keeper/distribution.go
Missing keeper argument also exists on several places, similar to the ‘distribution.go’ file, please fix @odeke-em |
493c0e8
to
f790f7f
Compare
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 (4)
- x/participationrewards/keeper/callbacks.go (8 hunks)
- x/participationrewards/keeper/callbacks_test.go (8 hunks)
- x/participationrewards/keeper/distribution.go (1 hunks)
- x/participationrewards/keeper/protocol_data.go (2 hunks)
Files skipped from review as they are similar to previous changes (4)
- x/participationrewards/keeper/callbacks.go
- x/participationrewards/keeper/callbacks_test.go
- x/participationrewards/keeper/distribution.go
- x/participationrewards/keeper/protocol_data.go
Done, thanks for the ping @tropicaldog |
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.
LGTM. failing ci is pending fix on #1680
f790f7f
to
7062aa7
Compare
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 (4)
- x/participationrewards/keeper/callbacks.go (8 hunks)
- x/participationrewards/keeper/callbacks_test.go (8 hunks)
- x/participationrewards/keeper/distribution.go (1 hunks)
- x/participationrewards/keeper/protocol_data.go (2 hunks)
Additional comments not posted (18)
x/participationrewards/keeper/protocol_data.go (1)
43-57
: Ensure correct type assertion inGetAndUnmarshalProtocolData
.The type assertion on line 52 may fail if the type
T
does not match the expected type. Consider adding a more robust type check or logging for debugging purposes.x/participationrewards/keeper/distribution.go (1)
40-45
: Remove the unused variabledata
.The variable
data
is assigned but never used.- _, osmoParams, err := GetAndUnmarshalProtocolData[*types.OsmosisParamsProtocolData](ctx, k, "osmosisparams", types.ProtocolDataTypeOsmosisParams) + _, osmoParams, err := GetAndUnmarshalProtocolData[*types.OsmosisParamsProtocolData](ctx, k, "osmosisparams", types.ProtocolDataTypeOsmosisParams)Likely invalid or redundant comment.
x/participationrewards/keeper/callbacks.go (8)
142-147
: Ensure proper error handling inOsmosisPoolUpdateCallback
.The function correctly handles errors from
GetAndUnmarshalProtocolData
andjson.Marshal
.
182-186
: Ensure proper error handling inOsmosisClPoolUpdateCallback
.The function correctly handles errors from
GetAndUnmarshalProtocolData
andjson.Marshal
.
212-216
: Ensure proper error handling inUmeeReservesUpdateCallback
.The function correctly handles errors from
GetAndUnmarshalProtocolData
andjson.Marshal
.
242-246
: Ensure proper error handling inUmeeTotalBorrowsUpdateCallback
.The function correctly handles errors from
GetAndUnmarshalProtocolData
andjson.Marshal
.
272-276
: Ensure proper error handling inUmeeInterestScalarUpdateCallback
.The function correctly handles errors from
GetAndUnmarshalProtocolData
andjson.Marshal
.
302-307
: Ensure proper error handling inUmeeUTokenSupplyUpdateCallback
.The function correctly handles errors from
GetAndUnmarshalProtocolData
andjson.Marshal
.
338-343
: Ensure proper error handling inUmeeLeverageModuleBalanceUpdateCallback
.The function correctly handles errors from
GetAndUnmarshalProtocolData
andjson.Marshal
.
Line range hint
359-364
:
Ensure proper error handling inSetEpochBlockCallback
.The function correctly handles errors from
GetAndUnmarshalProtocolData
andjson.Marshal
.x/participationrewards/keeper/callbacks_test.go (8)
76-80
: Ensure proper error handling inTestOsmosisPoolUpdateCallback
.The test function correctly handles errors from
GetAndUnmarshalProtocolData
.
134-138
: Ensure proper error handling inTestOsmosisClPoolUpdateCallback
.The test function correctly handles errors from
GetAndUnmarshalProtocolData
.
189-193
: Ensure proper error handling inexecuteOsmosisPoolUpdateCallback
.The test function correctly handles errors from
GetAndUnmarshalProtocolData
.
308-312
: Ensure proper error handling inexecuteUmeeReservesUpdateCallback
.The test function correctly handles errors from
GetAndUnmarshalProtocolData
.
348-352
: Ensure proper error handling inexecuteUmeeLeverageModuleBalanceUpdateCallback
.The test function correctly handles errors from
GetAndUnmarshalProtocolData
.
386-390
: Ensure proper error handling inexecuteUmeeUTokenSupplyUpdateCallback
.The test function correctly handles errors from
GetAndUnmarshalProtocolData
.
424-428
: Ensure proper error handling inexecuteUmeeTotalBorrowsUpdateCallback
.The test function correctly handles errors from
GetAndUnmarshalProtocolData
.
Line range hint
462-466
:
Ensure proper error handling inexecuteUmeeInterestScalarUpdateCallback
.The test function correctly handles errors from
GetAndUnmarshalProtocolData
.
…rshalProtocolData This change combines GetProtocolData and types.UnmarshalProtocolData into a generic function that unifies the functionality and the pattern. Fixes quicksilver-zone#1631
7062aa7
to
4612067
Compare
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 (4)
- x/participationrewards/keeper/callbacks.go (8 hunks)
- x/participationrewards/keeper/callbacks_test.go (8 hunks)
- x/participationrewards/keeper/distribution.go (1 hunks)
- x/participationrewards/keeper/protocol_data.go (2 hunks)
Files skipped from review as they are similar to previous changes (3)
- x/participationrewards/keeper/callbacks.go
- x/participationrewards/keeper/callbacks_test.go
- x/participationrewards/keeper/distribution.go
Additional context used
golangci-lint
x/participationrewards/keeper/protocol_data.go
54-54: File is not
gci
-ed with --skip-generated -s standard -s default -s blank -s dot -s prefix(cosmossdk.io) -s prefix(github.com/cosmos/cosmos-sdk) -s prefix(github.com/cometbft/cometbft) -s prefix(github.com/cosmos/ibc-go) -s prefix(github.com/quicksilver-zone/quicksilver) --custom-order(gci)
Additional comments not posted (2)
x/participationrewards/keeper/protocol_data.go (2)
43-57
: Improve error message for type assertion failure.The error message on line 54 could be more descriptive to aid in debugging.
- return dt, tt, fmt.Errorf("could not retrieve type of %T", (*T)(nil)) + return dt, tt, fmt.Errorf("could not retrieve type of %T, actual type: %T", (*T)(nil), pd)Tools
golangci-lint
54-54: File is not
gci
-ed with --skip-generated -s standard -s default -s blank -s dot -s prefix(cosmossdk.io) -s prefix(github.com/cosmos/cosmos-sdk) -s prefix(github.com/cometbft/cometbft) -s prefix(github.com/cosmos/ibc-go) -s prefix(github.com/quicksilver-zone/quicksilver) --custom-order(gci)
43-57
: Ensure proper type assertion for generics.The type assertion on line 52 might fail if the type
T
is not compatible. Consider adding more robust type handling or validation.Ensure that the type
T
is always compatible with the expected protocol data type.Tools
golangci-lint
54-54: File is not
gci
-ed with --skip-generated -s standard -s default -s blank -s dot -s prefix(cosmossdk.io) -s prefix(github.com/cosmos/cosmos-sdk) -s prefix(github.com/cometbft/cometbft) -s prefix(github.com/cosmos/ibc-go) -s prefix(github.com/quicksilver-zone/quicksilver) --custom-order(gci)
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1681 +/- ##
==========================================
+ Coverage 63.82% 63.92% +0.10%
==========================================
Files 196 196
Lines 13831 13794 -37
==========================================
- Hits 8827 8818 -9
+ Misses 4136 4122 -14
+ Partials 868 854 -14
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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.
lgtm. Thanks @odeke-em!
This pull request has been automatically marked as stale because it has not had any recent activity. It will be closed if no further activity occurs. Thank you! |
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.
lgtm
This change combines GetProtocolData and types.UnmarshalProtocolData into a generic function that unifies the functionality and the pattern.
Fixes #1631
Summary by CodeRabbit
Refactor
Bug Fixes