-
Notifications
You must be signed in to change notification settings - Fork 143
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
Validate state root hash #986
Conversation
8cf6863
to
a683a81
Compare
a683a81
to
401b999
Compare
Codecov Report
@@ Coverage Diff @@
## main #986 +/- ##
==========================================
- Coverage 89.16% 88.97% -0.20%
==========================================
Files 324 328 +4
Lines 29370 29465 +95
==========================================
+ Hits 26189 26216 +27
- Misses 1625 1696 +71
+ Partials 1556 1553 -3
|
753c27a
to
c809550
Compare
It seems conflicting. |
c809550
to
2626326
Compare
@longfin I resolved. You can review them 😀 |
- `BlockPolicy<T>` became to validate `Block<T>.StateRootHash` property | ||
of a `Block<T>`. [[#986]] |
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.
Is this necessary despite we've never released Block<T>.StateRootHash
?
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.
The reason why I added the line, was the behavior of BlockPolicy<T>
. As you said, Block<T>.StateRootHash
is had never released yet, but BlockPolicy<T>
does. Then isn't it right to log the change or is it unnecessary?
2626326
to
389ab87
Compare
5e34ea6
to
9193e58
Compare
where T : IAction, new() | ||
{ | ||
private readonly ILogger _logger; | ||
private readonly IAction _blockAction; |
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.
private readonly IAction _blockAction; | |
private readonly IAction? _blockAction; |
_balanceGetter; | ||
|
||
internal BlockEvaluator( | ||
IAction blockAction, |
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.
IAction blockAction, | |
IAction? blockAction, |
Libplanet/Store/TrieStateStore.cs
Outdated
internal HashDigest<SHA256>? SetStates<T>( | ||
Block<T> block, | ||
IImmutableDictionary<string, IValue> states, | ||
bool rehearsal) |
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.
Do we need this rehearsal option? This seems to be only used when making the genesis block. Since the MakeGenesisBlock
method uses an in-memory DefaultKeyValueStore
, wouldn't it be okay without this option?
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.
You're right. I will remove it.
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.
I fixed it in 68090f7. Please check your intention was applied well.
/rebase |
/rebase |
Originally, it was hard to evaluate blocks properly because blockchain contained the logic to evaluate and block action (i.e., block policy). BlockChain required a genesis block but it require logic to evaluate block and block action. This fixes the interdependence issue.
- Remove code duplication - Remove useless comment
`ExecuteActionsBetweenTrieStateStoreAndBlockStatesStore` is not correct anymore because `TrieStateStore` and `IBlockStatesStore` doesn't share same block layout
- `InvalidBlockStateRootHashException` [skip changelog]
Co-Authored-By: Seunghun Lee <waydi1@gmail.com>
43ad298
3b31603
to
43ad298
Compare
Block<T>.StateRootHash
field when usingTrieStateStore
.evaluationDigest
(akaactionsHash
)