Skip to content

Commit 4c3f158

Browse files
committed
test(ton): enable AdvancedMode for TonSignTx tests
Firmware now gates length-only blind TON transaction signing behind the AdvancedMode policy (same fence as TonSignMessage and Solana/TRON opaque signing).
1 parent e0587c0 commit 4c3f158

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

tests/test_msg_ton_signtx.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ def test_ton_sign_structured(self):
7575
"""
7676
self.requires_fullFeature()
7777
self.setup_mnemonic_allallall()
78+
self.client.apply_policy('AdvancedMode', True)
7879

7980
dest_addr = make_ton_address()
8081

@@ -100,6 +101,7 @@ def test_ton_sign_with_memo(self):
100101
"""Test TON transfer with a text memo (blind-sign path)."""
101102
self.requires_fullFeature()
102103
self.setup_mnemonic_allallall()
104+
self.client.apply_policy('AdvancedMode', True)
103105

104106
dest_addr = make_ton_address()
105107

@@ -123,6 +125,7 @@ def test_ton_sign_legacy_raw_tx(self):
123125
"""Test legacy blind-sign with raw_tx field."""
124126
self.requires_fullFeature()
125127
self.setup_mnemonic_allallall()
128+
self.client.apply_policy('AdvancedMode', True)
126129

127130
raw_tx = b'\x00' * 64
128131

@@ -138,6 +141,7 @@ def test_ton_sign_missing_fields_rejected(self):
138141
"""Test that incomplete structured fields are rejected."""
139142
self.requires_fullFeature()
140143
self.setup_mnemonic_allallall()
144+
self.client.apply_policy('AdvancedMode', True)
141145

142146
msg = ton_messages.TonSignTx(
143147
address_n=parse_path(TON_PATH),
@@ -151,6 +155,7 @@ def test_ton_sign_deterministic(self):
151155
"""Test that signing the same message produces same signature."""
152156
self.requires_fullFeature()
153157
self.setup_mnemonic_allallall()
158+
self.client.apply_policy('AdvancedMode', True)
154159

155160
dest_addr = make_ton_address()
156161
raw_tx = hashlib.sha256(b'test-ton-deterministic').digest() * 2 # 64 bytes
@@ -181,6 +186,7 @@ def test_ton_sign_empty_raw_tx(self):
181186
"""Empty raw_tx (0 bytes) should be rejected by firmware."""
182187
self.requires_fullFeature()
183188
self.setup_mnemonic_allallall()
189+
self.client.apply_policy('AdvancedMode', True)
184190

185191
msg = ton_messages.TonSignTx(
186192
address_n=parse_path(TON_PATH),
@@ -194,6 +200,7 @@ def test_ton_sign_oversized_raw_tx(self):
194200
"""raw_tx of 1025 bytes exceeds proto max (1024) and should be rejected."""
195201
self.requires_fullFeature()
196202
self.setup_mnemonic_allallall()
203+
self.client.apply_policy('AdvancedMode', True)
197204

198205
raw_tx = b'\xAB' * 1025
199206

@@ -209,6 +216,7 @@ def test_ton_sign_with_empty_memo(self):
209216
"""Empty memo string should be accepted (memo is optional text)."""
210217
self.requires_fullFeature()
211218
self.setup_mnemonic_allallall()
219+
self.client.apply_policy('AdvancedMode', True)
212220

213221
dest_addr = make_ton_address()
214222
raw_tx = hashlib.sha256(b'test-ton-empty-memo').digest() * 2 # 64 bytes
@@ -230,6 +238,7 @@ def test_ton_sign_with_long_memo(self):
230238
"""Memo of 120 characters (near max_size 121) should be accepted."""
231239
self.requires_fullFeature()
232240
self.setup_mnemonic_allallall()
241+
self.client.apply_policy('AdvancedMode', True)
233242

234243
dest_addr = make_ton_address()
235244
raw_tx = hashlib.sha256(b'test-ton-long-memo').digest() * 2 # 64 bytes
@@ -252,6 +261,7 @@ def test_ton_sign_workchain_zero(self):
252261
"""Explicit workchain=0 (basechain) in TonSignTx."""
253262
self.requires_fullFeature()
254263
self.setup_mnemonic_allallall()
264+
self.client.apply_policy('AdvancedMode', True)
255265

256266
dest_addr = make_ton_address()
257267
raw_tx = hashlib.sha256(b'test-ton-workchain-zero').digest() * 2 # 64 bytes
@@ -279,6 +289,7 @@ def test_ton_sign_workchain_default(self):
279289
"""
280290
self.requires_fullFeature()
281291
self.setup_mnemonic_allallall()
292+
self.client.apply_policy('AdvancedMode', True)
282293

283294
dest_addr = make_ton_address()
284295
raw_tx = hashlib.sha256(b'test-ton-workchain-default').digest() * 2 # 64 bytes
@@ -315,6 +326,7 @@ def test_ton_sign_different_accounts(self):
315326
"""Signing with different account paths must produce different signatures."""
316327
self.requires_fullFeature()
317328
self.setup_mnemonic_allallall()
329+
self.client.apply_policy('AdvancedMode', True)
318330

319331
dest_addr = make_ton_address()
320332
raw_tx = hashlib.sha256(b'test-ton-different-accounts').digest() * 2 # 64 bytes

0 commit comments

Comments
 (0)