diff --git a/modules/coinswap/simulation/genesis.go b/modules/coinswap/simulation/genesis.go index e73cf0de..86bb3501 100644 --- a/modules/coinswap/simulation/genesis.go +++ b/modules/coinswap/simulation/genesis.go @@ -39,7 +39,7 @@ func RandomizedGenState(simState *module.SimulationState) { simState.AppParams.GetOrGenerate( keyPoolCreationFee, &poolCreationFee, simState.Rand, - func(r *rand.Rand) { poolCreationFee = sdk.NewInt64Coin(sdk.DefaultBondDenom, r.Int63n(100)) }, + func(r *rand.Rand) { poolCreationFee = sdk.NewInt64Coin(sdk.DefaultBondDenom, r.Int63n(100)+1) }, ) simState.AppParams.GetOrGenerate( diff --git a/modules/service/keeper/invocation.go b/modules/service/keeper/invocation.go index da4134de..50cbac69 100644 --- a/modules/service/keeper/invocation.go +++ b/modules/service/keeper/invocation.go @@ -236,7 +236,7 @@ func (k Keeper) UpdateRequestContext( repeatedFreq = requestContext.RepeatedFrequency } - if repeatedFreq < uint64(timeout) { + if requestContext.Repeated && repeatedFreq < uint64(timeout) { return errorsmod.Wrapf( types.ErrInvalidRepeatedFreq, "repeated frequency [%d] must not be less than the timeout [%d]", diff --git a/modules/service/simulation/operations.go b/modules/service/simulation/operations.go index 5e17bd42..5ee0e991 100644 --- a/modules/service/simulation/operations.go +++ b/modules/service/simulation/operations.go @@ -3,7 +3,6 @@ package simulation import ( "errors" "fmt" - "math/rand" "cosmossdk.io/math" tmbytes "github.com/cometbft/cometbft/libs/bytes" @@ -14,6 +13,7 @@ import ( moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" "github.com/cosmos/cosmos-sdk/x/simulation" + "math/rand" "mods.irisnet.org/modules/service/keeper" "mods.irisnet.org/modules/service/types" @@ -990,12 +990,15 @@ func SimulateMsgCallService( } timeout := int64(simtypes.RandIntBetween(r, 1, int(k.MaxRequestTimeout(ctx)))) - repeated := true - repeatedFrequency := uint64(100) - repeatedTotal := int64(10) + repeated := r.Intn(2) == 0 + var repeatedFrequency, repeatedTotal uint64 + if repeated { + repeatedFrequency = uint64(100) + repeatedTotal = uint64(10) + } msg := types.NewMsgCallService(serviceName, providers, consumer, input, - serviceFeeCap, timeout, repeated, repeatedFrequency, repeatedTotal) + serviceFeeCap, timeout, repeated, repeatedFrequency, int64(repeatedTotal)) spendable := bk.SpendableCoins(ctx, account.GetAddress()) spendable, hasNeg := spendable.SafeSub(serviceFeeCap...) @@ -1158,6 +1161,15 @@ func SimulateMsgPauseRequestContext( "not authorized operation", ), nil, nil } + + if !requestContext.Repeated { + return simtypes.NoOpMsg( + types.ModuleName, + types.TypeMsgPauseRequestContext, + "requestContext non repeated", + ), nil, nil + } + consumer, err := sdk.AccAddressFromBech32(requestContext.Consumer) if err != nil { return simtypes.NoOpMsg( diff --git a/modules/token/simulation/genesis.go b/modules/token/simulation/genesis.go index 0db47cd9..742ba439 100644 --- a/modules/token/simulation/genesis.go +++ b/modules/token/simulation/genesis.go @@ -71,7 +71,7 @@ func RandomizedGenState(simState *module.SimulationState) { ) tokenGenesis := v1.NewGenesisState( - v1.NewParams(tokenTaxRate, sdk.NewCoin(sdk.DefaultBondDenom, issueTokenBaseFee), mintTokenFeeRatio, enableErc20, ""), + v1.NewParams(tokenTaxRate, sdk.NewCoin(v1.GetNativeToken().Symbol, issueTokenBaseFee), mintTokenFeeRatio, enableErc20, ""), tokens, )