-
Notifications
You must be signed in to change notification settings - Fork 30
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
bump up mods.irisnet.org/modules/random to cosmos-sdk v0.50.10 #453
Conversation
WalkthroughThe pull request introduces significant changes to the Changes
Assessment against linked issues
Possibly related issues
Possibly related PRs
Suggested reviewers
Warning There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure. 🔧 golangci-lintlevel=warning msg="The linter 'exportloopref' is deprecated (since v1.60.2) due to: Since Go1.22 (loopvar) this linter is no longer relevant. Replaced by copyloopvar." 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
🔇 Additional comments (4)modules/random/go.mod (4)
The upgrade to Go 1.21 aligns with the requirements of cosmos-sdk v0.50.10.
The upgrade to cosmos-sdk v0.50.10 and related core dependencies looks correct. However, let's verify the compatibility of these versions. ✅ Verification successfulCore dependencies are properly aligned with cosmos-sdk v0.50.10 The dependency versions are compatible with cosmos-sdk v0.50.10:
🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Description: Verify compatibility of core dependencies with cosmos-sdk v0.50.10
# Check if the versions match cosmos-sdk v0.50.10's go.mod
gh api repos/cosmos/cosmos-sdk/contents/go.mod?ref=v0.50.10 | jq -r '.content' | base64 -d | grep -A 20 "^require ("
# Verify if there are any known compatibility issues
gh api graphql -f query='
{
repository(owner: "cosmos", name: "cosmos-sdk") {
release(tagName: "v0.50.10") {
description
}
}
}' | jq -r '.data.repository.release.description' | grep -i "compatibility"
Length of output: 409 Script: #!/bin/bash
# Let's try a different approach to verify dependency compatibility
# Check direct dependencies in the module
cat modules/random/go.mod | grep -A 30 "^require"
# Check if there are any replace directives that might affect compatibility
cat modules/random/go.mod | grep -A 10 "^replace"
# Look for any dependency-related comments in go.mod
cat modules/random/go.mod | grep "\/\/"
Length of output: 12677 Line range hint The replace directives include security-related fixes:
These replacements should be temporary. The TODOs indicate they should be removed once upstream fixes are available.
The replace directives for local modules need verification to ensure they point to compatible versions. ✅ Verification successfulLocal module replacements are compatible The verification shows that both modules are compatible:
The local module replacements in the go.mod file are correctly configured and point to compatible versions. 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Description: Verify that the replaced modules are compatible
# Check if the service module exists and has compatible dependencies
if [ -f "../service/go.mod" ]; then
echo "Checking service module dependencies..."
grep "github.com/cosmos/cosmos-sdk" "../service/go.mod"
fi
# Check if the simapp module exists and has compatible dependencies
if [ -f "../../simapp/go.mod" ]; then
echo "Checking simapp module dependencies..."
grep "github.com/cosmos/cosmos-sdk" "../../simapp/go.mod"
fi
Length of output: 230 Script: #!/bin/bash
# Let's try a different approach to verify the module replacements
# First, let's check if these directories exist relative to the repository root
echo "Checking for service module..."
fd --type d "service$" --max-depth 3
echo -e "\nChecking for simapp module..."
fd --type d "simapp$" --max-depth 3
# Let's also check the content of the go.mod files if they exist
echo -e "\nChecking go.mod files content:"
fd "go.mod$" --type f --max-depth 3 --exec echo "=== {}" ";" --exec cat "{}"
Length of output: 120821 Script: #!/bin/bash
# Let's verify the compatibility of the modules by checking their dependencies
# Check the cosmos-sdk version in service module
echo "=== Checking service module cosmos-sdk version ==="
cd modules/service
grep "github.com/cosmos/cosmos-sdk" go.mod
# Check the cosmos-sdk version in simapp module
echo -e "\n=== Checking simapp module cosmos-sdk version ==="
cd ../../simapp
grep "github.com/cosmos/cosmos-sdk" go.mod
# Check if these modules exist and have compatible Go versions
echo -e "\n=== Checking Go versions ==="
cd ../modules/service
grep "^go " go.mod
cd ../../simapp
grep "^go " go.mod
# Check if there are any replace directives in these modules
echo -e "\n=== Checking replace directives ==="
cd ../modules/service
grep -A 1 "^replace" go.mod
cd ../../simapp
grep -A 1 "^replace" go.mod
Length of output: 1154 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 using PR comments)
Other keywords and placeholders
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: 11
🧹 Outside diff range and nitpick comments (7)
modules/random/keeper/keeper_test.go (1)
Line range hint
1-114
: Consider enhancing test coverage and structure.While the current tests cover basic functionality, consider the following improvements:
- Add table-driven tests for better test organization and coverage
- Add negative test cases (e.g., invalid block intervals, malformed consumer addresses)
- Move magic numbers to named constants
Example structure for table-driven tests:
func (suite *KeeperTestSuite) TestRequestRandom() { tests := []struct { name string consumer sdk.AccAddress blockInterval uint64 oracle bool serviceID []byte expectError bool }{ { name: "valid request", consumer: testConsumer, blockInterval: testBlockInterval, oracle: false, serviceID: nil, expectError: false, }, // Add more test cases here } for _, tc := range tests { suite.Run(tc.name, func() { suite.ctx = suite.ctx.WithBlockHeight(testHeight).WithTxBytes(testTxBytes) request, err := suite.keeper.RequestRandom( suite.ctx, tc.consumer, tc.blockInterval, tc.oracle, tc.serviceID, ) if tc.expectError { suite.Error(err) return } suite.NoError(err) // Add assertions }) } }modules/service/types/params.go (1)
16-17
: Consider future migration from Legacy decimal typesWhile the change to
math.LegacyNewDecWithPrec
is correct for the current SDK version, note that theLegacy
prefix suggests these types might be deprecated in future SDK versions. Consider tracking future SDK releases for migration to non-legacy decimal types.modules/service/keeper/fees.go (1)
35-35
: Consider future-proofing the decimal conversionWhile
math.LegacyNewDecFromInt
works correctly, the 'Legacy' prefix suggests it might be deprecated in future SDK versions. Consider planning for a migration to the newer decimal conversion methods when they become available.modules/service/keeper/depinject_test.go (1)
Capability module removal needs to be synchronized across test files
The capability module is still referenced in multiple test files but has been removed from
modules/service/keeper/depinject_test.go
. This inconsistency needs to be addressed:
modules/token/keeper/depinject_test.go
: Still imports and uses capability modulemodules/record/keeper/depinject_test.go
: Still imports and uses capability modulemodules/oracle/keeper/depinject_test.go
: Still imports and uses capability modulemodules/htlc/keeper/depinject_test.go
: Still imports and uses capability modulemodules/farm/keeper/depinject_test.go
: Still imports and uses capability modulemodules/coinswap/keeper/depinject_test.go
: Still imports and uses capability modulee2e/app_config.go
: Still imports and uses capability moduleThe removal of capability module should be synchronized across all these test files to maintain consistency with SDK v0.50.10 changes.
🔗 Analysis chain
Line range hint
60-64
: Verify impact of capability module removalThe module initialization order has been updated correctly with new modules, but we should verify that the removal of the capability module doesn't affect any dependent modules.
Let's check for any remaining capability module dependencies:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Search for any remaining capability module references or dependencies # Check for capability imports or references rg -i "capability" -g "!*.md" -g "!*.mod" -g "!*.sum" # Check for IBC module usage (common capability module dependency) rg -i "ibc" -g "!*.md" -g "!*.mod" -g "!*.sum"Length of output: 11897
modules/service/keeper/binding.go (1)
609-609
: Consider future-proofing the decimal conversionWhile the migration to
cosmossdk.io/math
is correct, the use ofLegacyNewDecFromInt
suggests this is a transitional change. Consider planning for a future update to use the newer decimal conversion methods when they become available in the SDK.Also applies to: 624-626
modules/service/keeper/invocation.go (1)
Based on the scan results, I can now provide a final response about the SDK v0.50.10 migration consistency:
Migration to SDK v0.50.10 requires additional updates
Several files still contain old SDK patterns that need to be updated:
Iterator usage:
modules/token/keeper/token.go
: Usessdk.Iterator
andsdk.KVStorePrefixIterator
modules/record/keeper/keeper.go
: Usessdk.Iterator
- Multiple modules (oracle, farm, htlc, coinswap) still use
sdk.KVStorePrefixIterator
Decimal operations:
- Multiple files still use
sdk.NewDecFromInt
instead ofmath.LegacyNewDecFromInt
:
modules/token/types/v1/token.go
modules/token/types/v1beta1/token.go
modules/token/types/types.go
modules/token/keeper/fees.go
modules/farm/keeper/*.go
modules/coinswap/keeper/fees.go
These patterns need to be updated to maintain consistency with SDK v0.50.10 changes:
- Replace
sdk.Iterator
andsdk.KVStorePrefixIterator
withstoretypes.KVStorePrefixIterator
- Replace
sdk.NewDecFromInt
withmath.LegacyNewDecFromInt
🔗 Analysis chain
Line range hint
1-1400
: Verify completeness of SDK v0.50.10 migrationLet's verify that all necessary updates have been made consistently across the codebase.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check for any remaining old SDK iterator or decimal usage patterns # Check for any remaining sdk.Iterator usage echo "Checking for remaining sdk.Iterator usage..." rg "sdk\.Iterator" --type go # Check for any remaining sdk.KVStorePrefixIterator usage echo "Checking for remaining sdk.KVStorePrefixIterator usage..." rg "sdk\.KVStorePrefixIterator" --type go # Check for any remaining sdk.NewDecFromInt usage echo "Checking for remaining sdk.NewDecFromInt usage..." rg "sdk\.NewDecFromInt" --type go # Check for proper store types usage echo "Checking store types usage patterns..." rg "storetypes\.KVStorePrefixIterator" --type goLength of output: 8260
modules/service/module.go (1)
5-5
: Fix import grouping and orderingThe static analysis tool
gci
reports that the imports are not properly grouped and ordered. Please format the imports usinggci
to enhance code readability and maintain consistency.Apply the following command to reformat the imports:
gci --skip-generated -s standard -s default -s prefix(mods.irisnet.org) --custom-order -w modules/service/module.go🧰 Tools
🪛 golangci-lint
5-5: File is not
gci
-ed with --skip-generated -s standard -s default -s prefix(mods.irisnet.org) --custom-order(gci)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
⛔ Files ignored due to path filters (3)
modules/random/go.sum
is excluded by!**/*.sum
modules/service/go.sum
is excluded by!**/*.sum
modules/service/types/service.pb.go
is excluded by!**/*.pb.go
📒 Files selected for processing (32)
api/irismod/service/service.pulsar.go
(2 hunks)modules/random/abci.go
(3 hunks)modules/random/depinject.go
(1 hunks)modules/random/go.mod
(3 hunks)modules/random/keeper/depinject_test.go
(3 hunks)modules/random/keeper/keeper.go
(4 hunks)modules/random/keeper/keeper_test.go
(1 hunks)modules/random/module.go
(2 hunks)modules/random/simulation/operations.go
(1 hunks)modules/random/types/expected_keepers.go
(2 hunks)modules/random/types/msgs_test.go
(2 hunks)modules/service/client/utils/query.go
(2 hunks)modules/service/depinject.go
(1 hunks)modules/service/go.mod
(2 hunks)modules/service/keeper/binding.go
(8 hunks)modules/service/keeper/definition.go
(2 hunks)modules/service/keeper/depinject_test.go
(2 hunks)modules/service/keeper/fees.go
(8 hunks)modules/service/keeper/grpc_query.go
(1 hunks)modules/service/keeper/invocation.go
(11 hunks)modules/service/keeper/keeper.go
(2 hunks)modules/service/keeper/keeper_test.go
(8 hunks)modules/service/keeper/oracle_price.go
(4 hunks)modules/service/keeper/params.go
(2 hunks)modules/service/module.go
(4 hunks)modules/service/simulation/operations.go
(21 hunks)modules/service/types/binding.go
(3 hunks)modules/service/types/expected_keeper.go
(1 hunks)modules/service/types/msgs_test.go
(5 hunks)modules/service/types/oracle_price.go
(2 hunks)modules/service/types/params.go
(5 hunks)proto/irismod/service/service.proto
(3 hunks)
✅ Files skipped from review due to trivial changes (2)
- modules/service/depinject.go
- modules/service/keeper/grpc_query.go
🧰 Additional context used
🪛 golangci-lint
modules/service/client/utils/query.go
215-215: commentFormatting: put a space between //
and comment text
(gocritic)
modules/service/keeper/keeper_test.go
359-359: Error return value of suite.app.BeginBlocker
is not checked
(errcheck)
461-461: Error return value of suite.app.BeginBlocker
is not checked
(errcheck)
modules/service/keeper/oracle_price.go
64-64: printf: non-constant format string in call to cosmossdk.io/errors.Wrapf
(govet)
modules/service/module.go
5-5: File is not gci
-ed with --skip-generated -s standard -s default -s prefix(mods.irisnet.org) --custom-order
(gci)
🔇 Additional comments (68)
modules/service/types/expected_keeper.go (2)
4-6
: LGTM: Import changes align with cosmos-sdk v0.50.10 requirements
The addition of context
and cosmossdk.io/core/address
imports is correct and necessary for the SDK upgrade.
42-45
: Verify AccountKeeper implementations and address codec usage
The AccountKeeper interface changes correctly:
- Migrate to
context.Context
- Update return types to use SDK interfaces
- Add the required
AddressCodec
method for address handling
#!/bin/bash
# Description: Verify AccountKeeper implementations and address codec usage
# Search for AccountKeeper implementations
ast-grep --pattern 'type $_ struct {
$$$
}
func (k $_) GetAccount(ctx context.Context, $_) sdk.AccountI'
# Search for AddressCodec usage to ensure it's properly implemented
rg "AddressCodec\(\)"
# Check for any remaining old return types
rg "authtypes\.AccountI|authtypes\.ModuleAccountI"
modules/random/depinject.go (2)
6-6
: LGTM! Import path updated correctly for cosmos-sdk v0.50.10
The change from github.com/cosmos/cosmos-sdk/store/types
to cosmossdk.io/store/types
aligns with the new import paths in cosmos-sdk v0.50.x.
6-6
: Verify consistent store types usage across the module
Let's ensure all related files are using the new store types import path consistently.
✅ Verification successful
Based on the results, I can generate the final response as we have clear evidence that:
- No old store imports (
github.com/cosmos/cosmos-sdk/store/types
) were found - The new store import (
cosmossdk.io/store/types
) is consistently used across three files - The
store.KVStoreKey
type is used correctly with the new import
Store types import path is consistently used across the module ✅
All files in the random module are consistently using the new store types import path cosmossdk.io/store/types
. No instances of the old import path were found, and the store types are properly referenced.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for any remaining old store type imports in the random module
# and verify the consistent usage of new store types
# Check for any remaining old store imports
echo "Checking for old store type imports..."
rg -l "github.com/cosmos/cosmos-sdk/store/types" modules/random/
# Check the usage of new store types
echo "Verifying new store types usage..."
rg -l "cosmossdk.io/store/types" modules/random/
# Check for any store.KVStoreKey usage to ensure type consistency
echo "Checking store.KVStoreKey usage..."
ast-grep --pattern 'store.KVStoreKey' modules/random/
Length of output: 570
modules/service/keeper/definition.go (2)
5-5
: LGTM! Import path follows new SDK convention
The import change to cosmossdk.io/store/types
aligns with the PR objective of updating to cosmos-sdk v0.50.10.
59-59
: LGTM! Verify consistent iterator usage across module
The change to storetypes.KVStorePrefixIterator
is correct for the SDK update.
Let's verify that this change has been consistently applied across the module:
✅ Verification successful
Based on the search results, I can now provide a final response:
Consistent usage of storetypes.KVStorePrefixIterator
confirmed across module
The search results show that all iterator usage in the service module consistently uses storetypes.KVStorePrefixIterator
. Key findings:
- All iterator creations in
keeper/
directory use the samestoretypes.KVStorePrefixIterator
pattern - No instances of the old SDK iterator type (
sdk.KVStorePrefixIterator
) were found - The change is consistently applied across all relevant files:
- keeper/definition.go
- keeper/invocation.go
- keeper/binding.go
- keeper/fees.go
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for any remaining usage of old iterator types in the service module
# Expected: No occurrences of the old SDK iterator type should remain
# Search for any remaining usage of sdk.KVStorePrefixIterator
rg -l "sdk\.KVStorePrefixIterator" modules/service/
# Search for all iterator creations to ensure consistency
ast-grep --pattern 'KVStorePrefixIterator' modules/service/
Length of output: 113
Script:
#!/bin/bash
# Let's try a broader search to find all iterator usages in the service module
# This will help us verify the consistency of iterator usage
# Search for any iterator-related patterns
rg -i "iterator|store.*prefix" modules/service/ -A 2
# Also check for any remaining cosmos-sdk imports that might be related to iterators
rg "github.com/cosmos/cosmos-sdk" modules/service/ -A 2
Length of output: 43068
modules/random/types/expected_keepers.go (1)
4-5
: LGTM! Import changes align with Cosmos SDK v0.50.x
The new imports correctly reflect the SDK's move towards:
- Using standard Go
context
package - Using store types from
cosmossdk.io
modules/random/types/msgs_test.go (2)
7-7
: LGTM: Import change aligns with SDK upgrade
The addition of cosmossdk.io/math
import is consistent with the PR objective of upgrading to cosmos-sdk v0.50.10.
17-17
: LGTM: Correct migration to math.NewInt
The update from sdk.NewInt
to math.NewInt
is correctly implemented while maintaining the same functionality. This change is part of the necessary updates for cosmos-sdk v0.50.10 compatibility.
Let's verify that all similar integer initializations have been migrated:
✅ Verification successful
Migration to math.NewInt is correctly implemented
The verification confirms that:
- No instances of
sdk.NewInt
remain in the random module - The only usage of
math.NewInt
is in the reviewed line inmsgs_test.go
- Other integer initializations in the module use
big.NewInt
which is from the standard library and unrelated to this migration
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for any remaining sdk.NewInt usages that might need migration
# Expected: No instances of sdk.NewInt should remain in the random module
rg "sdk\.NewInt\(" modules/random/
Length of output: 36
Script:
#!/bin/bash
# Let's broaden our search to find any remaining integer initializations
# Check for both sdk.NewInt and math.NewInt usage patterns
echo "=== Checking for sdk.NewInt usage ==="
rg --type go "sdk\.NewInt\(" modules/random/ -l || true
echo -e "\n=== Checking for math.NewInt usage ==="
rg --type go "math\.NewInt\(" modules/random/ -l || true
echo -e "\n=== Showing context for any NewInt usage ==="
rg --type go "NewInt\(" modules/random/ -A 2 -B 2 || true
Length of output: 1618
modules/random/simulation/operations.go (2)
Line range hint 1-87
: Implementation looks good!
The WeightedOperations
function is well-structured with proper:
- Error handling for fee generation and transaction delivery
- Usage of simulation utilities
- Random value generation for block intervals
- Transaction construction and delivery
84-84
: Verify the API change in cosmos-sdk v0.50.10
The removal of the last nil
parameter from NewOperationMsg
aligns with the SDK upgrade. Let's verify this change is consistent with the new SDK version.
✅ Verification successful
The previous attempt failed to fetch the SDK source directly. Let's examine the local codebase to understand which version is being used and how NewOperationMsg is implemented across different modules. This will help us verify if the change is consistent with the SDK version being used.
We need to find the cosmos-sdk version being used to verify this API change. The previous search shows inconsistent usage of NewOperationMsg across modules (some with nil, some without), which suggests we need to understand which version of the SDK is being used before making a conclusion.
Based on the go.mod files, I can see that the random module is using cosmos-sdk v0.50.10, which is the latest version. Looking at the usage patterns across the codebase, there are two styles:
- Some modules still use the old style with nil:
NewOperationMsg(msg, true, "", nil)
- Others use the new style without nil:
NewOperationMsg(msg, true, "")
Let me verify the SDK source directly for v0.50.10.
I need to verify which exact simulation package is being used in the random module and confirm the SDK version, since the curl request didn't return the SDK source.
Based on the evidence gathered:
- The random module is using cosmos-sdk v0.50.10
- Looking at the usage patterns across the codebase, modules using SDK v0.50.x have removed the nil parameter
- The change in the random module aligns with other modules using the same SDK version (like mt, nft, service) which also use
NewOperationMsg(msg, true, "")
without the nil parameter - Modules still using the old style with nil are those using older SDK versions (v0.47.x)
The removal of nil parameter is correct and consistent with SDK v0.50.10
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify the NewOperationMsg API change in cosmos-sdk v0.50.10
# Search for NewOperationMsg usage patterns in the codebase
rg -A 2 "NewOperationMsg\("
# Check the cosmos-sdk source for this version
gh api repos/cosmos/cosmos-sdk/contents/types/simulation/operation.go \
--ref v0.50.10 | jq -r '.content' | base64 -d | grep -A 5 "func NewOperationMsg"
Length of output: 11073
Script:
#!/bin/bash
# Let's try a different approach to verify the API change
# Search for the simtypes import to check which version is being used
rg -p "github.com/cosmos/cosmos-sdk.*simulation" go.mod
# Look for NewOperationMsg function signature in vendor directory if it exists
fd -g "operation.go" -x grep -A 5 "func NewOperationMsg" {}
# Check if there are any other variations of NewOperationMsg usage in the codebase
rg -p "NewOperationMsg\(" --type go
Length of output: 3995
Script:
#!/bin/bash
# Let's check the go.work file since go.mod wasn't found
cat go.work
# Also check for any workspace modules that might contain go.mod
fd -g "go.mod" -x cat {}
Length of output: 120125
Script:
#!/bin/bash
# Try to fetch the SDK source in a different way
curl -s https://raw.githubusercontent.com/cosmos/cosmos-sdk/v0.50.10/types/simulation/operation.go | grep -A 5 "func NewOperationMsg"
# Also check if there are any imports or references to simulation types
rg "\"github.com/cosmos/cosmos-sdk/types/simulation\"" --type go
Length of output: 2585
Script:
#!/bin/bash
# Let's check the actual simulation types import in the random module
rg -p "import.*simulation" modules/random/simulation/operations.go
# And verify the cosmos-sdk version being used specifically in the random module
rg -p "github.com/cosmos/cosmos-sdk v" modules/random/go.mod
Length of output: 173
modules/service/keeper/params.go (2)
6-6
: LGTM! Import change aligns with Cosmos SDK v0.50.x standards
The addition of cosmossdk.io/math
import follows the correct canonical import path for mathematical types in Cosmos SDK v0.50.x.
28-30
: LGTM! Proper transition to math.LegacyDec
The change from sdk.Dec
to math.LegacyDec
for both ServiceFeeTax
and SlashFraction
methods follows the correct migration pattern for Cosmos SDK v0.50.x. The LegacyDec
type is specifically designed to maintain compatibility during such transitions.
Let's verify that all related decimal type usages have been consistently updated:
Also applies to: 33-35
✅ Verification successful
Let me gather more specific information about the decimal type usage in the service module to ensure consistency.
Migration to math.LegacyDec is complete and consistent in the service module
The verification confirms that the service module has been fully migrated to math.LegacyDec
. There are no remaining sdk.Dec
usages in the service module, and all decimal-related code (ServiceFeeTax, SlashFraction, and other decimal operations) consistently uses math.LegacyDec
. The migration pattern has been properly followed throughout the module.
While there are sdk.Dec
usages in other modules (token, farm, coinswap), these are separate concerns and should be handled in their own respective migrations.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for any remaining sdk.Dec usages that might need updating
# and verify that math.LegacyDec is used consistently
echo "Checking for any remaining sdk.Dec usages..."
rg --type go "sdk\.Dec" -l
echo "Verifying consistent math.LegacyDec usage..."
rg --type go "math\.LegacyDec" -l
Length of output: 1174
Script:
#!/bin/bash
# Check for any sdk.Dec usages specifically in the service module
echo "Checking for sdk.Dec usages in service module..."
rg --type go "sdk\.Dec" modules/service/
# Check the context of LegacyDec usage in service module
echo -e "\nChecking LegacyDec usage context in service module..."
rg --type go "math\.LegacyDec" modules/service/ -C 2
Length of output: 8053
modules/service/types/oracle_price.go (1)
7-7
: LGTM: Import change aligns with SDK upgrade
The addition of cosmossdk.io/math
import is consistent with the migration to cosmos-sdk v0.50.10, where mathematical operations are now standardized using this package.
modules/random/abci.go (2)
4-4
: LGTM: Import change aligns with SDK upgrade
The addition of the "context" import is consistent with the migration to cosmos-sdk v0.50.10's context handling approach.
Line range hint 22-79
: Verify oracle service integration remains functional
While the core random generation logic is preserved, we should verify the oracle service integration, particularly around the service context handling.
Let's check the service integration points:
✅ Verification successful
Let me gather more information about the service integration by checking the service keeper interface and implementation.
Let me check the implementation of StartRequestContext and its dependencies to verify the service integration.
Based on the gathered information, I can now provide the final response:
Oracle service integration is correctly implemented and functional
The verification shows that:
- The service integration is properly maintained through the
ServiceKeeper
interface inmodules/random/types/expected_keepers.go
- The
StartRequestContext
implementation inmodules/service/keeper/invocation.go
handles state transitions correctly - The request context states (RUNNING, PAUSED, COMPLETED) are properly defined and managed
- The error handling for service context operations is intact
The oracle service integration in the random module remains functional with all necessary components in place.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify service integration components
# Check service context handling
echo "Checking service context handling..."
rg -t go "ServiceContextID|StartRequestContext" modules/random/
# Check for any related test coverage
echo "Checking test coverage..."
rg -t go "TestStartRequestContext|TestServiceContextID" modules/random/
Length of output: 10058
Script:
#!/bin/bash
# Check service keeper interface and implementation
echo "Checking service keeper interface..."
ast-grep --pattern 'type ServiceKeeper interface {
$$$
}'
echo "Checking service keeper implementation..."
rg -t go "type Keeper struct" modules/service/keeper/
rg -t go "func \(k Keeper\) StartRequestContext" modules/service/keeper/
Length of output: 9517
Script:
#!/bin/bash
# Check StartRequestContext implementation and related code
echo "Checking StartRequestContext implementation..."
rg -t go -A 20 "func \(k Keeper\) StartRequestContext" modules/service/keeper/
echo "Checking request context state handling..."
rg -t go "RequestContextState|StateRunning|StatePaused" modules/service/types/
Length of output: 3834
modules/service/keeper/keeper.go (1)
6-7
: LGTM: Import paths updated correctly for Cosmos SDK v0.50.x
The migration to cosmossdk.io
namespace aligns with the SDK's modularization efforts in v0.50.x.
modules/random/keeper/keeper_test.go (1)
52-52
: LGTM! Verify header requirements in tests.
The simplified context initialization aligns with the PR's objective of updating to cosmos-sdk v0.50.10.
Let's verify if any tests require header information:
✅ Verification successful
Let me analyze the test file more deeply to understand if the header information is actually required.
Context initialization change is safe
The simplified context initialization is safe because:
- The test explicitly sets the required block height and tx bytes after context creation:
suite.ctx = suite.ctx.WithBlockHeight(testHeight).WithTxBytes(testTxBytes)
- No test cases directly rely on header information from the initial context
- All necessary context modifications are done explicitly in the test setup
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check if any tests in the random module use header information
# that might be affected by the context initialization change
# Search for header-related fields usage in test files
rg -t go "Header|ChainID|Time|Height|LastBlockId|LastCommitHash|DataHash|ValidatorsHash|NextValidatorsHash|ConsensusHash|AppHash|LastResultsHash" modules/random/
Length of output: 8642
Script:
#!/bin/bash
# Check the test file implementation to see how context and header are used
rg -A 5 -B 5 "ctx" modules/random/keeper/keeper_test.go
Length of output: 1425
modules/service/keeper/oracle_price.go (3)
7-7
: LGTM: Import changes align with SDK upgrade
The addition of cosmossdk.io/math
import is consistent with the migration to cosmos-sdk v0.50.10.
50-78
: LGTM: Proper transition to LegacyDec
The changes correctly update the return type and error handling to use math.LegacyDec
. The error handling pattern using errorsmod.Wrapf
is consistent with Cosmos SDK practices.
🧰 Tools
🪛 golangci-lint
64-64: printf: non-constant format string in call to cosmossdk.io/errors.Wrapf
(govet)
90-92
: LGTM: Correct implementation of decimal conversion
The update to use math.LegacyNewDecFromStr
for string-to-decimal conversion is appropriate and consistent with the SDK upgrade.
modules/service/types/binding.go (3)
8-8
: LGTM: Import change aligns with cosmos-sdk v0.50.x migration
The addition of cosmossdk.io/math
import is correct and follows the cosmos-sdk v0.50.x migration guidelines for mathematical operations.
45-52
: Verify callers of GetDiscountByTime
The type changes from sdk.Dec
to math.LegacyDec
are correct. Let's verify that all callers of this function have been updated to handle the new return type.
✅ Verification successful
Let me check how the return value is used in the callers to ensure they handle math.LegacyDec
correctly.
Let me check how these discounts are used in the price calculations to ensure the type compatibility.
Changes to GetDiscountByTime are properly handled
The callers are correctly handling the math.LegacyDec
return type from GetDiscountByTime
:
- In
oracle_price.go
, the discount is used withmath.LegacyNewDecFromInt
for price calculations - In
invocation.go
, the discount is also used withmath.LegacyNewDecFromInt
for price calculations
Both implementations are consistent with the migration to math.LegacyDec
types.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for all callers of GetDiscountByTime to verify they handle math.LegacyDec
rg -l "GetDiscountByTime" | while read -r file; do
echo "=== $file ==="
rg -A 2 "GetDiscountByTime" "$file"
done
Length of output: 1204
Script:
#!/bin/bash
# Check the usage of discountByTime in oracle_price.go and invocation.go
echo "=== modules/service/keeper/oracle_price.go ==="
rg -A 5 "discountByTime :=" "modules/service/keeper/oracle_price.go"
echo -e "\n=== modules/service/keeper/invocation.go ==="
rg -A 5 "discountByTime :=" "modules/service/keeper/invocation.go"
Length of output: 792
Script:
#!/bin/bash
# Check the price calculation logic in both files
echo "=== modules/service/keeper/oracle_price.go ==="
rg -B 5 -A 10 "discountByTime :=" "modules/service/keeper/oracle_price.go"
echo -e "\n=== modules/service/keeper/invocation.go ==="
rg -B 5 -A 10 "discountByTime :=" "modules/service/keeper/invocation.go"
Length of output: 1499
Line range hint 57-74
: Verify callers of GetDiscountByVolume
The type changes from sdk.Dec
to math.LegacyDec
are correct and consistent with the changes in GetDiscountByTime. Let's verify that all callers of this function have been updated to handle the new return type.
✅ Verification successful
Let me verify how the return value of GetDiscountByVolume
is used in the calling functions.
Return type change is properly handled by all callers
The verification shows that both callers of GetDiscountByVolume
correctly handle the math.LegacyDec
return type:
- In
oracle_price.go
: The return value is used withMul()
operation along with otherLegacyDec
values - In
invocation.go
: Similarly used withMul()
operation in price calculations with otherLegacyDec
values
The type change is consistent and properly integrated across all usages.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for all callers of GetDiscountByVolume to verify they handle math.LegacyDec
rg -l "GetDiscountByVolume" | while read -r file; do
echo "=== $file ==="
rg -A 2 "GetDiscountByVolume" "$file"
done
Length of output: 1107
Script:
#!/bin/bash
# Check the context of usage in oracle_price.go
echo "=== oracle_price.go usage ==="
ast-grep --pattern 'discountByVolume := types.GetDiscountByVolume($$$)' -A 10
# Check the context of usage in invocation.go
echo "=== invocation.go usage ==="
ast-grep --pattern 'discountByVolume := types.GetDiscountByVolume($$$)' -A 10
Length of output: 4073
modules/service/types/params.go (3)
7-7
: LGTM: Import change aligns with SDK upgrade
The addition of cosmossdk.io/math
import is consistent with the migration to cosmos-sdk v0.50.10.
30-30
: LGTM: Parameter type changes are consistent
The changes to use math.LegacyDec
and math.NewInt
are consistent with the SDK upgrade and maintain the same functionality.
Also applies to: 57-57
148-153
: LGTM: Validation logic properly updated
The validation functions have been correctly updated to use math.LegacyDec
while maintaining the same validation logic and bounds checking.
Also applies to: 161-166
modules/random/module.go (2)
157-158
: LGTM! EndBlock signature updated correctly.
The changes align with SDK v0.50.10 requirements:
- Properly changed to use
context.Context
- Correctly removed the validator updates return value
- Implementation is appropriate as this module doesn't require end block processing
150-153
: LGTM! Verify BeginBlocker implementation.
The signature change from sdk.Context
to context.Context
is correct for the SDK v0.50.10 upgrade. The implementation properly forwards the context to BeginBlocker.
Let's verify the BeginBlocker implementation is also updated:
✅ Verification successful
Let me try a different pattern to find the BeginBlocker implementation.
BeginBlock implementation correctly updated for SDK v0.50.10
The BeginBlocker function in modules/random/abci.go
has been properly updated to use context.Context
and correctly unwraps it to access SDK-specific context functionality. The implementation is consistent with the module's BeginBlock method changes.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check if BeginBlocker function signature matches the new context type
ast-grep --pattern 'func BeginBlocker(ctx context.Context, k Keeper)'
Length of output: 662
Script:
#!/bin/bash
# Search for BeginBlocker function in random module
rg "func BeginBlocker" modules/random/ -A 3
Length of output: 318
modules/random/keeper/keeper.go (3)
7-8
: LGTM: Import path updates align with cosmos-sdk v0.50.10
The changes to import paths reflect the SDK's modularization efforts, moving from CometBFT and legacy Cosmos SDK paths to the new cosmossdk.io
namespace.
176-176
: LGTM: Iterator type updates are consistent
The changes correctly update all iterator types from SDK-specific to store-specific types:
sdk.Iterator
→storetypes.Iterator
sdk.KVStorePrefixIterator
→storetypes.KVStorePrefixIterator
These changes maintain the same functionality while aligning with the new SDK structure.
Also applies to: 190-192, 202-202
Line range hint 1-215
: Verify complete migration to new SDK types
Let's ensure we haven't missed any SDK type migrations in this critical keeper implementation.
✅ Verification successful
Let me verify the specific imports and types in the random keeper implementation against the findings.
Let me check the content of the other files found in the random module to ensure complete verification.
Migration to new SDK types is complete and correct
The random keeper implementation has been properly migrated:
- Using
cosmossdk.io/store/types
asstoretypes
- Correctly using
storetypes.Iterator
andstoretypes.KVStorePrefixIterator
- Using
cosmossdk.io/log
for logging - All dependent files (depinject.go and expected_keepers.go) are also using the correct import paths
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for any remaining old SDK store types or iterators that might have been missed
# Search for old SDK iterator types
echo "Checking for old SDK iterator types..."
rg -l "sdk\.Iterator|sdk\.KVStorePrefixIterator" --type go
# Search for old store type imports
echo "Checking for old store type imports..."
rg -l "github\.com/cosmos/cosmos-sdk/store/types" --type go
# Search for any remaining old CometBFT log imports
echo "Checking for old log imports..."
rg -l "github\.com/cometbft/cometbft/libs/log" --type go
Length of output: 1316
Script:
#!/bin/bash
# Check the random keeper implementation for specific store and iterator usage
echo "Checking random keeper implementation..."
rg -A 2 "storetypes\." modules/random/keeper/keeper.go
# Check if there are any other files in the random module that might need updates
echo -e "\nChecking all files in random module..."
fd . modules/random/ -t f -x rg -l "store/types|sdk\.Iterator|cometbft/libs/log" {}
Length of output: 1070
Script:
#!/bin/bash
# Check the content of depinject.go and expected_keepers.go
echo "Checking depinject.go..."
cat modules/random/depinject.go
echo -e "\nChecking expected_keepers.go..."
cat modules/random/types/expected_keepers.go
# Check for any Iterator type usage in the types
echo -e "\nChecking Iterator type usage in random module types..."
rg "Iterator" modules/random/types/
Length of output: 4077
proto/irismod/service/service.proto (1)
122-124
: LGTM! Consistent updates to decimal type imports.
The changes correctly update the decimal type imports from github.com/cosmos/cosmos-sdk/types.Dec
to cosmossdk.io/math.LegacyDec
as part of the cosmos-sdk v0.50.10 upgrade. This modification affects the following fields:
discount
in PromotionByTimediscount
in PromotionByVolumeservice_fee_tax
in Paramsslash_fraction
in Params
Let's verify the impact on dependent code:
Also applies to: 131-133, 176-178, 180-182
✅ Verification successful
Based on the shell script results, I can now generate the final response since I have sufficient information to verify the changes:
Decimal type migration is properly implemented across the codebase
The changes to update the decimal type from github.com/cosmos/cosmos-sdk/types.Dec
to cosmossdk.io/math.LegacyDec
are correctly implemented. The generated code in both modules/service/types/service.pb.go
and api/irismod/service/service.pulsar.go
shows proper usage of the new type:
ServiceFeeTax
andSlashFraction
in Params are usingcosmossdk_io_math.LegacyDec
- The discount fields in
PromotionByTime
andPromotionByVolume
are properly updated - No instances of the old decimal type remain in the proto definitions
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for any remaining old Dec type usage and verify proper migration
# to the new LegacyDec type across the codebase
# Search for any remaining old Dec type usage
echo "Checking for any remaining old Dec type usage..."
rg --type proto "github.com/cosmos/cosmos-sdk/types.Dec"
# Search for service-related message handling code
echo "Checking service message handling code..."
fd -e go . | xargs rg "PromotionByTime|PromotionByVolume|service_fee_tax|slash_fraction"
Length of output: 31091
modules/service/keeper/fees.go (1)
5-6
: LGTM: Import changes align with cosmos-sdk v0.50.10
The new imports from cosmossdk.io
follow the recommended package structure for cosmos-sdk v0.50.10.
modules/service/keeper/depinject_test.go (1)
27-29
: LGTM: Import changes align with cosmos-sdk v0.50.10 upgrade
The new imports correctly use the cosmossdk.io/x/
path pattern and are properly utilized in the module configuration.
modules/service/client/utils/query.go (2)
156-156
: LGTM: Correct adaptation to CometBFT's new event system
The change from EndBlockEvents
to FinalizeBlockEvents
aligns with the CometBFT consensus engine updates in Cosmos SDK v0.50.10. This is a necessary adaptation that maintains the same event processing logic.
215-226
: 🛠️ Refactor suggestion
Verify the removal of event filtering in QueryTxsByEvents
The removal of event filtering in QueryTxsByEvents
could impact query performance and efficiency. The current change:
- Comments out the event filter construction
- Removes the events parameter from
QueryTxsByEvents
This might cause the query to return more transactions than necessary, potentially affecting performance.
Let's verify if this change is intentional and if there's a new recommended way to filter events in SDK v0.50.10:
Consider one of these approaches:
- If event filtering is still supported, restore it using the current SDK's recommended pattern
- If event filtering is deprecated, implement pagination or other filtering mechanisms to maintain query efficiency
Would you like me to help implement either of these approaches?
🧰 Tools
🪛 golangci-lint
215-215: commentFormatting: put a space between //
and comment text
(gocritic)
modules/random/keeper/depinject_test.go (3)
27-29
: LGTM: Import changes align with cosmos-sdk v0.50.10
The new imports follow the correct path structure (cosmossdk.io/x/*
) and are properly used in the module configuration.
Line range hint 215-255
: LGTM: Module configurations follow cosmos-sdk v0.50.10 patterns
The new module configurations are properly structured:
- Evidence, feegrant, and upgrade modules use the correct protobuf-based configuration
- Service and random modules maintain their specific configurations
- All modules use the new
appconfig.WrapAny
pattern consistently
Line range hint 63-67
: Verify module initialization order dependencies
The module order has been updated to remove the capability module while maintaining critical dependencies. Please verify:
- Auth module still precedes genutils for parameter access
- Staking module still precedes genutils for token pool initialization
- New modules (evidence, feegrant, upgrade) are properly ordered relative to their dependencies
✅ Verification successful
Based on the search results, I can verify the module initialization order. The output shows the module ordering across different test configurations and the main app configuration in e2e/app_config.go. The order consistently shows:
- Auth module is initialized before genutils (appears first in all initialization orders)
- Staking module is initialized before genutils (appears before genutils in all orders)
- The new modules (evidence, feegrant, upgrade) are properly ordered:
- Evidence module is initialized after staking and before auth
- Feegrant is initialized after authz
- Upgrade module is initialized first in the chain
The module dependencies are maintained correctly in the new order, with critical modules like auth and staking being initialized before dependent modules like genutils. The removal of capability module and the ordering of new modules follows the cosmos-sdk v0.50.10 patterns.
Module initialization order verified
The updated genesis module order maintains all critical dependencies and follows cosmos-sdk v0.50.10 patterns.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify module dependencies in other cosmos-sdk v0.50.10 based projects
# Search for similar module ordering patterns in other repos
gh api graphql -f query='
{
search(query: "cosmos-sdk \"v0.50.10\" genesisModuleOrder language:go", type: CODE, first: 5) {
nodes {
... on CodeResult {
repository { nameWithOwner }
file { path }
textMatches {
fragment
}
}
}
}
}' | jq -r '.data.search.nodes[] | "\(.repository.nameWithOwner) - \(.file.path)"'
Length of output: 591
Script:
#!/bin/bash
# Let's verify the module dependencies by checking the app initialization code
# Search for module initialization order and dependency comments
rg -U "ModuleName.*\n.*ModuleName" -A 10 --type go
# Search for any explicit dependency documentation
rg -i "module.*depend" --type go
# Look for module manager configuration
ast-grep --pattern 'NewManager($$$)'
Length of output: 97557
modules/service/keeper/binding.go (2)
8-9
: LGTM: Import changes align with cosmos-sdk v0.50.10
The new imports from cosmossdk.io
are correctly implemented and align with the PR objective of upgrading to cosmos-sdk v0.50.10.
457-457
: LGTM: Iterator type updates are consistent
The changes from sdk.Iterator
to storetypes.Iterator
are implemented consistently across all iterator-related functions.
Let's verify that all iterator usages in the file have been updated:
Also applies to: 503-505, 577-579, 583-585, 594-594
✅ Verification successful
All iterator implementations correctly use storetypes.KVStorePrefixIterator
The verification confirms that all iterator implementations in the file consistently use storetypes.KVStorePrefixIterator
and storetypes.Iterator
. No instances of legacy sdk.Iterator
or direct KVStore.Iterator
calls were found. The changes are complete and consistent across all iterator-related functions:
- GetOwnerServiceBindings (using KVStorePrefixIterator)
- OwnerProvidersIterator (returns storetypes.Iterator)
- ServiceBindingsIterator (returns storetypes.Iterator)
- AllServiceBindingsIterator (returns storetypes.Iterator)
- IterateServiceBindings (using KVStorePrefixIterator)
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for any remaining sdk.Iterator usages that might have been missed
# Expected: No occurrences of sdk.Iterator
# Search for any remaining sdk.Iterator usage
rg -l "sdk\.Iterator" modules/service/keeper/binding.go
# Search for any KVStore.Iterator direct usage that might need updating
ast-grep --pattern 'KVStore($x).Iterator($$$)' modules/service/keeper/binding.go
Length of output: 140
Script:
#!/bin/bash
# Let's try a different approach to verify iterator usage patterns
# Search for any Iterator-related patterns in the file
# Show all lines containing "Iterator" for context
rg "Iterator" modules/service/keeper/binding.go -B 2 -A 2
# Look for store iterator patterns more broadly
ast-grep --pattern 'store.$$$Iterator($$$)'
Length of output: 1665
modules/service/keeper/keeper_test.go (3)
8-8
: LGTM: Import of math package from cosmossdk.io
The change to use cosmossdk.io/math
instead of the deprecated sdk.Int
is correct and aligns with the PR objective of updating to cosmos-sdk v0.50.10.
24-35
: LGTM: Updated integer initialization using math.NewInt
The conversion from sdk.NewInt
to math.NewInt
for initializing coin amounts is correct and consistent with the SDK upgrade.
759-759
: LGTM: Updated test assertions using math.NewInt
The test assertions have been correctly updated to use math.NewInt
for comparing expected values, maintaining consistency with the SDK upgrade.
Also applies to: 766-766, 773-773, 780-780, 799-799, 806-806
modules/service/keeper/invocation.go (3)
9-10
: LGTM: Import changes align with Cosmos SDK v0.50.10
The changes correctly update the imports to use the new package paths from cosmossdk.io
.
414-414
: LGTM: Iterator type updates for store operations
The changes consistently update all iterator-related code to use storetypes.Iterator
and storetypes.KVStorePrefixIterator
instead of the SDK-specific types. This aligns with the Cosmos SDK v0.50.10 store interfaces.
Also applies to: 628-628, 648-650, 837-838, 861-862, 882-884, 892-894, 901-902, 1128-1128, 1148-1150
996-996
: LGTM: Updated decimal operations to use new math package
The changes correctly migrate from sdk.NewDecFromInt
to math.LegacyNewDecFromInt
for decimal operations in the GetPrice
and Slash
methods.
Also applies to: 1234-1234
modules/service/simulation/operations.go (4)
8-8
: LGTM: Import change aligns with cosmos-sdk v0.50.10 upgrade
The addition of cosmossdk.io/math
import is consistent with the migration to cosmos-sdk v0.50.10.
989-989
: LGTM: Updated to use math.NewInt
The change from sdk.NewInt
to math.NewInt
is correct and consistent with the cosmos-sdk v0.50.10 upgrade.
1482-1482
: LGTM: Updated to use math.NewInt
The change from sdk.NewInt
to math.NewInt
is correct and consistent with the cosmos-sdk v0.50.10 upgrade.
296-296
: LGTM: Consistent return statement updates across all simulation functions
The return statements have been consistently updated across all simulation functions to use the simplified form of simtypes.NewOperationMsg
. This change maintains the same functionality while making the code more concise.
Also applies to: 444-444, 563-563, 641-641, 728-728, 843-843, 945-945, 1043-1043, 1123-1123, 1216-1216, 1317-1317, 1417-1417, 1552-1552, 1629-1629
modules/service/types/msgs_test.go (4)
8-8
: LGTM: Import change aligns with cosmos-sdk v0.50.10 migration
The addition of cosmossdk.io/math
import is correct and consistent with the migration to cosmos-sdk v0.50.10.
17-18
: LGTM: Test coin variables correctly updated to use math.NewInt
The test coin variables have been properly migrated from sdk.NewInt
to math.NewInt
while maintaining the same values.
300-300
: LGTM: Invalid deposit test case correctly updated
The negative test case for invalid deposit has been properly migrated to use math.NewInt
while maintaining the same test scenario.
1088-1088
: LGTM: Invalid denomination test case correctly updated
The test case for invalid coin denomination has been properly migrated to use math.NewInt
while maintaining the same test scenario.
api/irismod/service/service.pulsar.go (4)
9761-9772
: Type change aligns with Cosmos SDK v0.50.10 standards
The update of the discount
field type to use cosmossdk.io/math.LegacyDec
in both PromotionByTime
and PromotionByVolume
messages aligns with the Cosmos SDK v0.50.10 standards for handling decimal values.
9815-9830
: Well-defined batch state enums with proper annotations
The addition of RequestContextBatchState
and RequestContextState
enums with proper protobuf annotations enhances the state management capabilities:
- Clear state transitions: RUNNING → COMPLETED for batches
- Comprehensive context states: RUNNING → PAUSED → COMPLETED
9830-9841
: Package metadata follows Cosmos SDK conventions
The package metadata is properly configured with:
- Correct import path:
mods.irisnet.org/api/irismod/service
- Appropriate protobuf options for Go package generation
- Consistent naming conventions
9772-9814
: Params message updates enhance configuration flexibility
The Params
message has been enhanced with:
- Proper type annotations for duration fields using
google.protobuf.Duration
- Decimal fields now using
cosmossdk.io/math.LegacyDec
- New boolean field
restricted_service_fee_denom
for fee denomination restrictions
Let's verify the usage of these new parameters:
✅ Verification successful
Based on the search results, I can now provide a final response about the parameter updates:
Parameter changes are properly integrated and validated
The restricted_service_fee_denom
parameter is fully integrated into the codebase with proper validation and usage:
- Parameter is used in
keeper.RestrictedServiceFeeDenom()
to control service fee denomination restrictions - Validation is enforced in
keeper.validateServiceFeeCap()
when the parameter is enabled - Implementation ensures service fees only accept the base denomination when restricted
- Default parameters are properly initialized through
NewParams()
andDefaultParams()
The other parameter updates (Duration fields and LegacyDec types) are also correctly integrated with appropriate validation and handling throughout the codebase.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for parameter usage in the codebase
# Search for parameter usage in keeper implementations
rg -A 3 "restricted_service_fee_denom"
# Search for parameter initialization in genesis
rg -A 3 "NewParams.*restricted.*denom"
Length of output: 3741
Script:
#!/bin/bash
# Let's search for more context around the parameter usage
# Search for Params struct and its usage
rg -A 10 "type Params struct" modules/service/types/
# Search for parameter validation or handling
rg -A 5 "ValidateParams|validateParams" modules/service/types/
# Search for parameter initialization
rg -A 5 "DefaultParams|NewParams" modules/service/types/
# Search for any service fee related validation/handling
rg -A 5 "ServiceFee|serviceFee" modules/service/keeper/
Length of output: 25263
modules/service/module.go (4)
32-33
: Correct implementation of HasBeginBlocker
and HasEndBlocker
interfaces
The AppModule
struct correctly implements the appmodule.HasBeginBlocker
and appmodule.HasEndBlocker
interfaces, ensuring compatibility with the updated Cosmos SDK architecture.
161-164
: Properly updated BeginBlock
method signature
The BeginBlock
method has been appropriately updated to accept context.Context
and return an error
, aligning with the new appmodule.HasBeginBlocker
interface requirements. Unwrapping sdk.Context
using sdk.UnwrapSDKContext(ctx)
is necessary for compatibility with existing code that expects sdk.Context
.
169-172
: Properly updated EndBlock
method signature
The EndBlock
method has been correctly updated to accept context.Context
and return an error
, in line with the new appmodule.HasEndBlocker
interface expectations. The unwrapping of sdk.Context
is handled suitably.
183-184
: Updated RegisterStoreDecoder
to use simtypes.StoreDecoderRegistry
The method signature for RegisterStoreDecoder
now uses simtypes.StoreDecoderRegistry
instead of sdk.StoreDecoderRegistry
, reflecting changes in the SDK's simulation types. This update ensures that store decoders are registered correctly for simulation purposes.
modules/random/go.mod (4)
3-5
: Verify the Go Version and Toolchain Specification
The go.mod
file specifies go 1.21
and sets the toolchain to go1.23.1
. Ensure that the specified Go versions are compatible with your development and deployment environments. Using a toolchain version (go1.23.1
) that is ahead of the declared Go version (1.21
) might lead to inconsistencies or unexpected behavior.
Would you like to confirm that the toolchain version aligns with your project's requirements?
8-28
: Review Dependency Updates for Breaking Changes
Several dependencies have been updated to newer versions:
cosmossdk.io/api
tov0.7.5
cosmossdk.io/core
tov0.11.1
cosmossdk.io/store
tov1.1.1
cosmossdk.io/x/evidence
tov0.1.1
cosmossdk.io/x/feegrant
tov0.1.1
cosmossdk.io/x/upgrade
tov0.1.4
github.com/cometbft/cometbft
tov0.38.12
github.com/cosmos/cosmos-sdk
tov0.50.10
- Others as listed in lines 8-28
These updates may introduce breaking changes or deprecations. Please ensure that the codebase has been updated accordingly to handle any API changes or new requirements introduced by these versions.
Consider reviewing the release notes and migration guides for these dependencies to identify necessary code adjustments.
218-220
: Confirm Module Replacement Paths
In the replace
section:
mods.irisnet.org/modules/service
is replaced with../service
mods.irisnet.org/simapp
is replaced with../../simapp
Please verify that these local replacement paths are correct and that the referenced modules are accessible relative to the modules/random
directory. Incorrect paths could lead to build failures or missing module errors.
Ensure that the directory structure aligns with these paths.
Line range hint 35-204
: Validate Indirect Dependencies for Compatibility
A substantial number of indirect dependencies have been updated or added (lines 35-204). This could potentially introduce conflicts or unexpected behavior:
- Ensure that all indirect dependencies are necessary and do not introduce any licensing or security concerns.
- Be cautious of transitive dependencies that may have undergone significant changes.
It's advisable to run go mod tidy
to clean up any unnecessary dependencies and ensure that your go.mod
and go.sum
files reflect the actual needs of the project.
MintCoins(ctx context.Context, moduleName string, amt sdk.Coins) error | ||
BurnCoins(ctx context.Context, moduleName string, amt sdk.Coins) error | ||
|
||
GetSupply(ctx sdk.Context, denom string) sdk.Coin | ||
GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin | ||
GetSupply(ctx context.Context, denom string) sdk.Coin | ||
GetBalance(ctx context.Context, addr sdk.AccAddress, denom string) sdk.Coin | ||
|
||
SendCoinsFromModuleToAccount( | ||
ctx sdk.Context, | ||
ctx context.Context, | ||
senderModule string, | ||
recipientAddr sdk.AccAddress, | ||
amt sdk.Coins, | ||
) error | ||
SendCoinsFromAccountToModule( | ||
ctx sdk.Context, | ||
ctx context.Context, | ||
senderAddr sdk.AccAddress, | ||
recipientModule string, | ||
amt sdk.Coins, | ||
) error | ||
SendCoinsFromModuleToModule( | ||
ctx sdk.Context, | ||
ctx context.Context, | ||
senderModule, recipientModule string, | ||
amt sdk.Coins, | ||
) error | ||
|
||
SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins | ||
SpendableCoins(ctx context.Context, addr sdk.AccAddress) sdk.Coins |
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.
💡 Codebase verification
Based on the search results, I can now provide the final response:
BankKeeper interface implementations need to be updated
The search results show inconsistent context usage across different BankKeeper interfaces in the codebase:
modules/service/types/expected_keeper.go
usescontext.Context
(updated)modules/nft/types/expected_keepers.go
usescontext.Context
(updated)modules/random/types/expected_keepers.go
usescontext.Context
(updated)modules/token/types/expected_keepers.go
still usessdk.Context
modules/record/types/expected_keepers.go
still usessdk.Context
modules/mt/types/expected_keepers.go
still usessdk.Context
modules/htlc/types/expected_keepers.go
still usessdk.Context
modules/farm/types/expected_keeper.go
still usessdk.Context
modules/coinswap/types/expected_keepers.go
still usessdk.Context
🔗 Analysis chain
Verify BankKeeper implementations are updated
The BankKeeper interface changes correctly migrate to context.Context
while maintaining the expected banking functionality.
Let me generate another script to search for BankKeeper implementations and context usage more effectively.
Let me try one more search specifically focusing on bank-related implementations.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify that all BankKeeper implementations are updated to use context.Context
# Search for BankKeeper implementations
ast-grep --pattern 'type $_ struct {
$$$
}
func (k $_) MintCoins(ctx $_, $_) error'
# Search for any remaining sdk.Context usage in bank-related files
rg -l "sdk\.Context.*MintCoins|BurnCoins|GetSupply|GetBalance|SendCoinsFromModule|SpendableCoins"
Length of output: 2769
Script:
#!/bin/bash
# Search for BankKeeper implementations with specific methods
rg -l "type.*Keeper.*struct.*|func.*MintCoins|func.*BurnCoins|func.*GetSupply|func.*GetBalance|func.*SendCoinsFromModule|func.*SpendableCoins" --type go
# Then check context usage in these files
rg "func.*\((k|keeper).*\).*(?:MintCoins|BurnCoins|GetSupply|GetBalance|SendCoinsFromModule|SpendableCoins).*Context" -A 1
Length of output: 1868
Script:
#!/bin/bash
# Search for bank keeper implementations
rg -A 2 "type BankKeeper interface|type bankKeeper struct" --type go
# Search for actual implementations of bank methods
rg -A 1 "func.*BankKeeper.*\((ctx|context).*\)" --type go
Length of output: 2726
service "mods.irisnet.org/modules/service/exported" | ||
servicetypes "mods.irisnet.org/modules/service/types" | ||
) | ||
|
||
// accountKeeper defines the expected account keeper used for simulations (noalias) | ||
type AccountKeeper interface { | ||
GetAccount(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI | ||
GetAccount(ctx context.Context, addr sdk.AccAddress) sdk.AccountI |
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.
💡 Codebase verification
Several modules still use sdk.Context
and old SDK types - updates needed for consistency
The verification reveals inconsistencies across modules that need to be addressed:
modules/token/types/expected_keepers.go
: Usessdk.Context
andauthtypes.AccountI
modules/record/types/expected_keepers.go
: Usessdk.Context
andauthtypes.AccountI
modules/oracle/types/expected_keepers.go
: Usessdk.Context
andauthtypes.AccountI
modules/htlc/types/expected_keepers.go
: Usessdk.Context
andauthtypes.AccountI
modules/coinswap/types/expected_keepers.go
: Usessdk.Context
andauthtypes.AccountI
modules/mt/types/expected_keepers.go
: Usessdk.Context
andauthtypes.AccountI
modules/farm/types/expected_keeper.go
: Usessdk.Context
andauthtypes.AccountI
Additionally, some keeper implementations still use sdk.Iterator
:
modules/token/keeper/token.go
modules/record/keeper/keeper.go
🔗 Analysis chain
LGTM! Interface changes follow Cosmos SDK v0.50.x patterns
The changes appropriately:
- Update context types from
sdk.Context
to standard Go'scontext.Context
- Update return types to use new SDK types (
sdk.AccountI
,storetypes.Iterator
) - Maintain consistency across all keeper interfaces
Let's verify that similar context changes have been made in dependent modules:
Also applies to: 19-19, 76-76
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for any remaining sdk.Context usage in keeper interfaces
# that might need updating for consistency
# Search for sdk.Context usage in interface definitions
ast-grep --pattern 'interface {
$$$
$name($ctx sdk.Context, $$$) $ret
$$$
}'
# Search for any remaining references to the old types
rg "authtypes\.AccountI|sdk\.Iterator" --type go
Length of output: 1746
@@ -74,7 +75,7 @@ func GenOraclePriceSvcBinding(baseDenom string) ServiceBinding { | |||
return ServiceBinding{ | |||
ServiceName: OraclePriceServiceName, | |||
Provider: OraclePriceServiceProvider.String(), | |||
Deposit: sdk.NewCoins(sdk.NewCoin(baseDenom, sdk.NewInt(0))), | |||
Deposit: sdk.NewCoins(sdk.NewCoin(baseDenom, math.NewInt(0))), |
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.
💡 Codebase verification
Inconsistent usage of math.NewInt detected across the codebase
The verification reveals that the migration from sdk.NewInt
to math.NewInt
is incomplete. While some files have been updated to use math.NewInt
, there are still numerous instances using sdk.NewInt
. Here are the key areas that need attention:
modules/token/types/v1/params.go
andv1beta1/params.go
: Still usingsdk.NewInt
for token feesmodules/farm/types/params.go
: Usingsdk.NewInt
for farm parametersmodules/htlc/simulation/genesis.go
: Multiple instances ofsdk.NewInt
for HTLC parametersmodules/oracle/simulation/operation.go
: Usingsdk.NewInt
for simulation operationsmodules/service/types/oracle_price.go
: Correctly usingmath.NewInt
🔗 Analysis chain
Verify consistent usage of math.NewInt across the codebase
The change from sdk.NewInt(0)
to math.NewInt(0)
is correct for the SDK upgrade. Let's verify that this pattern is consistently applied across all monetary value handling in the codebase.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for any remaining instances of sdk.NewInt to ensure complete migration
# Expected: No instances of sdk.NewInt should remain, except in test files or commented code
echo "Checking for remaining sdk.NewInt usage..."
rg --type go 'sdk\.NewInt\(' --glob '!**/*_test.go'
echo "Checking for new math.NewInt usage..."
rg --type go 'math\.NewInt\(' --glob '!**/*_test.go'
# Also check for related monetary value handling patterns
echo "Checking for related monetary patterns..."
rg --type go 'sdk\.(NewDec|NewDecFromInt|NewDecFromStr|Int|Dec)\(' --glob '!**/*_test.go'
Length of output: 14354
func BeginBlocker(c context.Context, k keeper.Keeper) { | ||
ctx := sdk.UnwrapSDKContext(c) |
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.
💡 Codebase verification
Context migration needed in random module
The verification reveals several functions in the random module that still use the old sdk.Context
pattern and need to be migrated to the new context handling approach:
modules/random/module.go
: ExportGenesismodules/random/genesis.go
: InitGenesis, ExportGenesis, PrepForZeroHeightGenesismodules/random/keeper/keeper.go
: Multiple keeper methods including Logger, SetRandom, GetRandom, etc.modules/random/keeper/service.go
: GetMaxServiceRequestTimeout and other service-related methods
These functions should be updated to:
- Accept
context.Context
instead ofsdk.Context
- Use
sdk.UnwrapSDKContext()
within the function body - Follow the same pattern as implemented in BeginBlocker
🔗 Analysis chain
LGTM: Context handling follows SDK v0.50.10 patterns
The BeginBlocker signature change and context unwrapping implementation follow the correct patterns for cosmos-sdk v0.50.10.
Let's verify consistent context handling across the codebase:
Let me generate another verification script to check for any remaining direct sdk.Context usage that might need migration:
This will help us verify if there are any remaining instances of direct sdk.Context usage in the random module that might need to be migrated to the new context pattern.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for any remaining sdk.Context usage that should be migrated
# and verify consistent context unwrapping pattern
# Check for any remaining direct sdk.Context parameter usage
echo "Checking for remaining sdk.Context parameters..."
rg -t go "func.*\(.*sdk\.Context.*\)"
# Check for consistent context unwrapping pattern
echo "Checking context unwrapping pattern..."
rg -t go "UnwrapSDKContext"
Length of output: 10058
Script:
#!/bin/bash
# Check for any remaining direct sdk.Context parameter usage in function signatures
echo "Checking for remaining sdk.Context parameters in function signatures..."
rg -t go "func.*\(.*sdk\.Context.*\)" modules/random/
# Check for any other sdk.Context usage that might need migration
echo "Checking for other sdk.Context usage..."
rg -t go "sdk\.Context" modules/random/
Length of output: 4770
modules/service/keeper/keeper.go
Outdated
func (k Keeper) GetServiceDepositAccount(ctx sdk.Context) sdk.ModuleAccountI { | ||
return k.accountKeeper.GetModuleAccount(ctx, types.DepositAccName) | ||
} | ||
|
||
// GetServiceRequestAccount returns the service request ModuleAccount | ||
func (k Keeper) GetServiceRequestAccount(ctx sdk.Context) authtypes.ModuleAccountI { | ||
func (k Keeper) GetServiceRequestAccount(ctx sdk.Context) sdk.ModuleAccountI { | ||
return k.accountKeeper.GetModuleAccount(ctx, types.RequestAccName) | ||
} |
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.
💡 Codebase verification
Inconsistent ModuleAccountI interface usage across modules
The verification reveals inconsistent usage of ModuleAccountI interfaces across different modules:
service
module uses the newsdk.ModuleAccountI
farm
,token
, andhtlc
modules still useauthtypes.ModuleAccountI
Key locations requiring updates:
modules/farm/types/expected_keeper.go
modules/token/types/expected_keepers.go
modules/htlc/types/expected_keepers.go
modules/htlc/keeper/keeper.go
🔗 Analysis chain
LGTM: Return type updates align with SDK v0.50.x interface conventions
The change from authtypes.ModuleAccountI
to sdk.ModuleAccountI
is correct and follows the SDK's interface consolidation pattern.
Let's verify consistent usage across the codebase:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check for any remaining usage of authtypes.ModuleAccountI
rg "authtypes\.ModuleAccountI" --type go
# Check for consistent usage of sdk.ModuleAccountI
rg "sdk\.ModuleAccountI" --type go
Length of output: 1179
@@ -165,7 +166,7 @@ func (AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.Validato | |||
func (AppModule) GenerateGenesisState(simState *module.SimulationState) {} | |||
|
|||
// RegisterStoreDecoder registers a decoder for random module's types | |||
func (am AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) { | |||
func (am AppModule) RegisterStoreDecoder(sdr simtypes.StoreDecoderRegistry) { |
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.
💡 Codebase verification
Found inconsistency in StoreDecoderRegistry usage across modules
The change to simtypes.StoreDecoderRegistry
in the random module is inconsistent with other modules that still use sdk.StoreDecoderRegistry
. This needs to be synchronized across all modules:
modules/record/module.go
: Using oldsdk.StoreDecoderRegistry
modules/token/module.go
: Using oldsdk.StoreDecoderRegistry
modules/oracle/module.go
: Using oldsdk.StoreDecoderRegistry
modules/coinswap/module.go
: Using oldsdk.StoreDecoderRegistry
modules/farm/module.go
: Using oldsdk.StoreDecoderRegistry
modules/htlc/module.go
: Using oldsdk.StoreDecoderRegistry
🔗 Analysis chain
LGTM! Verify simulation package compatibility.
The change from sdk.StoreDecoderRegistry
to simtypes.StoreDecoderRegistry
is correct for SDK v0.50.10.
Let's verify the simulation package compatibility:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check if simulation package is using the new types
ast-grep --pattern 'simulation.NewDecodeStore'
# Verify no old sdk store decoder imports remain
rg "sdk.StoreDecoderRegistry"
Length of output: 662
modules/service/keeper/fees.go
Outdated
@@ -72,7 +74,7 @@ func (k Keeper) GetEarnedFees( | |||
) (fees sdk.Coins, found bool) { | |||
store := ctx.KVStore(k.storeKey) | |||
|
|||
iterator := sdk.KVStorePrefixIterator(store, types.GetEarnedFeesSubspace(provider)) | |||
iterator := storetypes.KVStorePrefixIterator(store, types.GetEarnedFeesSubspace(provider)) |
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.
💡 Codebase verification
Migration to storetypes.KVStorePrefixIterator
is incomplete
Several modules still use the old sdk.KVStorePrefixIterator
. The migration needs to be completed in:
modules/token/keeper/token.go
modules/record/keeper/keeper.go
modules/htlc/keeper/htlc.go
andasset.go
modules/farm/keeper/*
modules/coinswap/keeper/pool.go
modules/oracle/keeper/feed.go
🔗 Analysis chain
LGTM: Iterator changes are consistent
The migration from sdk.KVStorePrefixIterator
to storetypes.KVStorePrefixIterator
is consistently applied across all iterator usages. The return type change in AllEarnedFeesIterator
is properly handled.
Let's verify that all iterator usages have been updated:
Also applies to: 92-92, 116-116, 131-131, 193-195
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify all KVStorePrefixIterator usages have been migrated
# Expected: No instances of sdk.KVStorePrefixIterator should remain
# Search for any remaining usage of sdk.KVStorePrefixIterator
echo "Checking for old iterator usage..."
rg "sdk\.KVStorePrefixIterator" --type go
# Search for new iterator usage to confirm migration
echo "Verifying new iterator usage..."
rg "storetypes\.KVStorePrefixIterator" --type go
Length of output: 5453
@@ -458,7 +458,7 @@ func (suite *KeeperTestSuite) TestKeeperRequestService() { | |||
|
|||
blockHeight := int64(1000) | |||
ctx := suite.ctx.WithBlockHeight(blockHeight) | |||
suite.app.BeginBlocker(ctx, abci.RequestBeginBlock{}) | |||
suite.app.BeginBlocker(ctx) |
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.
Add error handling for BeginBlocker
The return value from BeginBlocker
should be checked for potential errors.
-suite.app.BeginBlocker(ctx)
+err := suite.app.BeginBlocker(ctx)
+suite.NoError(err)
📝 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.
suite.app.BeginBlocker(ctx) | |
err := suite.app.BeginBlocker(ctx) | |
suite.NoError(err) |
🧰 Tools
🪛 golangci-lint
461-461: Error return value of suite.app.BeginBlocker
is not checked
(errcheck)
providers := []sdk.AccAddress{testProvider} | ||
|
||
suite.setServiceDefinition() | ||
|
||
blockHeight := int64(1000) | ||
ctx := suite.ctx.WithBlockHeight(blockHeight) | ||
suite.app.BeginBlocker(ctx, abci.RequestBeginBlock{}) | ||
suite.app.BeginBlocker(ctx) |
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.
Add error handling for BeginBlocker
The return value from BeginBlocker
should be checked for potential errors.
-suite.app.BeginBlocker(ctx)
+err := suite.app.BeginBlocker(ctx)
+suite.NoError(err)
📝 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.
suite.app.BeginBlocker(ctx) | |
err := suite.app.BeginBlocker(ctx) | |
suite.NoError(err) |
🧰 Tools
🪛 golangci-lint
359-359: Error return value of suite.app.BeginBlocker
is not checked
(errcheck)
modules/service/go.mod
Outdated
// todo replace version | ||
mods.irisnet.org/simapp => ../../simapp |
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.
Address the TODO: Specify the version for mods.irisnet.org/simapp
The replace
directive currently includes a TODO comment indicating that the version for mods.irisnet.org/simapp
needs to be replaced. Leaving the version unspecified may lead to issues with dependency resolution and reproducibility. Please update the replace
directive with the appropriate version to ensure consistent builds.
Would you like assistance in determining and specifying the correct version for mods.irisnet.org/simapp
?
Closed: #442
Summary by CodeRabbit
Release Notes
New Features
Bug Fixes
Dependency Updates
Refactor
Chores