From e4b0e4d0c030b3720613ad8ec17e8430086cd652 Mon Sep 17 00:00:00 2001 From: gabrielkerekes Date: Tue, 8 Aug 2023 12:48:29 +0200 Subject: [PATCH] annotate test transaction --- common/tests/fixtures/solana/sign_tx.json | 34 +++++++++++++++++++++-- tests/device_tests/solana/test_sign_tx.py | 3 ++ 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/common/tests/fixtures/solana/sign_tx.json b/common/tests/fixtures/solana/sign_tx.json index a1573374d..31b6a0514 100644 --- a/common/tests/fixtures/solana/sign_tx.json +++ b/common/tests/fixtures/solana/sign_tx.json @@ -7,10 +7,40 @@ { "parameters": { "signer_path": "m/44'/501'/0'/0'", - "serialized_tx": "01000103c80f8b50107e9f3e3c16a661b8c806df454a6deb293d5e8730a9d28f2f4998c68f41927b2e58cbc31ed3aa5163a7b8ca4eb5590e8dc1dc682426cd2895aa9c0a00000000000000000000000000000000000000000000000000000000000000001aea57c9906a7cad656ff61b3893abda63f4b6b210c939855e7ab6e54049213d01020200010c02000000002d310100000000" + "annotated_serialized_tx": [ + "#header", + "010001", + "#number of accounts", + "03", + "#accounts", + "00d1699dcb1811b50bb0055f13044463128242e37a463b52f6c97a1f6eef88ad", + "8f41927b2e58cbc31ed3aa5163a7b8ca4eb5590e8dc1dc682426cd2895aa9c0a", + "0000000000000000000000000000000000000000000000000000000000000000", + "#blockhash", + "1aea57c9906a7cad656ff61b3893abda63f4b6b210c939855e7ab6e54049213d", + "#instructions", + "#num_of_instructions", + "01", + "#instruction", + "#program id index (system)", + "02", + "#number of accounts", + "02", + "#accounts (from, to)", + "00", "01", + "#data", + "#data length", + "0c", + "#instruction id (transfer)", + "02000000", + "#data (lamports amount) (20000000)", + "002d310100000000" + + ], + "serialized_tx": "0100010300d1699dcb1811b50bb0055f13044463128242e37a463b52f6c97a1f6eef88ad8f41927b2e58cbc31ed3aa5163a7b8ca4eb5590e8dc1dc682426cd2895aa9c0a00000000000000000000000000000000000000000000000000000000000000001aea57c9906a7cad656ff61b3893abda63f4b6b210c939855e7ab6e54049213d01020200010c02000000002d310100000000" }, "result": { - "expected_signature": "fa61c29a7cbd21598c856d83208465177fadb8c9a0ba96fa16a538ec95cd3e10f41b839e8db6135b5f18a9e3c94b7ed593794e91546c960ac45309512c36570c" + "expected_signature": "74a8360ed4342608fde93fedd48debf8b582264af94878b3d42fc52c7d4de87de090cd5c042783c6645a25b3bd4c394bac8cf23bcd530bad87601d9baa8c6d02" } } ] diff --git a/tests/device_tests/solana/test_sign_tx.py b/tests/device_tests/solana/test_sign_tx.py index 5e1187654..88f3a016a 100644 --- a/tests/device_tests/solana/test_sign_tx.py +++ b/tests/device_tests/solana/test_sign_tx.py @@ -35,6 +35,9 @@ pytestmark = [ def test_solana_sign_tx(client: Client, parameters, result): client.init_device(new_session=True) + # make sure the annotated transaction matches the original one + assert parameters["serialized_tx"] == "".join([i for i in parameters["annotated_serialized_tx"] if "#" not in i]) + actual_result = sign_tx( client, signer_path_n=parse_path(parameters["signer_path"]),