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

fix(test): broken address test #5134

Merged

Conversation

AaronFeickert
Copy link
Collaborator

@AaronFeickert AaronFeickert commented Jan 23, 2023

Description

Fixes a broken address test that exhibits inconsistent failure.

Closes issue 5133.

Motivation and Context

The test in question claims to detect failures caused by bad network bytes. However, it attempts to do this by mutating the checksum, setting the second address byte to a fixed value that happens to match the checksum mutation, and checking for a checksum failure when the result is decoded using the same network used when generating the address.

It's not clear why the test is structured this way. What it's really doing is simulating the effect of two mutations, which the checksum algorithm is not guaranteed to detect (and which has caused CI failures).

This PR restructures the test to perform two separate but related tests.

In the first test, we generate a valid address on one network and attempt to decode it for another network. The checksum algorithm guarantees this will always be detected. In the second test, we mutate the checksum and attempt to decode it for the same network. The checksum algorithm guarantees this will also always be detected.

How Has This Been Tested?

Updated test passes. Manually ran 100000 iterations to ensure no obvious spurious failures occur.

@AaronFeickert AaronFeickert changed the title Fix broken address test fix(test): broken address test Jan 23, 2023
Copy link
Collaborator

@SWvheerden SWvheerden left a comment

Choose a reason for hiding this comment

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

utACK

@stringhandler stringhandler merged commit 6b125af into tari-project:development Jan 24, 2023
@AaronFeickert AaronFeickert deleted the fix-address-test branch January 24, 2023 14:11
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.

Bad-network address test can fail
3 participants