Skip to content

Conversation

@jamillambert
Copy link
Contributor

New mutants were found in the weekly mutation testing. One set is from a function that is for optimization and testing it is unnecessary, the other causes a timeout by changing the return of functions which are used in testing to exit loops.

  • Edit an existing exclude to make it more specific and only exclude the needed function.
  • Exclude the optimization functions min_bytes_needed.
  • Exclude the WitnessEncoder functions that cause an infinite loop in mutation testing.

Closes #5088

Add the function name to the encoding::Decodable exclusion so that if
new functions are added in the future they will still be tested.
The min_byte_needed function is a simple cast for optimization and does
not need to be tested.

Add a mutation testing exclude for all of these functions.
Two functions in WitnessEncoder cause infinite loops when mutated.

Add excludes for them.
Copy link
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

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

ACK 8da0bec; successfully ran local tests

"Iterator", # Mutating operations in an iterator can result in an infinite loop
"impl encoding::Decodable", # Mutant replacing Default::default() is equivalent to returning new()
"<impl encoding::Decodable for .*>::decoder", # Mutant replacing Default::default() is equivalent to returning new()
"<impl encoding::Decoder for .*>::min_bytes_needed", # Function is just a cast for optimization.
Copy link
Member

@tcharding tcharding Oct 7, 2025

Choose a reason for hiding this comment

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

What do you mean by this comment 'is just a cast'? Also, give how unsure I was when writing impls for this method it makes me nervous to exclude it. Although I cannot thing of a sane way to mutate it so I I think you are correct to exclude it ...

Copy link
Member

Choose a reason for hiding this comment

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

FTR I just read #5088 (comment) after reviewing so I see where you got the optimisation bit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since this is approved I'll leave the comment as is. But if you have a better version I'll add it next time. Probably next monday, going by the last few weeks..

Copy link
Member

Choose a reason for hiding this comment

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

Heh, oops, I read this as "just a case of optimization".

But we can change the comment in a followup.

Copy link
Member

@tcharding tcharding left a comment

Choose a reason for hiding this comment

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

ACK 8da0bec

Copy link
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

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

ACK 8da0bec; successfully ran local tests

@apoelstra apoelstra merged commit 3f50209 into rust-bitcoin:master Oct 8, 2025
25 checks passed
apoelstra added a commit that referenced this pull request Oct 13, 2025
80f95b2 Update mutant exclude for lifetime syntax change (Jamil Lambert, PhD)
6133e10 Reword mutant exclude comment (Jamil Lambert, PhD)

Pull request description:

  Two mutant excludes stopped working and caused a timeout in the weekly mutation testing. The lifetimes are now elided to fix a clippy error. And an existing comment needs to be updated in response to a review comment on previous PR.
  
  - Fix the comment for a mutant exclude as a follow up to #5094.
  - Change the excludes to match the new syntax and kill the mutants.
  
  Together with #5119 Closes #5121


ACKs for top commit:
  tcharding:
    ACK 80f95b2
  apoelstra:
    ACK 80f95b2; successfully ran local tests


Tree-SHA512: 547f17a9ab1244467458ce57e2914bd74520401d18c5697812c22921bb078af225e9eaf74f1d3c21efeecfba314d4b9d99fb09994bc573abc8fc36094606144d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

New Mutants Found

3 participants