This requires the order of the sub tree hashes to be known in order to calculate the state hash, and therefore to prove the inclusion of a specific tree in the state hash calculation this order must be known throughout the codebase.
This should instead be as follows:
Create a rootTree object in the TreeStore module
Fill this tree with the following key-value pairings
"app": appTree.Root()
"transactions": transactionsTree.Root()
...
Calculate the overall state hash by rootTree.Root()
This allows for the computation of the state hash in a deterministic manner as the SMT is not order dependent in its updates, thus removing the need to know the tree orders as they are no longer needed. It also allows for the generation of proofs determining whether a state tree hash was included in the root hash - this will be needed for the IBC module's light clients.
Origin Document
Goals
Create a rootTree in the TreeStore
Change the logic for state hash computation to insert the different sub trees hashes into the rootTree and generate the root this way
Update the pokt-network/pocket-network-protocol documentation to reflect this change
Deliverable
[ ] Update state hash calculation to be done via the new rootTree SMT
[ ] Update tests to use the new hashes
[ ] Update documentation
Non-goals / Non-deliverables
Change any other logic in the TreeStore module
General issue deliverables
[ ] Update the appropriate CHANGELOG(s)
[ ] Update any relevant local/global README(s)
[ ] Update relevant source code tree explanations
[ ] Add or update any relevant or supporting mermaid diagrams
Testing Methodology
[ ] Task specific tests or benchmarks: make ...
[ ] New tests or benchmarks: make ...
[ ] All tests: make test_all
[ ] LocalNet: verify a LocalNet is still functioning correctly by following the instructions at docs/development/README.md
[ ] k8s LocalNet: verify a k8s LocalNet is still functioning correctly by following the instructions here
Objective
The way the root hash is currently computed is as follows:
This requires the order of the sub tree hashes to be known in order to calculate the state hash, and therefore to prove the inclusion of a specific tree in the state hash calculation this order must be known throughout the codebase.
This should instead be as follows:
rootTree
object in theTreeStore
module"app": appTree.Root()
"transactions": transactionsTree.Root()
rootTree.Root()
This allows for the computation of the state hash in a deterministic manner as the SMT is not order dependent in its updates, thus removing the need to know the tree orders as they are no longer needed. It also allows for the generation of proofs determining whether a state tree hash was included in the root hash - this will be needed for the IBC module's light clients.
Origin Document
Goals
rootTree
in theTreeStore
rootTree
and generate the root this waypokt-network/pocket-network-protocol
documentation to reflect this changeDeliverable
rootTree
SMTNon-goals / Non-deliverables
TreeStore
moduleGeneral issue deliverables
Testing Methodology
make ...
make ...
make test_all
LocalNet
is still functioning correctly by following the instructions at docs/development/README.mdk8s LocalNet
is still functioning correctly by following the instructions hereCreator: @h5law Co-Owners: @dylanlott