osmosis icon indicating copy to clipboard operation
osmosis copied to clipboard

Mutation test 2022/09/26

Open github-actions[bot] opened this issue 3 years ago • 0 comments

--- ./x/tokenfactory/keeper/genesis.go 2022-09-26 13:17:05.034500501 +0000 +++ /tmp/go-mutesting-3740572161/./x/tokenfactory/keeper/genesis.go.5 2022-09-26 13:21:09.982514437 +0000 @@ -19,7 +19,8 @@


 	for _, genDenom := range genState.GetFactoryDenoms() {
 		creator, _, err := types.DeconstructDenom(genDenom.GetDenom())
 		if err != nil {
-			panic(err)
+			_ = err
+
 		}
 		err = k.createDenomAfterValidation(ctx, creator, genDenom.GetDenom())
 		if err != nil {

FAIL

"/tmp/go-mutesting-3740572161/./x/tokenfactory/keeper/genesis.go.5" with checksum 956032c4e4bdae36c6d3143ce7370d84 --- ./x/tokenfactory/keeper/genesis.go 2022-09-26 13:17:05.034500501 +0000 +++ /tmp/go-mutesting-3740572161/./x/tokenfactory/keeper/genesis.go.6 2022-09-26 13:21:18.790511908 +0000 @@ -23,7 +23,8 @@


 		}
 		err = k.createDenomAfterValidation(ctx, creator, genDenom.GetDenom())
 		if err != nil {
-			panic(err)
+			_ = err
+
 		}
 		err = k.setAuthorityMetadata(ctx, genDenom.GetDenom(), genDenom.GetAuthorityMetadata())
 		if err != nil {

FAIL

"/tmp/go-mutesting-3740572161/./x/tokenfactory/keeper/genesis.go.6" with checksum 7161ec4b5f72fff20e05c4baae6b387d --- ./x/tokenfactory/keeper/genesis.go 2022-09-26 13:17:05.034500501 +0000 +++ /tmp/go-mutesting-3740572161/./x/tokenfactory/keeper/genesis.go.7 2022-09-26 13:21:24.642510505 +0000 @@ -27,7 +27,8 @@


 		}
 		err = k.setAuthorityMetadata(ctx, genDenom.GetDenom(), genDenom.GetAuthorityMetadata())
 		if err != nil {
-			panic(err)
+			_ = err
+
 		}
 	}
 }

FAIL

