Repository navigation
csnode: BlockVerifier for blocks that come from outside the consensus - #90
Merged
Merged
Conversation
One verifier for the snapshot importer and backward sync: the block parses, has the expected sequence and hash, and its signatures verify against its own confidants with the real trusted mask, as the node does when it stores a deferred block (block 0 has none). Round confirmations are checked separately against the previous block's confidants, with finalizeBlock's exceptions. Step 3b of snapshots served by community nodes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An invalid pool reads as sequence 0 and was taken for the genesis block by verifySignatures, which needs no signature there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Signature and confirmation counts are checked with a reason before checkGroupSignature, which logs them as errors (untrusted input). - verifyConfirmations refuses a normal round's block without round confirmations, as storeBlock does. - The header says an empty expectedHash proves only self-consistency: the caller must anchor the block. - Tests: a flipped bit in a real pool signature (it parses, keeps its hash and fails), more signatures than the mask, no confidants, a block without confirmations, confirmations against a set of another size. The two former cases passed without reaching the check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Step 3b of snapshots served by community nodes, shared with backward sync.
BlockVerifier::verify(block, expectedSequence, expectedHash): the block parses, has the expected sequence and, when given, the expected hash, computed from its bytes. For sequence ≥ 1 its signatures also verify against its own confidants with the real trusted mask, exactly astryFlushDeferredBlockdoes. Block 0 needs none.verifySignatures: the signatures alone. They are outside the hashed part, so they are the only thing a sender could alter without changing the hash.verifyConfirmations(block, previousConfidants): the round confirmations, withfinalizeBlock's exceptions (bootstrap blocks, one-entry masks).Nothing uses it yet. Not consensus-relevant: the existing checks are unchanged and called the same way.
Tests use blocks signed with real keys: valid; wrong sequence; wrong hash; signatures by keys other than the confidants; fewer signatures than the mask; genesis; confirmations against the right and the wrong confidants.
🤖 Generated with Claude Code