paritytech / trie

Base-16 Modified Patricia Merkle Tree (aka Trie)
Apache License 2.0
251 stars 67 forks source link

Make `trie_nodes_recorded_for_key` work for inline values #194

Closed bkchr closed 12 months ago

bkchr commented 1 year ago

trie_nodes_recorded_for_key was not working properly for inline values. It would always return RecordedForKey::None while we actually have accessed and recorded all the trie nodes for the value. The pr introduces TrieAccess::InlineValue to communicate this access to the recorder properly to make it then return RecordedForKey::Value.

arkpar commented 1 year ago

@bkchr Is this still relevant? Why do we need to record inline nodes in the first place?

bkchr commented 12 months ago

@bkchr Is this still relevane? Why do we need to record inline nodes in the first place?

This is just about telling the recorder that we have seen the value. This is required when we use the cache, to be able to fetch the value from the cache. When the recorder and cache are enabled, we only fetch a value from the cache if we have recorded all the trie nodes up to this value. To be able to know if we have recorded all the trie nodes, we need to tell the recorder, also for the inline values.