-
Notifications
You must be signed in to change notification settings - Fork 524
crypto: add SHA-512 hashes #6339
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
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6339 +/- ##
==========================================
- Coverage 51.90% 51.89% -0.02%
==========================================
Files 653 653
Lines 87469 87500 +31
==========================================
+ Hits 45399 45405 +6
- Misses 39197 39219 +22
- Partials 2873 2876 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Pull Request Overview
Adds support for SHA-512 hashing in block headers and transaction commitments.
- Introduces a new
Branch512field onBlockHeaderand wires it throughPreCheck, serialization, and genesis/block creation. - Adds
TxnMerkleTreeSHA512andpaysetCommitSHA512alongside the existing SHA-256 and SHA-512/256 commitments. - Updates consensus parameters, tests, and regenerated MsgPack code to account for the new 64-byte fields.
Reviewed Changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| protocol/tags.go | Increased ProposalPayloadTagMaxSize for extra hash. |
| data/bookkeeping/genesis.go | Modified genesis block initialization of TxnCommitments. |
| data/bookkeeping/txn_merkle.go | Added TxnMerkleTreeSHA512 method. |
| data/bookkeeping/block.go | Added Branch512, Hash512, paysetCommitSHA512; integrated into MakeBlock and PreCheck. |
| data/bookkeeping/msgp_gen.go | Regenerated MsgPack code to include new fields. |
| crypto/hashes.go | Added Sha512 type, Sha512Digest, and hash factory case. |
| config/consensus.go | Introduced EnableSha512BlockHash flag and enabled it for future protocols. |
| crypto/msgp_gen.go & crypto/msgp_gen_test.go | Added MsgPack support and tests for Sha512Digest. |
| catchup/catchpointService_test.go | Updated test to set Branch512 on downloaded blocks. |
| (plus extensive autogenerated changes in agreement/msgp_gen.go and transmittedPayload code) |
Summary
This adds SHA-512 hashing to the block header, including the transaction commitment. When #3829 was added, a generic hashing abstraction and a new vector commitment implementation were added that supports both 64-byte (sumhash) and 32-byte (SHA-256, SHA-512/256) hashes, so not many changes were needed.
Matching go-algorand-sdk PR in algorand/go-algorand-sdk#723
Test Plan
Existing tests should pass; in addition, #3829 added some tests for SHA-256 transaction commitments that could be copy/pasted into this PR for SHA-512.