Removing global state root #425
Replies: 3 comments 1 reply
-
Some initial thoughts:
|
Beta Was this translation helpful? Give feedback.
-
This is soooo interesting.
|
Beta Was this translation helpful? Give feedback.
-
I'll try to rephrase it to understand the idea better: Currently we maintain global state root and recompute it for each new chunk. This requires O(N) overhead to recompute it where N is the depth of account. Instead, each node can locally maintain a mapping from each account key to its state and last block where the account was modified. When new receipt occurs, we easily modify our mapping and append receipt output to merkle tree of existing outputs. The latter one is fast, because we just need a path to the previous receipt output in merkle tree and can keep it in memory. To prove the account state, we prove the last receipt output where account was modified. It can be slow, but it doesn't slow down block/chunk production. However, I feel that answering the question "how to check if there was a newer transaction that changed given account?" leads to the same bottleneck as we have now. For example, account can be untouched in a year, and if one wants to prove its state, they need to prove that it was untouched in every block during this year. Maybe we can achieve something if we try different approaches for accounts which are touched rarely or frequently, but I would need to think more about it. Also I think that we need to treat each contract data key as a separate account, otherwise we will have the same problem for large contract storages (e.g. Sweatcoin). |
Beta Was this translation helpful? Give feedback.
-
Idea around figuring out how to remove global state root (and chunk level state roots), removing need to maintain patricia merkle tree between all accounts. While maintaining same level of provability/light client.
Inspired by convo with Fuel network
They are using UTXO model to avoid the need to have global state root
What are problems this would try to solve:
Maintaining large merkle tree that must be updated after processing every chunk
Large Fraud proofs of the whole chunk
Because NEAR already has isolation on the account level, we can consider that last update to the account is an unspent output and each receipt takes last unspent output of that that account and transforms into a new one.
Applying it to NEAR:
Questions:
—-
Same:
Pros:
Cons:
Beta Was this translation helpful? Give feedback.
All reactions