@ledgerhq/zcash-utils 2.0.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @ledgerhq/zcash-utils
2
2
 
3
+ ## 2.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 152aa4d: Accept V6 transactions when recomputing the txid on broadcast. `broadcastTransaction` derived the txid behind a guard that admitted only V5, which dates from when V5 was the only post-ZIP-225 format and survived the V6 builder, the Ironwood finalize path, and the Ironwood PCZT parse without being revisited. Only a transparent t→t send stays on V5 — any shielded send carrying an Ironwood bundle finalizes to V6 — so every shielded send failed with `expected V5 transaction, got V6` _after_ the device had already signed, and before the transaction was ever submitted. Nothing was lost: the txid is computed before the transaction is handed to the server, so the failing path returned without broadcasting.
8
+
9
+ The guard now admits V5 and V6 and still rejects pre-ZIP-225 formats, whose wire layout differs. The txid derives from the stream for both versions: `Transaction::read` dispatches on the version header and forwards its consensus-branch argument only to the V4 reader, so a V6 txid is computed exactly as a V5 one is and still matches the operation hash the sync path records for the same transaction.
10
+
11
+ Also derive Ironwood completed-shard roots locally instead of calling `GetSubtreeRoots`. The deployed Zaino does not serve that RPC for the Ironwood pool — it rejects `ShieldedProtocol::Ironwood` as an invalid shielded protocol value — so Ironwood witness computation now streams the pool's cmx leaves over `GetBlockRange` and reduces each completed shard to its root with the same level-encoded Sinsemilla hash the server would have applied. The pure witness assembly is unchanged and still shared with Orchard.
12
+
13
+ The pool's first block is located by binary-searching the commitment-tree frontier on leaf count rather than on whether the server's tree-state field is a non-empty string, so the search does not depend on how a server represents an empty frontier. Two bounds are checked before any block is fetched: the pool must be small enough for local reduction to stay interactive, and the scan range must be plausible, so a misresolved activation height fails fast instead of streaming a large share of the chain through a request that carries no timeout. Collected leaf counts are reconciled against the frontier, so a disagreement surfaces as an error rather than a silently wrong witness, and a note position past the anchor's leaf count is rejected up front. Callers should move back to `GetSubtreeRoots` once the server serves it for Ironwood.
14
+
15
+ ## 2.1.0
16
+
17
+ ### Minor Changes
18
+
19
+ - abe272e: Surface the Ironwood bundle from `parsePczt`.
20
+
3
21
  ## 2.0.0
4
22
 
5
23
  ### Major Changes
package/index.d.ts CHANGED
@@ -560,6 +560,61 @@ export interface PcztOrchardBundle {
560
560
  /** Orchard commitment-tree anchor, 32 bytes. */
561
561
  anchor: Uint8Array
562
562
  }
563
+ /**
564
+ * A single Ironwood action (NU6.3, V6 transactions only).
565
+ *
566
+ * The wire format mirrors an Orchard action with the PCZT v2
567
+ * `note_plaintext_version` byte appended; the fields are spelled out here
568
+ * rather than nested so the object maps 1:1 onto the signer's
569
+ * `PcztIronwoodAction`.
570
+ */
571
+ export interface PcztIronwoodAction {
572
+ /** Value commitment, 32 bytes. */
573
+ cvNet: Uint8Array
574
+ /** Spend nullifier, 32 bytes. */
575
+ nullifier: Uint8Array
576
+ /** Randomized verification key, 32 bytes. */
577
+ rk: Uint8Array
578
+ /** Raw Orchard address of the spent note, 43 bytes. */
579
+ spendRecipient: Uint8Array
580
+ /** Spent-note value in zatoshis (decimal string to avoid f64 precision loss). */
581
+ spendValue: string
582
+ /** Spend rho, 32 bytes. */
583
+ spendRho: Uint8Array
584
+ /** Spend rseed, 32 bytes. */
585
+ spendRseed: Uint8Array
586
+ /** Spend-authorization randomizer, 32 bytes. */
587
+ alpha: Uint8Array
588
+ /** ZIP-32 derivation path of the signing key. */
589
+ signingPath: string
590
+ /** ZIP-32 seed fingerprint, 32 bytes. */
591
+ seedFingerprint: Uint8Array
592
+ /** Note commitment x-coordinate, 32 bytes. */
593
+ cmx: Uint8Array
594
+ /** Ephemeral key, 32 bytes. */
595
+ ephemeralKey: Uint8Array
596
+ encCiphertext: Uint8Array
597
+ outCiphertext: Uint8Array
598
+ /** Raw Orchard address of the output note, 43 bytes. */
599
+ recipient: Uint8Array
600
+ /** Output-note value in zatoshis (decimal string to avoid f64 precision loss). */
601
+ value: string
602
+ /** Output rseed, 32 bytes. */
603
+ rseed: Uint8Array
604
+ /** Value commitment randomness, 32 bytes. */
605
+ rcv: Uint8Array
606
+ /** Note-plaintext lead byte (`0x03` for Ironwood), required for PCZT v2. */
607
+ notePlaintextVersion: number
608
+ }
609
+ /** The Ironwood action bundle plus its trailer (V6 transactions only). */
610
+ export interface PcztIronwoodBundle {
611
+ actions: Array<PcztIronwoodAction>
612
+ flags: number
613
+ /** Net value balance in zatoshis (signed decimal string, lossless for i128). */
614
+ valueBalance: string
615
+ /** Ironwood commitment-tree anchor, 32 bytes. */
616
+ anchor: Uint8Array
617
+ }
563
618
  /** A fully structured PCZT ready for `DmkSignerZcash.signPcztTransaction`. */
564
619
  export interface PcztTransaction {
565
620
  global: PcztGlobal
@@ -567,6 +622,12 @@ export interface PcztTransaction {
567
622
  transparentOutputs: Array<PcztTransparentOutput>
568
623
  /** `null` when the transaction has no Orchard actions. */
569
624
  orchardBundle?: PcztOrchardBundle
625
+ /**
626
+ * `null` when the transaction has no Ironwood actions. Always `null` below
627
+ * transaction version 6 — the Ironwood pool is V6-only, and the signer
628
+ * rejects an Ironwood bundle on a V5 transaction.
629
+ */
630
+ ironwoodBundle?: PcztIronwoodBundle
570
631
  }
571
632
  /**
572
633
  * Parse canonical PCZT bytes (hex, as returned by `buildTransaction`) into the
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/zcash-utils",
3
- "version": "2.0.0",
3
+ "version": "2.1.1",
4
4
  "description": "Native Zcash key derivation and shielded sync — Node.js (NAPI)",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",