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

scan(test): Implement scanner format round-trip tests #8071

Merged
merged 3 commits into from
Dec 7, 2023
Merged

Conversation

teor2345
Copy link
Contributor

@teor2345 teor2345 commented Dec 6, 2023

Motivation

We skipped these tests in tickets #8019 and #8050. Now the format has settled it's a good time to do them.

PR Author Checklist

Check before marking the PR as ready for review:

  • Will the PR name make sense to users?
  • Does the PR have a priority label?
  • Have you added or updated tests?
  • Is the documentation up to date?

If a checkbox isn't relevant to the PR, mark it as done.

Test APIs

Proptests generate random typed data, then run it through a test closure or function. In this case, our assert_value_properties() makes sure that the round-trip format is correct.

We can't use clamp() with proptests because it sets the value to the end of the range, but we want it distributed over the range.

Solution / Testing

  • Add round-trip format tests for all the scanner formats
  • Add Arbitrary implementations for all the scanner formats

Related changes:

  • Derive Default in test-only code to make testing easier
  • Clean up an existing round-trip test

Related fixes:

  • Increase proptest coverage of height serialization

(The fix for ticket #7443 in PR #7628 was incomplete.)

Review

This is a lower priority routine testing change.

Reviewer Checklist

Check before approving the PR:

  • Does the PR scope match the ticket?
  • Are there enough tests to make sure it works? Do the tests cover the PR motivation?
  • Are all the PR blockers dealt with?
    PR blockers can be dealt with in new tickets or PRs.

And check the PR Author checklist is complete.

@teor2345 teor2345 added P-Low ❄️ C-testing Category: These are tests C-trivial Category: A trivial change that is not worth mentioning in the CHANGELOG A-blockchain-scanner Area: Blockchain scanner of shielded transactions labels Dec 6, 2023
@teor2345 teor2345 self-assigned this Dec 6, 2023
@teor2345 teor2345 requested a review from a team as a code owner December 6, 2023 21:40
@teor2345 teor2345 requested review from oxarbitrage and removed request for a team December 6, 2023 21:40
@teor2345 teor2345 marked this pull request as draft December 6, 2023 23:07
@teor2345

This comment was marked as resolved.

@teor2345 teor2345 added the A-state Area: State / database changes label Dec 7, 2023
@teor2345 teor2345 marked this pull request as ready for review December 7, 2023 05:58
Copy link
Contributor

@oxarbitrage oxarbitrage left a comment

Choose a reason for hiding this comment

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

Thanks!

@mergify mergify bot merged commit 1ccf5fb into main Dec 7, 2023
128 checks passed
@mergify mergify bot deleted the fmt-rnd-trip branch December 7, 2023 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-blockchain-scanner Area: Blockchain scanner of shielded transactions A-state Area: State / database changes C-testing Category: These are tests C-trivial Category: A trivial change that is not worth mentioning in the CHANGELOG
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Change scanner database format so it is easier for users to query for transaction IDs
2 participants