"/tmp/go-mutesting-3740572161/./x/tokenfactory/keeper/genesis.go.7" with checksum 7d47b1ad88a807b0c72d24f2e66aef61 --- ./x/tokenfactory/keeper/genesis.go 2022-09-26 13:17:05.034500501 +0000 +++ /tmp/go-mutesting-3740572161/./x/tokenfactory/keeper/genesis.go.9 2022-09-26 13:21:32.266509191 +0000 @@ -42,7 +42,8 @@


 
 		authorityMetadata, err := k.GetAuthorityMetadata(ctx, denom)
 		if err != nil {
-			panic(err)
+			_ = err
+
 		}
 
 		genDenoms = append(genDenoms, types.GenesisDenom{

FAIL

"/tmp/go-mutesting-3740572161/./x/tokenfactory/keeper/genesis.go.9" with checksum 82c8b70206cbbdd0f373a924dd93932d --- ./x/tokenfactory/types/codec.go 2022-09-26 13:17:05.034500501 +0000 +++ /tmp/go-mutesting-3740572161/./x/tokenfactory/types/codec.go.5 2022-09-26 13:23:54.778485790 +0000 @@ -27,7 +27,7 @@


 		// &MsgForceTransfer{},
 		&MsgChangeAdmin{},
 	)
-	msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc)
+	_, _, _ = msgservice.RegisterMsgServiceDesc, registry, _Msg_serviceDesc
 }
 
 var (

FAIL

"/tmp/go-mutesting-3740572161/./x/tokenfactory/types/codec.go.5" with checksum 7cab79f91fcb1f9c6b53deaff78f6bd1 --- ./x/tokenfactory/types/codec.go 2022-09-26 13:17:05.034500501 +0000 +++ /tmp/go-mutesting-3740572161/./x/tokenfactory/types/codec.go.6 2022-09-26 13:24:00.090485335 +0000 @@ -36,7 +36,8 @@


 )
 
 func init() {
-	RegisterCodec(amino)
+	_ = amino
+
 	// Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be
 	// used to properly serialize MsgGrant and MsgExec instances
 	sdk.RegisterLegacyAminoCodec(amino)

FAIL

"/tmp/go-mutesting-3740572161/./x/tokenfactory/types/codec.go.6" with checksum 53712e3b7e98a7d747ae5933dd622891 --- ./x/tokenfactory/types/codec.go 2022-09-26 13:17:05.034500501 +0000 +++ /tmp/go-mutesting-3740572161/./x/tokenfactory/types/codec.go.7 2022-09-26 13:24:05.450485169 +0000 @@ -37,9 +37,10 @@


 
 func init() {
 	RegisterCodec(amino)
-	// Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be
-	// used to properly serialize MsgGrant and MsgExec instances
-	sdk.RegisterLegacyAminoCodec(amino)
+	_, _ =
+		// Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be
+		// used to properly serialize MsgGrant and MsgExec instances
+		sdk.RegisterLegacyAminoCodec, amino
 	RegisterCodec(authzcodec.Amino)
 
 	amino.Seal()

FAIL

"/tmp/go-mutesting-3740572161/./x/tokenfactory/types/codec.go.7" with checksum 2b15484c0c7715aa9a37799dd240d423 --- ./x/tokenfactory/types/codec.go 2022-09-26 13:17:05.034500501 +0000 +++ /tmp/go-mutesting-3740572161/./x/tokenfactory/types/codec.go.9 2022-09-26 13:24:16.102483786 +0000 @@ -41,6 +41,5 @@


 	// used to properly serialize MsgGrant and MsgExec instances
 	sdk.RegisterLegacyAminoCodec(amino)
 	RegisterCodec(authzcodec.Amino)
-
-	amino.Seal()
+	_ = amino.Seal
 }

FAIL

"/tmp/go-mutesting-3740572161/./x/tokenfactory/types/codec.go.9" with checksum 8bc9ec805222a80496de33f3ea452fef --- ./x/tokenfactory/types/msgs.go 2022-09-26 13:17:05.034500501 +0000 +++ /tmp/go-mutesting-3740572161/./x/tokenfactory/types/msgs.go.2 2022-09-26 13:25:42.822453229 +0000 @@ -103,7 +103,7 @@


 		return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid sender address (%s)", err)
 	}
 
-	if !m.Amount.IsValid() || m.Amount.Amount.Equal(sdk.ZeroInt()) {
+	if false || m.Amount.Amount.Equal(sdk.ZeroInt()) {
 		return sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, m.Amount.String())
 	}
 

FAIL

"/tmp/go-mutesting-3740572161/./x/tokenfactory/types/msgs.go.2" with checksum 6c2a1682800f46983ae4ae3eae21ee2f --- ./x/tokenfactory/types/msgs.go 2022-09-26 13:17:05.034500501 +0000 +++ /tmp/go-mutesting-3740572161/./x/tokenfactory/types/msgs.go.3 2022-09-26 13:25:48.126452643 +0000 @@ -103,7 +103,7 @@


 		return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid sender address (%s)", err)
 	}
 
-	if !m.Amount.IsValid() || m.Amount.Amount.Equal(sdk.ZeroInt()) {
+	if !m.Amount.IsValid() || false {
 		return sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, m.Amount.String())
 	}
 

FAIL

