Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(balanced_mp): removes some panics, adds some checks and new tests (…
…#5432) Description --- - number of minor optimisations (e.g MergedBalancedBinaryMerkleIndexOrHash type vs tuple with index uint to Vec<u8> conversion) - removed a number of possible panics - adds integer underflow check in BalancedMerkleProof::verify - adds edge case check for if all proofs to merge are zero height - adds some extra tests for faulty proofs and "real world" data test - minor memory optimisations - format cargo.toml and reduce minimum required versions for some dependencies Motivation and Context --- None of these changes are game changing however they do address some important bugs that could prevent a bad actor from causing panics in a remote node. @Cifko please check that I didn't break anything. I wanted to investigate this because of an issue in a test in the DAN repo that fails with an invalid BMT even though all unmerged proofs are valid. I imported this data and strangely, the proof verifies (both in the previous code and code from this PR), so I was unable to track down the precise reason for the failure. How Has This Been Tested? --- New and existing unit tests What process can a PR reviewer use to test or verify this change? --- Run tests <!-- Checklist --> <!-- 1. Is the title of your PR in the form that would make nice release notes? The title, excluding the conventional commit tag, will be included exactly as is in the CHANGELOG, so please think about it carefully. --> Breaking Changes --- - [x] None - [ ] Requires data directory on base node to be deleted - [ ] Requires hard fork - [ ] Other - Please specify <!-- Does this include a breaking change? If so, include this line as a footer --> <!-- BREAKING CHANGE: Description what the user should do, e.g. delete a database, resync the chain -->
- Loading branch information