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.
Purpose:
transition
validate_removals()
to use the fast function to compute a merkle tree root. TheMerkleSet
class is an inefficient implementation, and very expensive to use. The block validation as well asvalidate_additions()
were transitioned to use the fast function when I first introduced it, but must have missed this place.history
in #10146 Mariano introduced an
assert removals_res.proofs is not None
which looks wrong, because the function that the proof is passed to handles the case where it'sNone
. That's specifically the case this PR focuses on updating.The fact that nothing has been broken this whole time (as far as I can tell) may suggest that perhaps the feature of omitting the proof when all removals are returned, is unnecessary.
This patch operates under the assumption that it is useful. Improves it and removes the assert blocking it.
Current Behavior:
validate_removals()
is expensive.The response to a removals request must include proofs, even when every single removal is included.
New Behavior:
validate_removals()
is less expensive.The response to a removals request may omit proofs if every single removal is included.
Testing Notes:
Tests have been added.