Skip to content

feat(wasm-utxo): add BLAKE2b-256 personalization helper#330

Merged
veetragjain merged 1 commit into
zcash-v6-transactionfrom
zcash-blake2b
Jul 23, 2026
Merged

feat(wasm-utxo): add BLAKE2b-256 personalization helper#330
veetragjain merged 1 commit into
zcash-v6-transactionfrom
zcash-blake2b

Conversation

@veetragjain

Copy link
Copy Markdown
Contributor

Shared primitive for Zcash ZIP-243/ZIP-244/ZIP-316 hashing, extracted as the base for the v6 transaction and unified-address work (PR1 of 3).

Includes the block-aligned finalization fix and a variable-length variant (blake2b_var_personal) that F4Jumble needs. Ships with unit tests.

@veetragjain
veetragjain marked this pull request as ready for review July 23, 2026 06:02
@veetragjain
veetragjain requested a review from a team as a code owner July 23, 2026 06:02

@OttoAllmendinger OttoAllmendinger left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Requesting changes — one item.

The block_aligned_input_is_stable test doesn't actually guard the bug this helper exists to fix. It only asserts the digest is non-zero and deterministic — the old f=0 implementation produces a deterministic, non-zero (but wrong) 32-byte output too, so it would pass this test unchanged. Same trap called out in bitgo_psbt/mod.rs test_zcash_sighash_block_aligned_outputs: a self-consistent round-trip agrees with itself on the wrong value.

Please pin a known-answer vector for a block-aligned (128-byte-multiple) input, and — importantly — source it from something external, not "whatever our implementation currently emits." Ideally reference the spec that carries the vectors, or vendor a fixture file into the repo with its provenance:

  • BLAKE2b personalization / block behavior → RFC 7693 test vectors, and/or
  • the Zcash ZIP-243/ZIP-244 hash-tree vectors from zcash/zcash-test-vectors

so the value is traceable to the spec rather than self-referential. A single block-aligned KAT plus its cited source is enough to unblock; the rest of the PR looks good.


Generated by Claude Code

Shared primitive for Zcash ZIP-243/ZIP-244/ZIP-316 hashing, extracted as
the base for the v6 transaction and unified-address work (PR1 of 3).

The BitGo miniscript fork already has a blake2b_256_personal helper but it
is pub(crate) and unreachable from this crate, so we reimplement it here on
the blake2 crate (already in the tree transitively; pinned as a direct dep).
Includes the block-aligned finalization fix and a variable-length variant
(blake2b_var_personal) that F4Jumble needs. Ships with unit tests.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@veetragjain
veetragjain merged commit 3730478 into zcash-v6-transaction Jul 23, 2026
19 checks passed
@veetragjain
veetragjain deleted the zcash-blake2b branch July 23, 2026 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants