diff --git a/test/python/snapshots/nanos/test_sign_when_chain_is_setup/app_context/chain_id.png b/test/python/snapshots/nanos/test_sign_when_chain_is_setup/app_context/chain_id.png new file mode 100644 index 00000000..13fd7604 Binary files /dev/null and b/test/python/snapshots/nanos/test_sign_when_chain_is_setup/app_context/chain_id.png differ diff --git a/test/python/snapshots/nanos/test_sign_when_chain_is_setup/app_context/high_watermark.png b/test/python/snapshots/nanos/test_sign_when_chain_is_setup/app_context/high_watermark.png new file mode 100644 index 00000000..0cccb5b4 Binary files /dev/null and b/test/python/snapshots/nanos/test_sign_when_chain_is_setup/app_context/high_watermark.png differ diff --git a/test/python/snapshots/nanos/test_sign_when_chain_is_setup/app_context/public_key_hash_1.png b/test/python/snapshots/nanos/test_sign_when_chain_is_setup/app_context/public_key_hash_1.png new file mode 100644 index 00000000..50537f75 Binary files /dev/null and b/test/python/snapshots/nanos/test_sign_when_chain_is_setup/app_context/public_key_hash_1.png differ diff --git a/test/python/snapshots/nanos/test_sign_when_chain_is_setup/app_context/public_key_hash_2.png b/test/python/snapshots/nanos/test_sign_when_chain_is_setup/app_context/public_key_hash_2.png new file mode 100644 index 00000000..a30fbd95 Binary files /dev/null and b/test/python/snapshots/nanos/test_sign_when_chain_is_setup/app_context/public_key_hash_2.png differ diff --git a/test/python/snapshots/nanosp/test_sign_when_chain_is_setup/app_context/chain_id.png b/test/python/snapshots/nanosp/test_sign_when_chain_is_setup/app_context/chain_id.png new file mode 100644 index 00000000..8795bcf1 Binary files /dev/null and b/test/python/snapshots/nanosp/test_sign_when_chain_is_setup/app_context/chain_id.png differ diff --git a/test/python/snapshots/nanosp/test_sign_when_chain_is_setup/app_context/high_watermark.png b/test/python/snapshots/nanosp/test_sign_when_chain_is_setup/app_context/high_watermark.png new file mode 100644 index 00000000..a970fc01 Binary files /dev/null and b/test/python/snapshots/nanosp/test_sign_when_chain_is_setup/app_context/high_watermark.png differ diff --git a/test/python/snapshots/nanosp/test_sign_when_chain_is_setup/app_context/public_key_hash.png b/test/python/snapshots/nanosp/test_sign_when_chain_is_setup/app_context/public_key_hash.png new file mode 100644 index 00000000..a2b2f3cf Binary files /dev/null and b/test/python/snapshots/nanosp/test_sign_when_chain_is_setup/app_context/public_key_hash.png differ diff --git a/test/python/snapshots/nanox/test_sign_when_chain_is_setup/app_context/chain_id.png b/test/python/snapshots/nanox/test_sign_when_chain_is_setup/app_context/chain_id.png new file mode 100644 index 00000000..8795bcf1 Binary files /dev/null and b/test/python/snapshots/nanox/test_sign_when_chain_is_setup/app_context/chain_id.png differ diff --git a/test/python/snapshots/nanox/test_sign_when_chain_is_setup/app_context/high_watermark.png b/test/python/snapshots/nanox/test_sign_when_chain_is_setup/app_context/high_watermark.png new file mode 100644 index 00000000..a970fc01 Binary files /dev/null and b/test/python/snapshots/nanox/test_sign_when_chain_is_setup/app_context/high_watermark.png differ diff --git a/test/python/snapshots/nanox/test_sign_when_chain_is_setup/app_context/public_key_hash.png b/test/python/snapshots/nanox/test_sign_when_chain_is_setup/app_context/public_key_hash.png new file mode 100644 index 00000000..a2b2f3cf Binary files /dev/null and b/test/python/snapshots/nanox/test_sign_when_chain_is_setup/app_context/public_key_hash.png differ diff --git a/test/python/snapshots/stax/test_sign_when_chain_is_setup/app_context/app_context.png b/test/python/snapshots/stax/test_sign_when_chain_is_setup/app_context/app_context.png new file mode 100644 index 00000000..b6aec4c6 Binary files /dev/null and b/test/python/snapshots/stax/test_sign_when_chain_is_setup/app_context/app_context.png differ diff --git a/test/python/test_instructions.py b/test/python/test_instructions.py index 8746c631..67fffcaa 100644 --- a/test/python/test_instructions.py +++ b/test/python/test_instructions.py @@ -669,6 +669,65 @@ def test_sign_when_no_chain_setup( ) +def test_sign_when_chain_is_setup( + client: TezosClient, + tezos_navigator: TezosNavigator) -> None: + """Check that signing when chain has been setup change main HWM.""" + + account = DEFAULT_ACCOUNT + main_chain_id = "NetXH12AexHqTQa" # Chain = 1 + + tezos_navigator.setup_app_context( + account, + main_chain_id, + main_hwm=Hwm(0), + test_hwm=Hwm(0) + ) + + attestation = build_attestation( + 1, 0, + main_chain_id + ) + + client.sign_message(account, attestation) + + tezos_navigator.check_app_context( + account, + chain_id=main_chain_id, + main_hwm=Hwm(1, 0), + test_hwm=Hwm(0, 0), + ) + + attestation = build_attestation( + 2, 0, + DEFAULT_CHAIN_ID # Chain = 0 + ) + + client.sign_message(account, attestation) + + tezos_navigator.check_app_context( + account, + chain_id=main_chain_id, + main_hwm=Hwm(1, 0), + test_hwm=Hwm(2, 0), + ) + + attestation = build_attestation( + 2, 0, + "NetXH12Af5mrXhq" # Chain = 2 + ) + + with StatusCode.WRONG_VALUES.expected(): + client.sign_message(account, attestation) + + tezos_navigator.check_app_context( + account, + chain_id=main_chain_id, + main_hwm=Hwm(1, 0), + test_hwm=Hwm(2, 0), + ) + + # Data generated by the old application itself HMAC_TEST_SET = [ (DEFAULT_ACCOUNT,