diff --git a/modules/service/go.mod b/modules/service/go.mod index 415fbdbd..1dbb197f 100644 --- a/modules/service/go.mod +++ b/modules/service/go.mod @@ -2,8 +2,6 @@ module mods.irisnet.org/modules/service go 1.21 -toolchain go1.23.1 - require ( cosmossdk.io/api v0.7.5 cosmossdk.io/core v0.11.1 diff --git a/modules/service/keeper/keeper.go b/modules/service/keeper/keeper.go index 62199d4a..3dca2581 100644 --- a/modules/service/keeper/keeper.go +++ b/modules/service/keeper/keeper.go @@ -7,8 +7,6 @@ import ( storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "mods.irisnet.org/modules/service/types" ) @@ -67,11 +65,11 @@ func (k Keeper) Logger(ctx sdk.Context) log.Logger { } // GetServiceDepositAccount returns the service depost ModuleAccount -func (k Keeper) GetServiceDepositAccount(ctx sdk.Context) authtypes.ModuleAccountI { +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) } diff --git a/modules/service/keeper/keeper_test.go b/modules/service/keeper/keeper_test.go index b29c5b56..e30bf36d 100644 --- a/modules/service/keeper/keeper_test.go +++ b/modules/service/keeper/keeper_test.go @@ -349,6 +349,7 @@ func (suite *KeeperTestSuite) TestRegisterCallback() { func (suite *KeeperTestSuite) TestKeeperRequestContext() { consumer := testConsumer + providers := []sdk.AccAddress{testProvider} suite.setServiceDefinition() diff --git a/modules/service/simulation/operations.go b/modules/service/simulation/operations.go index 573d13ae..5e17bd42 100644 --- a/modules/service/simulation/operations.go +++ b/modules/service/simulation/operations.go @@ -1,11 +1,11 @@ package simulation import ( - "cosmossdk.io/math" "errors" "fmt" "math/rand" + "cosmossdk.io/math" tmbytes "github.com/cometbft/cometbft/libs/bytes" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/codec" diff --git a/modules/service/types/expected_keeper.go b/modules/service/types/expected_keeper.go index 41df09e2..37087cda 100644 --- a/modules/service/types/expected_keeper.go +++ b/modules/service/types/expected_keeper.go @@ -1,43 +1,46 @@ package types import ( + "context" + + "cosmossdk.io/core/address" sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) // BankKeeper defines the expected bank keeper (noalias) type BankKeeper interface { - MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error - BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error + 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 GetBlockedAddresses() map[string]bool } // AccountKeeper defines the expected account keeper (noalias) type AccountKeeper interface { - GetAccount(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI + GetAccount(ctx context.Context, addr sdk.AccAddress) sdk.AccountI GetModuleAddress(name string) sdk.AccAddress - GetModuleAccount(ctx sdk.Context, name string) authtypes.ModuleAccountI + GetModuleAccount(ctx context.Context, name string) sdk.ModuleAccountI + AddressCodec() address.Codec } diff --git a/modules/service/types/msgs_test.go b/modules/service/types/msgs_test.go index 504a612e..17bc9db2 100644 --- a/modules/service/types/msgs_test.go +++ b/modules/service/types/msgs_test.go @@ -5,6 +5,7 @@ import ( "strings" "testing" + "cosmossdk.io/math" "github.com/cometbft/cometbft/crypto/tmhash" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" @@ -13,8 +14,8 @@ import ( var ( emptyAddress = "" - testCoin1 = sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(10000)) - testCoin2 = sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(100)) + testCoin1 = sdk.NewCoin(sdk.DefaultBondDenom, math.NewInt(10000)) + testCoin2 = sdk.NewCoin(sdk.DefaultBondDenom, math.NewInt(100)) testServiceName = "test-service" testServiceDesc = "test-service-desc" @@ -296,7 +297,7 @@ func TestMsgBindServiceType(t *testing.T) { // TestMsgBindServiceValidation tests ValidateBasic for MsgBindService func TestMsgBindServiceValidation(t *testing.T) { invalidLongName := strings.Repeat("s", MaxNameLength+1) - invalidDeposit := sdk.Coins{sdk.Coin{Denom: "stake", Amount: sdk.NewInt(-1)}} + invalidDeposit := sdk.Coins{sdk.Coin{Denom: "stake", Amount: math.NewInt(-1)}} invalidQoS := uint64(0) invalidPricing := `{"price":"1stake","other":"notallowedfield"}` @@ -1084,7 +1085,7 @@ func TestMsgCallServiceType(t *testing.T) { // TestMsgCallServiceValidation tests ValidateBasic for MsgCallService func TestMsgCallServiceValidation(t *testing.T) { invalidLongName := strings.Repeat("s", MaxNameLength+1) - invalidDenomCoins := sdk.Coins{sdk.Coin{Denom: "eth+min", Amount: sdk.NewInt(1000)}} + invalidDenomCoins := sdk.Coins{sdk.Coin{Denom: "eth+min", Amount: math.NewInt(1000)}} invalidDuplicateProviders := []string{testProvider, testProvider} invalidInput := "iris-usdt" @@ -1558,7 +1559,7 @@ func TestMsgUpdateRequestContextValidation(t *testing.T) { invalidTimeout := int64(-1) invalidLessRepeatedFreq := uint64(testTimeout) - 10 invalidRepeatedTotal := int64(-2) - invalidDenomCoins := sdk.Coins{sdk.Coin{Denom: "eth+min", Amount: sdk.NewInt(1000)}} + invalidDenomCoins := sdk.Coins{sdk.Coin{Denom: "eth+min", Amount: math.NewInt(1000)}} testMsgs := []*MsgUpdateRequestContext{ NewMsgUpdateRequestContext(