Closed lexnv closed 12 months ago
After reading the spec more carefully, I think the logic here requires some changes. We need to return the descendant of the provided key, not just the lower bound. Basically this means traversing the tree as usual, but for Leaf, Extension and NibbledBranch nodes if you run out of key, just check if the current node key slice extends the remainder.
if slice.starts_with(&partial) {
return Ok(Some(hash)))
else
return Ok(None)
}
This PR adds support for fetching the merkle value directly from the trie-db.
get_closest_merkle_value
on theTrie
traitTrieDb
iterates over the nibbles of the provided keyHashedValueNoExtThreshold<1>
as trie layout and value update at given keyWe could build on this PR to have support for recorded Merkel Value in the cache.
Would love to get your thoughts on this @cheme @arkpar 🙏 (For reference @tomaka to ensure we don't break anything wrt to compatibilities between smoldot and substrate)
Part of https://github.com/paritytech/substrate/issues/14550.
// @paritytech/subxt-team