New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inject ActionEvaluator and BlockChainStates explicitly #2507
Inject ActionEvaluator and BlockChainStates explicitly #2507
Conversation
dcc375e
to
f94411e
Compare
f94411e
to
67408e5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a little question, but what would happen if Store and StateStore objects passed to BlockChain constructor is different from what was passed to BlockChainStates constructor that is passed to the BlockChain constructor?
This PR has Quantification details
Why proper sizing of changes matters
Optimal pull request sizes drive a better predictable PR flow as they strike a
What can I do to optimize my changes
How to interpret the change counts in git diff output
Was this comment helpful? 👍 :ok_hand: :thumbsdown: (Email) |
Basically, I believe the responsibility for the chain state and its calculation in |
On second thought, adding a guard for |
This PR aims to extract
ActionEvaluator<T>
creation, fromBlockChain<T>
constructor to outside. to achieve that, we need to solve the dependency chain as below.ActionEvaluator<T>
dependsBlockChain<T>
asIBlockChainStates<T>
.IBlockChainStates<T>
,BlockChain<T>
dependsIStore
,IStateStore
, and itself. (due to state completion).In other words, if we can implement
IBlockChainState<T>
without the wholeBlockChain<T>
, extractingActionEvaluator<T>
creation fromBlockChain<T>
constructor seems possible.BlockChainStates<T>
implementingIBlockChainStates<T>
, instead ofBlockChain<T>
.GetBlances()
,GetStates()
andGetTotalSupply()
fromBlockChain<T>
toBlockChainStates<T>
.StateCompleter<T>
s, I introducedBlockChainStates<T>.Bind()
. it takesBlockChain<T>
to support previous methods.