"/tmp/go-mutesting-3740572161/./x/tokenfactory/types/msgs.go.3" with checksum 2c777f8bb18098f9606a5e7fd4ecbd33 --- ./x/tokenfactory/types/msgs.go 2022-09-26 13:17:05.034500501 +0000 +++ /tmp/go-mutesting-3740572161/./x/tokenfactory/types/msgs.go.5 2022-09-26 13:26:00.846451185 +0000 @@ -182,8 +182,7 @@


 	if err != nil {
 		return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid sender address (%s)", err)
 	}
-
-	_, err = sdk.AccAddressFromBech32(m.NewAdmin)
+	_, _, _ = err, sdk.AccAddressFromBech32, m.NewAdmin
 	if err != nil {
 		return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid address (%s)", err)
 	}

FAIL

"/tmp/go-mutesting-3740572161/./x/tokenfactory/types/msgs.go.5" with checksum b6a39dad85c19350e6f7979df8cdecc6 --- ./x/tokenfactory/types/msgs.go 2022-09-26 13:17:05.034500501 +0000 +++ /tmp/go-mutesting-3740572161/./x/tokenfactory/types/msgs.go.6 2022-09-26 13:26:08.206474233 +0000 @@ -187,8 +187,7 @@


 	if err != nil {
 		return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid address (%s)", err)
 	}
-
-	_, _, err = DeconstructDenom(m.Denom)
+	_, _ = err, m.Denom
 	if err != nil {
 		return err
 	}

FAIL

"/tmp/go-mutesting-3740572161/./x/tokenfactory/types/msgs.go.6" with checksum 824aa65bbb8b3fe9c7c06d9a7c5f7b9d --- ./x/tokenfactory/types/msgs.go 2022-09-26 13:17:05.034500501 +0000 +++ /tmp/go-mutesting-3740572161/./x/tokenfactory/types/msgs.go.7 2022-09-26 13:26:13.586473688 +0000 @@ -222,8 +222,7 @@


 	if err != nil {
 		return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid sender address (%s)", err)
 	}
-
-	err = m.Metadata.Validate()
+	_, _ = err, m.Metadata.Validate
 	if err != nil {
 		return err
 	}

FAIL

"/tmp/go-mutesting-3740572161/./x/tokenfactory/types/msgs.go.7" with checksum c58d1b6e4362aac9579a7bd84084ae13 --- ./x/tokenfactory/types/msgs.go 2022-09-26 13:17:05.034500501 +0000 +++ /tmp/go-mutesting-3740572161/./x/tokenfactory/types/msgs.go.8 2022-09-26 13:26:20.954473041 +0000 @@ -227,8 +227,7 @@


 	if err != nil {
 		return err
 	}
-
-	_, _, err = DeconstructDenom(m.Metadata.Base)
+	_, _ = err, m.Metadata.Base
 	if err != nil {
 		return err
 	}

FAIL

