Skip to content

Conversation

@Nana-EC
Copy link
Contributor

@Nana-EC Nana-EC commented Nov 21, 2025

Reviewer Notes

Related Issue(s)

Use keywords Fix, Fixes, Fixed, Close, Closes, Closed, Resolve, Resolves, Resolved
to connect an issue to be closed by this pull request.

@Nana-EC Nana-EC added this to the 0.24.0 milestone Nov 21, 2025
@Nana-EC Nana-EC self-assigned this Nov 21, 2025
@Nana-EC Nana-EC added the Block Node Issues/PR related to the Block Node. label Nov 21, 2025
@Nana-EC
Copy link
Contributor Author

Nana-EC commented Nov 22, 2025

Leaving in draft until @AlfredoG87 's PR #1891 goes in.
I can more easily rebase my PR to add some tests and other support I found useful here.
More important for verification logic to go in sooner

@Nana-EC Nana-EC force-pushed the 1880-bump-0-68-1-cn-proto branch from c4b9e3e to e8360d1 Compare November 29, 2025 04:54
@Nana-EC Nana-EC changed the title chore: Bump CN Proto 0.68.1 w Basic Footer Support chore: Improvements to Block Footer and Proof Support Nov 29, 2025
Signed-off-by: Nana Essilfie-Conduah <[email protected]>
Signed-off-by: Nana Essilfie-Conduah <[email protected]>
@codecov
Copy link

codecov bot commented Nov 29, 2025

Codecov Report

❌ Patch coverage is 38.88889% with 11 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...cation/session/impl/ExtendedMerkleTreeSession.java 38.88% 8 Missing and 3 partials ⚠️

❌ Your patch check has failed because the patch coverage (38.88%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

@@             Coverage Diff              @@
##               main    #1891      +/-   ##
============================================
- Coverage     79.48%   78.91%   -0.58%     
- Complexity     1193     1200       +7     
============================================
  Files           128      130       +2     
  Lines          5684     5781      +97     
  Branches        610      618       +8     
============================================
+ Hits           4518     4562      +44     
- Misses          887      934      +47     
- Partials        279      285       +6     
Files with missing lines Coverage Δ Complexity Δ
...cation/session/impl/ExtendedMerkleTreeSession.java 71.18% <38.88%> (-15.49%) 15.00 <0.00> (+13.00) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@jsync-swirlds jsync-swirlds left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few concerns we might need to address.

Comment on lines +103 to +113
switch (blockProof.proof().kind()) {
case BLOCK_STATE_PROOF -> this.blockStateProof = blockProof.blockStateProof();
case SIGNED_BLOCK_PROOF -> this.tssSignedBlockProof = blockProof.signedBlockProof();
case SIGNED_RECORD_FILE_PROOF ->
this.signedRecordFileProof = blockProof.signedRecordFileProof();
default -> {
continue;
}
}

blockProofsReceived++;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appears to be assuming only one of any given type of proof. That is not what we expect; there may well be multiples of the same type. The original (add all of them to a set and process all as a set) seems more correct.

Copy link
Contributor Author

@Nana-EC Nana-EC Dec 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed that was the assumption, good note, will re-approach this


blockProofsReceived++;
}
case REDACTED_ITEM -> LOGGER.log(WARNING, "Redacted item observed in block {0}", blockNumber);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is tricky.
A live block cannot have redaction.
An historical block may.
In the former case the block must be rejected (bad block).
In the latter case, we don't need to log it, we need to include that redacted hash in the correct subtree and proceed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes tricky indeed, hmm, VerificationSession would have to be aware of the source of the Block.
If it's from a CN publisher then reject otherwise include hash as is without rehashing.
The warning log is to highlight we have things to do in the code.
Might be worth dropping this part and just capturing a ticket to come back to

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably better to have an issue filed to revisit.
Generally, because WARNING logs are interpreted as software bugs by some testing processes, INFO would be the highest priority for a "we need to come back and improve this" log.

blockProofsReceived++;
}
case REDACTED_ITEM -> LOGGER.log(WARNING, "Redacted item observed in block {0}", blockNumber);
case FILTERED_ITEM_HASH -> LOGGER.log(WARNING, "Filtered item hash observed in block {0}", blockNumber);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is fun.

  1. From live, this is strictly prohibited
  2. From storage or another block node in tier 1 this is strictly prohibited.
  3. From any source in tier 2 this is permitted.

In all cases filtered items still need to be added to the proper subtree as a pre-computed hash (which I do not believe the current hasher supports, future work to handle that).

This suggests that we probably need two different verification plugins. One that is "strict" and runs in tier 1, and another that is "lenient" and may run in tier 2 if an operator chooses. (yes, we could do this with configuration, but I believe we'd be better off and much safer to just have two different plugins).

case FILTERED_ITEM_HASH -> LOGGER.log(WARNING, "Filtered item hash observed in block {0}", blockNumber);
case RECORD_FILE -> LOGGER.log(WARNING, "Record file observed in block {0}", blockNumber);
case UNSET -> LOGGER.log(WARNING, "Unset block item observed in block {1}", kind, blockNumber);
default -> LOGGER.log(WARNING, "Unknown block item type {0} in block {1}", kind, blockNumber);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't have default; the enumerated value is comprehensive and we should ensure every known enum is handled (which the compiler will only do if there is no default).
Any enumerated type we don't yet handle should be in a different place (the unknown values map); not mixed in with existing block items.

case REDACTED_ITEM -> LOGGER.log(WARNING, "Redacted item observed in block {0}", blockNumber);
case FILTERED_ITEM_HASH -> LOGGER.log(WARNING, "Filtered item hash observed in block {0}", blockNumber);
case RECORD_FILE -> LOGGER.log(WARNING, "Record file observed in block {0}", blockNumber);
case UNSET -> LOGGER.log(WARNING, "Unset block item observed in block {1}", kind, blockNumber);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't happen.
It also probably shouldn't be a warning log; I would expect an info log and immediate failure of the verification (because there is a completely unprocessable block item).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe a new blockitem type we are unaware of would show up as UNSET.
Need to confirm with tests

}
case REDACTED_ITEM -> LOGGER.log(WARNING, "Redacted item observed in block {0}", blockNumber);
case FILTERED_ITEM_HASH -> LOGGER.log(WARNING, "Filtered item hash observed in block {0}", blockNumber);
case RECORD_FILE -> LOGGER.log(WARNING, "Record file observed in block {0}", blockNumber);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We actually need to parse and process these; for now we probably want an info log; not warning.

Comment on lines +61 to +65
private TssSignedBlockProof tssSignedBlockProof;
private StateProof blockStateProof;
private SignedRecordFileProof signedRecordFileProof;

private List<BlockProof> blockProofs = new ArrayList<>();
private int blockProofsReceived = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This probably won't work. We can have multiple of the same type of block proof.
StateProof type block proofs, in particular, are very likely to have multiple on a given block.
TSS signed proofs are currently expected to be singular, but that may not always be true. Signed record file proof type will probably always be singular, but we perhaps shouldn't assume that (for symmetry, if nothing else).

@AlfredoG87 AlfredoG87 modified the milestones: 0.24.0, 0.25.0 Dec 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Block Node Issues/PR related to the Block Node.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants