Skip to content

Commit b11a326

Browse files
committed
fix: FVK account default bug + remove redundant account=0 in tests
Change zcash_get_orchard_fvk account default from 0 to None. Only serialize account field when explicitly set — firmware derives from address_n[2] otherwise. Same fix as zcash_sign_pczt. Update tests to rely on address_n path derivation.
1 parent 9f461c2 commit b11a326

2 files changed

Lines changed: 10 additions & 13 deletions

File tree

keepkeylib/client.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1607,14 +1607,11 @@ def ton_sign_tx(self, address_n, raw_tx):
16071607

16081608
# ── Zcash Orchard ──────────────────────────────────────────
16091609
@expect(zcash_proto.ZcashOrchardFVK)
1610-
def zcash_get_orchard_fvk(self, address_n, account=0, show_display=False):
1611-
return self.call(
1612-
zcash_proto.ZcashGetOrchardFVK(
1613-
address_n=address_n,
1614-
account=account,
1615-
show_display=show_display,
1616-
)
1617-
)
1610+
def zcash_get_orchard_fvk(self, address_n, account=None, show_display=False):
1611+
kwargs = dict(address_n=address_n, show_display=show_display)
1612+
if account is not None:
1613+
kwargs['account'] = account
1614+
return self.call(zcash_proto.ZcashGetOrchardFVK(**kwargs))
16181615

16191616
@session
16201617
def zcash_sign_pczt(self, address_n, actions, account=None,

tests/test_msg_zcash_orchard.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def test_fvk_field_ranges(self):
4848

4949
# ZIP-32 Orchard path: m/32'/133'/0'
5050
address_n = [0x80000000 + 32, 0x80000000 + 133, 0x80000000]
51-
resp = self.client.zcash_get_orchard_fvk(address_n=address_n, account=0)
51+
resp = self.client.zcash_get_orchard_fvk(address_n=address_n)
5252

5353
ak = resp.ak
5454
nk = resp.nk
@@ -84,7 +84,7 @@ def test_fvk_reference_vectors(self):
8484
self.setup_mnemonic_allallall()
8585

8686
address_n = [0x80000000 + 32, 0x80000000 + 133, 0x80000000]
87-
resp = self.client.zcash_get_orchard_fvk(address_n=address_n, account=0)
87+
resp = self.client.zcash_get_orchard_fvk(address_n=address_n)
8888

8989
ak_hex = binascii.hexlify(resp.ak).decode()
9090
nk_hex = binascii.hexlify(resp.nk).decode()
@@ -100,8 +100,8 @@ def test_fvk_consistency_across_calls(self):
100100

101101
address_n = [0x80000000 + 32, 0x80000000 + 133, 0x80000000]
102102

103-
resp1 = self.client.zcash_get_orchard_fvk(address_n=address_n, account=0)
104-
resp2 = self.client.zcash_get_orchard_fvk(address_n=address_n, account=0)
103+
resp1 = self.client.zcash_get_orchard_fvk(address_n=address_n)
104+
resp2 = self.client.zcash_get_orchard_fvk(address_n=address_n)
105105

106106
self.assertTrue(resp1.ak == resp2.ak, "ak must be deterministic")
107107
self.assertTrue(resp1.nk == resp2.nk, "nk must be deterministic")
@@ -127,7 +127,7 @@ def test_fvk_abandon_mnemonic(self):
127127
self.setup_mnemonic_abandon()
128128

129129
address_n = [0x80000000 + 32, 0x80000000 + 133, 0x80000000]
130-
resp = self.client.zcash_get_orchard_fvk(address_n=address_n, account=0)
130+
resp = self.client.zcash_get_orchard_fvk(address_n=address_n)
131131

132132
# Check field ranges (not reference values — just validity)
133133
self.assertTrue(resp.ak[31] & 0x80 == 0, "ak sign bit must be 0 for abandon mnemonic")

0 commit comments

Comments
 (0)