From 9d16f284d3ebb083beda802b7643d6f9d7f76b43 Mon Sep 17 00:00:00 2001 From: keiff3r Date: Thu, 6 Feb 2025 13:31:30 +0100 Subject: [PATCH] refactor: rename all instances of 'boilerplate' to 'everscale' --- ...mmand_sender.py => everscale_command_sender.py} | 4 ++-- ..._unpacker.py => everscale_response_unpacker.py} | 0 ...ate_transaction.py => everscale_transaction.py} | 2 +- .../{boilerplate_utils.py => everscale_utils.py} | 0 tests/test_appname_cmd.py | 6 +++--- tests/test_error_cmd.py | 2 +- ...t_version_cmd.py => test_get_app_config_cmd.py} | 10 +++++----- tests/test_name_version.py | 6 +++--- tests/test_pubkey_cmd.py | 10 +++++----- tests/test_sign_cmd.py | 14 +++++++------- 10 files changed, 27 insertions(+), 27 deletions(-) rename tests/application_client/{boilerplate_command_sender.py => everscale_command_sender.py} (98%) rename tests/application_client/{boilerplate_response_unpacker.py => everscale_response_unpacker.py} (100%) rename tests/application_client/{boilerplate_transaction.py => everscale_transaction.py} (94%) rename tests/application_client/{boilerplate_utils.py => everscale_utils.py} (100%) rename tests/{test_version_cmd.py => test_get_app_config_cmd.py} (59%) diff --git a/tests/application_client/boilerplate_command_sender.py b/tests/application_client/everscale_command_sender.py similarity index 98% rename from tests/application_client/boilerplate_command_sender.py rename to tests/application_client/everscale_command_sender.py index 84c3ca3..73093b5 100644 --- a/tests/application_client/boilerplate_command_sender.py +++ b/tests/application_client/everscale_command_sender.py @@ -50,7 +50,7 @@ class Errors(IntEnum): SW_INVALID_WALLET_TYPE = 0x6B15, SW_INVALID_TICKER_LENGTH = 0x6B16 - # Status Word from boilerplate app + # Status Word from everscale app # SW_DENY = 0x6985 # SW_WRONG_P1P2 = 0x6A86 # SW_WRONG_DATA_LENGTH = 0x6A87 @@ -71,7 +71,7 @@ def split_message(message: bytes, max_size: int) -> List[bytes]: return [message[x:x + max_size] for x in range(0, len(message), max_size)] -class BoilerplateCommandSender: +class EverscaleCommandSender: def __init__(self, backend: BackendInterface) -> None: self.backend = backend diff --git a/tests/application_client/boilerplate_response_unpacker.py b/tests/application_client/everscale_response_unpacker.py similarity index 100% rename from tests/application_client/boilerplate_response_unpacker.py rename to tests/application_client/everscale_response_unpacker.py diff --git a/tests/application_client/boilerplate_transaction.py b/tests/application_client/everscale_transaction.py similarity index 94% rename from tests/application_client/boilerplate_transaction.py rename to tests/application_client/everscale_transaction.py index 19f0625..9ef3d17 100644 --- a/tests/application_client/boilerplate_transaction.py +++ b/tests/application_client/everscale_transaction.py @@ -1,7 +1,7 @@ from io import BytesIO from typing import Union -from .boilerplate_utils import read, read_uint, read_varint, write_varint, UINT64_MAX +from .everscale_utils import read, read_uint, read_varint, write_varint, UINT64_MAX class TransactionError(Exception): diff --git a/tests/application_client/boilerplate_utils.py b/tests/application_client/everscale_utils.py similarity index 100% rename from tests/application_client/boilerplate_utils.py rename to tests/application_client/everscale_utils.py diff --git a/tests/test_appname_cmd.py b/tests/test_appname_cmd.py index f1eefb8..277c58a 100644 --- a/tests/test_appname_cmd.py +++ b/tests/test_appname_cmd.py @@ -1,7 +1,7 @@ from ragger.backend.interface import BackendInterface -from application_client.boilerplate_command_sender import BoilerplateCommandSender -from application_client.boilerplate_response_unpacker import unpack_get_app_name_response +from application_client.everscale_command_sender import EverscaleCommandSender +from application_client.everscale_response_unpacker import unpack_get_app_name_response from utils import verify_name @@ -9,7 +9,7 @@ # In this test we check that the GET_APP_NAME replies the application name def test_app_name(backend: BackendInterface) -> None: # Use the app interface instead of raw interface - client = BoilerplateCommandSender(backend) + client = EverscaleCommandSender(backend) # Send the GET_APP_NAME instruction to the app response = client.get_app_name() # Assert that we have received the correct appname diff --git a/tests/test_error_cmd.py b/tests/test_error_cmd.py index 3d89a57..12e3166 100644 --- a/tests/test_error_cmd.py +++ b/tests/test_error_cmd.py @@ -3,7 +3,7 @@ from ragger.error import ExceptionRAPDU from ragger.backend.interface import BackendInterface -from application_client.boilerplate_command_sender import CLA, InsType, P1, P2, Errors +from application_client.everscale_command_sender import CLA, InsType, P1, P2, Errors # Ensure the app returns an error when a bad CLA is used diff --git a/tests/test_version_cmd.py b/tests/test_get_app_config_cmd.py similarity index 59% rename from tests/test_version_cmd.py rename to tests/test_get_app_config_cmd.py index 0f1d4be..733d1ee 100644 --- a/tests/test_version_cmd.py +++ b/tests/test_get_app_config_cmd.py @@ -1,16 +1,16 @@ from ragger.backend.interface import BackendInterface -from application_client.boilerplate_command_sender import BoilerplateCommandSender -from application_client.boilerplate_response_unpacker import unpack_get_version_response +from application_client.everscale_command_sender import EverscaleCommandSender +from application_client.everscale_response_unpacker import unpack_get_version_response from utils import verify_version # In this test we check the behavior of the device when asked to provide the app version -def test_version(backend: BackendInterface) -> None: +def test_get_app_config(backend: BackendInterface) -> None: # Use the app interface instead of raw interface - client = BoilerplateCommandSender(backend) + client = EverscaleCommandSender(backend) # Send the GET_VERSION instruction - rapdu = client.get_version() + rapdu = client.get_app_config() # Use an helper to parse the response, assert the values MAJOR, MINOR, PATCH = unpack_get_version_response(rapdu.data) verify_version(f"{MAJOR}.{MINOR}.{PATCH}") diff --git a/tests/test_name_version.py b/tests/test_name_version.py index 68e9c5e..ce3e067 100644 --- a/tests/test_name_version.py +++ b/tests/test_name_version.py @@ -1,14 +1,14 @@ from ragger.backend.interface import BackendInterface -from application_client.boilerplate_command_sender import BoilerplateCommandSender -from application_client.boilerplate_response_unpacker import unpack_get_app_and_version_response +from application_client.everscale_command_sender import EverscaleCommandSender +from application_client.everscale_response_unpacker import unpack_get_app_and_version_response from utils import verify_version, verify_name # Test a specific APDU asking BOLOS (and not the app) the name and version of the current app def test_get_app_and_version(backend: BackendInterface) -> None: # Use the app interface instead of raw interface - client = BoilerplateCommandSender(backend) + client = EverscaleCommandSender(backend) # Send the special instruction to BOLOS response = client.get_app_and_version() # Use an helper to parse the response, assert the values diff --git a/tests/test_pubkey_cmd.py b/tests/test_pubkey_cmd.py index 92966db..de3fade 100644 --- a/tests/test_pubkey_cmd.py +++ b/tests/test_pubkey_cmd.py @@ -5,8 +5,8 @@ from ragger.backend.interface import BackendInterface from ragger.navigator.navigation_scenario import NavigateWithScenario -from application_client.boilerplate_command_sender import BoilerplateCommandSender, Errors -from application_client.boilerplate_response_unpacker import unpack_get_public_key_response +from application_client.everscale_command_sender import EverscaleCommandSender, Errors +from application_client.everscale_response_unpacker import unpack_get_public_key_response # In this test we check that the GET_PUBLIC_KEY works in non-confirmation mode @@ -19,7 +19,7 @@ def test_get_public_key_no_confirm(backend: BackendInterface) -> None: "m/44'/1'/2147483647/0/0/0/0/0/0/0" ] for path in path_list: - client = BoilerplateCommandSender(backend) + client = EverscaleCommandSender(backend) response = client.get_public_key(path=path).data _, public_key, _, chain_code = unpack_get_public_key_response(response) @@ -30,7 +30,7 @@ def test_get_public_key_no_confirm(backend: BackendInterface) -> None: # In this test we check that the GET_PUBLIC_KEY works in confirmation mode def test_get_public_key_confirm_accepted(backend: BackendInterface, scenario_navigator: NavigateWithScenario) -> None: - client = BoilerplateCommandSender(backend) + client = EverscaleCommandSender(backend) path = "m/44'/1'/0'/0/0" with client.get_public_key_with_confirmation(path=path): scenario_navigator.address_review_approve() @@ -45,7 +45,7 @@ def test_get_public_key_confirm_accepted(backend: BackendInterface, scenario_nav # In this test we check that the GET_PUBLIC_KEY in confirmation mode replies an error if the user refuses def test_get_public_key_confirm_refused(backend: BackendInterface, scenario_navigator: NavigateWithScenario) -> None: - client = BoilerplateCommandSender(backend) + client = EverscaleCommandSender(backend) path = "m/44'/1'/0'/0/0" with pytest.raises(ExceptionRAPDU) as e: diff --git a/tests/test_sign_cmd.py b/tests/test_sign_cmd.py index 81ed8eb..ebc3127 100644 --- a/tests/test_sign_cmd.py +++ b/tests/test_sign_cmd.py @@ -6,9 +6,9 @@ from ragger.navigator import Navigator, NavInsID from ragger.navigator.navigation_scenario import NavigateWithScenario -from application_client.boilerplate_transaction import Transaction -from application_client.boilerplate_command_sender import BoilerplateCommandSender, Errors -from application_client.boilerplate_response_unpacker import unpack_get_public_key_response, unpack_sign_tx_response +from application_client.everscale_transaction import Transaction +from application_client.everscale_command_sender import EverscaleCommandSender, Errors +from application_client.everscale_response_unpacker import unpack_get_public_key_response, unpack_sign_tx_response from utils import check_signature_validity # In this tests we check the behavior of the device when asked to sign a transaction @@ -19,7 +19,7 @@ # We will ensure that the displayed information is correct by using screenshots comparison def test_sign_tx_short_tx(backend: BackendInterface, scenario_navigator: NavigateWithScenario) -> None: # Use the app interface instead of raw interface - client = BoilerplateCommandSender(backend) + client = EverscaleCommandSender(backend) # The path used for this entire test path: str = "m/44'/1'/0'/0/0" @@ -58,7 +58,7 @@ def test_sign_tx_short_tx_blind_sign(firmware: Firmware, test_name: str, default_screenshot_path: str) -> None: # Use the app interface instead of raw interface - client = BoilerplateCommandSender(backend) + client = EverscaleCommandSender(backend) # The path used for this entire test path: str = "m/44'/1'/0'/0/0" @@ -97,7 +97,7 @@ def test_sign_tx_short_tx_blind_sign(firmware: Firmware, # In particular the long memo will force the transaction to be sent in multiple chunks def test_sign_tx_long_tx(backend: BackendInterface, scenario_navigator: NavigateWithScenario) -> None: # Use the app interface instead of raw interface - client = BoilerplateCommandSender(backend) + client = EverscaleCommandSender(backend) path: str = "m/44'/1'/0'/0/0" rapdu = client.get_public_key(path=path) @@ -126,7 +126,7 @@ def test_sign_tx_long_tx(backend: BackendInterface, scenario_navigator: Navigate # The test will ask for a transaction signature that will be refused on screen def test_sign_tx_refused(backend: BackendInterface, scenario_navigator: NavigateWithScenario) -> None: # Use the app interface instead of raw interface - client = BoilerplateCommandSender(backend) + client = EverscaleCommandSender(backend) path: str = "m/44'/1'/0'/0/0" transaction = Transaction(