Merged
Conversation
mmsqe
reviewed
Dec 12, 2022
iavl/iavl.py
Outdated
| get_node: GetNode, | ||
| v: int, | ||
| predecessor: int, | ||
| successor: int, |
added 3 commits
December 12, 2022 16:48
mmsqe
reviewed
Dec 13, 2022
iavl/iavl.py
Outdated
| predecessor: int, | ||
| root: bytes, | ||
| successor_root: bytes, | ||
| ) -> int: |
iavl/utils.py
Outdated
| @@ -330,26 +335,26 @@ def visit_iavl_nodes( | |||
| stack: List[bytes] = [hash] | |||
| while stack: | |||
| hash = stack.pop() | |||
|
|
||
| node = get_node(hash) | ||
|
|
||
| if not preorder: |
There was a problem hiding this comment.
not sure if we need postorder now, but need loop all anyway right?
Author
There was a problem hiding this comment.
postorder is only used in import/export, which we haven't implemented in python version.
Author
There was a problem hiding this comment.
yes, without prune_check it'll traverse all.
Co-authored-by: mmsqe <tqd0800210105@gmail.com> Signed-off-by: yihuang <huang@crypto.com>
mmsqe
approved these changes
Dec 13, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The algorithm is adapted from cosmos/iavl#646, credits: @cool-developer
The new one visit the same amount of nodes as the previous one, but is simpler.
It could be further optimized after new node key format, because we can traverse nodes with whatever order, so we can just traverse them ordered by node key with the version as prefix.