Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactor: Add `iter_from()` method in `CyclicBoundedVec` `ConcurrentMerkleTree` uses `CyclicBoundedVec` for storing changelog entries. And it often needs to iterate over changelogs which are full and started overwriting elements from the start. Even though `CyclicBoundedVec` was doing good job in preserving the bounds, before this change, it didn't provide any safe way of iterating over elements with a custom index as a start. That unfortunately resulted in attempts to solve that problem in the code of `ConcurrentMerkleTree`, which eventually resulted in bugs. The bugs were harder to spot, because mixing the logic of Merkle proof patching with leaked internals of `CyclicBoundedVec` made it confusing to read, debug and test. To avoid such issues, introduce the `iter_from()` method which allows iteration from the given index and simplify the `ConcurrentMerkleTree` to just use that iterator. Other changes: * Stop returning `Result` in `push()`. `push()` can never panic, unless we have a bug in the implementation. Our tests should make sure that the structure is bulletproof. * fix: Point `getAccountState.sh` to new test crate location * chore: Regenerate accounts * test: Add more cases for `CyclicBoundedVec` * chore: Update IDL
- Loading branch information