This PR is focused on reconstructing txhashset PMMRs from segment data. Txhashset reconstruction via segments is now in its initially working state, with next steps being to finish hooking up desegmenter functionality to the sync process. (Note that sync will never still never exit the PIBD stage of sync, that's for the next PR.)
Add push_pruned_subtree to core/pmmr, which pushes a given hash representing a fully-pruned subtree to a pmmr. This function then calculates all needed hashes up to the leftmost parent and moves the mmr size to the next available leaf position.
Add functions to TxHashset that apply segments to the appropriate PMMRs. Note that when a pruned subtree is added, the push_pruned_subtree function above calculates all missing hashes and moves the pmmr size to the next leaf insertion position. These segment application functions then skip any intermediate hashes that have already been calculated, which means they're only attempting to push hashes that represent pruned subtrees.
Add append_hash to pmmr backend to support the above
Add OrderedHashLeafNode struct and supporting functions to sort lists of hashes and leaves from segments into insertion order.
Additions to desegmenter to request and apply kernel and rangeproof segments. Note there's a lot of redundancy in these functions, but rust being rust refactoring them into more generic functions might be a bit of a project given the number of Traits involved.
Updates to test_pibd_copy to exercise all of the above manually on live chain data. Note this test is not intended to be run during CI but are meant to be triggered manually for development/debugging
This PR is focused on reconstructing txhashset PMMRs from segment data. Txhashset reconstruction via segments is now in its initially working state, with next steps being to finish hooking up desegmenter functionality to the sync process. (Note that sync will never still never exit the PIBD stage of sync, that's for the next PR.)
push_pruned_subtree
to core/pmmr, which pushes a given hash representing a fully-pruned subtree to a pmmr. This function then calculates all needed hashes up to the leftmost parent and moves the mmr size to the next available leaf position.TxHashset
that apply segments to the appropriate PMMRs. Note that when a pruned subtree is added, thepush_pruned_subtree
function above calculates all missing hashes and moves the pmmr size to the next leaf insertion position. These segment application functions then skip any intermediate hashes that have already been calculated, which means they're only attempting to push hashes that represent pruned subtrees.append_hash
to pmmr backend to support the aboveOrderedHashLeafNode
struct and supporting functions to sort lists of hashes and leaves from segments into insertion order.test_pibd_copy
to exercise all of the above manually on live chain data. Note this test is not intended to be run during CI but are meant to be triggered manually for development/debugging