I understand the value of a Patricia trie for key-value mappings. And, probably for dynamic arrays too. I also understand that Patricia trie in Ethereum is combined with Merkle tree properties, and the value of that. I also understand Merkle Patricia Tree is used for Transaction Trie mostly to only have to use one standard for "Merkling" (source). But, I do not entirely see why Patricia trie is ideal for statically-sized variables, unless the reason is to only need a single standard (similar to the Transaction Trie case), and the Patricia trie is chosen because it also supports mappings and dynamic arrays. It seems to me like statically-sized data can easily be done with no trie at all, and just simple merkle tree from all "storage slots", since the number of data elements is typically fixed.

Edit: Double-checked in Remix, and apparently uninitialized statically-sized variables are not assigned storage slot. So, new storage slots are added to the tree even with the static data. Maybe that answers my question.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.