"/tmp/go-mutesting-3740572161/./x/tokenfactory/types/msgs.go.8" with checksum 1b5e08bc3d5ee418fc4cf7d63a42420b --- ./x/twap/keeper.go 2022-09-26 13:17:05.034500501 +0000 +++ /tmp/go-mutesting-3740572161/./x/twap/keeper.go.7 2022-09-26 13:27:52.742463738 +0000 @@ -75,7 +75,8 @@


 	// that is prefixed by time.
 	twapRecords, err := k.getAllHistoricalTimeIndexedTWAPs(ctx)
 	if err != nil {
-		panic(err)
+		_ = err
+
 	}
 
 	return &types.GenesisState{

FAIL

"/tmp/go-mutesting-3740572161/./x/twap/keeper.go.7" with checksum fa249852af4a159aaa3a19794323bed2 --- ./x/twap/listeners.go 2022-09-26 13:17:05.034500501 +0000 +++ /tmp/go-mutesting-3740572161/./x/twap/listeners.go.0 2022-09-26 13:28:09.578462771 +0000 @@ -23,7 +23,8 @@


 func (hook *epochhook) AfterEpochEnd(ctx sdk.Context, epochIdentifier string, epochNumber int64) error {
 	if epochIdentifier == hook.k.PruneEpochIdentifier(ctx) {
 		if err := hook.k.pruneRecords(ctx); err != nil {
-			ctx.Logger().Error("Error pruning old twaps at the epoch end", err)
+			_ = err
+
 		}
 	}
 	return nil

FAIL

"/tmp/go-mutesting-3740572161/./x/twap/listeners.go.0" with checksum d0df56d7db6adb81ef91f2b4a265471d --- ./x/twap/listeners.go 2022-09-26 13:17:05.034500501 +0000 +++ /tmp/go-mutesting-3740572161/./x/twap/listeners.go.1 2022-09-26 13:28:25.862461743 +0000 @@ -46,7 +46,8 @@


 	err := hook.k.afterCreatePool(ctx, poolId)
 	// Will halt pool creation
 	if err != nil {
-		panic(err)
+		_ = err
+
 	}
 }
 

FAIL

"/tmp/go-mutesting-3740572161/./x/twap/listeners.go.1" with checksum cb6d173cb59ce85361fd242acf30ecc2 --- ./x/twap/store.go 2022-09-26 13:17:05.038500496 +0000 +++ /tmp/go-mutesting-3740572161/./x/twap/store.go.0 2022-09-26 13:33:07.490466798 +0000 @@ -205,7 +205,7 @@


 			return types.TwapRecord{}, timeTooOldError{Time: t}
 		}
 	}
-	if twap.Asset0Denom != asset0Denom || twap.Asset1Denom != asset1Denom || twap.PoolId != poolId {
+	if false || twap.PoolId != poolId {
 		return types.TwapRecord{}, fmt.Errorf("internal error, got twap but its data is wrong")
 	}
 

FAIL

"/tmp/go-mutesting-3740572161/./x/twap/store.go.0" with checksum c031df2cff52048b6b3fc79aee9ec4ae --- ./x/twap/store.go 2022-09-26 13:17:05.038500496 +0000 +++ /tmp/go-mutesting-3740572161/./x/twap/store.go.1 2022-09-26 13:33:20.726467300 +0000 @@ -205,7 +205,7 @@


 			return types.TwapRecord{}, timeTooOldError{Time: t}
 		}
 	}
-	if twap.Asset0Denom != asset0Denom || twap.Asset1Denom != asset1Denom || twap.PoolId != poolId {
+	if twap.Asset0Denom != asset0Denom || twap.Asset1Denom != asset1Denom || false {
 		return types.TwapRecord{}, fmt.Errorf("internal error, got twap but its data is wrong")
 	}
 

FAIL

"/tmp/go-mutesting-3740572161/./x/twap/store.go.1" with checksum 8b0c80141dd13156b7c32aca268f28f0 --- ./x/twap/store.go 2022-09-26 13:17:05.038500496 +0000 +++ /tmp/go-mutesting-3740572161/./x/twap/store.go.2 2022-09-26 13:33:33.146467727 +0000 @@ -205,7 +205,7 @@


 			return types.TwapRecord{}, timeTooOldError{Time: t}
 		}
 	}
-	if twap.Asset0Denom != asset0Denom || twap.Asset1Denom != asset1Denom || twap.PoolId != poolId {
+	if false || twap.Asset1Denom != asset1Denom || twap.PoolId != poolId {
 		return types.TwapRecord{}, fmt.Errorf("internal error, got twap but its data is wrong")
 	}
 

FAIL

"/tmp/go-mutesting-3740572161/./x/twap/store.go.2" with checksum b9ffd75960acb59ddf95aa541b468c09 --- ./x/twap/store.go 2022-09-26 13:17:05.038500496 +0000 +++ /tmp/go-mutesting-3740572161/./x/twap/store.go.3 2022-09-26 13:33:45.434468139 +0000 @@ -205,7 +205,7 @@


 			return types.TwapRecord{}, timeTooOldError{Time: t}
 		}
 	}
