-
Notifications
You must be signed in to change notification settings - Fork 112
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
HIP-1056 Block File Reader #10072
base: main
Are you sure you want to change the base?
HIP-1056 Block File Reader #10072
Conversation
Signed-off-by: Xin Li <[email protected]>
Signed-off-by: Xin Li <[email protected]>
Signed-off-by: Xin Li <[email protected]>
Signed-off-by: Xin Li <[email protected]>
Signed-off-by: Xin Li <[email protected]>
Signed-off-by: Xin Li <[email protected]>
@@ -37,7 +37,8 @@ package com.hedera.mirror.common.domain.transaction; | |||
public record BlockItem(Transaction transaction, | |||
TransactionResult transactionResult, | |||
List<TransactionOutput> transactionOutput, // Note: List may be empty | |||
Optional<StateChanges> stateChanges) implements StreamItem {} | |||
List<StateChanges> stateChanges // Note: List may be empty |
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.
two reasons to make the change
- it's unclear from the doc if there should be strictly at most 1 statechanges for a transaction or not
- there are always non-transactional state changes before block proof, in case the last event in the last round has an event transaction, there will be more than 1 statechanges; it's unnecessary for the reader to sort out which statechanges belong to a transaction, and which belong to the event transaction.
Signed-off-by: Xin Li <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #10072 +/- ##
============================================
+ Coverage 92.21% 92.22% +0.01%
- Complexity 7858 7896 +38
============================================
Files 956 958 +2
Lines 32938 33099 +161
Branches 4151 4170 +19
============================================
+ Hits 30373 30525 +152
- Misses 1588 1593 +5
- Partials 977 981 +4 ☔ View full report in Codecov by Sentry. |
@@ -43,9 +44,6 @@ public class BlockFile implements StreamFile<BlockItem> { | |||
// Used to generate block hash | |||
private BlockProof blockProof; | |||
|
|||
// Contained within the last StateChange of the block, contains hashes needed to generate the block hash |
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.
we have the following two hash leaves
- previous hash from
BlockHeader
- start of block state hash from
BlockProof
The other two are calculated from input block items merkle tree and output block item merkle tree, so we don't need BlockStreamInfo
...rror-importer/src/main/java/com/hedera/mirror/importer/reader/block/BlockRootHashDigest.java
Outdated
Show resolved
Hide resolved
coverage Signed-off-by: Xin Li <[email protected]>
...ror-importer/src/main/java/com/hedera/mirror/importer/reader/block/ProtoBlockFileReader.java
Show resolved
Hide resolved
...ror-importer/src/main/java/com/hedera/mirror/importer/reader/block/ProtoBlockFileReader.java
Show resolved
Hide resolved
Signed-off-by: Xin Li <[email protected]>
Signed-off-by: Xin Li <[email protected]>
@@ -60,6 +58,8 @@ public class BlockFile implements StreamFile<BlockItem> { | |||
@ToString.Exclude | |||
private String hash; | |||
|
|||
private Long index; |
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.
add back the index
field so we have a setter which makes testing easier. Not really benefit test cases in this PR, however it makes the block stream verifier PR tests easier so as to just set the index, instead of crafting a proper BlockHeader
with the correct block number.
Quality Gate passedIssues Measures |
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.
Looks good to me!
Description:
This PR adds block file reader to read block stream files as defined by HIP-1056
ProtoBlockFileReader
BlockRootHashDigest
to calculate block file's root hashRelated issue(s):
Fixes #9894
Notes for reviewer:
Checklist