test: fix mutable MMR test and add documentation #5276
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Fixes a broken test of mutable MMR functionality. Updates documentation.
Closes issue 5268.
Motivation and Context
A mutable MMR test is currently broken. The test checks a utility function (which is currently unused) against computation of a mutable pruned MMR root. The test fails intermittently due to a failure to compress the underlying deletion bitmap prior to computing the Merkle root. This PR adds the necessary compression step to fix the test.
However, the test failure reveals a risk. The functionality used to compute the root for a mutable MMR implicitly requires that the caller have already compressed the deletion bitmap if any deletions were performed. If the caller doesn't do this (as in the failed test), the root may be different.
It may be prudent, if feasible, to include compression in
get_merkle_root
directly, as suggested in this issue. There are several critical places within the codebase where compression is performed, and where roots are computed. Relying on callers to do these steps correctly seems risky. This PR does not address this directly, but adds a warning to theget_merkle_root
documentation.How Has This Been Tested?
Manually checked (via looped testing) that the affected test succeeds.
What process can a PR reviewer use to test or verify this change?
Assert that CI passes. Run the test on a loop to assert that the test does not fail intermittently.
Breaking Changes