-
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Answer from @ajsutton: Each contract account has its own (potentially empty) storage: a new merkle trie. This represents the "inter-transactional state" and comes at a cost (in gas). If you store the accounts' storage tries by storageRoot rather than the more natural account address, i.e. |
Beta Was this translation helpful? Give feedback.
Answer from @ajsutton:
Each contract account has its own (potentially empty) storage: a new merkle trie. This represents the "inter-transactional state" and comes at a cost (in gas).
Some contracts have lots of storage.
Many smaller tries is a good model because you avoid paying the gas costs of hashing lots of small changes to one big trie. (Does besu's BONSAI mode change this?).
A merkle trie is a good choice because you're still able to identify it with a single hash.
If you store the accounts' storage tries by storageRoot rather than the more natural account address, i.e.
Map<StorageRoot, StorageTrie>
rather thanMap<Account, StorageTrie>
then this leads to de-duplication since two co…