From a8efd69470342fbf1907d05ecb455924a21ed221 Mon Sep 17 00:00:00 2001 From: ajinkyaraj-23 <145996984+ajinkyaraj-23@users.noreply.github.com> Date: Tue, 31 Oct 2023 13:23:07 +0000 Subject: [PATCH] Adding bip25519 derivation in integration tests --- tests/integration/check_section_text.py | 4 ++-- tests/integration/nano/test_get_tz1_bip25519_pk.sh | 6 ++++++ .../{test_get_pk.sh => test_get_tz1_ed25519_pk.sh} | 0 .../integration/nano/test_provide_tz1_bip25519_pk.sh | 10 ++++++++++ ..._provide_pk.sh => test_provide_tz1_ed25519_pk.sh} | 0 .../nano/test_tz1_bip25519_sign_micheline_basic.sh | 12 ++++++++++++ ...c.sh => test_tz1_ed25519_sign_micheline_basic.sh} | 0 tests/integration/run_test_local.sh | 1 + 8 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 tests/integration/nano/test_get_tz1_bip25519_pk.sh rename tests/integration/nano/{test_get_pk.sh => test_get_tz1_ed25519_pk.sh} (100%) create mode 100644 tests/integration/nano/test_provide_tz1_bip25519_pk.sh rename tests/integration/nano/{test_provide_pk.sh => test_provide_tz1_ed25519_pk.sh} (100%) create mode 100644 tests/integration/nano/test_tz1_bip25519_sign_micheline_basic.sh rename tests/integration/nano/{test_sign_micheline_basic.sh => test_tz1_ed25519_sign_micheline_basic.sh} (100%) diff --git a/tests/integration/check_section_text.py b/tests/integration/check_section_text.py index 08dd234b0..f4f0e96ac 100755 --- a/tests/integration/check_section_text.py +++ b/tests/integration/check_section_text.py @@ -20,6 +20,7 @@ import time TIMEOUT = int(os.environ.get('TIMEOUT', '5')) +RETRIES = int(os.environ.get('RETRIES', TIMEOUT*2)) @dataclass class Screen: @@ -47,8 +48,7 @@ def strip(self, content: str) -> str: content = content.lstrip('\n') return content -def with_retry(f, timeout=TIMEOUT): - attempts = timeout / 0.5 +def with_retry(f, attempts=RETRIES): while True: try: return f() diff --git a/tests/integration/nano/test_get_tz1_bip25519_pk.sh b/tests/integration/nano/test_get_tz1_bip25519_pk.sh new file mode 100644 index 000000000..eb4241aa0 --- /dev/null +++ b/tests/integration/nano/test_get_tz1_bip25519_pk.sh @@ -0,0 +1,6 @@ +start_speculos "$seed" +sleep 0.2 +expected_home +send_apdu 8002000311048000002c800006c18000000080000000 +RETRIES=60 expect_apdu_return 210293c6b359964a4332bf1355579d665b753343f7b0a42567978cea1671f7b89f479000 +quit_app diff --git a/tests/integration/nano/test_get_pk.sh b/tests/integration/nano/test_get_tz1_ed25519_pk.sh similarity index 100% rename from tests/integration/nano/test_get_pk.sh rename to tests/integration/nano/test_get_tz1_ed25519_pk.sh diff --git a/tests/integration/nano/test_provide_tz1_bip25519_pk.sh b/tests/integration/nano/test_provide_tz1_bip25519_pk.sh new file mode 100644 index 000000000..657cf14cd --- /dev/null +++ b/tests/integration/nano/test_provide_tz1_bip25519_pk.sh @@ -0,0 +1,10 @@ +start_speculos "$seed" +sleep 0.2 +expected_home +send_apdu 8003000311048000002c800006c18000000080000000 +RETRIES=80 expect_section_content "Provide Key" 'tz1VKyZ3RFDwTkrz5LKcTc6fcYqZj6pvsyA7' +press_button right +expected_accept +press_button both +expect_apdu_return 210293c6b359964a4332bf1355579d665b753343f7b0a42567978cea1671f7b89f479000 +quit_app diff --git a/tests/integration/nano/test_provide_pk.sh b/tests/integration/nano/test_provide_tz1_ed25519_pk.sh similarity index 100% rename from tests/integration/nano/test_provide_pk.sh rename to tests/integration/nano/test_provide_tz1_ed25519_pk.sh diff --git a/tests/integration/nano/test_tz1_bip25519_sign_micheline_basic.sh b/tests/integration/nano/test_tz1_bip25519_sign_micheline_basic.sh new file mode 100644 index 000000000..b5ae90cc5 --- /dev/null +++ b/tests/integration/nano/test_tz1_bip25519_sign_micheline_basic.sh @@ -0,0 +1,12 @@ +start_speculos "$seed" +sleep 0.2 +expected_home +send_apdu 800f000311048000002c800006c18000000080000000 +expect_apdu_return 9000 +send_apdu 800f81032305020000001d0100000004434143410100000004504f504f0100000006424f5544494e +expect_section_content 'Expression' '{"CACA";"POPO";"BOUDIN"}' +press_button right +expected_accept +press_button both +expect_apdu_return 84e475e38707140e725019e91f036e341fa4a2c8752b7828f37bbf91061b0e0af54b3f3d3a4f5e35584f4d206ee4648ad808c9d119f789112b7e1aec61f156eb48eacec419313bef6f7d3f63b614abe709be6b939f155ea9efa688816fe123029000 +quit_app diff --git a/tests/integration/nano/test_sign_micheline_basic.sh b/tests/integration/nano/test_tz1_ed25519_sign_micheline_basic.sh similarity index 100% rename from tests/integration/nano/test_sign_micheline_basic.sh rename to tests/integration/nano/test_tz1_ed25519_sign_micheline_basic.sh diff --git a/tests/integration/run_test_local.sh b/tests/integration/run_test_local.sh index a753f7d2f..51410f3dd 100755 --- a/tests/integration/run_test_local.sh +++ b/tests/integration/run_test_local.sh @@ -18,6 +18,7 @@ set -e if [[ -z "${COMMIT_BYTES}" ]]; then + echo "Loaded environmental variables and error codes." . "`dirname $0`/app_vars.sh" . "`dirname $0`/err_codes.sh" fi