diff --git a/test/python/apps/exchange_test_runner.py b/test/python/apps/exchange_test_runner.py index 877b563b..8e0d20c6 100644 --- a/test/python/apps/exchange_test_runner.py +++ b/test/python/apps/exchange_test_runner.py @@ -10,7 +10,7 @@ from . import cal as cal from .signing_authority import SigningAuthority, LEDGER_SIGNER -from ..utils import handle_lib_call_start_or_stop +from ..utils import handle_lib_call_start_or_stop, int_to_minimally_sized_bytes # When adding a new test, have it prefixed by this string in order to have it automatically parametrized for currencies tests TEST_METHOD_PREFIX="perform_test_" @@ -57,7 +57,7 @@ def _perform_valid_exchange(self, subcommand, tx_infos, fees, ui_validation): ex = ExchangeClient(self.backend, Rate.FIXED, subcommand) # The partner we will perform the exchange with - partner = SigningAuthority(curve=get_partner_curve(subcommand), name="Default name") + partner = SigningAuthority(curve=get_partner_curve(subcommand), name=self.partner_name) # Initialize a new transaction request transaction_id = ex.init_transaction().data @@ -105,7 +105,7 @@ def perform_valid_swap_from_custom(self, destination, send_amount, fees, memo, r "payout_extra_id": b"", # Default "currency_from": self.currency_ticker, "currency_to": "ETH", # Default - "amount_to_provider": int.to_bytes(send_amount, length=8, byteorder='big'), + "amount_to_provider": int_to_minimally_sized_bytes(send_amount), "amount_to_wallet": b"\246\333t\233+\330\000", # Default } self._perform_valid_exchange(SubCommand.SWAP, tx_infos, fees, ui_validation=ui_validation) @@ -120,28 +120,28 @@ def perform_valid_swap_to_custom(self, destination, send_amount, fees, memo, ui_ "payout_extra_id": memo.encode(), "currency_from": "ETH", # Default "currency_to": self.currency_ticker, - "amount_to_provider": int.to_bytes(send_amount, length=8, byteorder='big'), + "amount_to_provider": int_to_minimally_sized_bytes(send_amount), "amount_to_wallet": b"\246\333t\233+\330\000", # Default } self._perform_valid_exchange(SubCommand.SWAP, tx_infos, fees, ui_validation=ui_validation) def perform_valid_fund_from_custom(self, destination, send_amount, fees): tx_infos = { - "user_id": "Jon Wick", # Default - "account_name": "My account 00", # Default + "user_id": self.fund_user_id, + "account_name": self.fund_account_name, "in_currency": self.currency_ticker, - "in_amount": int.to_bytes(send_amount, length=4, byteorder='big'), + "in_amount": int_to_minimally_sized_bytes(send_amount), "in_address": destination, } self._perform_valid_exchange(SubCommand.FUND, tx_infos, fees, ui_validation=True) def perform_valid_sell_from_custom(self, destination, send_amount, fees): tx_infos = { - "trader_email": "john@doe.lost", # Default - "out_currency": "USD", # Default - "out_amount": {"coefficient": b"\x01", "exponent": 3}, # Default + "trader_email": self.sell_trader_email, + "out_currency": self.sell_out_currency, + "out_amount": self.sell_out_amount, "in_currency": self.currency_ticker, - "in_amount": int.to_bytes(send_amount, length=4, byteorder='big'), + "in_amount": int_to_minimally_sized_bytes(send_amount), "in_address": destination, } self._perform_valid_exchange(SubCommand.SELL, tx_infos, fees, ui_validation=True) @@ -338,6 +338,7 @@ def perform_test_sell_wrong_amount(self): # Remove prefix to have nice snapshots directories ALL_TESTS = [str(i).replace(TEST_METHOD_PREFIX, '') for i in _all_test_methods_prefixed] ALL_TESTS_EXCEPT_MEMO = [test for test in ALL_TESTS if not "memo" in test] +ALL_TESTS_EXCEPT_MEMO_AND_FEES = [test for test in ALL_TESTS if (not "memo" in test and not "fees" in test)] SWAP_TESTS = [test for test in ALL_TESTS if "swap" in test] FUND_TESTS = [test for test in ALL_TESTS if "fund" in test] SELL_TESTS = [test for test in ALL_TESTS if "sell" in test] diff --git a/test/python/apps/solana_utils.py b/test/python/apps/solana_utils.py index ec7be1e0..d45db03c 100644 --- a/test/python/apps/solana_utils.py +++ b/test/python/apps/solana_utils.py @@ -27,6 +27,9 @@ def lamports_to_bytes(lamports: int) -> str: FEES = sol_to_lamports(0.00000564) FEES_BYTES = lamports_to_bytes(FEES) +FEES_2 = sol_to_lamports(0.0005543) +FEES_2_BYTES = lamports_to_bytes(FEES_2) + ### Proposed foreign and owned addresses ### diff --git a/test/python/snapshots/nanos/test_solana_fund_cancel/00006.png b/test/python/snapshots/nanos/test_solana_fund_cancel/00006.png deleted file mode 100644 index 9c7e7049..00000000 Binary files a/test/python/snapshots/nanos/test_solana_fund_cancel/00006.png and /dev/null differ diff --git a/test/python/snapshots/nanos/test_solana_fund_cancel/00000.png b/test/python/snapshots/nanos/test_solana_fund_refuse_double_sign/00000.png similarity index 100% rename from test/python/snapshots/nanos/test_solana_fund_cancel/00000.png rename to test/python/snapshots/nanos/test_solana_fund_refuse_double_sign/00000.png diff --git a/test/python/snapshots/nanos/test_solana_fund_cancel/00001.png b/test/python/snapshots/nanos/test_solana_fund_refuse_double_sign/00001.png similarity index 100% rename from test/python/snapshots/nanos/test_solana_fund_cancel/00001.png rename to test/python/snapshots/nanos/test_solana_fund_refuse_double_sign/00001.png diff --git a/test/python/snapshots/nanos/test_solana_fund_cancel/00002.png b/test/python/snapshots/nanos/test_solana_fund_refuse_double_sign/00002.png similarity index 100% rename from test/python/snapshots/nanos/test_solana_fund_cancel/00002.png rename to test/python/snapshots/nanos/test_solana_fund_refuse_double_sign/00002.png diff --git a/test/python/snapshots/nanos/test_solana_fund_cancel/00003.png b/test/python/snapshots/nanos/test_solana_fund_refuse_double_sign/00003.png similarity index 100% rename from test/python/snapshots/nanos/test_solana_fund_cancel/00003.png rename to test/python/snapshots/nanos/test_solana_fund_refuse_double_sign/00003.png diff --git a/test/python/snapshots/nanos/test_solana_fund_cancel/00004.png b/test/python/snapshots/nanos/test_solana_fund_refuse_double_sign/00004.png similarity index 100% rename from test/python/snapshots/nanos/test_solana_fund_cancel/00004.png rename to test/python/snapshots/nanos/test_solana_fund_refuse_double_sign/00004.png diff --git a/test/python/snapshots/nanos/test_solana_fund_cancel/00005.png b/test/python/snapshots/nanos/test_solana_fund_refuse_double_sign/00005.png similarity index 100% rename from test/python/snapshots/nanos/test_solana_fund_cancel/00005.png rename to test/python/snapshots/nanos/test_solana_fund_refuse_double_sign/00005.png diff --git a/test/python/snapshots/nanos/test_solana_fund_ok/00006.png b/test/python/snapshots/nanos/test_solana_fund_refuse_double_sign/00006.png similarity index 100% rename from test/python/snapshots/nanos/test_solana_fund_ok/00006.png rename to test/python/snapshots/nanos/test_solana_fund_refuse_double_sign/00006.png diff --git a/test/python/snapshots/nanos/test_solana_fund_ok/00000.png b/test/python/snapshots/nanos/test_solana_fund_valid_1/00000.png similarity index 100% rename from test/python/snapshots/nanos/test_solana_fund_ok/00000.png rename to test/python/snapshots/nanos/test_solana_fund_valid_1/00000.png diff --git a/test/python/snapshots/nanos/test_solana_fund_ok/00001.png b/test/python/snapshots/nanos/test_solana_fund_valid_1/00001.png similarity index 100% rename from test/python/snapshots/nanos/test_solana_fund_ok/00001.png rename to test/python/snapshots/nanos/test_solana_fund_valid_1/00001.png diff --git a/test/python/snapshots/nanos/test_solana_fund_ok/00002.png b/test/python/snapshots/nanos/test_solana_fund_valid_1/00002.png similarity index 100% rename from test/python/snapshots/nanos/test_solana_fund_ok/00002.png rename to test/python/snapshots/nanos/test_solana_fund_valid_1/00002.png diff --git a/test/python/snapshots/nanos/test_solana_fund_ok/00003.png b/test/python/snapshots/nanos/test_solana_fund_valid_1/00003.png similarity index 100% rename from test/python/snapshots/nanos/test_solana_fund_ok/00003.png rename to test/python/snapshots/nanos/test_solana_fund_valid_1/00003.png diff --git a/test/python/snapshots/nanos/test_solana_fund_ok/00004.png b/test/python/snapshots/nanos/test_solana_fund_valid_1/00004.png similarity index 100% rename from test/python/snapshots/nanos/test_solana_fund_ok/00004.png rename to test/python/snapshots/nanos/test_solana_fund_valid_1/00004.png diff --git a/test/python/snapshots/nanos/test_solana_fund_ok/00005.png b/test/python/snapshots/nanos/test_solana_fund_valid_1/00005.png similarity index 100% rename from test/python/snapshots/nanos/test_solana_fund_ok/00005.png rename to test/python/snapshots/nanos/test_solana_fund_valid_1/00005.png diff --git a/test/python/snapshots/nanos/test_solana_sell_ok/00006.png b/test/python/snapshots/nanos/test_solana_fund_valid_1/00006.png similarity index 100% rename from test/python/snapshots/nanos/test_solana_sell_ok/00006.png rename to test/python/snapshots/nanos/test_solana_fund_valid_1/00006.png diff --git a/test/python/snapshots/nanos/test_solana_sell_cancel/00000.png b/test/python/snapshots/nanos/test_solana_fund_valid_2/00000.png similarity index 100% rename from test/python/snapshots/nanos/test_solana_sell_cancel/00000.png rename to test/python/snapshots/nanos/test_solana_fund_valid_2/00000.png diff --git a/test/python/snapshots/nanos/test_solana_fund_valid_2/00001.png b/test/python/snapshots/nanos/test_solana_fund_valid_2/00001.png new file mode 100644 index 00000000..426fd9a8 Binary files /dev/null and b/test/python/snapshots/nanos/test_solana_fund_valid_2/00001.png differ diff --git a/test/python/snapshots/nanos/test_solana_fund_valid_2/00002.png b/test/python/snapshots/nanos/test_solana_fund_valid_2/00002.png new file mode 100644 index 00000000..b1b0e458 Binary files /dev/null and b/test/python/snapshots/nanos/test_solana_fund_valid_2/00002.png differ diff --git a/test/python/snapshots/nanos/test_solana_fund_valid_2/00003.png b/test/python/snapshots/nanos/test_solana_fund_valid_2/00003.png new file mode 100644 index 00000000..3a699dc3 Binary files /dev/null and b/test/python/snapshots/nanos/test_solana_fund_valid_2/00003.png differ diff --git a/test/python/snapshots/nanos/test_solana_fund_valid_2/00004.png b/test/python/snapshots/nanos/test_solana_fund_valid_2/00004.png new file mode 100644 index 00000000..2bd082bc Binary files /dev/null and b/test/python/snapshots/nanos/test_solana_fund_valid_2/00004.png differ diff --git a/test/python/snapshots/nanos/test_solana_sell_cancel/00005.png b/test/python/snapshots/nanos/test_solana_fund_valid_2/00005.png similarity index 100% rename from test/python/snapshots/nanos/test_solana_sell_cancel/00005.png rename to test/python/snapshots/nanos/test_solana_fund_valid_2/00005.png diff --git a/test/python/snapshots/nanos/test_solana_swap_recipient_cancel/00006.png b/test/python/snapshots/nanos/test_solana_fund_valid_2/00006.png similarity index 100% rename from test/python/snapshots/nanos/test_solana_swap_recipient_cancel/00006.png rename to test/python/snapshots/nanos/test_solana_fund_valid_2/00006.png diff --git a/test/python/snapshots/nanos/test_solana_sell_cancel/00006.png b/test/python/snapshots/nanos/test_solana_sell_cancel/00006.png deleted file mode 100644 index 9c7e7049..00000000 Binary files a/test/python/snapshots/nanos/test_solana_sell_cancel/00006.png and /dev/null differ diff --git a/test/python/snapshots/nanos/test_solana_sell_ok/00000.png b/test/python/snapshots/nanos/test_solana_sell_refuse_double_sign/00000.png similarity index 100% rename from test/python/snapshots/nanos/test_solana_sell_ok/00000.png rename to test/python/snapshots/nanos/test_solana_sell_refuse_double_sign/00000.png diff --git a/test/python/snapshots/nanos/test_solana_sell_cancel/00001.png b/test/python/snapshots/nanos/test_solana_sell_refuse_double_sign/00001.png similarity index 100% rename from test/python/snapshots/nanos/test_solana_sell_cancel/00001.png rename to test/python/snapshots/nanos/test_solana_sell_refuse_double_sign/00001.png diff --git a/test/python/snapshots/nanos/test_solana_sell_cancel/00002.png b/test/python/snapshots/nanos/test_solana_sell_refuse_double_sign/00002.png similarity index 100% rename from test/python/snapshots/nanos/test_solana_sell_cancel/00002.png rename to test/python/snapshots/nanos/test_solana_sell_refuse_double_sign/00002.png diff --git a/test/python/snapshots/nanos/test_solana_sell_cancel/00003.png b/test/python/snapshots/nanos/test_solana_sell_refuse_double_sign/00003.png similarity index 100% rename from test/python/snapshots/nanos/test_solana_sell_cancel/00003.png rename to test/python/snapshots/nanos/test_solana_sell_refuse_double_sign/00003.png diff --git a/test/python/snapshots/nanos/test_solana_sell_cancel/00004.png b/test/python/snapshots/nanos/test_solana_sell_refuse_double_sign/00004.png similarity index 100% rename from test/python/snapshots/nanos/test_solana_sell_cancel/00004.png rename to test/python/snapshots/nanos/test_solana_sell_refuse_double_sign/00004.png diff --git a/test/python/snapshots/nanos/test_solana_sell_ok/00005.png b/test/python/snapshots/nanos/test_solana_sell_refuse_double_sign/00005.png similarity index 100% rename from test/python/snapshots/nanos/test_solana_sell_ok/00005.png rename to test/python/snapshots/nanos/test_solana_sell_refuse_double_sign/00005.png diff --git a/test/python/snapshots/nanos/test_solana_swap_sender_cancel/00006.png b/test/python/snapshots/nanos/test_solana_sell_refuse_double_sign/00006.png similarity index 100% rename from test/python/snapshots/nanos/test_solana_swap_sender_cancel/00006.png rename to test/python/snapshots/nanos/test_solana_sell_refuse_double_sign/00006.png diff --git a/test/python/snapshots/nanos/test_solana_swap_recipient_cancel/00000.png b/test/python/snapshots/nanos/test_solana_sell_valid_1/00000.png similarity index 100% rename from test/python/snapshots/nanos/test_solana_swap_recipient_cancel/00000.png rename to test/python/snapshots/nanos/test_solana_sell_valid_1/00000.png diff --git a/test/python/snapshots/nanos/test_solana_sell_ok/00001.png b/test/python/snapshots/nanos/test_solana_sell_valid_1/00001.png similarity index 100% rename from test/python/snapshots/nanos/test_solana_sell_ok/00001.png rename to test/python/snapshots/nanos/test_solana_sell_valid_1/00001.png diff --git a/test/python/snapshots/nanos/test_solana_sell_ok/00002.png b/test/python/snapshots/nanos/test_solana_sell_valid_1/00002.png similarity index 100% rename from test/python/snapshots/nanos/test_solana_sell_ok/00002.png rename to test/python/snapshots/nanos/test_solana_sell_valid_1/00002.png diff --git a/test/python/snapshots/nanos/test_solana_sell_ok/00003.png b/test/python/snapshots/nanos/test_solana_sell_valid_1/00003.png similarity index 100% rename from test/python/snapshots/nanos/test_solana_sell_ok/00003.png rename to test/python/snapshots/nanos/test_solana_sell_valid_1/00003.png diff --git a/test/python/snapshots/nanos/test_solana_sell_ok/00004.png b/test/python/snapshots/nanos/test_solana_sell_valid_1/00004.png similarity index 100% rename from test/python/snapshots/nanos/test_solana_sell_ok/00004.png rename to test/python/snapshots/nanos/test_solana_sell_valid_1/00004.png diff --git a/test/python/snapshots/nanos/test_solana_swap_recipient_cancel/00004.png b/test/python/snapshots/nanos/test_solana_sell_valid_1/00005.png similarity index 100% rename from test/python/snapshots/nanos/test_solana_swap_recipient_cancel/00004.png rename to test/python/snapshots/nanos/test_solana_sell_valid_1/00005.png diff --git a/test/python/snapshots/nanos/test_solana_fund_cancel/00007.png b/test/python/snapshots/nanos/test_solana_sell_valid_1/00006.png similarity index 100% rename from test/python/snapshots/nanos/test_solana_fund_cancel/00007.png rename to test/python/snapshots/nanos/test_solana_sell_valid_1/00006.png diff --git a/test/python/snapshots/nanos/test_solana_swap_recipient_ok/00000.png b/test/python/snapshots/nanos/test_solana_sell_valid_2/00000.png similarity index 100% rename from test/python/snapshots/nanos/test_solana_swap_recipient_ok/00000.png rename to test/python/snapshots/nanos/test_solana_sell_valid_2/00000.png diff --git a/test/python/snapshots/nanos/test_solana_sell_valid_2/00001.png b/test/python/snapshots/nanos/test_solana_sell_valid_2/00001.png new file mode 100644 index 00000000..ae0a2947 Binary files /dev/null and b/test/python/snapshots/nanos/test_solana_sell_valid_2/00001.png differ diff --git a/test/python/snapshots/nanos/test_solana_sell_valid_2/00002.png b/test/python/snapshots/nanos/test_solana_sell_valid_2/00002.png new file mode 100644 index 00000000..b1b0e458 Binary files /dev/null and b/test/python/snapshots/nanos/test_solana_sell_valid_2/00002.png differ diff --git a/test/python/snapshots/nanos/test_solana_sell_valid_2/00003.png b/test/python/snapshots/nanos/test_solana_sell_valid_2/00003.png new file mode 100644 index 00000000..01f7f182 Binary files /dev/null and b/test/python/snapshots/nanos/test_solana_sell_valid_2/00003.png differ diff --git a/test/python/snapshots/nanos/test_solana_sell_valid_2/00004.png b/test/python/snapshots/nanos/test_solana_sell_valid_2/00004.png new file mode 100644 index 00000000..2bd082bc Binary files /dev/null and b/test/python/snapshots/nanos/test_solana_sell_valid_2/00004.png differ diff --git a/test/python/snapshots/nanos/test_solana_swap_recipient_ok/00004.png b/test/python/snapshots/nanos/test_solana_sell_valid_2/00005.png similarity index 100% rename from test/python/snapshots/nanos/test_solana_swap_recipient_ok/00004.png rename to test/python/snapshots/nanos/test_solana_sell_valid_2/00005.png diff --git a/test/python/snapshots/nanos/test_solana_sell_cancel/00007.png b/test/python/snapshots/nanos/test_solana_sell_valid_2/00006.png similarity index 100% rename from test/python/snapshots/nanos/test_solana_sell_cancel/00007.png rename to test/python/snapshots/nanos/test_solana_sell_valid_2/00006.png diff --git a/test/python/snapshots/nanos/test_solana_swap_recipient_cancel/00001.png b/test/python/snapshots/nanos/test_solana_swap_recipient_cancel/00001.png deleted file mode 100644 index 57e07235..00000000 Binary files a/test/python/snapshots/nanos/test_solana_swap_recipient_cancel/00001.png and /dev/null differ diff --git a/test/python/snapshots/nanos/test_solana_swap_recipient_cancel/00002.png b/test/python/snapshots/nanos/test_solana_swap_recipient_cancel/00002.png deleted file mode 100644 index 2222a836..00000000 Binary files a/test/python/snapshots/nanos/test_solana_swap_recipient_cancel/00002.png and /dev/null differ diff --git a/test/python/snapshots/nanos/test_solana_swap_recipient_cancel/00003.png b/test/python/snapshots/nanos/test_solana_swap_recipient_cancel/00003.png deleted file mode 100644 index 25b667a8..00000000 Binary files a/test/python/snapshots/nanos/test_solana_swap_recipient_cancel/00003.png and /dev/null differ diff --git a/test/python/snapshots/nanos/test_solana_swap_recipient_cancel/00005.png b/test/python/snapshots/nanos/test_solana_swap_recipient_cancel/00005.png deleted file mode 100644 index 9c7e7049..00000000 Binary files a/test/python/snapshots/nanos/test_solana_swap_recipient_cancel/00005.png and /dev/null differ diff --git a/test/python/snapshots/nanos/test_solana_swap_recipient_ok/00001.png b/test/python/snapshots/nanos/test_solana_swap_recipient_ok/00001.png deleted file mode 100644 index 57e07235..00000000 Binary files a/test/python/snapshots/nanos/test_solana_swap_recipient_ok/00001.png and /dev/null differ diff --git a/test/python/snapshots/nanos/test_solana_swap_recipient_ok/00002.png b/test/python/snapshots/nanos/test_solana_swap_recipient_ok/00002.png deleted file mode 100644 index 2222a836..00000000 Binary files a/test/python/snapshots/nanos/test_solana_swap_recipient_ok/00002.png and /dev/null differ diff --git a/test/python/snapshots/nanos/test_solana_swap_recipient_ok/00003.png b/test/python/snapshots/nanos/test_solana_swap_recipient_ok/00003.png deleted file mode 100644 index 25b667a8..00000000 Binary files a/test/python/snapshots/nanos/test_solana_swap_recipient_ok/00003.png and /dev/null differ diff --git a/test/python/snapshots/nanos/test_solana_swap_sender_cancel/00000.png b/test/python/snapshots/nanos/test_solana_swap_refuse_double_sign/00000.png similarity index 100% rename from test/python/snapshots/nanos/test_solana_swap_sender_cancel/00000.png rename to test/python/snapshots/nanos/test_solana_swap_refuse_double_sign/00000.png diff --git a/test/python/snapshots/nanos/test_solana_swap_sender_cancel/00001.png b/test/python/snapshots/nanos/test_solana_swap_refuse_double_sign/00001.png similarity index 100% rename from test/python/snapshots/nanos/test_solana_swap_sender_cancel/00001.png rename to test/python/snapshots/nanos/test_solana_swap_refuse_double_sign/00001.png diff --git a/test/python/snapshots/nanos/test_solana_swap_refuse_double_sign/00002.png b/test/python/snapshots/nanos/test_solana_swap_refuse_double_sign/00002.png new file mode 100644 index 00000000..b744ccf6 Binary files /dev/null and b/test/python/snapshots/nanos/test_solana_swap_refuse_double_sign/00002.png differ diff --git a/test/python/snapshots/nanos/test_solana_swap_sender_cancel/00003.png b/test/python/snapshots/nanos/test_solana_swap_refuse_double_sign/00003.png similarity index 100% rename from test/python/snapshots/nanos/test_solana_swap_sender_cancel/00003.png rename to test/python/snapshots/nanos/test_solana_swap_refuse_double_sign/00003.png diff --git a/test/python/snapshots/nanos/test_solana_swap_sender_cancel/00004.png b/test/python/snapshots/nanos/test_solana_swap_refuse_double_sign/00004.png similarity index 100% rename from test/python/snapshots/nanos/test_solana_swap_sender_cancel/00004.png rename to test/python/snapshots/nanos/test_solana_swap_refuse_double_sign/00004.png diff --git a/test/python/snapshots/nanos/test_solana_swap_recipient_ok/00005.png b/test/python/snapshots/nanos/test_solana_swap_refuse_double_sign/00005.png similarity index 100% rename from test/python/snapshots/nanos/test_solana_swap_recipient_ok/00005.png rename to test/python/snapshots/nanos/test_solana_swap_refuse_double_sign/00005.png diff --git a/test/python/snapshots/nanos/test_solana_swap_sender_cancel/00002.png b/test/python/snapshots/nanos/test_solana_swap_sender_cancel/00002.png deleted file mode 100644 index 25197fbc..00000000 Binary files a/test/python/snapshots/nanos/test_solana_swap_sender_cancel/00002.png and /dev/null differ diff --git a/test/python/snapshots/nanos/test_solana_swap_sender_cancel/00005.png b/test/python/snapshots/nanos/test_solana_swap_sender_cancel/00005.png deleted file mode 100644 index 9c7e7049..00000000 Binary files a/test/python/snapshots/nanos/test_solana_swap_sender_cancel/00005.png and /dev/null differ diff --git a/test/python/snapshots/nanos/test_solana_swap_sender_double_sign/00002.png b/test/python/snapshots/nanos/test_solana_swap_sender_double_sign/00002.png deleted file mode 100644 index 25197fbc..00000000 Binary files a/test/python/snapshots/nanos/test_solana_swap_sender_double_sign/00002.png and /dev/null differ diff --git a/test/python/snapshots/nanos/test_solana_swap_sender_ok/00002.png b/test/python/snapshots/nanos/test_solana_swap_sender_ok/00002.png deleted file mode 100644 index 25197fbc..00000000 Binary files a/test/python/snapshots/nanos/test_solana_swap_sender_ok/00002.png and /dev/null differ diff --git a/test/python/snapshots/nanos/test_solana_swap_sender_wrong_amount/00002.png b/test/python/snapshots/nanos/test_solana_swap_sender_wrong_amount/00002.png deleted file mode 100644 index 25197fbc..00000000 Binary files a/test/python/snapshots/nanos/test_solana_swap_sender_wrong_amount/00002.png and /dev/null differ diff --git a/test/python/snapshots/nanos/test_solana_swap_sender_wrong_destination/00001.png b/test/python/snapshots/nanos/test_solana_swap_sender_wrong_destination/00001.png deleted file mode 100644 index b328d0cb..00000000 Binary files a/test/python/snapshots/nanos/test_solana_swap_sender_wrong_destination/00001.png and /dev/null differ diff --git a/test/python/snapshots/nanos/test_solana_swap_sender_wrong_destination/00002.png b/test/python/snapshots/nanos/test_solana_swap_sender_wrong_destination/00002.png deleted file mode 100644 index 25197fbc..00000000 Binary files a/test/python/snapshots/nanos/test_solana_swap_sender_wrong_destination/00002.png and /dev/null differ diff --git a/test/python/snapshots/nanos/test_solana_swap_sender_wrong_destination/00003.png b/test/python/snapshots/nanos/test_solana_swap_sender_wrong_destination/00003.png deleted file mode 100644 index 4a4f58ac..00000000 Binary files a/test/python/snapshots/nanos/test_solana_swap_sender_wrong_destination/00003.png and /dev/null differ diff --git a/test/python/snapshots/nanos/test_solana_swap_sender_double_sign/00000.png b/test/python/snapshots/nanos/test_solana_swap_valid_1/00000.png similarity index 100% rename from test/python/snapshots/nanos/test_solana_swap_sender_double_sign/00000.png rename to test/python/snapshots/nanos/test_solana_swap_valid_1/00000.png diff --git a/test/python/snapshots/nanos/test_solana_swap_sender_double_sign/00001.png b/test/python/snapshots/nanos/test_solana_swap_valid_1/00001.png similarity index 100% rename from test/python/snapshots/nanos/test_solana_swap_sender_double_sign/00001.png rename to test/python/snapshots/nanos/test_solana_swap_valid_1/00001.png diff --git a/test/python/snapshots/nanos/test_solana_swap_valid_1/00002.png b/test/python/snapshots/nanos/test_solana_swap_valid_1/00002.png new file mode 100644 index 00000000..b744ccf6 Binary files /dev/null and b/test/python/snapshots/nanos/test_solana_swap_valid_1/00002.png differ diff --git a/test/python/snapshots/nanos/test_solana_swap_sender_double_sign/00003.png b/test/python/snapshots/nanos/test_solana_swap_valid_1/00003.png similarity index 100% rename from test/python/snapshots/nanos/test_solana_swap_sender_double_sign/00003.png rename to test/python/snapshots/nanos/test_solana_swap_valid_1/00003.png diff --git a/test/python/snapshots/nanos/test_solana_swap_sender_double_sign/00004.png b/test/python/snapshots/nanos/test_solana_swap_valid_1/00004.png similarity index 100% rename from test/python/snapshots/nanos/test_solana_swap_sender_double_sign/00004.png rename to test/python/snapshots/nanos/test_solana_swap_valid_1/00004.png diff --git a/test/python/snapshots/nanos/test_solana_swap_sender_double_sign/00005.png b/test/python/snapshots/nanos/test_solana_swap_valid_1/00005.png similarity index 100% rename from test/python/snapshots/nanos/test_solana_swap_sender_double_sign/00005.png rename to test/python/snapshots/nanos/test_solana_swap_valid_1/00005.png diff --git a/test/python/snapshots/nanos/test_solana_swap_sender_ok/00000.png b/test/python/snapshots/nanos/test_solana_swap_valid_2/00000.png similarity index 100% rename from test/python/snapshots/nanos/test_solana_swap_sender_ok/00000.png rename to test/python/snapshots/nanos/test_solana_swap_valid_2/00000.png diff --git a/test/python/snapshots/nanos/test_solana_swap_valid_2/00001.png b/test/python/snapshots/nanos/test_solana_swap_valid_2/00001.png new file mode 100644 index 00000000..b1b0e458 Binary files /dev/null and b/test/python/snapshots/nanos/test_solana_swap_valid_2/00001.png differ diff --git a/test/python/snapshots/nanos/test_solana_swap_valid_2/00002.png b/test/python/snapshots/nanos/test_solana_swap_valid_2/00002.png new file mode 100644 index 00000000..b744ccf6 Binary files /dev/null and b/test/python/snapshots/nanos/test_solana_swap_valid_2/00002.png differ diff --git a/test/python/snapshots/nanos/test_solana_swap_valid_2/00003.png b/test/python/snapshots/nanos/test_solana_swap_valid_2/00003.png new file mode 100644 index 00000000..2bd082bc Binary files /dev/null and b/test/python/snapshots/nanos/test_solana_swap_valid_2/00003.png differ diff --git a/test/python/snapshots/nanos/test_solana_swap_sender_ok/00004.png b/test/python/snapshots/nanos/test_solana_swap_valid_2/00004.png similarity index 100% rename from test/python/snapshots/nanos/test_solana_swap_sender_ok/00004.png rename to test/python/snapshots/nanos/test_solana_swap_valid_2/00004.png diff --git a/test/python/snapshots/nanos/test_solana_swap_sender_ok/00005.png b/test/python/snapshots/nanos/test_solana_swap_valid_2/00005.png similarity index 100% rename from test/python/snapshots/nanos/test_solana_swap_sender_ok/00005.png rename to test/python/snapshots/nanos/test_solana_swap_valid_2/00005.png diff --git a/test/python/snapshots/nanos/test_solana_swap_sender_wrong_amount/00000.png b/test/python/snapshots/nanos/test_solana_swap_wrong_amount/00000.png similarity index 100% rename from test/python/snapshots/nanos/test_solana_swap_sender_wrong_amount/00000.png rename to test/python/snapshots/nanos/test_solana_swap_wrong_amount/00000.png diff --git a/test/python/snapshots/nanos/test_solana_swap_sender_ok/00001.png b/test/python/snapshots/nanos/test_solana_swap_wrong_amount/00001.png similarity index 100% rename from test/python/snapshots/nanos/test_solana_swap_sender_ok/00001.png rename to test/python/snapshots/nanos/test_solana_swap_wrong_amount/00001.png diff --git a/test/python/snapshots/nanos/test_solana_swap_wrong_amount/00002.png b/test/python/snapshots/nanos/test_solana_swap_wrong_amount/00002.png new file mode 100644 index 00000000..b744ccf6 Binary files /dev/null and b/test/python/snapshots/nanos/test_solana_swap_wrong_amount/00002.png differ diff --git a/test/python/snapshots/nanos/test_solana_swap_sender_ok/00003.png b/test/python/snapshots/nanos/test_solana_swap_wrong_amount/00003.png similarity index 100% rename from test/python/snapshots/nanos/test_solana_swap_sender_ok/00003.png rename to test/python/snapshots/nanos/test_solana_swap_wrong_amount/00003.png diff --git a/test/python/snapshots/nanos/test_solana_swap_sender_wrong_amount/00004.png b/test/python/snapshots/nanos/test_solana_swap_wrong_amount/00004.png similarity index 100% rename from test/python/snapshots/nanos/test_solana_swap_sender_wrong_amount/00004.png rename to test/python/snapshots/nanos/test_solana_swap_wrong_amount/00004.png diff --git a/test/python/snapshots/nanos/test_solana_swap_sender_wrong_amount/00005.png b/test/python/snapshots/nanos/test_solana_swap_wrong_amount/00005.png similarity index 100% rename from test/python/snapshots/nanos/test_solana_swap_sender_wrong_amount/00005.png rename to test/python/snapshots/nanos/test_solana_swap_wrong_amount/00005.png diff --git a/test/python/snapshots/nanos/test_solana_swap_sender_wrong_destination/00000.png b/test/python/snapshots/nanos/test_solana_swap_wrong_destination/00000.png similarity index 100% rename from test/python/snapshots/nanos/test_solana_swap_sender_wrong_destination/00000.png rename to test/python/snapshots/nanos/test_solana_swap_wrong_destination/00000.png diff --git a/test/python/snapshots/nanos/test_solana_swap_sender_wrong_amount/00001.png b/test/python/snapshots/nanos/test_solana_swap_wrong_destination/00001.png similarity index 100% rename from test/python/snapshots/nanos/test_solana_swap_sender_wrong_amount/00001.png rename to test/python/snapshots/nanos/test_solana_swap_wrong_destination/00001.png diff --git a/test/python/snapshots/nanos/test_solana_swap_wrong_destination/00002.png b/test/python/snapshots/nanos/test_solana_swap_wrong_destination/00002.png new file mode 100644 index 00000000..b744ccf6 Binary files /dev/null and b/test/python/snapshots/nanos/test_solana_swap_wrong_destination/00002.png differ diff --git a/test/python/snapshots/nanos/test_solana_swap_sender_wrong_amount/00003.png b/test/python/snapshots/nanos/test_solana_swap_wrong_destination/00003.png similarity index 100% rename from test/python/snapshots/nanos/test_solana_swap_sender_wrong_amount/00003.png rename to test/python/snapshots/nanos/test_solana_swap_wrong_destination/00003.png diff --git a/test/python/snapshots/nanos/test_solana_swap_sender_wrong_destination/00004.png b/test/python/snapshots/nanos/test_solana_swap_wrong_destination/00004.png similarity index 100% rename from test/python/snapshots/nanos/test_solana_swap_sender_wrong_destination/00004.png rename to test/python/snapshots/nanos/test_solana_swap_wrong_destination/00004.png diff --git a/test/python/snapshots/nanos/test_solana_swap_sender_wrong_destination/00005.png b/test/python/snapshots/nanos/test_solana_swap_wrong_destination/00005.png similarity index 100% rename from test/python/snapshots/nanos/test_solana_swap_sender_wrong_destination/00005.png rename to test/python/snapshots/nanos/test_solana_swap_wrong_destination/00005.png diff --git a/test/python/snapshots/nanosp/test_solana_fund_cancel/00006.png b/test/python/snapshots/nanosp/test_solana_fund_cancel/00006.png deleted file mode 100644 index c9222461..00000000 Binary files a/test/python/snapshots/nanosp/test_solana_fund_cancel/00006.png and /dev/null differ diff --git a/test/python/snapshots/nanosp/test_solana_fund_cancel/00000.png b/test/python/snapshots/nanosp/test_solana_fund_refuse_double_sign/00000.png similarity index 100% rename from test/python/snapshots/nanosp/test_solana_fund_cancel/00000.png rename to test/python/snapshots/nanosp/test_solana_fund_refuse_double_sign/00000.png diff --git a/test/python/snapshots/nanosp/test_solana_fund_cancel/00001.png b/test/python/snapshots/nanosp/test_solana_fund_refuse_double_sign/00001.png similarity index 100% rename from test/python/snapshots/nanosp/test_solana_fund_cancel/00001.png rename to test/python/snapshots/nanosp/test_solana_fund_refuse_double_sign/00001.png diff --git a/test/python/snapshots/nanosp/test_solana_fund_cancel/00002.png b/test/python/snapshots/nanosp/test_solana_fund_refuse_double_sign/00002.png similarity index 100% rename from test/python/snapshots/nanosp/test_solana_fund_cancel/00002.png rename to test/python/snapshots/nanosp/test_solana_fund_refuse_double_sign/00002.png diff --git a/test/python/snapshots/nanosp/test_solana_fund_cancel/00003.png b/test/python/snapshots/nanosp/test_solana_fund_refuse_double_sign/00003.png similarity index 100% rename from test/python/snapshots/nanosp/test_solana_fund_cancel/00003.png rename to test/python/snapshots/nanosp/test_solana_fund_refuse_double_sign/00003.png diff --git a/test/python/snapshots/nanosp/test_solana_fund_cancel/00004.png b/test/python/snapshots/nanosp/test_solana_fund_refuse_double_sign/00004.png similarity index 100% rename from test/python/snapshots/nanosp/test_solana_fund_cancel/00004.png rename to test/python/snapshots/nanosp/test_solana_fund_refuse_double_sign/00004.png diff --git a/test/python/snapshots/nanosp/test_solana_fund_cancel/00005.png b/test/python/snapshots/nanosp/test_solana_fund_refuse_double_sign/00005.png similarity index 100% rename from test/python/snapshots/nanosp/test_solana_fund_cancel/00005.png rename to test/python/snapshots/nanosp/test_solana_fund_refuse_double_sign/00005.png diff --git a/test/python/snapshots/nanosp/test_solana_fund_ok/00006.png b/test/python/snapshots/nanosp/test_solana_fund_refuse_double_sign/00006.png similarity index 100% rename from test/python/snapshots/nanosp/test_solana_fund_ok/00006.png rename to test/python/snapshots/nanosp/test_solana_fund_refuse_double_sign/00006.png diff --git a/test/python/snapshots/nanosp/test_solana_fund_ok/00000.png b/test/python/snapshots/nanosp/test_solana_fund_valid_1/00000.png similarity index 100% rename from test/python/snapshots/nanosp/test_solana_fund_ok/00000.png rename to test/python/snapshots/nanosp/test_solana_fund_valid_1/00000.png diff --git a/test/python/snapshots/nanosp/test_solana_fund_ok/00001.png b/test/python/snapshots/nanosp/test_solana_fund_valid_1/00001.png similarity index 100% rename from test/python/snapshots/nanosp/test_solana_fund_ok/00001.png rename to test/python/snapshots/nanosp/test_solana_fund_valid_1/00001.png diff --git a/test/python/snapshots/nanosp/test_solana_fund_ok/00002.png b/test/python/snapshots/nanosp/test_solana_fund_valid_1/00002.png similarity index 100% rename from test/python/snapshots/nanosp/test_solana_fund_ok/00002.png rename to test/python/snapshots/nanosp/test_solana_fund_valid_1/00002.png diff --git a/test/python/snapshots/nanosp/test_solana_fund_ok/00003.png b/test/python/snapshots/nanosp/test_solana_fund_valid_1/00003.png similarity index 100% rename from test/python/snapshots/nanosp/test_solana_fund_ok/00003.png rename to test/python/snapshots/nanosp/test_solana_fund_valid_1/00003.png diff --git a/test/python/snapshots/nanosp/test_solana_fund_ok/00004.png b/test/python/snapshots/nanosp/test_solana_fund_valid_1/00004.png similarity index 100% rename from test/python/snapshots/nanosp/test_solana_fund_ok/00004.png rename to test/python/snapshots/nanosp/test_solana_fund_valid_1/00004.png diff --git a/test/python/snapshots/nanosp/test_solana_fund_ok/00005.png b/test/python/snapshots/nanosp/test_solana_fund_valid_1/00005.png similarity index 100% rename from test/python/snapshots/nanosp/test_solana_fund_ok/00005.png rename to test/python/snapshots/nanosp/test_solana_fund_valid_1/00005.png diff --git a/test/python/snapshots/nanosp/test_solana_sell_ok/00006.png b/test/python/snapshots/nanosp/test_solana_fund_valid_1/00006.png similarity index 100% rename from test/python/snapshots/nanosp/test_solana_sell_ok/00006.png rename to test/python/snapshots/nanosp/test_solana_fund_valid_1/00006.png diff --git a/test/python/snapshots/nanosp/test_solana_sell_cancel/00000.png b/test/python/snapshots/nanosp/test_solana_fund_valid_2/00000.png similarity index 100% rename from test/python/snapshots/nanosp/test_solana_sell_cancel/00000.png rename to test/python/snapshots/nanosp/test_solana_fund_valid_2/00000.png diff --git a/test/python/snapshots/nanosp/test_solana_fund_valid_2/00001.png b/test/python/snapshots/nanosp/test_solana_fund_valid_2/00001.png new file mode 100644 index 00000000..8a381d03 Binary files /dev/null and b/test/python/snapshots/nanosp/test_solana_fund_valid_2/00001.png differ diff --git a/test/python/snapshots/nanosp/test_solana_fund_valid_2/00002.png b/test/python/snapshots/nanosp/test_solana_fund_valid_2/00002.png new file mode 100644 index 00000000..d6d796d2 Binary files /dev/null and b/test/python/snapshots/nanosp/test_solana_fund_valid_2/00002.png differ diff --git a/test/python/snapshots/nanosp/test_solana_fund_valid_2/00003.png b/test/python/snapshots/nanosp/test_solana_fund_valid_2/00003.png new file mode 100644 index 00000000..d8f5e38c Binary files /dev/null and b/test/python/snapshots/nanosp/test_solana_fund_valid_2/00003.png differ diff --git a/test/python/snapshots/nanosp/test_solana_fund_valid_2/00004.png b/test/python/snapshots/nanosp/test_solana_fund_valid_2/00004.png new file mode 100644 index 00000000..a0671c45 Binary files /dev/null and b/test/python/snapshots/nanosp/test_solana_fund_valid_2/00004.png differ diff --git a/test/python/snapshots/nanosp/test_solana_sell_cancel/00005.png b/test/python/snapshots/nanosp/test_solana_fund_valid_2/00005.png similarity index 100% rename from test/python/snapshots/nanosp/test_solana_sell_cancel/00005.png rename to test/python/snapshots/nanosp/test_solana_fund_valid_2/00005.png diff --git a/test/python/snapshots/nanosp/test_solana_swap_recipient_cancel/00006.png b/test/python/snapshots/nanosp/test_solana_fund_valid_2/00006.png similarity index 100% rename from test/python/snapshots/nanosp/test_solana_swap_recipient_cancel/00006.png rename to test/python/snapshots/nanosp/test_solana_fund_valid_2/00006.png diff --git a/test/python/snapshots/nanosp/test_solana_sell_cancel/00006.png b/test/python/snapshots/nanosp/test_solana_sell_cancel/00006.png deleted file mode 100644 index c9222461..00000000 Binary files a/test/python/snapshots/nanosp/test_solana_sell_cancel/00006.png and /dev/null differ diff --git a/test/python/snapshots/nanosp/test_solana_sell_ok/00000.png b/test/python/snapshots/nanosp/test_solana_sell_refuse_double_sign/00000.png similarity index 100% rename from test/python/snapshots/nanosp/test_solana_sell_ok/00000.png rename to test/python/snapshots/nanosp/test_solana_sell_refuse_double_sign/00000.png diff --git a/test/python/snapshots/nanosp/test_solana_sell_cancel/00001.png b/test/python/snapshots/nanosp/test_solana_sell_refuse_double_sign/00001.png similarity index 100% rename from test/python/snapshots/nanosp/test_solana_sell_cancel/00001.png rename to test/python/snapshots/nanosp/test_solana_sell_refuse_double_sign/00001.png diff --git a/test/python/snapshots/nanosp/test_solana_sell_cancel/00002.png b/test/python/snapshots/nanosp/test_solana_sell_refuse_double_sign/00002.png similarity index 100% rename from test/python/snapshots/nanosp/test_solana_sell_cancel/00002.png rename to test/python/snapshots/nanosp/test_solana_sell_refuse_double_sign/00002.png diff --git a/test/python/snapshots/nanosp/test_solana_sell_cancel/00003.png b/test/python/snapshots/nanosp/test_solana_sell_refuse_double_sign/00003.png similarity index 100% rename from test/python/snapshots/nanosp/test_solana_sell_cancel/00003.png rename to test/python/snapshots/nanosp/test_solana_sell_refuse_double_sign/00003.png diff --git a/test/python/snapshots/nanosp/test_solana_sell_cancel/00004.png b/test/python/snapshots/nanosp/test_solana_sell_refuse_double_sign/00004.png similarity index 100% rename from test/python/snapshots/nanosp/test_solana_sell_cancel/00004.png rename to test/python/snapshots/nanosp/test_solana_sell_refuse_double_sign/00004.png diff --git a/test/python/snapshots/nanosp/test_solana_sell_ok/00005.png b/test/python/snapshots/nanosp/test_solana_sell_refuse_double_sign/00005.png similarity index 100% rename from test/python/snapshots/nanosp/test_solana_sell_ok/00005.png rename to test/python/snapshots/nanosp/test_solana_sell_refuse_double_sign/00005.png diff --git a/test/python/snapshots/nanosp/test_solana_swap_sender_cancel/00006.png b/test/python/snapshots/nanosp/test_solana_sell_refuse_double_sign/00006.png similarity index 100% rename from test/python/snapshots/nanosp/test_solana_swap_sender_cancel/00006.png rename to test/python/snapshots/nanosp/test_solana_sell_refuse_double_sign/00006.png diff --git a/test/python/snapshots/nanosp/test_solana_swap_recipient_cancel/00000.png b/test/python/snapshots/nanosp/test_solana_sell_valid_1/00000.png similarity index 100% rename from test/python/snapshots/nanosp/test_solana_swap_recipient_cancel/00000.png rename to test/python/snapshots/nanosp/test_solana_sell_valid_1/00000.png diff --git a/test/python/snapshots/nanosp/test_solana_sell_ok/00001.png b/test/python/snapshots/nanosp/test_solana_sell_valid_1/00001.png similarity index 100% rename from test/python/snapshots/nanosp/test_solana_sell_ok/00001.png rename to test/python/snapshots/nanosp/test_solana_sell_valid_1/00001.png diff --git a/test/python/snapshots/nanosp/test_solana_sell_ok/00002.png b/test/python/snapshots/nanosp/test_solana_sell_valid_1/00002.png similarity index 100% rename from test/python/snapshots/nanosp/test_solana_sell_ok/00002.png rename to test/python/snapshots/nanosp/test_solana_sell_valid_1/00002.png diff --git a/test/python/snapshots/nanosp/test_solana_sell_ok/00003.png b/test/python/snapshots/nanosp/test_solana_sell_valid_1/00003.png similarity index 100% rename from test/python/snapshots/nanosp/test_solana_sell_ok/00003.png rename to test/python/snapshots/nanosp/test_solana_sell_valid_1/00003.png diff --git a/test/python/snapshots/nanosp/test_solana_sell_ok/00004.png b/test/python/snapshots/nanosp/test_solana_sell_valid_1/00004.png similarity index 100% rename from test/python/snapshots/nanosp/test_solana_sell_ok/00004.png rename to test/python/snapshots/nanosp/test_solana_sell_valid_1/00004.png diff --git a/test/python/snapshots/nanox/test_solana_fund_cancel/00005.png b/test/python/snapshots/nanosp/test_solana_sell_valid_1/00005.png similarity index 100% rename from test/python/snapshots/nanox/test_solana_fund_cancel/00005.png rename to test/python/snapshots/nanosp/test_solana_sell_valid_1/00005.png diff --git a/test/python/snapshots/nanosp/test_solana_fund_cancel/00007.png b/test/python/snapshots/nanosp/test_solana_sell_valid_1/00006.png similarity index 100% rename from test/python/snapshots/nanosp/test_solana_fund_cancel/00007.png rename to test/python/snapshots/nanosp/test_solana_sell_valid_1/00006.png diff --git a/test/python/snapshots/nanosp/test_solana_swap_recipient_ok/00000.png b/test/python/snapshots/nanosp/test_solana_sell_valid_2/00000.png similarity index 100% rename from test/python/snapshots/nanosp/test_solana_swap_recipient_ok/00000.png rename to test/python/snapshots/nanosp/test_solana_sell_valid_2/00000.png diff --git a/test/python/snapshots/nanosp/test_solana_sell_valid_2/00001.png b/test/python/snapshots/nanosp/test_solana_sell_valid_2/00001.png new file mode 100644 index 00000000..a7dec8ea Binary files /dev/null and b/test/python/snapshots/nanosp/test_solana_sell_valid_2/00001.png differ diff --git a/test/python/snapshots/nanosp/test_solana_sell_valid_2/00002.png b/test/python/snapshots/nanosp/test_solana_sell_valid_2/00002.png new file mode 100644 index 00000000..d6d796d2 Binary files /dev/null and b/test/python/snapshots/nanosp/test_solana_sell_valid_2/00002.png differ diff --git a/test/python/snapshots/nanox/test_solana_sell_cancel/00003.png b/test/python/snapshots/nanosp/test_solana_sell_valid_2/00003.png similarity index 100% rename from test/python/snapshots/nanox/test_solana_sell_cancel/00003.png rename to test/python/snapshots/nanosp/test_solana_sell_valid_2/00003.png diff --git a/test/python/snapshots/nanosp/test_solana_sell_valid_2/00004.png b/test/python/snapshots/nanosp/test_solana_sell_valid_2/00004.png new file mode 100644 index 00000000..a0671c45 Binary files /dev/null and b/test/python/snapshots/nanosp/test_solana_sell_valid_2/00004.png differ diff --git a/test/python/snapshots/nanox/test_solana_fund_ok/00005.png b/test/python/snapshots/nanosp/test_solana_sell_valid_2/00005.png similarity index 100% rename from test/python/snapshots/nanox/test_solana_fund_ok/00005.png rename to test/python/snapshots/nanosp/test_solana_sell_valid_2/00005.png diff --git a/test/python/snapshots/nanosp/test_solana_sell_cancel/00007.png b/test/python/snapshots/nanosp/test_solana_sell_valid_2/00006.png similarity index 100% rename from test/python/snapshots/nanosp/test_solana_sell_cancel/00007.png rename to test/python/snapshots/nanosp/test_solana_sell_valid_2/00006.png diff --git a/test/python/snapshots/nanosp/test_solana_swap_recipient_cancel/00001.png b/test/python/snapshots/nanosp/test_solana_swap_recipient_cancel/00001.png deleted file mode 100644 index 6c5483cb..00000000 Binary files a/test/python/snapshots/nanosp/test_solana_swap_recipient_cancel/00001.png and /dev/null differ diff --git a/test/python/snapshots/nanosp/test_solana_swap_recipient_cancel/00002.png b/test/python/snapshots/nanosp/test_solana_swap_recipient_cancel/00002.png deleted file mode 100644 index 0ab84580..00000000 Binary files a/test/python/snapshots/nanosp/test_solana_swap_recipient_cancel/00002.png and /dev/null differ diff --git a/test/python/snapshots/nanosp/test_solana_swap_recipient_cancel/00003.png b/test/python/snapshots/nanosp/test_solana_swap_recipient_cancel/00003.png deleted file mode 100644 index 95580750..00000000 Binary files a/test/python/snapshots/nanosp/test_solana_swap_recipient_cancel/00003.png and /dev/null differ diff --git a/test/python/snapshots/nanosp/test_solana_swap_recipient_cancel/00005.png b/test/python/snapshots/nanosp/test_solana_swap_recipient_cancel/00005.png deleted file mode 100644 index c9222461..00000000 Binary files a/test/python/snapshots/nanosp/test_solana_swap_recipient_cancel/00005.png and /dev/null differ diff --git a/test/python/snapshots/nanosp/test_solana_swap_recipient_ok/00001.png b/test/python/snapshots/nanosp/test_solana_swap_recipient_ok/00001.png deleted file mode 100644 index 6c5483cb..00000000 Binary files a/test/python/snapshots/nanosp/test_solana_swap_recipient_ok/00001.png and /dev/null differ diff --git a/test/python/snapshots/nanosp/test_solana_swap_recipient_ok/00002.png b/test/python/snapshots/nanosp/test_solana_swap_recipient_ok/00002.png deleted file mode 100644 index 0ab84580..00000000 Binary files a/test/python/snapshots/nanosp/test_solana_swap_recipient_ok/00002.png and /dev/null differ diff --git a/test/python/snapshots/nanosp/test_solana_swap_recipient_ok/00003.png b/test/python/snapshots/nanosp/test_solana_swap_recipient_ok/00003.png deleted file mode 100644 index 95580750..00000000 Binary files a/test/python/snapshots/nanosp/test_solana_swap_recipient_ok/00003.png and /dev/null differ diff --git a/test/python/snapshots/nanosp/test_solana_swap_sender_cancel/00000.png b/test/python/snapshots/nanosp/test_solana_swap_refuse_double_sign/00000.png similarity index 100% rename from test/python/snapshots/nanosp/test_solana_swap_sender_cancel/00000.png rename to test/python/snapshots/nanosp/test_solana_swap_refuse_double_sign/00000.png diff --git a/test/python/snapshots/nanosp/test_solana_swap_sender_cancel/00001.png b/test/python/snapshots/nanosp/test_solana_swap_refuse_double_sign/00001.png similarity index 100% rename from test/python/snapshots/nanosp/test_solana_swap_sender_cancel/00001.png rename to test/python/snapshots/nanosp/test_solana_swap_refuse_double_sign/00001.png diff --git a/test/python/snapshots/nanosp/test_solana_swap_refuse_double_sign/00002.png b/test/python/snapshots/nanosp/test_solana_swap_refuse_double_sign/00002.png new file mode 100644 index 00000000..2d2fc70b Binary files /dev/null and b/test/python/snapshots/nanosp/test_solana_swap_refuse_double_sign/00002.png differ diff --git a/test/python/snapshots/nanosp/test_solana_swap_sender_cancel/00003.png b/test/python/snapshots/nanosp/test_solana_swap_refuse_double_sign/00003.png similarity index 100% rename from test/python/snapshots/nanosp/test_solana_swap_sender_cancel/00003.png rename to test/python/snapshots/nanosp/test_solana_swap_refuse_double_sign/00003.png diff --git a/test/python/snapshots/nanosp/test_solana_swap_recipient_cancel/00004.png b/test/python/snapshots/nanosp/test_solana_swap_refuse_double_sign/00004.png similarity index 100% rename from test/python/snapshots/nanosp/test_solana_swap_recipient_cancel/00004.png rename to test/python/snapshots/nanosp/test_solana_swap_refuse_double_sign/00004.png diff --git a/test/python/snapshots/nanosp/test_solana_swap_recipient_ok/00005.png b/test/python/snapshots/nanosp/test_solana_swap_refuse_double_sign/00005.png similarity index 100% rename from test/python/snapshots/nanosp/test_solana_swap_recipient_ok/00005.png rename to test/python/snapshots/nanosp/test_solana_swap_refuse_double_sign/00005.png diff --git a/test/python/snapshots/nanosp/test_solana_swap_sender_cancel/00002.png b/test/python/snapshots/nanosp/test_solana_swap_sender_cancel/00002.png deleted file mode 100644 index cf33e5fc..00000000 Binary files a/test/python/snapshots/nanosp/test_solana_swap_sender_cancel/00002.png and /dev/null differ diff --git a/test/python/snapshots/nanosp/test_solana_swap_sender_cancel/00005.png b/test/python/snapshots/nanosp/test_solana_swap_sender_cancel/00005.png deleted file mode 100644 index c9222461..00000000 Binary files a/test/python/snapshots/nanosp/test_solana_swap_sender_cancel/00005.png and /dev/null differ diff --git a/test/python/snapshots/nanosp/test_solana_swap_sender_double_sign/00002.png b/test/python/snapshots/nanosp/test_solana_swap_sender_double_sign/00002.png deleted file mode 100644 index cf33e5fc..00000000 Binary files a/test/python/snapshots/nanosp/test_solana_swap_sender_double_sign/00002.png and /dev/null differ diff --git a/test/python/snapshots/nanosp/test_solana_swap_sender_ok/00002.png b/test/python/snapshots/nanosp/test_solana_swap_sender_ok/00002.png deleted file mode 100644 index cf33e5fc..00000000 Binary files a/test/python/snapshots/nanosp/test_solana_swap_sender_ok/00002.png and /dev/null differ diff --git a/test/python/snapshots/nanosp/test_solana_swap_sender_wrong_amount/00002.png b/test/python/snapshots/nanosp/test_solana_swap_sender_wrong_amount/00002.png deleted file mode 100644 index cf33e5fc..00000000 Binary files a/test/python/snapshots/nanosp/test_solana_swap_sender_wrong_amount/00002.png and /dev/null differ diff --git a/test/python/snapshots/nanosp/test_solana_swap_sender_wrong_destination/00001.png b/test/python/snapshots/nanosp/test_solana_swap_sender_wrong_destination/00001.png deleted file mode 100644 index fc19bb25..00000000 Binary files a/test/python/snapshots/nanosp/test_solana_swap_sender_wrong_destination/00001.png and /dev/null differ diff --git a/test/python/snapshots/nanosp/test_solana_swap_sender_wrong_destination/00002.png b/test/python/snapshots/nanosp/test_solana_swap_sender_wrong_destination/00002.png deleted file mode 100644 index cf33e5fc..00000000 Binary files a/test/python/snapshots/nanosp/test_solana_swap_sender_wrong_destination/00002.png and /dev/null differ diff --git a/test/python/snapshots/nanosp/test_solana_swap_sender_double_sign/00000.png b/test/python/snapshots/nanosp/test_solana_swap_valid_1/00000.png similarity index 100% rename from test/python/snapshots/nanosp/test_solana_swap_sender_double_sign/00000.png rename to test/python/snapshots/nanosp/test_solana_swap_valid_1/00000.png diff --git a/test/python/snapshots/nanosp/test_solana_swap_sender_double_sign/00001.png b/test/python/snapshots/nanosp/test_solana_swap_valid_1/00001.png similarity index 100% rename from test/python/snapshots/nanosp/test_solana_swap_sender_double_sign/00001.png rename to test/python/snapshots/nanosp/test_solana_swap_valid_1/00001.png diff --git a/test/python/snapshots/nanosp/test_solana_swap_valid_1/00002.png b/test/python/snapshots/nanosp/test_solana_swap_valid_1/00002.png new file mode 100644 index 00000000..2d2fc70b Binary files /dev/null and b/test/python/snapshots/nanosp/test_solana_swap_valid_1/00002.png differ diff --git a/test/python/snapshots/nanosp/test_solana_swap_sender_double_sign/00003.png b/test/python/snapshots/nanosp/test_solana_swap_valid_1/00003.png similarity index 100% rename from test/python/snapshots/nanosp/test_solana_swap_sender_double_sign/00003.png rename to test/python/snapshots/nanosp/test_solana_swap_valid_1/00003.png diff --git a/test/python/snapshots/nanosp/test_solana_swap_recipient_ok/00004.png b/test/python/snapshots/nanosp/test_solana_swap_valid_1/00004.png similarity index 100% rename from test/python/snapshots/nanosp/test_solana_swap_recipient_ok/00004.png rename to test/python/snapshots/nanosp/test_solana_swap_valid_1/00004.png diff --git a/test/python/snapshots/nanosp/test_solana_swap_sender_double_sign/00005.png b/test/python/snapshots/nanosp/test_solana_swap_valid_1/00005.png similarity index 100% rename from test/python/snapshots/nanosp/test_solana_swap_sender_double_sign/00005.png rename to test/python/snapshots/nanosp/test_solana_swap_valid_1/00005.png diff --git a/test/python/snapshots/nanosp/test_solana_swap_sender_ok/00000.png b/test/python/snapshots/nanosp/test_solana_swap_valid_2/00000.png similarity index 100% rename from test/python/snapshots/nanosp/test_solana_swap_sender_ok/00000.png rename to test/python/snapshots/nanosp/test_solana_swap_valid_2/00000.png diff --git a/test/python/snapshots/nanosp/test_solana_swap_valid_2/00001.png b/test/python/snapshots/nanosp/test_solana_swap_valid_2/00001.png new file mode 100644 index 00000000..d6d796d2 Binary files /dev/null and b/test/python/snapshots/nanosp/test_solana_swap_valid_2/00001.png differ diff --git a/test/python/snapshots/nanosp/test_solana_swap_valid_2/00002.png b/test/python/snapshots/nanosp/test_solana_swap_valid_2/00002.png new file mode 100644 index 00000000..2d2fc70b Binary files /dev/null and b/test/python/snapshots/nanosp/test_solana_swap_valid_2/00002.png differ diff --git a/test/python/snapshots/nanosp/test_solana_swap_valid_2/00003.png b/test/python/snapshots/nanosp/test_solana_swap_valid_2/00003.png new file mode 100644 index 00000000..a0671c45 Binary files /dev/null and b/test/python/snapshots/nanosp/test_solana_swap_valid_2/00003.png differ diff --git a/test/python/snapshots/nanosp/test_solana_swap_sender_cancel/00004.png b/test/python/snapshots/nanosp/test_solana_swap_valid_2/00004.png similarity index 100% rename from test/python/snapshots/nanosp/test_solana_swap_sender_cancel/00004.png rename to test/python/snapshots/nanosp/test_solana_swap_valid_2/00004.png diff --git a/test/python/snapshots/nanosp/test_solana_swap_sender_ok/00005.png b/test/python/snapshots/nanosp/test_solana_swap_valid_2/00005.png similarity index 100% rename from test/python/snapshots/nanosp/test_solana_swap_sender_ok/00005.png rename to test/python/snapshots/nanosp/test_solana_swap_valid_2/00005.png diff --git a/test/python/snapshots/nanosp/test_solana_swap_sender_wrong_amount/00000.png b/test/python/snapshots/nanosp/test_solana_swap_wrong_amount/00000.png similarity index 100% rename from test/python/snapshots/nanosp/test_solana_swap_sender_wrong_amount/00000.png rename to test/python/snapshots/nanosp/test_solana_swap_wrong_amount/00000.png diff --git a/test/python/snapshots/nanosp/test_solana_swap_sender_ok/00001.png b/test/python/snapshots/nanosp/test_solana_swap_wrong_amount/00001.png similarity index 100% rename from test/python/snapshots/nanosp/test_solana_swap_sender_ok/00001.png rename to test/python/snapshots/nanosp/test_solana_swap_wrong_amount/00001.png diff --git a/test/python/snapshots/nanosp/test_solana_swap_wrong_amount/00002.png b/test/python/snapshots/nanosp/test_solana_swap_wrong_amount/00002.png new file mode 100644 index 00000000..2d2fc70b Binary files /dev/null and b/test/python/snapshots/nanosp/test_solana_swap_wrong_amount/00002.png differ diff --git a/test/python/snapshots/nanosp/test_solana_swap_sender_ok/00003.png b/test/python/snapshots/nanosp/test_solana_swap_wrong_amount/00003.png similarity index 100% rename from test/python/snapshots/nanosp/test_solana_swap_sender_ok/00003.png rename to test/python/snapshots/nanosp/test_solana_swap_wrong_amount/00003.png diff --git a/test/python/snapshots/nanosp/test_solana_swap_sender_double_sign/00004.png b/test/python/snapshots/nanosp/test_solana_swap_wrong_amount/00004.png similarity index 100% rename from test/python/snapshots/nanosp/test_solana_swap_sender_double_sign/00004.png rename to test/python/snapshots/nanosp/test_solana_swap_wrong_amount/00004.png diff --git a/test/python/snapshots/nanosp/test_solana_swap_sender_wrong_amount/00005.png b/test/python/snapshots/nanosp/test_solana_swap_wrong_amount/00005.png similarity index 100% rename from test/python/snapshots/nanosp/test_solana_swap_sender_wrong_amount/00005.png rename to test/python/snapshots/nanosp/test_solana_swap_wrong_amount/00005.png diff --git a/test/python/snapshots/nanosp/test_solana_swap_sender_wrong_destination/00000.png b/test/python/snapshots/nanosp/test_solana_swap_wrong_destination/00000.png similarity index 100% rename from test/python/snapshots/nanosp/test_solana_swap_sender_wrong_destination/00000.png rename to test/python/snapshots/nanosp/test_solana_swap_wrong_destination/00000.png diff --git a/test/python/snapshots/nanosp/test_solana_swap_sender_wrong_amount/00001.png b/test/python/snapshots/nanosp/test_solana_swap_wrong_destination/00001.png similarity index 100% rename from test/python/snapshots/nanosp/test_solana_swap_sender_wrong_amount/00001.png rename to test/python/snapshots/nanosp/test_solana_swap_wrong_destination/00001.png diff --git a/test/python/snapshots/nanosp/test_solana_swap_wrong_destination/00002.png b/test/python/snapshots/nanosp/test_solana_swap_wrong_destination/00002.png new file mode 100644 index 00000000..2d2fc70b Binary files /dev/null and b/test/python/snapshots/nanosp/test_solana_swap_wrong_destination/00002.png differ diff --git a/test/python/snapshots/nanosp/test_solana_swap_sender_wrong_amount/00003.png b/test/python/snapshots/nanosp/test_solana_swap_wrong_destination/00003.png similarity index 100% rename from test/python/snapshots/nanosp/test_solana_swap_sender_wrong_amount/00003.png rename to test/python/snapshots/nanosp/test_solana_swap_wrong_destination/00003.png diff --git a/test/python/snapshots/nanosp/test_solana_swap_sender_ok/00004.png b/test/python/snapshots/nanosp/test_solana_swap_wrong_destination/00004.png similarity index 100% rename from test/python/snapshots/nanosp/test_solana_swap_sender_ok/00004.png rename to test/python/snapshots/nanosp/test_solana_swap_wrong_destination/00004.png diff --git a/test/python/snapshots/nanosp/test_solana_swap_sender_wrong_destination/00005.png b/test/python/snapshots/nanosp/test_solana_swap_wrong_destination/00005.png similarity index 100% rename from test/python/snapshots/nanosp/test_solana_swap_sender_wrong_destination/00005.png rename to test/python/snapshots/nanosp/test_solana_swap_wrong_destination/00005.png diff --git a/test/python/snapshots/nanox/test_solana_fund_cancel/00006.png b/test/python/snapshots/nanox/test_solana_fund_cancel/00006.png deleted file mode 100644 index e90cd9db..00000000 Binary files a/test/python/snapshots/nanox/test_solana_fund_cancel/00006.png and /dev/null differ diff --git a/test/python/snapshots/nanox/test_solana_fund_cancel/00000.png b/test/python/snapshots/nanox/test_solana_fund_refuse_double_sign/00000.png similarity index 100% rename from test/python/snapshots/nanox/test_solana_fund_cancel/00000.png rename to test/python/snapshots/nanox/test_solana_fund_refuse_double_sign/00000.png diff --git a/test/python/snapshots/nanox/test_solana_fund_cancel/00001.png b/test/python/snapshots/nanox/test_solana_fund_refuse_double_sign/00001.png similarity index 100% rename from test/python/snapshots/nanox/test_solana_fund_cancel/00001.png rename to test/python/snapshots/nanox/test_solana_fund_refuse_double_sign/00001.png diff --git a/test/python/snapshots/nanox/test_solana_fund_cancel/00002.png b/test/python/snapshots/nanox/test_solana_fund_refuse_double_sign/00002.png similarity index 100% rename from test/python/snapshots/nanox/test_solana_fund_cancel/00002.png rename to test/python/snapshots/nanox/test_solana_fund_refuse_double_sign/00002.png diff --git a/test/python/snapshots/nanox/test_solana_fund_cancel/00003.png b/test/python/snapshots/nanox/test_solana_fund_refuse_double_sign/00003.png similarity index 100% rename from test/python/snapshots/nanox/test_solana_fund_cancel/00003.png rename to test/python/snapshots/nanox/test_solana_fund_refuse_double_sign/00003.png diff --git a/test/python/snapshots/nanox/test_solana_fund_cancel/00004.png b/test/python/snapshots/nanox/test_solana_fund_refuse_double_sign/00004.png similarity index 100% rename from test/python/snapshots/nanox/test_solana_fund_cancel/00004.png rename to test/python/snapshots/nanox/test_solana_fund_refuse_double_sign/00004.png diff --git a/test/python/snapshots/nanox/test_solana_sell_cancel/00005.png b/test/python/snapshots/nanox/test_solana_fund_refuse_double_sign/00005.png similarity index 100% rename from test/python/snapshots/nanox/test_solana_sell_cancel/00005.png rename to test/python/snapshots/nanox/test_solana_fund_refuse_double_sign/00005.png diff --git a/test/python/snapshots/nanox/test_solana_fund_ok/00006.png b/test/python/snapshots/nanox/test_solana_fund_refuse_double_sign/00006.png similarity index 100% rename from test/python/snapshots/nanox/test_solana_fund_ok/00006.png rename to test/python/snapshots/nanox/test_solana_fund_refuse_double_sign/00006.png diff --git a/test/python/snapshots/nanox/test_solana_fund_ok/00000.png b/test/python/snapshots/nanox/test_solana_fund_valid_1/00000.png similarity index 100% rename from test/python/snapshots/nanox/test_solana_fund_ok/00000.png rename to test/python/snapshots/nanox/test_solana_fund_valid_1/00000.png diff --git a/test/python/snapshots/nanox/test_solana_fund_ok/00001.png b/test/python/snapshots/nanox/test_solana_fund_valid_1/00001.png similarity index 100% rename from test/python/snapshots/nanox/test_solana_fund_ok/00001.png rename to test/python/snapshots/nanox/test_solana_fund_valid_1/00001.png diff --git a/test/python/snapshots/nanox/test_solana_fund_ok/00002.png b/test/python/snapshots/nanox/test_solana_fund_valid_1/00002.png similarity index 100% rename from test/python/snapshots/nanox/test_solana_fund_ok/00002.png rename to test/python/snapshots/nanox/test_solana_fund_valid_1/00002.png diff --git a/test/python/snapshots/nanox/test_solana_fund_ok/00003.png b/test/python/snapshots/nanox/test_solana_fund_valid_1/00003.png similarity index 100% rename from test/python/snapshots/nanox/test_solana_fund_ok/00003.png rename to test/python/snapshots/nanox/test_solana_fund_valid_1/00003.png diff --git a/test/python/snapshots/nanox/test_solana_fund_ok/00004.png b/test/python/snapshots/nanox/test_solana_fund_valid_1/00004.png similarity index 100% rename from test/python/snapshots/nanox/test_solana_fund_ok/00004.png rename to test/python/snapshots/nanox/test_solana_fund_valid_1/00004.png diff --git a/test/python/snapshots/nanox/test_solana_sell_ok/00005.png b/test/python/snapshots/nanox/test_solana_fund_valid_1/00005.png similarity index 100% rename from test/python/snapshots/nanox/test_solana_sell_ok/00005.png rename to test/python/snapshots/nanox/test_solana_fund_valid_1/00005.png diff --git a/test/python/snapshots/nanox/test_solana_sell_ok/00006.png b/test/python/snapshots/nanox/test_solana_fund_valid_1/00006.png similarity index 100% rename from test/python/snapshots/nanox/test_solana_sell_ok/00006.png rename to test/python/snapshots/nanox/test_solana_fund_valid_1/00006.png diff --git a/test/python/snapshots/nanox/test_solana_sell_cancel/00000.png b/test/python/snapshots/nanox/test_solana_fund_valid_2/00000.png similarity index 100% rename from test/python/snapshots/nanox/test_solana_sell_cancel/00000.png rename to test/python/snapshots/nanox/test_solana_fund_valid_2/00000.png diff --git a/test/python/snapshots/nanox/test_solana_fund_valid_2/00001.png b/test/python/snapshots/nanox/test_solana_fund_valid_2/00001.png new file mode 100644 index 00000000..218ab5e0 Binary files /dev/null and b/test/python/snapshots/nanox/test_solana_fund_valid_2/00001.png differ diff --git a/test/python/snapshots/nanox/test_solana_fund_valid_2/00002.png b/test/python/snapshots/nanox/test_solana_fund_valid_2/00002.png new file mode 100644 index 00000000..c012d308 Binary files /dev/null and b/test/python/snapshots/nanox/test_solana_fund_valid_2/00002.png differ diff --git a/test/python/snapshots/nanox/test_solana_fund_valid_2/00003.png b/test/python/snapshots/nanox/test_solana_fund_valid_2/00003.png new file mode 100644 index 00000000..f6913414 Binary files /dev/null and b/test/python/snapshots/nanox/test_solana_fund_valid_2/00003.png differ diff --git a/test/python/snapshots/nanox/test_solana_fund_valid_2/00004.png b/test/python/snapshots/nanox/test_solana_fund_valid_2/00004.png new file mode 100644 index 00000000..a0671c45 Binary files /dev/null and b/test/python/snapshots/nanox/test_solana_fund_valid_2/00004.png differ diff --git a/test/python/snapshots/nanosp/test_solana_swap_sender_wrong_amount/00004.png b/test/python/snapshots/nanox/test_solana_fund_valid_2/00005.png similarity index 100% rename from test/python/snapshots/nanosp/test_solana_swap_sender_wrong_amount/00004.png rename to test/python/snapshots/nanox/test_solana_fund_valid_2/00005.png diff --git a/test/python/snapshots/nanox/test_solana_swap_recipient_cancel/00006.png b/test/python/snapshots/nanox/test_solana_fund_valid_2/00006.png similarity index 100% rename from test/python/snapshots/nanox/test_solana_swap_recipient_cancel/00006.png rename to test/python/snapshots/nanox/test_solana_fund_valid_2/00006.png diff --git a/test/python/snapshots/nanox/test_solana_sell_cancel/00006.png b/test/python/snapshots/nanox/test_solana_sell_cancel/00006.png deleted file mode 100644 index e90cd9db..00000000 Binary files a/test/python/snapshots/nanox/test_solana_sell_cancel/00006.png and /dev/null differ diff --git a/test/python/snapshots/nanox/test_solana_sell_ok/00000.png b/test/python/snapshots/nanox/test_solana_sell_refuse_double_sign/00000.png similarity index 100% rename from test/python/snapshots/nanox/test_solana_sell_ok/00000.png rename to test/python/snapshots/nanox/test_solana_sell_refuse_double_sign/00000.png diff --git a/test/python/snapshots/nanox/test_solana_sell_cancel/00001.png b/test/python/snapshots/nanox/test_solana_sell_refuse_double_sign/00001.png similarity index 100% rename from test/python/snapshots/nanox/test_solana_sell_cancel/00001.png rename to test/python/snapshots/nanox/test_solana_sell_refuse_double_sign/00001.png diff --git a/test/python/snapshots/nanox/test_solana_sell_cancel/00002.png b/test/python/snapshots/nanox/test_solana_sell_refuse_double_sign/00002.png similarity index 100% rename from test/python/snapshots/nanox/test_solana_sell_cancel/00002.png rename to test/python/snapshots/nanox/test_solana_sell_refuse_double_sign/00002.png diff --git a/test/python/snapshots/nanox/test_solana_sell_ok/00003.png b/test/python/snapshots/nanox/test_solana_sell_refuse_double_sign/00003.png similarity index 100% rename from test/python/snapshots/nanox/test_solana_sell_ok/00003.png rename to test/python/snapshots/nanox/test_solana_sell_refuse_double_sign/00003.png diff --git a/test/python/snapshots/nanox/test_solana_sell_cancel/00004.png b/test/python/snapshots/nanox/test_solana_sell_refuse_double_sign/00004.png similarity index 100% rename from test/python/snapshots/nanox/test_solana_sell_cancel/00004.png rename to test/python/snapshots/nanox/test_solana_sell_refuse_double_sign/00004.png diff --git a/test/python/snapshots/nanosp/test_solana_swap_sender_wrong_destination/00004.png b/test/python/snapshots/nanox/test_solana_sell_refuse_double_sign/00005.png similarity index 100% rename from test/python/snapshots/nanosp/test_solana_swap_sender_wrong_destination/00004.png rename to test/python/snapshots/nanox/test_solana_sell_refuse_double_sign/00005.png diff --git a/test/python/snapshots/nanox/test_solana_swap_sender_cancel/00006.png b/test/python/snapshots/nanox/test_solana_sell_refuse_double_sign/00006.png similarity index 100% rename from test/python/snapshots/nanox/test_solana_swap_sender_cancel/00006.png rename to test/python/snapshots/nanox/test_solana_sell_refuse_double_sign/00006.png diff --git a/test/python/snapshots/nanox/test_solana_swap_recipient_cancel/00000.png b/test/python/snapshots/nanox/test_solana_sell_valid_1/00000.png similarity index 100% rename from test/python/snapshots/nanox/test_solana_swap_recipient_cancel/00000.png rename to test/python/snapshots/nanox/test_solana_sell_valid_1/00000.png diff --git a/test/python/snapshots/nanox/test_solana_sell_ok/00001.png b/test/python/snapshots/nanox/test_solana_sell_valid_1/00001.png similarity index 100% rename from test/python/snapshots/nanox/test_solana_sell_ok/00001.png rename to test/python/snapshots/nanox/test_solana_sell_valid_1/00001.png diff --git a/test/python/snapshots/nanox/test_solana_sell_ok/00002.png b/test/python/snapshots/nanox/test_solana_sell_valid_1/00002.png similarity index 100% rename from test/python/snapshots/nanox/test_solana_sell_ok/00002.png rename to test/python/snapshots/nanox/test_solana_sell_valid_1/00002.png diff --git a/test/python/snapshots/nanox/test_solana_sell_valid_1/00003.png b/test/python/snapshots/nanox/test_solana_sell_valid_1/00003.png new file mode 100644 index 00000000..6749f273 Binary files /dev/null and b/test/python/snapshots/nanox/test_solana_sell_valid_1/00003.png differ diff --git a/test/python/snapshots/nanox/test_solana_sell_ok/00004.png b/test/python/snapshots/nanox/test_solana_sell_valid_1/00004.png similarity index 100% rename from test/python/snapshots/nanox/test_solana_sell_ok/00004.png rename to test/python/snapshots/nanox/test_solana_sell_valid_1/00004.png diff --git a/test/python/snapshots/nanox/test_solana_swap_recipient_cancel/00004.png b/test/python/snapshots/nanox/test_solana_sell_valid_1/00005.png similarity index 100% rename from test/python/snapshots/nanox/test_solana_swap_recipient_cancel/00004.png rename to test/python/snapshots/nanox/test_solana_sell_valid_1/00005.png diff --git a/test/python/snapshots/nanox/test_solana_fund_cancel/00007.png b/test/python/snapshots/nanox/test_solana_sell_valid_1/00006.png similarity index 100% rename from test/python/snapshots/nanox/test_solana_fund_cancel/00007.png rename to test/python/snapshots/nanox/test_solana_sell_valid_1/00006.png diff --git a/test/python/snapshots/nanox/test_solana_swap_recipient_ok/00000.png b/test/python/snapshots/nanox/test_solana_sell_valid_2/00000.png similarity index 100% rename from test/python/snapshots/nanox/test_solana_swap_recipient_ok/00000.png rename to test/python/snapshots/nanox/test_solana_sell_valid_2/00000.png diff --git a/test/python/snapshots/nanox/test_solana_sell_valid_2/00001.png b/test/python/snapshots/nanox/test_solana_sell_valid_2/00001.png new file mode 100644 index 00000000..60ee7698 Binary files /dev/null and b/test/python/snapshots/nanox/test_solana_sell_valid_2/00001.png differ diff --git a/test/python/snapshots/nanox/test_solana_sell_valid_2/00002.png b/test/python/snapshots/nanox/test_solana_sell_valid_2/00002.png new file mode 100644 index 00000000..c012d308 Binary files /dev/null and b/test/python/snapshots/nanox/test_solana_sell_valid_2/00002.png differ diff --git a/test/python/snapshots/nanox/test_solana_sell_valid_2/00003.png b/test/python/snapshots/nanox/test_solana_sell_valid_2/00003.png new file mode 100644 index 00000000..6749f273 Binary files /dev/null and b/test/python/snapshots/nanox/test_solana_sell_valid_2/00003.png differ diff --git a/test/python/snapshots/nanox/test_solana_sell_valid_2/00004.png b/test/python/snapshots/nanox/test_solana_sell_valid_2/00004.png new file mode 100644 index 00000000..a0671c45 Binary files /dev/null and b/test/python/snapshots/nanox/test_solana_sell_valid_2/00004.png differ diff --git a/test/python/snapshots/nanox/test_solana_swap_recipient_ok/00004.png b/test/python/snapshots/nanox/test_solana_sell_valid_2/00005.png similarity index 100% rename from test/python/snapshots/nanox/test_solana_swap_recipient_ok/00004.png rename to test/python/snapshots/nanox/test_solana_sell_valid_2/00005.png diff --git a/test/python/snapshots/nanox/test_solana_sell_cancel/00007.png b/test/python/snapshots/nanox/test_solana_sell_valid_2/00006.png similarity index 100% rename from test/python/snapshots/nanox/test_solana_sell_cancel/00007.png rename to test/python/snapshots/nanox/test_solana_sell_valid_2/00006.png diff --git a/test/python/snapshots/nanox/test_solana_swap_recipient_cancel/00001.png b/test/python/snapshots/nanox/test_solana_swap_recipient_cancel/00001.png deleted file mode 100644 index 8b0f7d73..00000000 Binary files a/test/python/snapshots/nanox/test_solana_swap_recipient_cancel/00001.png and /dev/null differ diff --git a/test/python/snapshots/nanox/test_solana_swap_recipient_cancel/00002.png b/test/python/snapshots/nanox/test_solana_swap_recipient_cancel/00002.png deleted file mode 100644 index 0ab84580..00000000 Binary files a/test/python/snapshots/nanox/test_solana_swap_recipient_cancel/00002.png and /dev/null differ diff --git a/test/python/snapshots/nanox/test_solana_swap_recipient_cancel/00003.png b/test/python/snapshots/nanox/test_solana_swap_recipient_cancel/00003.png deleted file mode 100644 index 95580750..00000000 Binary files a/test/python/snapshots/nanox/test_solana_swap_recipient_cancel/00003.png and /dev/null differ diff --git a/test/python/snapshots/nanox/test_solana_swap_recipient_cancel/00005.png b/test/python/snapshots/nanox/test_solana_swap_recipient_cancel/00005.png deleted file mode 100644 index e90cd9db..00000000 Binary files a/test/python/snapshots/nanox/test_solana_swap_recipient_cancel/00005.png and /dev/null differ diff --git a/test/python/snapshots/nanox/test_solana_swap_recipient_ok/00001.png b/test/python/snapshots/nanox/test_solana_swap_recipient_ok/00001.png deleted file mode 100644 index 8b0f7d73..00000000 Binary files a/test/python/snapshots/nanox/test_solana_swap_recipient_ok/00001.png and /dev/null differ diff --git a/test/python/snapshots/nanox/test_solana_swap_recipient_ok/00002.png b/test/python/snapshots/nanox/test_solana_swap_recipient_ok/00002.png deleted file mode 100644 index 0ab84580..00000000 Binary files a/test/python/snapshots/nanox/test_solana_swap_recipient_ok/00002.png and /dev/null differ diff --git a/test/python/snapshots/nanox/test_solana_swap_recipient_ok/00003.png b/test/python/snapshots/nanox/test_solana_swap_recipient_ok/00003.png deleted file mode 100644 index 95580750..00000000 Binary files a/test/python/snapshots/nanox/test_solana_swap_recipient_ok/00003.png and /dev/null differ diff --git a/test/python/snapshots/nanox/test_solana_swap_sender_cancel/00000.png b/test/python/snapshots/nanox/test_solana_swap_refuse_double_sign/00000.png similarity index 100% rename from test/python/snapshots/nanox/test_solana_swap_sender_cancel/00000.png rename to test/python/snapshots/nanox/test_solana_swap_refuse_double_sign/00000.png diff --git a/test/python/snapshots/nanox/test_solana_swap_sender_cancel/00001.png b/test/python/snapshots/nanox/test_solana_swap_refuse_double_sign/00001.png similarity index 100% rename from test/python/snapshots/nanox/test_solana_swap_sender_cancel/00001.png rename to test/python/snapshots/nanox/test_solana_swap_refuse_double_sign/00001.png diff --git a/test/python/snapshots/nanox/test_solana_swap_refuse_double_sign/00002.png b/test/python/snapshots/nanox/test_solana_swap_refuse_double_sign/00002.png new file mode 100644 index 00000000..2d2fc70b Binary files /dev/null and b/test/python/snapshots/nanox/test_solana_swap_refuse_double_sign/00002.png differ diff --git a/test/python/snapshots/nanosp/test_solana_swap_sender_wrong_destination/00003.png b/test/python/snapshots/nanox/test_solana_swap_refuse_double_sign/00003.png similarity index 100% rename from test/python/snapshots/nanosp/test_solana_swap_sender_wrong_destination/00003.png rename to test/python/snapshots/nanox/test_solana_swap_refuse_double_sign/00003.png diff --git a/test/python/snapshots/nanox/test_solana_swap_sender_cancel/00004.png b/test/python/snapshots/nanox/test_solana_swap_refuse_double_sign/00004.png similarity index 100% rename from test/python/snapshots/nanox/test_solana_swap_sender_cancel/00004.png rename to test/python/snapshots/nanox/test_solana_swap_refuse_double_sign/00004.png diff --git a/test/python/snapshots/nanox/test_solana_swap_recipient_ok/00005.png b/test/python/snapshots/nanox/test_solana_swap_refuse_double_sign/00005.png similarity index 100% rename from test/python/snapshots/nanox/test_solana_swap_recipient_ok/00005.png rename to test/python/snapshots/nanox/test_solana_swap_refuse_double_sign/00005.png diff --git a/test/python/snapshots/nanox/test_solana_swap_sender_cancel/00002.png b/test/python/snapshots/nanox/test_solana_swap_sender_cancel/00002.png deleted file mode 100644 index cf33e5fc..00000000 Binary files a/test/python/snapshots/nanox/test_solana_swap_sender_cancel/00002.png and /dev/null differ diff --git a/test/python/snapshots/nanox/test_solana_swap_sender_cancel/00005.png b/test/python/snapshots/nanox/test_solana_swap_sender_cancel/00005.png deleted file mode 100644 index e90cd9db..00000000 Binary files a/test/python/snapshots/nanox/test_solana_swap_sender_cancel/00005.png and /dev/null differ diff --git a/test/python/snapshots/nanox/test_solana_swap_sender_double_sign/00002.png b/test/python/snapshots/nanox/test_solana_swap_sender_double_sign/00002.png deleted file mode 100644 index cf33e5fc..00000000 Binary files a/test/python/snapshots/nanox/test_solana_swap_sender_double_sign/00002.png and /dev/null differ diff --git a/test/python/snapshots/nanox/test_solana_swap_sender_ok/00002.png b/test/python/snapshots/nanox/test_solana_swap_sender_ok/00002.png deleted file mode 100644 index cf33e5fc..00000000 Binary files a/test/python/snapshots/nanox/test_solana_swap_sender_ok/00002.png and /dev/null differ diff --git a/test/python/snapshots/nanox/test_solana_swap_sender_wrong_amount/00002.png b/test/python/snapshots/nanox/test_solana_swap_sender_wrong_amount/00002.png deleted file mode 100644 index cf33e5fc..00000000 Binary files a/test/python/snapshots/nanox/test_solana_swap_sender_wrong_amount/00002.png and /dev/null differ diff --git a/test/python/snapshots/nanox/test_solana_swap_sender_wrong_amount/00003.png b/test/python/snapshots/nanox/test_solana_swap_sender_wrong_amount/00003.png deleted file mode 100644 index 808cc244..00000000 Binary files a/test/python/snapshots/nanox/test_solana_swap_sender_wrong_amount/00003.png and /dev/null differ diff --git a/test/python/snapshots/nanox/test_solana_swap_sender_wrong_destination/00001.png b/test/python/snapshots/nanox/test_solana_swap_sender_wrong_destination/00001.png deleted file mode 100644 index e8b43d16..00000000 Binary files a/test/python/snapshots/nanox/test_solana_swap_sender_wrong_destination/00001.png and /dev/null differ diff --git a/test/python/snapshots/nanox/test_solana_swap_sender_wrong_destination/00002.png b/test/python/snapshots/nanox/test_solana_swap_sender_wrong_destination/00002.png deleted file mode 100644 index cf33e5fc..00000000 Binary files a/test/python/snapshots/nanox/test_solana_swap_sender_wrong_destination/00002.png and /dev/null differ diff --git a/test/python/snapshots/nanox/test_solana_swap_sender_wrong_destination/00003.png b/test/python/snapshots/nanox/test_solana_swap_sender_wrong_destination/00003.png deleted file mode 100644 index 808cc244..00000000 Binary files a/test/python/snapshots/nanox/test_solana_swap_sender_wrong_destination/00003.png and /dev/null differ diff --git a/test/python/snapshots/nanox/test_solana_swap_sender_double_sign/00000.png b/test/python/snapshots/nanox/test_solana_swap_valid_1/00000.png similarity index 100% rename from test/python/snapshots/nanox/test_solana_swap_sender_double_sign/00000.png rename to test/python/snapshots/nanox/test_solana_swap_valid_1/00000.png diff --git a/test/python/snapshots/nanox/test_solana_swap_sender_double_sign/00001.png b/test/python/snapshots/nanox/test_solana_swap_valid_1/00001.png similarity index 100% rename from test/python/snapshots/nanox/test_solana_swap_sender_double_sign/00001.png rename to test/python/snapshots/nanox/test_solana_swap_valid_1/00001.png diff --git a/test/python/snapshots/nanox/test_solana_swap_valid_1/00002.png b/test/python/snapshots/nanox/test_solana_swap_valid_1/00002.png new file mode 100644 index 00000000..2d2fc70b Binary files /dev/null and b/test/python/snapshots/nanox/test_solana_swap_valid_1/00002.png differ diff --git a/test/python/snapshots/nanox/test_solana_swap_sender_cancel/00003.png b/test/python/snapshots/nanox/test_solana_swap_valid_1/00003.png similarity index 100% rename from test/python/snapshots/nanox/test_solana_swap_sender_cancel/00003.png rename to test/python/snapshots/nanox/test_solana_swap_valid_1/00003.png diff --git a/test/python/snapshots/nanox/test_solana_swap_sender_double_sign/00004.png b/test/python/snapshots/nanox/test_solana_swap_valid_1/00004.png similarity index 100% rename from test/python/snapshots/nanox/test_solana_swap_sender_double_sign/00004.png rename to test/python/snapshots/nanox/test_solana_swap_valid_1/00004.png diff --git a/test/python/snapshots/nanox/test_solana_swap_sender_double_sign/00005.png b/test/python/snapshots/nanox/test_solana_swap_valid_1/00005.png similarity index 100% rename from test/python/snapshots/nanox/test_solana_swap_sender_double_sign/00005.png rename to test/python/snapshots/nanox/test_solana_swap_valid_1/00005.png diff --git a/test/python/snapshots/nanox/test_solana_swap_sender_ok/00000.png b/test/python/snapshots/nanox/test_solana_swap_valid_2/00000.png similarity index 100% rename from test/python/snapshots/nanox/test_solana_swap_sender_ok/00000.png rename to test/python/snapshots/nanox/test_solana_swap_valid_2/00000.png diff --git a/test/python/snapshots/nanox/test_solana_swap_valid_2/00001.png b/test/python/snapshots/nanox/test_solana_swap_valid_2/00001.png new file mode 100644 index 00000000..c012d308 Binary files /dev/null and b/test/python/snapshots/nanox/test_solana_swap_valid_2/00001.png differ diff --git a/test/python/snapshots/nanox/test_solana_swap_valid_2/00002.png b/test/python/snapshots/nanox/test_solana_swap_valid_2/00002.png new file mode 100644 index 00000000..2d2fc70b Binary files /dev/null and b/test/python/snapshots/nanox/test_solana_swap_valid_2/00002.png differ diff --git a/test/python/snapshots/nanox/test_solana_swap_valid_2/00003.png b/test/python/snapshots/nanox/test_solana_swap_valid_2/00003.png new file mode 100644 index 00000000..a0671c45 Binary files /dev/null and b/test/python/snapshots/nanox/test_solana_swap_valid_2/00003.png differ diff --git a/test/python/snapshots/nanox/test_solana_swap_sender_ok/00004.png b/test/python/snapshots/nanox/test_solana_swap_valid_2/00004.png similarity index 100% rename from test/python/snapshots/nanox/test_solana_swap_sender_ok/00004.png rename to test/python/snapshots/nanox/test_solana_swap_valid_2/00004.png diff --git a/test/python/snapshots/nanox/test_solana_swap_sender_ok/00005.png b/test/python/snapshots/nanox/test_solana_swap_valid_2/00005.png similarity index 100% rename from test/python/snapshots/nanox/test_solana_swap_sender_ok/00005.png rename to test/python/snapshots/nanox/test_solana_swap_valid_2/00005.png diff --git a/test/python/snapshots/nanox/test_solana_swap_sender_wrong_amount/00000.png b/test/python/snapshots/nanox/test_solana_swap_wrong_amount/00000.png similarity index 100% rename from test/python/snapshots/nanox/test_solana_swap_sender_wrong_amount/00000.png rename to test/python/snapshots/nanox/test_solana_swap_wrong_amount/00000.png diff --git a/test/python/snapshots/nanox/test_solana_swap_sender_ok/00001.png b/test/python/snapshots/nanox/test_solana_swap_wrong_amount/00001.png similarity index 100% rename from test/python/snapshots/nanox/test_solana_swap_sender_ok/00001.png rename to test/python/snapshots/nanox/test_solana_swap_wrong_amount/00001.png diff --git a/test/python/snapshots/nanox/test_solana_swap_wrong_amount/00002.png b/test/python/snapshots/nanox/test_solana_swap_wrong_amount/00002.png new file mode 100644 index 00000000..2d2fc70b Binary files /dev/null and b/test/python/snapshots/nanox/test_solana_swap_wrong_amount/00002.png differ diff --git a/test/python/snapshots/nanox/test_solana_swap_sender_double_sign/00003.png b/test/python/snapshots/nanox/test_solana_swap_wrong_amount/00003.png similarity index 100% rename from test/python/snapshots/nanox/test_solana_swap_sender_double_sign/00003.png rename to test/python/snapshots/nanox/test_solana_swap_wrong_amount/00003.png diff --git a/test/python/snapshots/nanox/test_solana_swap_sender_wrong_amount/00004.png b/test/python/snapshots/nanox/test_solana_swap_wrong_amount/00004.png similarity index 100% rename from test/python/snapshots/nanox/test_solana_swap_sender_wrong_amount/00004.png rename to test/python/snapshots/nanox/test_solana_swap_wrong_amount/00004.png diff --git a/test/python/snapshots/nanox/test_solana_swap_sender_wrong_amount/00005.png b/test/python/snapshots/nanox/test_solana_swap_wrong_amount/00005.png similarity index 100% rename from test/python/snapshots/nanox/test_solana_swap_sender_wrong_amount/00005.png rename to test/python/snapshots/nanox/test_solana_swap_wrong_amount/00005.png diff --git a/test/python/snapshots/nanox/test_solana_swap_sender_wrong_destination/00000.png b/test/python/snapshots/nanox/test_solana_swap_wrong_destination/00000.png similarity index 100% rename from test/python/snapshots/nanox/test_solana_swap_sender_wrong_destination/00000.png rename to test/python/snapshots/nanox/test_solana_swap_wrong_destination/00000.png diff --git a/test/python/snapshots/nanox/test_solana_swap_sender_wrong_amount/00001.png b/test/python/snapshots/nanox/test_solana_swap_wrong_destination/00001.png similarity index 100% rename from test/python/snapshots/nanox/test_solana_swap_sender_wrong_amount/00001.png rename to test/python/snapshots/nanox/test_solana_swap_wrong_destination/00001.png diff --git a/test/python/snapshots/nanox/test_solana_swap_wrong_destination/00002.png b/test/python/snapshots/nanox/test_solana_swap_wrong_destination/00002.png new file mode 100644 index 00000000..2d2fc70b Binary files /dev/null and b/test/python/snapshots/nanox/test_solana_swap_wrong_destination/00002.png differ diff --git a/test/python/snapshots/nanox/test_solana_swap_sender_ok/00003.png b/test/python/snapshots/nanox/test_solana_swap_wrong_destination/00003.png similarity index 100% rename from test/python/snapshots/nanox/test_solana_swap_sender_ok/00003.png rename to test/python/snapshots/nanox/test_solana_swap_wrong_destination/00003.png diff --git a/test/python/snapshots/nanox/test_solana_swap_sender_wrong_destination/00004.png b/test/python/snapshots/nanox/test_solana_swap_wrong_destination/00004.png similarity index 100% rename from test/python/snapshots/nanox/test_solana_swap_sender_wrong_destination/00004.png rename to test/python/snapshots/nanox/test_solana_swap_wrong_destination/00004.png diff --git a/test/python/snapshots/nanox/test_solana_swap_sender_wrong_destination/00005.png b/test/python/snapshots/nanox/test_solana_swap_wrong_destination/00005.png similarity index 100% rename from test/python/snapshots/nanox/test_solana_swap_sender_wrong_destination/00005.png rename to test/python/snapshots/nanox/test_solana_swap_wrong_destination/00005.png diff --git a/test/python/test_solana.py b/test/python/test_solana.py new file mode 100644 index 00000000..5f3afd0f --- /dev/null +++ b/test/python/test_solana.py @@ -0,0 +1,52 @@ +import pytest + +from .apps.exchange_test_runner import ExchangeTestRunner, ALL_TESTS_EXCEPT_MEMO_AND_FEES +from .apps.solana import SolanaClient, ErrorType +from .apps.solana_utils import SOL_PACKED_DERIVATION_PATH +from .apps.solana_cmd_builder import SystemInstructionTransfer, Message, verify_signature +from .apps import solana_utils as SOL + +# A bit hacky but way less hassle than actually writing an actual address decoder +SOLANA_ADDRESS_DECODER = { + SOL.FOREIGN_ADDRESS: SOL.FOREIGN_PUBLIC_KEY, + SOL.FOREIGN_ADDRESS_2: SOL.FOREIGN_PUBLIC_KEY_2, +} + +# ExchangeTestRunner implementation for Stellar +class SolanaTests(ExchangeTestRunner): + currency_ticker = "SOL" + valid_destination_1 = SOL.FOREIGN_ADDRESS + valid_destination_memo_1 = "" + valid_destination_2 = SOL.FOREIGN_ADDRESS_2 + valid_destination_memo_2 = "" + valid_refund = SOL.OWNED_ADDRESS + valid_refund_memo = "" + valid_send_amount_1 = SOL.AMOUNT + valid_send_amount_2 = SOL.AMOUNT_2 + valid_fees_1 = SOL.FEES + valid_fees_2 = SOL.FEES_2 + fake_refund = SOL.FOREIGN_ADDRESS + fake_refund_memo = "" + fake_payout = SOL.FOREIGN_ADDRESS + fake_payout_memo = "" + signature_refusal_error_code = ErrorType.SOLANA_SUMMARY_FINALIZE_FAILED + + partner_name = "Partner name" + fund_user_id = "Daft Punk" + fund_account_name = "Account 0" + + def perform_final_tx(self, destination, send_amount, fees, memo): + decoded_destination = SOLANA_ADDRESS_DECODER[destination] + instruction: SystemInstructionTransfer = SystemInstructionTransfer(SOL.OWNED_PUBLIC_KEY, decoded_destination, send_amount) + message: bytes = Message([instruction]).serialize() + sol = SolanaClient(self.backend) + with sol.send_async_sign_message(SOL_PACKED_DERIVATION_PATH, message): + pass + signature: bytes = sol.get_async_response().data + verify_signature(SOL.OWNED_PUBLIC_KEY, message, signature) + + +# Use a class to reuse the same Speculos instance +@pytest.mark.parametrize('test_to_run', ALL_TESTS_EXCEPT_MEMO_AND_FEES) +def test_solana(backend, exchange_navigation_helper, test_to_run): + SolanaTests(backend, exchange_navigation_helper).run_test(test_to_run) diff --git a/test/python/test_solana_fund.py b/test/python/test_solana_fund.py deleted file mode 100644 index 662b6a85..00000000 --- a/test/python/test_solana_fund.py +++ /dev/null @@ -1,105 +0,0 @@ -from ragger.backend.interface import RAPDU, RaisePolicy - -from .apps.exchange import ExchangeClient, Rate, SubCommand, Errors -from .apps.ethereum import EthereumClient - -from .apps.solana import SolanaClient, ErrorType -from .apps.solana_utils import SOL_PACKED_DERIVATION_PATH -from .apps.solana_cmd_builder import SystemInstructionTransfer, Message, verify_signature -from .apps import solana_utils as SOL - -from .apps.signing_authority import SigningAuthority, LEDGER_SIGNER -from .apps.exchange_transaction_builder import get_partner_curve, craft_tx, encode_tx, extract_payout_ticker, extract_refund_ticker -from .apps import cal as cal - - -# Swap transaction infos for valid ETH <-> SOL exchanges. Tamper the values to generate errors -VALID_FUND_SOL_TX_INFOS = { - "user_id": "Daft Punk", - "account_name": "Account 0", - "in_currency": "SOL", - "in_amount": SOL.AMOUNT_BYTES, - "in_address": SOL.FOREIGN_ADDRESS -} - -# Helper to validate a FUND transaction by the Exchange app and put the Solana app in front -def valid_fund(backend, exchange_navigation_helper, tx_infos, fees): - ex = ExchangeClient(backend, Rate.FIXED, SubCommand.FUND) - partner = SigningAuthority(curve=get_partner_curve(SubCommand.FUND), name="Partner name") - - transaction_id = ex.init_transaction().data - ex.set_partner_key(partner.credentials) - ex.check_partner_key(LEDGER_SIGNER.sign(partner.credentials)) - tx = craft_tx(SubCommand.FUND, tx_infos, transaction_id) - ex.process_transaction(tx, fees) - encoded_tx = encode_tx(SubCommand.FUND, partner, tx) - ex.check_transaction_signature(encoded_tx) - payout_ticker = extract_payout_ticker(SubCommand.FUND, tx_infos) - with ex.check_address(cal.get_conf_for_ticker(payout_ticker)): - exchange_navigation_helper.simple_accept() - ex.start_signing_transaction() - - -def test_solana_fund_ok(backend, exchange_navigation_helper): - valid_fund(backend, exchange_navigation_helper, VALID_FUND_SOL_TX_INFOS, SOL.FEES) - - instruction: SystemInstructionTransfer = SystemInstructionTransfer(SOL.OWNED_PUBLIC_KEY, SOL.FOREIGN_PUBLIC_KEY, SOL.AMOUNT) - message: bytes = Message([instruction]).serialize() - - sol = SolanaClient(backend) - with sol.send_async_sign_message(SOL_PACKED_DERIVATION_PATH, message): - # Instant rapdu expected - pass - signature: bytes = sol.get_async_response().data - verify_signature(SOL.OWNED_PUBLIC_KEY, message, signature) - - -def test_solana_fund_wrong_amount(backend, exchange_navigation_helper): - valid_fund(backend, exchange_navigation_helper, VALID_FUND_SOL_TX_INFOS, SOL.FEES) - - instruction: SystemInstructionTransfer = SystemInstructionTransfer(SOL.OWNED_PUBLIC_KEY, SOL.FOREIGN_PUBLIC_KEY, SOL.AMOUNT + 1) - message: bytes = Message([instruction]).serialize() - - sol = SolanaClient(backend) - backend.raise_policy = RaisePolicy.RAISE_NOTHING - with sol.send_async_sign_message(SOL_PACKED_DERIVATION_PATH, message): - # Instant rapdu expected - pass - rapdu: RAPDU = sol.get_async_response() - print("Received rapdu :", rapdu) - assert rapdu.status == ErrorType.SOLANA_SUMMARY_FINALIZE_FAILED - - -def test_solana_fund_wrong_destination(backend, exchange_navigation_helper): - valid_fund(backend, exchange_navigation_helper, VALID_FUND_SOL_TX_INFOS, SOL.FEES) - - instruction: SystemInstructionTransfer = SystemInstructionTransfer(SOL.OWNED_PUBLIC_KEY, SOL.FOREIGN_PUBLIC_KEY_2, SOL.AMOUNT) - message: bytes = Message([instruction]).serialize() - - sol = SolanaClient(backend) - backend.raise_policy = RaisePolicy.RAISE_NOTHING - with sol.send_async_sign_message(SOL_PACKED_DERIVATION_PATH, message): - # Instant rapdu expected - pass - rapdu: RAPDU = sol.get_async_response() - print("Received rapdu :", rapdu) - assert rapdu.status == ErrorType.SOLANA_SUMMARY_FINALIZE_FAILED - - -def test_solana_fund_cancel(backend, exchange_navigation_helper): - ex = ExchangeClient(backend, Rate.FIXED, SubCommand.FUND) - partner = SigningAuthority(curve=get_partner_curve(SubCommand.FUND), name="Partner name") - - transaction_id = ex.init_transaction().data - ex.set_partner_key(partner.credentials) - ex.check_partner_key(LEDGER_SIGNER.sign(partner.credentials)) - tx = craft_tx(SubCommand.FUND, VALID_FUND_SOL_TX_INFOS, transaction_id) - ex.process_transaction(tx, SOL.FEES) - encoded_tx = encode_tx(SubCommand.FUND, partner, tx) - ex.check_transaction_signature(encoded_tx) - payout_ticker = extract_payout_ticker(SubCommand.FUND, VALID_FUND_SOL_TX_INFOS) - - backend.raise_policy = RaisePolicy.RAISE_NOTHING - with ex.check_address(cal.get_conf_for_ticker(payout_ticker)): - exchange_navigation_helper.simple_reject() - assert ex.get_check_address_response().status == Errors.USER_REFUSED diff --git a/test/python/test_solana_sell.py b/test/python/test_solana_sell.py deleted file mode 100644 index 34dc026b..00000000 --- a/test/python/test_solana_sell.py +++ /dev/null @@ -1,107 +0,0 @@ -from ragger.backend.interface import RAPDU, RaisePolicy - -from .apps.exchange import ExchangeClient, Rate, SubCommand, Errors -from .apps.ethereum import EthereumClient - -from .apps.solana import SolanaClient, ErrorType -from .apps.solana_utils import SOL_PACKED_DERIVATION_PATH -from .apps.solana_cmd_builder import SystemInstructionTransfer, Message, verify_signature -from .apps import solana_utils as SOL - -from .apps.signing_authority import SigningAuthority, LEDGER_SIGNER -from .apps.exchange_transaction_builder import get_partner_curve, craft_tx, encode_tx, extract_payout_ticker, extract_refund_ticker -from .apps import cal as cal - - -# Sell transaction infos for valid SOL SELL. Tamper the values to generate errors -VALID_SELL_SOL_TX_INFOS = { - "trader_email": "john@doe.lost", - "out_currency": "USD", - "out_amount": {"coefficient": b"\x01", "exponent": 3}, - "in_currency": "SOL", - "in_amount": SOL.AMOUNT_BYTES, - "in_address": SOL.FOREIGN_ADDRESS -} - -# Helper to validate a SELL transaction by the Exchange app and put the Solana app in front -def valid_sell(backend, exchange_navigation_helper, tx_infos, fees): - ex = ExchangeClient(backend, Rate.FIXED, SubCommand.SELL) - partner = SigningAuthority(curve=get_partner_curve(SubCommand.FUND), name="Partner name") - - transaction_id = ex.init_transaction().data - ex.set_partner_key(partner.credentials) - ex.check_partner_key(LEDGER_SIGNER.sign(partner.credentials)) - tx = craft_tx(SubCommand.SELL, tx_infos, transaction_id) - ex.process_transaction(tx, fees) - encoded_tx = encode_tx(SubCommand.SELL, partner, tx) - ex.check_transaction_signature(encoded_tx) - - payout_ticker = extract_payout_ticker(SubCommand.SELL, tx_infos) - with ex.check_address(cal.get_conf_for_ticker(payout_ticker)): - exchange_navigation_helper.simple_accept() - ex.start_signing_transaction() - - -def test_solana_sell_ok(backend, exchange_navigation_helper): - valid_sell(backend, exchange_navigation_helper, VALID_SELL_SOL_TX_INFOS, SOL.FEES) - - instruction: SystemInstructionTransfer = SystemInstructionTransfer(SOL.OWNED_PUBLIC_KEY, SOL.FOREIGN_PUBLIC_KEY, SOL.AMOUNT) - message: bytes = Message([instruction]).serialize() - - sol = SolanaClient(backend) - with sol.send_async_sign_message(SOL_PACKED_DERIVATION_PATH, message): - # Instant rapdu expected - pass - signature: bytes = sol.get_async_response().data - verify_signature(SOL.OWNED_PUBLIC_KEY, message, signature) - - -def test_solana_sell_wrong_amount(backend, exchange_navigation_helper): - valid_sell(backend, exchange_navigation_helper, VALID_SELL_SOL_TX_INFOS, SOL.FEES) - - instruction: SystemInstructionTransfer = SystemInstructionTransfer(SOL.OWNED_PUBLIC_KEY, SOL.FOREIGN_PUBLIC_KEY, SOL.AMOUNT + 1) - message: bytes = Message([instruction]).serialize() - - sol = SolanaClient(backend) - backend.raise_policy = RaisePolicy.RAISE_NOTHING - with sol.send_async_sign_message(SOL_PACKED_DERIVATION_PATH, message): - # Instant rapdu expected - pass - rapdu: RAPDU = sol.get_async_response() - print("Received rapdu :", rapdu) - assert rapdu.status == ErrorType.SOLANA_SUMMARY_FINALIZE_FAILED - - -def test_solana_sell_wrong_destination(backend, exchange_navigation_helper): - valid_sell(backend, exchange_navigation_helper, VALID_SELL_SOL_TX_INFOS, SOL.FEES) - - instruction: SystemInstructionTransfer = SystemInstructionTransfer(SOL.OWNED_PUBLIC_KEY, SOL.FOREIGN_PUBLIC_KEY_2, SOL.AMOUNT) - message: bytes = Message([instruction]).serialize() - - sol = SolanaClient(backend) - backend.raise_policy = RaisePolicy.RAISE_NOTHING - with sol.send_async_sign_message(SOL_PACKED_DERIVATION_PATH, message): - # Instant rapdu expected - pass - rapdu: RAPDU = sol.get_async_response() - print("Received rapdu :", rapdu) - assert rapdu.status == ErrorType.SOLANA_SUMMARY_FINALIZE_FAILED - - -def test_solana_sell_cancel(backend, exchange_navigation_helper): - ex = ExchangeClient(backend, Rate.FIXED, SubCommand.SELL) - partner = SigningAuthority(curve=get_partner_curve(SubCommand.FUND), name="Partner name") - - transaction_id = ex.init_transaction().data - ex.set_partner_key(partner.credentials) - ex.check_partner_key(LEDGER_SIGNER.sign(partner.credentials)) - tx = craft_tx(SubCommand.SELL, VALID_SELL_SOL_TX_INFOS, transaction_id) - ex.process_transaction(tx, SOL.FEES) - encoded_tx = encode_tx(SubCommand.SELL, partner, tx) - ex.check_transaction_signature(encoded_tx) - payout_ticker = extract_payout_ticker(SubCommand.SELL, VALID_SELL_SOL_TX_INFOS) - - backend.raise_policy = RaisePolicy.RAISE_NOTHING - with ex.check_address(cal.get_conf_for_ticker(payout_ticker)): - exchange_navigation_helper.simple_reject() - assert ex.get_check_address_response().status == Errors.USER_REFUSED diff --git a/test/python/test_solana_swap.py b/test/python/test_solana_swap.py deleted file mode 100644 index 946b94b5..00000000 --- a/test/python/test_solana_swap.py +++ /dev/null @@ -1,281 +0,0 @@ -import pytest -from time import sleep - -from ragger.backend import RaisePolicy -from ragger.utils import pack_APDU, RAPDU -from ragger.error import ExceptionRAPDU - -from .apps.exchange import ExchangeClient, Rate, SubCommand, Errors -from .apps.ethereum import EthereumClient, ERR_SILENT_MODE_CHECK_FAILED, eth_amount_to_wei_hex_string, eth_amount_to_wei - -from .apps.solana import SolanaClient, ErrorType -from .apps.solana_utils import SOL_PACKED_DERIVATION_PATH -from .apps.solana_cmd_builder import SystemInstructionTransfer, Message, verify_signature -from .apps import solana_utils as SOL - -from .apps.signing_authority import SigningAuthority, LEDGER_SIGNER -from .apps.exchange_transaction_builder import get_partner_curve, craft_tx, encode_tx, extract_payout_ticker, extract_refund_ticker -from .apps import cal as cal - - -ETH_AMOUNT = eth_amount_to_wei_hex_string(0.09000564) -ETH_FEES = eth_amount_to_wei(0.000588) - -FOREIGN_ETH_ADDRESS = b"0xd692Cb1346262F584D17B4B470954501f6715a82" -OWNED_ETH_ADDRESS = b"0xDad77910DbDFdE764fC21FCD4E74D71bBACA6D8D" - - -# Swap transaction infos for valid ETH <-> SOL exchanges. Tamper the values to generate errors -VALID_SWAP_ETH_TO_SOL_TX_INFOS = { - "payin_address": FOREIGN_ETH_ADDRESS, - "payin_extra_id": b"", - "refund_address": OWNED_ETH_ADDRESS, - "refund_extra_id": b"", - "payout_address": SOL.OWNED_ADDRESS, - "payout_extra_id": b"", - "currency_from": "ETH", - "currency_to": "SOL", - "amount_to_provider": bytes.fromhex(ETH_AMOUNT), - "amount_to_wallet": SOL.AMOUNT_BYTES, -} - -VALID_SWAP_SOL_TO_ETH_TX_INFOS = { - "payin_address": SOL.FOREIGN_ADDRESS, - "payin_extra_id": b"", - "refund_address": SOL.OWNED_ADDRESS, - "refund_extra_id": b"", - "payout_address": OWNED_ETH_ADDRESS, - "payout_extra_id": b"", - "currency_from": "SOL", - "currency_to": "ETH", - "amount_to_provider": SOL.AMOUNT_BYTES, - "amount_to_wallet": bytes.fromhex(ETH_AMOUNT), -} - -# Helper to validate a SWAP transaction by the Exchange app and put the Solana app in front -def valid_swap(backend, exchange_navigation_helper, tx_infos, fees): - ex = ExchangeClient(backend, Rate.FIXED, SubCommand.SWAP) - partner = SigningAuthority(curve=get_partner_curve(SubCommand.SWAP), name="Partner name") - - transaction_id = ex.init_transaction().data - ex.set_partner_key(partner.credentials) - ex.check_partner_key(LEDGER_SIGNER.sign(partner.credentials)) - tx = craft_tx(SubCommand.SWAP, tx_infos, transaction_id) - ex.process_transaction(tx, fees) - encoded_tx = encode_tx(SubCommand.SWAP, partner, tx) - ex.check_transaction_signature(encoded_tx) - - payout_ticker = extract_payout_ticker(SubCommand.SWAP, tx_infos) - refund_ticker = extract_refund_ticker(SubCommand.SWAP, tx_infos) - with ex.check_address(cal.get_conf_for_ticker(payout_ticker), cal.get_conf_for_ticker(refund_ticker)): - exchange_navigation_helper.simple_accept() - ex.start_signing_transaction() - - -# Validate regular ETH <-> SOL exchanges - -def test_solana_swap_recipient_ok(backend, exchange_navigation_helper): - valid_swap(backend, exchange_navigation_helper, VALID_SWAP_ETH_TO_SOL_TX_INFOS, ETH_FEES) - - eth = EthereumClient(backend, derivation_path=bytes.fromhex("058000002c8000003c800000000000000000000000")) - eth.get_public_key() - eth.sign(extra_payload=bytes.fromhex("ec09850684ee180082520894d692cb1346262f584d17b4b470954501f6715a8288" + ETH_AMOUNT + "80018080")) - -def test_solana_swap_sender_ok(backend, exchange_navigation_helper): - valid_swap(backend, exchange_navigation_helper, VALID_SWAP_SOL_TO_ETH_TX_INFOS, SOL.FEES) - - instruction: SystemInstructionTransfer = SystemInstructionTransfer(SOL.OWNED_PUBLIC_KEY, SOL.FOREIGN_PUBLIC_KEY, SOL.AMOUNT) - message: bytes = Message([instruction]).serialize() - - sol = SolanaClient(backend) - with sol.send_async_sign_message(SOL_PACKED_DERIVATION_PATH, message): - pass - signature: bytes = sol.get_async_response().data - verify_signature(SOL.OWNED_PUBLIC_KEY, message, signature) - -def test_solana_swap_sender_double_sign(backend, exchange_navigation_helper): - valid_swap(backend, exchange_navigation_helper, VALID_SWAP_SOL_TO_ETH_TX_INFOS, SOL.FEES) - - instruction: SystemInstructionTransfer = SystemInstructionTransfer(SOL.OWNED_PUBLIC_KEY, SOL.FOREIGN_PUBLIC_KEY, SOL.AMOUNT) - message: bytes = Message([instruction]).serialize() - - sol = SolanaClient(backend) - with sol.send_async_sign_message(SOL_PACKED_DERIVATION_PATH, message): - pass - signature: bytes = sol.get_async_response().data - verify_signature(SOL.OWNED_PUBLIC_KEY, message, signature) - - sleep(0.5) - - with pytest.raises(ExceptionRAPDU) as e: - with sol.send_async_sign_message(SOL_PACKED_DERIVATION_PATH, message): - pass - assert e.value.status == Errors.INVALID_INSTRUCTION - -# Validate canceled ETH <-> SOL exchanges - -def test_solana_swap_recipient_cancel(backend, exchange_navigation_helper): - ex = ExchangeClient(backend, Rate.FIXED, SubCommand.SWAP) - partner = SigningAuthority(curve=get_partner_curve(SubCommand.SWAP), name="Partner name") - - transaction_id = ex.init_transaction().data - ex.set_partner_key(partner.credentials) - ex.check_partner_key(LEDGER_SIGNER.sign(partner.credentials)) - tx = craft_tx(SubCommand.SWAP, VALID_SWAP_ETH_TO_SOL_TX_INFOS, transaction_id) - ex.process_transaction(tx, ETH_FEES) - encoded_tx = encode_tx(SubCommand.SWAP, partner, tx) - ex.check_transaction_signature(encoded_tx) - - backend.raise_policy = RaisePolicy.RAISE_NOTHING - - payout_ticker = extract_payout_ticker(SubCommand.SWAP, VALID_SWAP_ETH_TO_SOL_TX_INFOS) - refund_ticker = extract_refund_ticker(SubCommand.SWAP, VALID_SWAP_ETH_TO_SOL_TX_INFOS) - with ex.check_address(cal.get_conf_for_ticker(payout_ticker), cal.get_conf_for_ticker(refund_ticker)): - exchange_navigation_helper.simple_reject() - assert ex.get_check_address_response().status == Errors.USER_REFUSED - -def test_solana_swap_sender_cancel(backend, exchange_navigation_helper): - ex = ExchangeClient(backend, Rate.FIXED, SubCommand.SWAP) - partner = SigningAuthority(curve=get_partner_curve(SubCommand.SWAP), name="Partner name") - - transaction_id = ex.init_transaction().data - ex.set_partner_key(partner.credentials) - ex.check_partner_key(LEDGER_SIGNER.sign(partner.credentials)) - tx = craft_tx(SubCommand.SWAP, VALID_SWAP_SOL_TO_ETH_TX_INFOS, transaction_id) - ex.process_transaction(tx, SOL.FEES) - encoded_tx = encode_tx(SubCommand.SWAP, partner, tx) - ex.check_transaction_signature(encoded_tx) - - backend.raise_policy = RaisePolicy.RAISE_NOTHING - - payout_ticker = extract_payout_ticker(SubCommand.SWAP, VALID_SWAP_SOL_TO_ETH_TX_INFOS) - refund_ticker = extract_refund_ticker(SubCommand.SWAP, VALID_SWAP_SOL_TO_ETH_TX_INFOS) - with ex.check_address(cal.get_conf_for_ticker(payout_ticker), cal.get_conf_for_ticker(refund_ticker)): - exchange_navigation_helper.simple_reject() - assert ex.get_check_address_response().status == Errors.USER_REFUSED - - -# SOL callbacks refuse to validate exchange fields - -def test_solana_swap_recipient_unowned_payout_address(backend): - tampered_tx_infos = VALID_SWAP_ETH_TO_SOL_TX_INFOS.copy() - tampered_tx_infos["payout_address"] = SOL.FOREIGN_ADDRESS - - ex = ExchangeClient(backend, Rate.FIXED, SubCommand.SWAP) - partner = SigningAuthority(curve=get_partner_curve(SubCommand.SWAP), name="Partner name") - - transaction_id = ex.init_transaction().data - ex.set_partner_key(partner.credentials) - ex.check_partner_key(LEDGER_SIGNER.sign(partner.credentials)) - tx = craft_tx(SubCommand.SWAP, tampered_tx_infos, transaction_id) - ex.process_transaction(tx, ETH_FEES) - encoded_tx = encode_tx(SubCommand.SWAP, partner, tx) - ex.check_transaction_signature(encoded_tx) - backend.raise_policy = RaisePolicy.RAISE_NOTHING - - payout_ticker = extract_payout_ticker(SubCommand.SWAP, tampered_tx_infos) - refund_ticker = extract_refund_ticker(SubCommand.SWAP, tampered_tx_infos) - with ex.check_address(cal.get_conf_for_ticker(payout_ticker), cal.get_conf_for_ticker(refund_ticker)): - pass - assert ex.get_check_address_response().status == Errors.INVALID_ADDRESS - - -def test_solana_swap_sender_unowned_refund_address(backend): - tampered_tx_infos = VALID_SWAP_SOL_TO_ETH_TX_INFOS.copy() - tampered_tx_infos["refund_address"] = SOL.FOREIGN_ADDRESS - - ex = ExchangeClient(backend, Rate.FIXED, SubCommand.SWAP) - partner = SigningAuthority(curve=get_partner_curve(SubCommand.SWAP), name="Partner name") - - transaction_id = ex.init_transaction().data - ex.set_partner_key(partner.credentials) - ex.check_partner_key(LEDGER_SIGNER.sign(partner.credentials)) - tx = craft_tx(SubCommand.SWAP, tampered_tx_infos, transaction_id) - ex.process_transaction(tx, SOL.FEES) - encoded_tx = encode_tx(SubCommand.SWAP, partner, tx) - ex.check_transaction_signature(encoded_tx) - backend.raise_policy = RaisePolicy.RAISE_NOTHING - - payout_ticker = extract_payout_ticker(SubCommand.SWAP, tampered_tx_infos) - refund_ticker = extract_refund_ticker(SubCommand.SWAP, tampered_tx_infos) - with ex.check_address(cal.get_conf_for_ticker(payout_ticker), cal.get_conf_for_ticker(refund_ticker)): - pass - assert ex.get_check_address_response().status == Errors.INVALID_ADDRESS - - -def test_solana_swap_recipient_payout_extra_id(backend): - tampered_tx_infos = VALID_SWAP_ETH_TO_SOL_TX_INFOS.copy() - tampered_tx_infos["payout_extra_id"] = "0xCAFE" - - ex = ExchangeClient(backend, Rate.FIXED, SubCommand.SWAP) - partner = SigningAuthority(curve=get_partner_curve(SubCommand.SWAP), name="Partner name") - - transaction_id = ex.init_transaction().data - ex.set_partner_key(partner.credentials) - ex.check_partner_key(LEDGER_SIGNER.sign(partner.credentials)) - tx = craft_tx(SubCommand.SWAP, tampered_tx_infos, transaction_id) - ex.process_transaction(tx, ETH_FEES) - encoded_tx = encode_tx(SubCommand.SWAP, partner, tx) - ex.check_transaction_signature(encoded_tx) - backend.raise_policy = RaisePolicy.RAISE_NOTHING - - payout_ticker = extract_payout_ticker(SubCommand.SWAP, tampered_tx_infos) - refund_ticker = extract_refund_ticker(SubCommand.SWAP, tampered_tx_infos) - with ex.check_address(cal.get_conf_for_ticker(payout_ticker), cal.get_conf_for_ticker(refund_ticker)): - pass - assert ex.get_check_address_response().status == Errors.INVALID_ADDRESS - - -def test_solana_swap_recipient_refund_extra_id(backend): - tampered_tx_infos = VALID_SWAP_SOL_TO_ETH_TX_INFOS.copy() - tampered_tx_infos["refund_extra_id"] = "0xCAFE" - - ex = ExchangeClient(backend, Rate.FIXED, SubCommand.SWAP) - partner = SigningAuthority(curve=get_partner_curve(SubCommand.SWAP), name="Partner name") - - transaction_id = ex.init_transaction().data - ex.set_partner_key(partner.credentials) - ex.check_partner_key(LEDGER_SIGNER.sign(partner.credentials)) - tx = craft_tx(SubCommand.SWAP, tampered_tx_infos, transaction_id) - ex.process_transaction(tx, SOL.FEES) - encoded_tx = encode_tx(SubCommand.SWAP, partner, tx) - ex.check_transaction_signature(encoded_tx) - backend.raise_policy = RaisePolicy.RAISE_NOTHING - - payout_ticker = extract_payout_ticker(SubCommand.SWAP, tampered_tx_infos) - refund_ticker = extract_refund_ticker(SubCommand.SWAP, tampered_tx_infos) - with ex.check_address(cal.get_conf_for_ticker(payout_ticker), cal.get_conf_for_ticker(refund_ticker)): - pass - assert ex.get_check_address_response().status == Errors.INVALID_ADDRESS - - -# Transaction validated in Exchange but Solana app receives a different message to sign - -def test_solana_swap_sender_wrong_amount(backend, exchange_navigation_helper): - valid_swap(backend, exchange_navigation_helper, VALID_SWAP_SOL_TO_ETH_TX_INFOS, SOL.FEES) - - instruction: SystemInstructionTransfer = SystemInstructionTransfer(SOL.OWNED_PUBLIC_KEY, SOL.FOREIGN_PUBLIC_KEY, SOL.AMOUNT + 1) - message: bytes = Message([instruction]).serialize() - - sol = SolanaClient(backend) - backend.raise_policy = RaisePolicy.RAISE_NOTHING - with sol.send_async_sign_message(SOL_PACKED_DERIVATION_PATH, message): - pass - rapdu: RAPDU = sol.get_async_response() - print("Received rapdu :", rapdu) - assert rapdu.status == ErrorType.SOLANA_SUMMARY_FINALIZE_FAILED - - -def test_solana_swap_sender_wrong_destination(backend, exchange_navigation_helper): - valid_swap(backend, exchange_navigation_helper, VALID_SWAP_SOL_TO_ETH_TX_INFOS, SOL.FEES) - - instruction: SystemInstructionTransfer = SystemInstructionTransfer(SOL.OWNED_PUBLIC_KEY, SOL.FOREIGN_PUBLIC_KEY_2, SOL.AMOUNT) - message: bytes = Message([instruction]).serialize() - - sol = SolanaClient(backend) - backend.raise_policy = RaisePolicy.RAISE_NOTHING - with sol.send_async_sign_message(SOL_PACKED_DERIVATION_PATH, message): - pass - rapdu: RAPDU = sol.get_async_response() - print("Received rapdu :", rapdu) - assert rapdu.status == ErrorType.SOLANA_SUMMARY_FINALIZE_FAILED