Skip to content

Commit 8fef364

Browse files
committed
fix: SPL opcode u8 not u32, PDF xref 'n' not 'g'
1. SPL Token instruction type is u8 per spec (bytes([3])), not u32 2. PDF xref entries use 'n' (in-use), not 'g' (generation marker)
1 parent c54c248 commit 8fef364

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

scripts/generate-test-report.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def write(self, path):
128128
f.write(b'xref\n')
129129
f.write(f'0 {len(objs)+1}\n'.encode())
130130
f.write(b'0000000000 65535 f \n')
131-
for o in offs: f.write(f'{o:010d} 00000 g \n'.encode())
131+
for o in offs: f.write(f'{o:010d} 00000 n \n'.encode())
132132
f.write(f'trailer\n<< /Size {len(objs)+1} /Root 1 0 R >>\nstartxref\n{xr}\n%%EOF\n'.encode())
133133

134134
GREEN = (0.13, 0.55, 0.13)

tests/test_msg_solana_signtx.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,8 @@ def test_solana_sign_token_transfer(self):
243243
from_pubkey = self._get_from_pubkey()
244244
to_account = b'\x33' * 32 # destination token account
245245
owner = from_pubkey # token owner = signer
246-
# SPL Token Transfer instruction: type=3 (LE u32) + amount (LE u64)
247-
instr_data = struct.pack('<I', 3) + struct.pack('<Q', 50000000) # 50M tokens
246+
# SPL Token Transfer instruction: opcode=3 (u8) + amount (LE u64)
247+
instr_data = bytes([3]) + struct.pack('<Q', 50000000) # 50M tokens
248248
raw_tx = self._build_tx(from_pubkey, [to_account], self.TOKEN_PROGRAM, instr_data)
249249
resp = self.client.call(messages.SolanaSignTx(
250250
address_n=parse_path("m/44'/501'/0'/0'"), raw_tx=raw_tx))
@@ -256,8 +256,8 @@ def test_solana_sign_token_approve(self):
256256
self.setup_mnemonic_allallall()
257257
from_pubkey = self._get_from_pubkey()
258258
delegate = b'\x44' * 32
259-
# SPL Token Approve: type=4 (LE u32) + amount (LE u64)
260-
instr_data = struct.pack('<I', 4) + struct.pack('<Q', 100000000)
259+
# SPL Token Approve: opcode=4 (u8) + amount (LE u64)
260+
instr_data = bytes([4]) + struct.pack('<Q', 100000000)
261261
raw_tx = self._build_tx(from_pubkey, [delegate], self.TOKEN_PROGRAM, instr_data)
262262
resp = self.client.call(messages.SolanaSignTx(
263263
address_n=parse_path("m/44'/501'/0'/0'"), raw_tx=raw_tx))

0 commit comments

Comments
 (0)