Skip to content
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

tokenfactory: address mutation tests part 2 #2504

Merged
merged 16 commits into from
Aug 26, 2022

Conversation

czarcas7ic
Copy link
Member

@czarcas7ic czarcas7ic commented Aug 25, 2022

Closes: #2105

What is the purpose of the change

Brings mutation tests for tokenfactory from 37% to 75% passing.

Brief Changelog

  • removes module.go from mutation tests
  • fixes GetTokenDenom bug (was checking subdenom length instead of creator length)
  • adds tests for denoms.go and msgs.go

Testing and Verifying

This change is already covered by existing tests

Documentation and Release Note

  • Does this pull request introduce a new feature or user-facing behavior changes? no
  • Is a relevant changelog entry added to the Unreleased section in CHANGELOG.md? no
  • How is the feature or change documented? not applicable

@github-actions github-actions bot added C:app-wiring Changes to the app folder C:docs Improvements or additions to documentation C:x/tokenfactory T:build labels Aug 25, 2022
@github-actions github-actions bot removed C:docs Improvements or additions to documentation C:app-wiring Changes to the app folder labels Aug 25, 2022
@@ -56,7 +56,7 @@ func DeconstructDenom(denom string) (creator string, subdenom string, err error)
}

creator = strParts[1]
_, err = sdk.AccAddressFromBech32(creator)
addr, err := sdk.AccAddressFromBech32(creator)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was done to make mutation tests happy. Understood that it is the same as what it replaced.

@czarcas7ic czarcas7ic marked this pull request as ready for review August 25, 2022 00:34
@czarcas7ic czarcas7ic requested a review from a team August 25, 2022 00:34
Copy link
Member

@p0mvn p0mvn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work

scripts/mutation-test.sh Outdated Show resolved Hide resolved
@@ -66,7 +66,7 @@ func DeconstructDenom(denom string) (creator string, subdenom string, err error)
// So we have to join [2:] with a "/" as the delimiter to get back the correct subdenom which should be "atomderivative/sikka"
subdenom = strings.Join(strParts[2:], "/")

return creator, subdenom, nil
return addr.String(), subdenom, nil
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious - what difference does this make for mutation testing?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah this change is unclear to me. We can rename it as "creatorAddr" if we want to, but this generally seems odd to me

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed it is odd. We are using the sdk.AccAddressFromBech32 just as a validation check. When mutation tests nil line 59 out, we have no checks that actually utilize this value since we are only using it as a check. By utilizing its output, mutation tests will then pass since we are now relying on the function call. I can change it back, but feel that since it does the same thing and now the mutation passes, it should be a non issue. Lmk what you think

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hrmm, this particular instance seems like a non-issue, but I would like to get mutation testing fixed to not make this error in the future.

This is good to merge rn though! Nice work

x/tokenfactory/types/denoms_test.go Show resolved Hide resolved
x/tokenfactory/types/denoms_test.go Outdated Show resolved Hide resolved
x/tokenfactory/types/msgs_test.go Outdated Show resolved Hide resolved
x/tokenfactory/types/msgs_test.go Outdated Show resolved Hide resolved
x/tokenfactory/types/msgs_test.go Outdated Show resolved Hide resolved
x/tokenfactory/types/msgs_test.go Outdated Show resolved Hide resolved
@ValarDragon
Copy link
Member

Nice work!

@ValarDragon ValarDragon merged commit 53819d6 into main Aug 26, 2022
@ValarDragon ValarDragon deleted the adam/tokenfactory-mutation-2 branch August 26, 2022 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tokenfactory: Mutation test issue (July 17th)
3 participants