The State tree needs to have its root hash recalculated at the commit of each block. To make it efficient, only paths that were changed during the given block should be recalculated. This requires to have an ability to memoize which paths were accessed, and act on this when recalculating the root.
There are two options to track the nodes that were amended during the given block. Track it in the node or the page, or track it elsewhere. The first option requires storing or cleaning additional metadata related to each key. The second, when a list of keys that were changes is kept in memory is much less demanding. The component that holds the dirty information can be called a DirtyMap
.
If DirtyMap
was stored alongside the block, and pointed from the RootPage
, it would in the future building an archive engine that would recognize what nodes were changed (on the DirtyMap
basis) and reindex them, before Paprika overrides it when the block moves beyond Max Reorganization Boundary.