1515# Hardened offset
1616H = 0x80000000
1717
18+ ORCHARD_ONLY_UA_ACCOUNT_0 = (
19+ "u1uzslnccvrw4r2y2kgjz7fm477xcnzge9z45scm4e6l6c63ren0ru29teedxw5vxu7c8xch"
20+ "p3ec2pu3wkgldc5zphwtm4w3fchcwrl26c"
21+ )
22+
1823
1924class TestMsgZcashDisplayAddress (common .KeepKeyTest ):
2025 """Test Zcash unified address display and verification."""
@@ -24,6 +29,20 @@ def setUp(self):
2429 self .requires_firmware ("7.15.0" )
2530 self .requires_message ("ZcashDisplayAddress" )
2631
32+ def test_zcash_display_address_device_derived (self ):
33+ """Device derives and displays the Orchard-only UA from seed/account."""
34+ self .setup_mnemonic_allallall ()
35+
36+ resp = self .client .zcash_display_address (
37+ address_n = [H + 32 , H + 133 , H + 0 ],
38+ account = 0 ,
39+ )
40+
41+ self .assertIsInstance (resp , zcash_proto .ZcashAddress )
42+ self .assertEqual (resp .address , ORCHARD_ONLY_UA_ACCOUNT_0 )
43+ self .assertTrue (resp .HasField ("seed_fingerprint" ))
44+ self .assertEqual (len (resp .seed_fingerprint ), 32 )
45+
2746 def test_zcash_display_address_basic (self ):
2847 """Verify a unified address using FVK components from the device."""
2948 self .setup_mnemonic_allallall ()
@@ -37,23 +56,18 @@ def test_zcash_display_address_basic(self):
3756 self .assertIsNotNone (fvk_resp .nk )
3857 self .assertIsNotNone (fvk_resp .rivk )
3958
40- # Use a placeholder unified address -- real address construction
41- # requires librustzcash (host-side). The firmware verifies the FVK
42- # matches its own derivation, not the address encoding.
43- # For a real test, construct a proper unified address externally.
44- resp = self .client .call (
45- zcash_proto .ZcashDisplayAddress (
46- address_n = [H + 32 , H + 133 , H + 0 ],
47- account = 0 ,
48- address = "u1placeholder" ,
49- ak = fvk_resp .ak ,
50- nk = fvk_resp .nk ,
51- rivk = fvk_resp .rivk ,
52- )
59+ resp = self .client .zcash_display_address (
60+ address_n = [H + 32 , H + 133 , H + 0 ],
61+ account = 0 ,
62+ address = ORCHARD_ONLY_UA_ACCOUNT_0 ,
63+ ak = fvk_resp .ak ,
64+ nk = fvk_resp .nk ,
65+ rivk = fvk_resp .rivk ,
5366 )
5467
5568 # Device should verify FVK matches and return the address
5669 self .assertIsInstance (resp , zcash_proto .ZcashAddress )
70+ self .assertEqual (resp .address , ORCHARD_ONLY_UA_ACCOUNT_0 )
5771
5872 def test_zcash_display_address_wrong_fvk_rejected (self ):
5973 """Device rejects address when FVK doesn't match its own derivation."""
@@ -64,15 +78,13 @@ def test_zcash_display_address_wrong_fvk_rejected(self):
6478
6579 # Send bogus FVK -- device should reject
6680 with pytest .raises (CallException ):
67- self .client .call (
68- zcash_proto .ZcashDisplayAddress (
69- address_n = [H + 32 , H + 133 , H + 0 ],
70- account = 0 ,
71- address = "u1placeholder" ,
72- ak = b'\x00 ' * 32 ,
73- nk = b'\x00 ' * 32 ,
74- rivk = b'\x00 ' * 32 ,
75- )
81+ self .client .zcash_display_address (
82+ address_n = [H + 32 , H + 133 , H + 0 ],
83+ account = 0 ,
84+ address = ORCHARD_ONLY_UA_ACCOUNT_0 ,
85+ ak = b'\x00 ' * 32 ,
86+ nk = b'\x00 ' * 32 ,
87+ rivk = b'\x00 ' * 32 ,
7688 )
7789
7890
0 commit comments