cosmos / iavl

Merkleized IAVL+ Tree implementation in Go
Apache License 2.0
409 stars 256 forks source link

fix: working hash with initial version (backport #943) #945

Closed mergify[bot] closed 1 month ago

mergify[bot] commented 1 month ago

Context

InitialVersion is not reflected in the WorkingHash calculation, only reflected in the SaveVersion. This will lead to the AppHash mismatch while upgrading, since the the hash of the root is already calculated in the WorkingHash and won't re-calculated in the SaveVersion which is wrong.


This is an automatic backport of pull request #943 done by Mergify.

mergify[bot] commented 1 month ago

Cherry-pick of 70f77c26e2a6cf24b99e2676bcc1667d6512fa95 has failed:

On branch mergify/bp/master/pr-943
Your branch is up to date with 'origin/master'.

You are currently cherry-picking commit 70f77c2.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
    modified:   mutable_tree.go
    modified:   tree_test.go

Unmerged paths:
  (use "git add <file>..." to mark resolution)
    both modified:   CHANGELOG.md

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally