I have seen primitives around Merkle Trees and Merkle Proofs a bit everywhere across the Substrate, Polkadot, and Smoldot repos. I was wondering what the right choice would be for the following use case:
At the end of each block, read from a storage map in a pallet a series of values, and for each of them generate a fresh Merkle Root (no information on previous roots is stored anywhere) and deposit an event with the value identifier and the new Merkle Root. What about verifying this proof with access only to the Merkle root, the proof itself, and the revealed leaves?
So far, I've found in the sp_trie::{generate_trie_proof, verify_trie_proof}
the best candidate, but I have seen Merkle stuff also in the beefy pallet, the mmr-pallet does something similar, and Smoldot has also support for Merkle proof generation and verification.