This issue actually suggests making planetarium/libplanet support universally another IStateStore implementation, not only TrieStateStore. Currently, there are many type testing logics and fields run on only TrieStateStore. That makes the existence of IStateStore suspicious: whether to allow using another custom IStateStore implementation. Also, it doesn't seem like a good model to make fields of Block<T> nullable. So I want to suggest to update and to discuss for below:
Rename Block<T>.StateRootHash more universal.
The name, StateRootHash, was from other blockchain's naming using MPT (e.g. Ethereum) and means the root hash of the tree. It is not suitable for another IStateStore implementation not using MPT. So we should rename it into a more universal name to mean "prove for the state of the block".
If you have some ideas about the naming, please leave them as a comment. cc @planetarium/libplanet
Separate the logic to validate its state from BlockChain<T>
Currently, BlockChain<T> validates the state of the block when using TrieStateStore. And the logic is in the BlockChain<T> implementation and it should be separated as another interface IStateValidator or something with better naming.
IMHO BlockChain<T> should be just a replacement of its tip, which doesn't do anything like mining.
Except for the above things, it should need one more interface to calculate the proof of the state.
This issue actually suggests making planetarium/libplanet support universally another
IStateStore
implementation, not onlyTrieStateStore
. Currently, there are many type testing logics and fields run on onlyTrieStateStore
. That makes the existence ofIStateStore
suspicious: whether to allow using another customIStateStore
implementation. Also, it doesn't seem like a good model to make fields ofBlock<T>
nullable. So I want to suggest to update and to discuss for below:Rename
Block<T>.StateRootHash
more universal.The name,
StateRootHash
, was from other blockchain's naming using MPT (e.g. Ethereum) and means the root hash of the tree. It is not suitable for anotherIStateStore
implementation not using MPT. So we should rename it into a more universal name to mean "prove for the state of the block".If you have some ideas about the naming, please leave them as a comment. cc @planetarium/libplanet
Separate the logic to validate its state from
BlockChain<T>
Currently,
BlockChain<T>
validates the state of the block when usingTrieStateStore
. And the logic is in theBlockChain<T>
implementation and it should be separated as another interfaceIStateValidator
or something with better naming.IMHO
BlockChain<T>
should be just a replacement of its tip, which doesn't do anything like mining.Except for the above things, it should need one more interface to calculate the proof of the state.