planetarium / libplanet

Blockchain in C#/.NET for on-chain, decentralized gaming
https://docs.libplanet.io/
GNU Lesser General Public License v2.1
506 stars 142 forks source link

Get rid of `IStateStore.PruneStates()` method & `MerkleTrie.IterateHashNodes()` method #1745

Closed moreal closed 1 year ago

moreal commented 2 years ago

📔 Overview

Currently, there are IStateStore.PruneStates()(TrieStateStore.PruneStates()) method and MerkleTrie.IterateHashNodes() method. And TrieStateStore.PruneStates()' implementation is very inefficient so #1691 introduced TrieStateStore.CopyStates() and libplanet should suggest efficient way and deprecate inefficient way.

🤔 Furthermore

While I had worked for #1691, I felt confused about IStateStore's role. Currently, there is only IStateStore.GetStateRoot() method and it just returns MerkleTrie with IKeyValueStore, secure bool option received from its constructor. it doesn't do anything except for it. Historically, IStateStore was introduced to replace state stores based on state-reference smoothly. But, today, IStateStore seems useless because Libplanet is using MPT as blockchain protocol level and I believe it will not be replaced, at least in near days.

References

See also https://github.com/planetarium/libplanet/pull/1691#issuecomment-1018113164.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions.