-
Notifications
You must be signed in to change notification settings - Fork 33
Closed
Labels
persistencePersistence specific changesPersistence specific changes
Milestone
Description
Objective
The way the root hash is currently computed is as follows:
stateHash := sha256.Sum256(appTreeHash + transactionsTreeHash + ... + flagsTreeHash)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
rootTreeobject in theTreeStoremodule - 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
rootTreein theTreeStore - Change the logic for state hash computation to insert the different sub trees hashes into the
rootTreeand generate the root this way - Update the
pokt-network/pocket-network-protocoldocumentation to reflect this change
Deliverable
- Update state hash calculation to be done via the new
rootTreeSMT - Update tests to use the new hashes
- Update documentation
Non-goals / Non-deliverables
- Change any other logic in the
TreeStoremodule
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
LocalNetis still functioning correctly by following the instructions at docs/development/README.md - k8s LocalNet: verify a
k8s LocalNetis still functioning correctly by following the instructions here
Creator: @h5law
Co-Owners: @dylanlott
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
persistencePersistence specific changesPersistence specific changes
Type
Projects
Status
Done