-	if twap.Asset0Denom != asset0Denom || twap.Asset1Denom != asset1Denom || twap.PoolId != poolId {
+	if twap.Asset0Denom != asset0Denom || false || twap.PoolId != poolId {
 		return types.TwapRecord{}, fmt.Errorf("internal error, got twap but its data is wrong")
 	}
 

FAIL

"/tmp/go-mutesting-3740572161/./x/twap/store.go.3" with checksum df79148da7441f6bef1030f88450a392 --- ./x/twap/store.go 2022-09-26 13:17:05.038500496 +0000 +++ /tmp/go-mutesting-3740572161/./x/twap/store.go.13 2022-09-26 13:36:07.750473848 +0000 @@ -138,8 +138,8 @@


 	bz := store.Get(key)
 	twap, err := types.ParseTwapFromBz(bz)
 	if err != nil {
-		err = fmt.Errorf("error in get most recent twap, likely that asset 0 or asset 1 were wrong: %s %s."+
-			" Underlying error: %w", asset0Denom, asset1Denom, err)
+		_, _, _, _, _ = err, fmt.Errorf, asset0Denom, asset1Denom, err
+
 	}
 	return twap, err
 }

FAIL

"/tmp/go-mutesting-3740572161/./x/twap/store.go.13" with checksum c748db95c94d2b16c4ed6641734dc0f6 --- ./x/twap/types/genesis.go 2022-09-26 13:17:05.038500496 +0000 +++ /tmp/go-mutesting-3740572161/./x/twap/types/genesis.go.1 2022-09-26 13:37:03.222451803 +0000 @@ -57,7 +57,7 @@


 	// if there was an error in this record, the spot prices should be 0.
 	// else, the the spot prices must be positive.
 	if t.LastErrorTime.Equal(t.Time) {
-		if t.P0LastSpotPrice.IsNil() || !t.P0LastSpotPrice.IsZero() {
+		if false || !t.P0LastSpotPrice.IsZero() {
 			return fmt.Errorf("twap record p0 last spot price must be zero due to having an error, was (%s)", t.P0LastSpotPrice)
 		}
 

FAIL

"/tmp/go-mutesting-3740572161/./x/twap/types/genesis.go.1" with checksum 148f7369ca1dd9638a3727f29aeda1a7 --- ./x/twap/types/genesis.go 2022-09-26 13:17:05.038500496 +0000 +++ /tmp/go-mutesting-3740572161/./x/twap/types/genesis.go.3 2022-09-26 13:37:07.658448503 +0000 @@ -61,7 +61,7 @@


 			return fmt.Errorf("twap record p0 last spot price must be zero due to having an error, was (%s)", t.P0LastSpotPrice)
 		}
 
-		if t.P1LastSpotPrice.IsNil() || !t.P1LastSpotPrice.IsZero() {
+		if false || !t.P1LastSpotPrice.IsZero() {
 			return fmt.Errorf("twap record p1 last spot price must be zero due to having an error, was (%s)", t.P1LastSpotPrice)
 		}
 	} else {

FAIL

"/tmp/go-mutesting-3740572161/./x/twap/types/genesis.go.3" with checksum 57ad8ba33c4cbe151e557ba7bc4106ac --- ./x/twap/types/params.go 2022-09-26 13:17:05.038500496 +0000 +++ /tmp/go-mutesting-3740572161/./x/twap/types/params.go.0 2022-09-26 13:37:41.378437412 +0000 @@ -69,7 +69,7 @@


 		return fmt.Errorf("invalid parameter type: %T", i)
 	}
 
-	if v <= 0 {
+	if v < 0 {
 		return fmt.Errorf("time must be positive: %d", v)
 	}
 

FAIL

"/tmp/go-mutesting-3740572161/./x/twap/types/params.go.0" with checksum a66c1293ef893a6178812383cb514bde --- ./x/twap/types/utils.go 2022-09-26 13:17:05.038500496 +0000 +++ /tmp/go-mutesting-3740572161/./x/twap/types/utils.go.0 2022-09-26 13:37:47.942436073 +0000 @@ -24,7 +24,7 @@


 	pairGT := make([]string, 0, numPairs)
 	pairLT := make([]string, 0, numPairs)
 
-	for i := 0; i < len(denoms); i++ {
+	for i := 0; i <= len(denoms); i++ {
 		for j := i + 1; j < len(denoms); j++ {
 			pairGT = append(pairGT, denoms[i])
 			pairLT = append(pairLT, denoms[j])

FAIL

"/tmp/go-mutesting-3740572161/./x/twap/types/utils.go.0" with checksum c87c410e660e59c0a49cccd9df782232 --- ./x/twap/types/utils.go 2022-09-26 13:17:05.038500496 +0000 +++ /tmp/go-mutesting-3740572161/./x/twap/types/utils.go.3 2022-09-26 13:37:55.026434394 +0000 @@ -61,7 +61,7 @@


 	if denom0 == denom1 {
 		return "", "", fmt.Errorf("both assets cannot be of the same denom: assetA: %s, assetB: %s", denom0, denom1)
 	}
-	if denom0 > denom1 {
+	if denom0 >= denom1 {
 		denom0, denom1 = denom1, denom0
 	}
 	return denom0, denom1, nil

FAIL

"/tmp/go-mutesting-3740572161/./x/twap/types/utils.go.3" with checksum e7686c5e3558e5bcd3981da87bb85fd3 --- ./x/twap/types/twapmock/amminterface.go 2022-09-26 13:17:05.038500496 +0000 +++ /tmp/go-mutesting-3740572161/./x/twap/types/twapmock/amminterface.go.2 2022-09-26 13:38:14.430431189 +0000 @@ -43,7 +43,8 @@


 	if existingForPool, ok := p.programmedPoolDenoms[poolId]; ok {
 		poolDenoms = existingForPool.poolDenoms
 	} else {
-		poolDenoms = map[string]struct{}{}
+		_ = poolDenoms
+
 	}
 	for _, denom := range overrideDenoms {
 		poolDenoms[denom] = struct{}{}

FAIL

"/tmp/go-mutesting-3740572161/./x/twap/types/twapmock/amminterface.go.2" with checksum 4636c91fbffdb853d3085dad3015c1d7 --- ./x/twap/types/twapmock/amminterface.go 2022-09-26 13:17:05.038500496 +0000 +++ /tmp/go-mutesting-3740572161/./x/twap/types/twapmock/amminterface.go.3 2022-09-26 13:38:15.198430991 +0000 @@ -46,7 +46,8 @@


 		poolDenoms = map[string]struct{}{}
 	}
 	for _, denom := range overrideDenoms {
-		poolDenoms[denom] = struct{}{}
+		_, _ = poolDenoms, denom
+
 	}
 	p.programmedPoolDenoms[poolId] = poolDenomsResult{poolDenoms, overrideErr}
 }

FAIL

"/tmp/go-mutesting-3740572161/./x/twap/types/twapmock/amminterface.go.3" with checksum b72bd51ac2564c538681960e115021ca --- ./x/twap/types/twapmock/amminterface.go 2022-09-26 13:17:05.038500496 +0000 +++ /tmp/go-mutesting-3740572161/./x/twap/types/twapmock/amminterface.go.5 2022-09-26 13:38:16.746430595 +0000 @@ -62,7 +62,8 @@


 	if res, ok := p.programmedPoolDenoms[poolId]; ok {
 		result := make([]string, 0, len(res.poolDenoms))
 		for denom := range res.poolDenoms {
-			result = append(result, denom)
+			_, _, _ = result, result, denom
+
 		}
 		return result, res.err
 	}

FAIL

"/tmp/go-mutesting-3740572161/./x/twap/types/twapmock/amminterface.go.5" with checksum 7921e28524e767bdb5348fbedf643408 The mutation score is 0.628378 (93 passed, 30 failed, 0 duplicated, 25 skipped, total is 148)

github-actions[bot] avatar Sep 26 '22 13:09 github-actions[bot]