Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
e6e0725
Add initial protobufs for new block merkle tree structure
mhess-swl Sep 26, 2025
3f3f453
Add algorithm for streaming merkle tree
mhess-swl Sep 26, 2025
8df4050
Update BlockItem with new definition
mhess-swl Sep 26, 2025
16daa56
Merge remote-tracking branch 'origin/main' into 21181-block-merkle-fe…
mhess-swl Oct 2, 2025
5a001c3
wip
mhess-swl Oct 4, 2025
4a8b8c1
Merge remote-tracking branch 'origin/main' into 21204-streaming-hash-…
mhess-swl Oct 4, 2025
8ee748e
Merge remote-tracking branch 'origin/main' into 21181-block-merkle-fe…
mhess-swl Oct 4, 2025
0aea101
Merge remote-tracking branch 'origin/main' into 21181-block-merkle-fe…
mhess-swl Oct 4, 2025
86bf07c
Merge remote-tracking branch 'origin/main' into 21204-streaming-hash-…
mhess-swl Oct 4, 2025
87995b0
Merge branch '21181-block-merkle-feature' into 21204-streaming-hash-tree
mhess-swl Oct 4, 2025
a4695d9
feat: add block footer (#21356)
aderevets Oct 6, 2025
4cb3d4c
Merge branch '21181-block-merkle-feature' into 21204-streaming-hash-tree
mhess-swl Oct 7, 2025
96fbb79
Fix compilation errors
mhess-swl Oct 7, 2025
577d884
spotless
mhess-swl Oct 7, 2025
df0f33b
Merge branch '21181-block-merkle-feature' into 21204-streaming-hash-tree
mhess-swl Oct 7, 2025
43cf3c6
wip
mhess-swl Oct 7, 2025
a0627a5
Merge remote-tracking branch 'origin/main' into 21181-block-merkle-fe…
mhess-swl Oct 13, 2025
6ea7a87
Merge branch '21181-block-merkle-feature' into 21204-streaming-hash-tree
mhess-swl Oct 13, 2025
f69b64c
Calculate block hash using v0.68 block merkle tree
mhess-swl Oct 14, 2025
603e232
Merge remote-tracking branch 'origin/main' into 21181-block-merkle-fe…
mhess-swl Oct 14, 2025
8b4a6dc
Merge branch '21181-block-merkle-feature' into 21204-streaming-hash-tree
mhess-swl Oct 14, 2025
916f7d0
Initialize block trees and last block hash
mhess-swl Oct 14, 2025
1d8c216
Initialize block trees and last block hash
mhess-swl Oct 14, 2025
b69dcf8
Protobuf improvements
mhess-swl Oct 15, 2025
7924118
State proof definition
mhess-swl Oct 15, 2025
d36219f
Comment out StateProof for now
mhess-swl Oct 16, 2025
a8a3f3a
feat: Send end block request (#21413)
JivkoKelchev Oct 16, 2025
c30ed92
Merge remote-tracking branch 'origin/main' into 21181-block-merkle-fe…
mhess-swl Oct 16, 2025
74a714b
Merge branch '21181-block-merkle-feature' into 21204-streaming-hash-tree
mhess-swl Oct 16, 2025
12726ef
Merge remote-tracking branch 'origin/main' into 21204-streaming-hash-…
mhess-swl Oct 22, 2025
05928c5
Temp fix for protobuf cyclic dependency (BlockItem <-> MerkleLeaf)
mhess-swl Oct 22, 2025
41205e8
Merge remote-tracking branch 'origin/main' into 21204-streaming-hash-…
mhess-swl Oct 23, 2025
c45d2a7
Add initial protobufs for new block merkle tree structure
mhess-swl Sep 26, 2025
d0200d2
Add algorithm for streaming merkle tree
mhess-swl Sep 26, 2025
c98d4d2
Update BlockItem with new definition
mhess-swl Sep 26, 2025
0020f29
feat: add block footer (#21356)
aderevets Oct 6, 2025
8f57951
Fix compilation errors
mhess-swl Oct 7, 2025
981aeb8
spotless
mhess-swl Oct 7, 2025
10b8d0b
feat: Send end block request (#21413)
JivkoKelchev Oct 16, 2025
5fbd73a
Merge branch '21181-block-merkle-feature' into 21204-streaming-hash-tree
mhess-swl Oct 23, 2025
f6fea58
Rework
mhess-swl Oct 23, 2025
eb2912d
NoThisStateProof block proof
mhess-swl Oct 23, 2025
7433e8c
gradle work around to compile `message StateProof`
edward-swirldslabs Oct 24, 2025
aee237e
Remove unneeded properties
mhess-swl Oct 23, 2025
2365bf0
Protobuf tweaks
mhess-swl Oct 24, 2025
7dfb4da
Protobuf tweaks
mhess-swl Oct 24, 2025
cedab7e
Proof mechanism
mhess-swl Oct 24, 2025
ff52f25
Cleanup
mhess-swl Oct 27, 2025
9d91890
Docs
mhess-swl Oct 27, 2025
ff3e0f7
Docs
mhess-swl Oct 28, 2025
01aecd2
Fixes
mhess-swl Oct 28, 2025
387ea8d
Merge branch 'main' into 21181-block-merkle-feature
mhess-swl Oct 28, 2025
86d5d61
Merge branch '21181-block-merkle-feature' into 21204-streaming-hash-tree
mhess-swl Oct 28, 2025
34a6438
Test fix
mhess-swl Oct 28, 2025
2c18cb2
wip
Neeharika-Sompalli Nov 1, 2025
e859fed
probablyyy fixes?
Neeharika-Sompalli Nov 1, 2025
7acd969
spotless
Neeharika-Sompalli Nov 1, 2025
3779cd1
Minor cleanup
mhess-swl Nov 1, 2025
20e0405
Some updates to state changes validator
mhess-swl Nov 1, 2025
165d857
Cleanup
mhess-swl Nov 1, 2025
38244c5
Fix a couple state changes validator issues
mhess-swl Nov 1, 2025
6ad0fae
wip
Neeharika-Sompalli Nov 2, 2025
80e004d
sync main
Neeharika-Sompalli Nov 2, 2025
a7edd85
fix translator
Neeharika-Sompalli Nov 2, 2025
59f91e4
validation passes on adHoc
Neeharika-Sompalli Nov 2, 2025
c204d91
validation passes
Neeharika-Sompalli Nov 2, 2025
e5bded6
Proto updates
mhess-swl Nov 2, 2025
7898950
Revert merkle leaf to proto.Timestamp
mhess-swl Nov 2, 2025
e6797ff
More proto doc updates, renumbering
mhess-swl Nov 3, 2025
4136cb6
Try removing duplicate timestamp
mhess-swl Nov 3, 2025
1525988
Spotless
mhess-swl Nov 3, 2025
42611d4
Use block proof's TSS signature
mhess-swl Nov 3, 2025
73416ce
Restore inc hashes init in validator
mhess-swl Nov 3, 2025
1d3f6b6
Copy array refs in inc hasher
mhess-swl Nov 3, 2025
5b6fc98
Remove duplicate timestamp from block stream info
mhess-swl Nov 3, 2025
72ee0d6
Fix unit tests, remove unused proto
mhess-swl Nov 3, 2025
7badf17
One more test
mhess-swl Nov 3, 2025
7c1e214
Re-enable tests, remove old comments
mhess-swl Nov 3, 2025
203a3c4
Test improvement
mhess-swl Nov 3, 2025
e9e4fef
Replace filtered item hash with filtered single item
mhess-swl Nov 3, 2025
0c581a9
Merge remote-tracking branch 'origin/main' into 21204-streaming-hash-…
mhess-swl Nov 3, 2025
8debbcc
Increase timeout
mhess-swl Nov 3, 2025
448c5ff
Remove block node suite test (not useful, already covered)
mhess-swl Nov 3, 2025
df9525a
Remove stray comment
mhess-swl Nov 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import "block/stream/output/transaction_output.proto";
import "block/stream/output/transaction_result.proto";
import "block/stream/trace/trace_data.proto";
import "block/stream/output/block_footer.proto";
import "services/state/blockstream/streaming_tree_snapshot.proto";

/**
* A single item within a block stream.
Expand Down Expand Up @@ -134,15 +133,15 @@ import "services/state/blockstream/streaming_tree_snapshot.proto";
* - `trace_data`
* - Any subtree (depending on what was filtered).
* This item contains it's path in the tree and must be fully parsed.
* - `filtered_item_hash`
* - `filtered_single_item`
* - No subtree (and not part of the "proof" merkle tree)
* - `block_footer`
* - `block_proof`
* - `record_file`
*/
message BlockItem {
// Reserved for future items that require separate handling for block hash purposes.
reserved 14,15,16,17,18,19;
reserved 13,14,15,16,17,18,19,20;

oneof item {
/**
Expand Down Expand Up @@ -208,19 +207,9 @@ message BlockItem {
com.hedera.hapi.block.stream.output.StateChanges state_changes = 7;

/**
* Verification data for an item filtered from the stream.<br/>
* This is a hash for a merkle tree node where the contents of that
* part of the merkle tree have been removed from this stream.
* <p>
* Items of this type SHALL NOT be present in the full (unfiltered)
* block stream.<br/>
* Items of this type SHALL replace any item removed from a partial
* (filtered) block stream.<br/>
* Presence of `filtered_item` entries SHALL NOT prevent verification
* of a block, but MAY preclude verification or reconstruction of
* consensus state.<br/>
* A block item intentionally filtered from the stream.
*/
FilteredItemHash filtered_item_hash = 8 [deprecated = true];
FilteredSingleItem filtered_single_item = 8;

/**
* A signed block proof.<br/>
Expand Down Expand Up @@ -271,11 +260,6 @@ message BlockItem {
* One or more Block Proof items SHALL follow this item.
*/
com.hedera.hapi.block.stream.output.BlockFooter block_footer = 12;

/**
* A transaction intentionally filtered from the stream.
*/
FilteredSingleItem filtered_single_item = 13;
}
}

Expand Down Expand Up @@ -390,3 +374,26 @@ message RedactedItem {
*/
SubMerkleTree tree = 3;
}

/**
* Identifier for each sub-tree of the block root fixed size tree
*/
enum SubMerkleTree {
ITEM_TYPE_UNSPECIFIED = 0; // Default value, required best practice
PREVIOUS_BLOCK_ROOT = 1;
PREVIOUS_ROOTS_TREE = 2;
PREVIOUS_BLOCK_START_STATE = 3;
CONSENSUS_HEADER_ITEMS = 4;
INPUT_ITEMS_TREE = 5;
OUTPUT_ITEMS_TREE = 6;
STATE_CHANGE_ITEMS_TREE = 7;
TRACE_DATA_ITEMS_TREE = 8;
FUTURE_1 = 9; // these place holders for future use sub trees, will be renamed if they are used later
FUTURE_2 = 10;
FUTURE_3 = 11;
FUTURE_4 = 12;
FUTURE_5 = 13;
FUTURE_6 = 14;
FUTURE_7 = 15;
FUTURE_8 = 16;
}
Original file line number Diff line number Diff line change
Expand Up @@ -152,45 +152,32 @@ message BlockStreamInfo {

/**
* A SHA2-384 hash value.<br/>
* This is the hash of the "consensus headers" subtree for this block.
* This is the final hash of the "consensus headers" subtree for this block.
*/
bytes consensus_header_tree_root_hash = 14 [deprecated = true];
bytes consensus_header_root_hash = 14;

/**
* A SHA2-384 hash value.<br/>
* This is the hash of the "trace data" subtree for this block.
* This is the final hash of the "output" subtree for this block.
*/
bytes trace_data_tree_root_hash = 15 [deprecated = true];

/**
* A SHA2-384 hash value.<br/>
* This is the hash of the "output" subtree for this block.
*/
bytes output_tree_root_hash = 16 [deprecated = true];

/**
* A SHA2-384 hash value.<br/>
* This is the final hash of the "consensus" subtree for this block.
*/
bytes consensus_header_root_hash = 17;

/**
* A SHA2-384 hash value.<br/>
* This is the final hash of the "output" subtree for this block.
*/
bytes output_item_root_hash = 18;
bytes output_item_root_hash = 15;

/**
* A SHA2-384 hash value.<br/>
* This is the final hash of the "trace data" subtree for this block.
*/
bytes trace_data_root_hash = 19;
bytes trace_data_root_hash = 16;

/**
* The intermediate hashes needed for subroot 2 in the block merkle
* tree structure. These hashes SHALL include the minimum required
* block root hashes needed to construct subroot 2's final state at
* the end of the previous block.
*/
repeated bytes intermediate_previous_block_root_hashes = 20;
repeated bytes intermediate_previous_block_root_hashes = 17;

/**
* The number of leaves in the intermediate block roots subtree.
*/
uint64 intermediate_block_roots_leaf_count = 18;
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import static com.hedera.node.app.hapi.utils.CommonPbjConverters.toPbj;
import static java.lang.System.arraycopy;
import static java.util.Objects.requireNonNull;
import static org.hiero.base.crypto.Cryptography.NULL_HASH;

import com.google.common.annotations.VisibleForTesting;
import com.google.common.primitives.Longs;
Expand All @@ -22,6 +23,7 @@
import com.hederahashgraph.api.proto.java.TransactionBody;
import com.hederahashgraph.api.proto.java.TransactionOrBuilder;
import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.Nullable;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.time.Instant;
Expand Down Expand Up @@ -185,4 +187,13 @@ public static long clampedAdd(final long addendA, final long addendB) {
return addendA > 0 ? Long.MAX_VALUE : Long.MIN_VALUE;
}
}

/**
* Returns the given hash if it is non-null and non-empty; otherwise, returns {@code NULL_HASH}
* @param maybeHash the possibly null or empty hash
* @return the given hash or {@code NULL_HASH} if the given hash is null or empty
*/
public static Bytes inputOrNullHash(@Nullable final Bytes maybeHash) {
return (maybeHash != null && maybeHash.length() > 0) ? maybeHash : NULL_HASH.getBytes();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import static com.hederahashgraph.api.proto.java.HederaFunctionality.UncheckedSubmit;
import static com.hederahashgraph.api.proto.java.HederaFunctionality.UtilPrng;
import static com.hederahashgraph.api.proto.java.ResponseType.ANSWER_ONLY;
import static org.hiero.base.crypto.Cryptography.NULL_HASH;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertEquals;
Expand All @@ -59,6 +60,7 @@
import com.google.protobuf.ByteString;
import com.google.protobuf.GeneratedMessage;
import com.google.protobuf.InvalidProtocolBufferException;
import com.hedera.pbj.runtime.io.buffer.Bytes;
import com.hederahashgraph.api.proto.java.AccountID;
import com.hederahashgraph.api.proto.java.ConsensusCreateTopicTransactionBody;
import com.hederahashgraph.api.proto.java.ConsensusDeleteTopicTransactionBody;
Expand Down Expand Up @@ -311,4 +313,23 @@ void getExpectEvmAddress() {
final var evmAddress = asEvmAddress(123L);
assertArrayEquals(address, evmAddress);
}

@Test
void inputOrNullHashReturnsHash() {
final Bytes input = Bytes.wrap(new byte[] {1, 2, 3, 4, 5});
final var result = CommonUtils.inputOrNullHash(input);
assertEquals(input, result);
}

@Test
void inputOrNullHashReturnsNullHash() {
final var result = CommonUtils.inputOrNullHash(null);
assertEquals(NULL_HASH.getBytes(), result);
}

@Test
void inputOrNullHashReturnsNullHashForEmpty() {
final var result = CommonUtils.inputOrNullHash(Bytes.EMPTY);
assertEquals(NULL_HASH.getBytes(), result);
}
}
Loading
Loading