What changed, and why it matters
This commit only adds automated functional tests for a new device setting that controls whether non-standard Bitcoin signature hash (sighash) types are allowed. It does not change the app code that runs on the Ledger device, so it cannot introduce a security vulnerability by itself. The tests verify that dangerous sighash types are blocked by default and require the user to explicitly enable a setting to allow them.
No security action needed; this is a test-only commit. Review the related application-code commit that implements the gating logic to ensure the security behavior is correctly enforced on the device.
Security signals we found
Tests for gating of non-standard sighash types
Default-deny behavior verified for SIGHASH_NONE, SIGHASH_SINGLE, ANYONECANPAY variants
No modification to device-side signing logic in this commit
Evidence from the diff
The commit adds test infrastructure and test cases for ‘SIGHASH gating’. It introduces a helper to toggle the ‘Non-standard sighash’ setting in the app UI, plus tests confirming that SIGHASH_NONE, SIGHASH_SINGLE, and ANYONECANPAY combinations are rejected with SW_SECURITY_STATUS_NOT_SATISFIED (0x6982) and error code EC_SIGN_PSBT_NONDEFAULT_SIGHASH_NOT_ALLOWED (0x000d) when the setting is disabled. Existing tests that use non-standard sighashes are updated to enable the setting first. No C/device application code is modified.
Changed components
tests/conftest.pytests/test_sighash_setting.pytests/test_sign_psbt_with_sighash_types.pyInspect captured patch +385 / −0
diff --git a/tests/conftest.py b/tests/conftest.py
index 04a6cd4..edc7483 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -5,6 +5,9 @@ from ragger_bitcoin import createRaggerClient, RaggerClient
from ragger.backend import RaisePolicy
from ragger.backend.interface import BackendInterface
from ragger.conftest import configuration
+from ragger.firmware import Firmware
+from ragger.firmware.touch.positions import STAX_X_CENTER, FLEX_X_CENTER, APEX_P_X_CENTER
+from ragger.navigator import Navigator, NavInsID, NavIns
import ledger_bitcoin._base58 as base58
from ledger_bitcoin.common import sha256
from ledger_bitcoin import Chain
@@ -253,3 +256,61 @@ def client(bitcoin_network: str, backend: BackendInterface) -> RaggerClient:
backend.raise_policy = RaisePolicy.RAISE_CUSTOM
backend.whitelisted_status = [0x9000, 0xE000]
return createRaggerClient(backend, chain=chain, debug=True, screenshot_dir=TESTS_ROOT_DIR)
+
+
+def toggle_nonstandard_sighash_setting(navigator: Navigator, firmware: Firmware,
+ test_case_name: str = None):
+ """Navigate to app settings and toggle the 'Non-standard sighash' switch.
+
+ Must be called at the start of any test that needs non-standard sighash types
+ to be accepted (the setting is disabled by default and resets per test).
+
+ If test_case_name* is provided, screenshots are captured and
+ compared against golden images via ``navigate_and_compare``; otherwise only
+ ``navigate`` (no screenshot comparison) is used.
+ """
+ if firmware.device.startswith("nano"):
+ # The warning in the choice dialog can span a variable number of Nano pages,
+ # so scroll to the confirm button by text ("enable", from "I understand,
+ # enable") instead of hard-coding the RIGHT_CLICK count.
+ open_dialog = [NavInsID.RIGHT_CLICK, NavInsID.BOTH_CLICK, NavInsID.BOTH_CLICK]
+ exit_settings = [NavInsID.RIGHT_CLICK, NavInsID.BOTH_CLICK]
+
+ if test_case_name is not None:
+ navigator.navigate_and_compare(
+ TESTS_ROOT_DIR, test_case_name, open_dialog,
+ screen_change_before_first_instruction=False, snap_start_idx=0)
+ # exit is not snapshotted: the scroll length above is variable
+ navigator.navigate_until_text_and_compare(
+ NavInsID.RIGHT_CLICK, [NavInsID.BOTH_CLICK], "enable",
+ TESTS_ROOT_DIR, test_case_name,
+ screen_change_before_first_instruction=False, snap_start_idx=len(open_dialog))
+ else:
+ navigator.navigate(open_dialog, screen_change_before_first_instruction=False)
+ navigator.navigate_until_text(
+ NavInsID.RIGHT_CLICK, [NavInsID.BOTH_CLICK], "enable",
+ screen_change_before_first_instruction=False)
+ navigator.navigate(exit_settings, screen_change_before_first_instruction=False)
+ return
+
+ # Touch devices (Stax/Flex/Apex): open settings, tap the switch row,
+ # confirm the "are you sure?" warning dialog, then exit settings
+ if firmware.device == "stax":
+ switch_pos = (STAX_X_CENTER, 140)
+ elif firmware.device == "flex":
+ switch_pos = (FLEX_X_CENTER, 150)
+ else: # apex_p, apex_m
+ switch_pos = (APEX_P_X_CENTER, 90)
+ instructions = [
+ NavInsID.USE_CASE_HOME_SETTINGS,
+ NavIns(NavInsID.TOUCH, switch_pos),
+ NavInsID.USE_CASE_CHOICE_CONFIRM,
+ NavInsID.USE_CASE_SETTINGS_MULTI_PAGE_EXIT,
+ ]
+
+ if test_case_name is not None:
+ navigator.navigate_and_compare(TESTS_ROOT_DIR, test_case_name, instructions,
+ screen_change_before_first_instruction=False)
+ else:
+ navigator.navigate(instructions,
+ screen_change_before_first_instruction=False)
diff --git a/tests/test_sighash_setting.py b/tests/test_sighash_setting.py
new file mode 100644
index 0000000..b03d896
--- /dev/null
+++ b/tests/test_sighash_setting.py
@@ -0,0 +1,301 @@
+"""
+Tests for the non-standard sighash gating feature.
+
+Verifies that:
+1. By default, non-standard sighash types (NONE, SINGLE, ANYONECANPAY|*) are rejected
+ with SW_SECURITY_STATUS_NOT_SATISFIED (0x6982) and error code
+ EC_SIGN_PSBT_NONDEFAULT_SIGHASH_NOT_ALLOWED (0x000d).
+2. After enabling "Non-standard sighash" in app settings, non-standard sighash types
+ are accepted with a warning (previous behavior).
+3. Unsupported sighash types are still rejected regardless of the setting.
+4. SIGHASH_ALL and SIGHASH_DEFAULT remain unaffected by the setting.
+"""
+import pytest
+from pathlib import Path
+from ledger_bitcoin import WalletPolicy
+from ledger_bitcoin.exception.errors import NotSupportedError, SecurityStatusNotSatisfiedError
+from ledger_bitcoin.exception.device_exception import DeviceException
+from ledger_bitcoin.psbt import PSBT
+from test_utils import bip0340
+from ragger.navigator import Navigator, NavInsID, NavIns
+from ragger.error import ExceptionRAPDU
+from ragger.firmware import Firmware
+from ragger_bitcoin import RaggerClient
+
+from .conftest import toggle_nonstandard_sighash_setting
+from .instructions import sign_psbt_instruction_approve
+
+tests_root: Path = Path(__file__).parent
+
+# Error codes from error_codes.h
+EC_SIGN_PSBT_NONDEFAULT_SIGHASH_NOT_ALLOWED = 0x000d
+
+# Status words
+SW_SECURITY_STATUS_NOT_SATISFIED = 0x6982
+
+tr_wallet = WalletPolicy(
+ "",
+ "tr(@0/**)",
+ [
+ "[f5acc2fd/86'/1'/0']tpubDDKYE6BREvDsSWMazgHoyQWiJwYaDDYPbCFjYxN3HFXJP5fokeiK4hwK5tTLBNEDBwrDXn8cQ4v9b2xdW62Xr5yxoQdMu1v6c7UDXYVH27U"
+ ],
+)
+
+wpkh_wallet = WalletPolicy(
+ "",
+ "wpkh(@0/**)",
+ [
+ "[f5acc2fd/84'/1'/0']tpubDCtKfsNyRhULjZ9XMS4VKKtVcPdVDi8MKUbcSD9MJDyjRu1A2ND5MiipozyyspBT9bg8upEp7a8EAgFxNxXn1d7QkdbL52Ty5jiSLcxPt1P"
+ ],
+)
+
+# Pre-computed sighash values from Bitcoin Core for verification
+sighash_bitcoin_core_none_0 = bytes.fromhex(
+ "965976D58A387369D970F0B6560B144E1B721D41E04675592C41AC35D30D2A56")
+sighash_bitcoin_core_none_1 = bytes.fromhex(
+ "67E85534A12E4054F4AFAA434D7A7C38123DA6909DF7E45DDB9945F7B8D832D0")
+sighash_bitcoin_core_all_0 = bytes.fromhex(
+ "2221AA462110C77A8E2DD34C3681BAA9BFFF6553B4C609EC7E3D8FF9B1D18D69")
+sighash_bitcoin_core_all_1 = bytes.fromhex(
+ "D47D3FA22B4F6C50521C49E1A42E8CB10689540A227491A8FC5AD0A6E413063E")
+
+
+def open_psbt_from_file(filename: str) -> PSBT:
+ raw_psbt_base64 = open(filename, "r").read()
+ psbt = PSBT()
+ psbt.deserialize(raw_psbt_base64)
+ return psbt
+
+
+# =========================================================================
+# Tests: Default behavior (setting disabled) - non-standard sighash REJECTED
+# =========================================================================
+
+
+def test_sighash_none_rejected_by_default(navigator: Navigator, firmware: Firmware,
+ client: RaggerClient, test_name: str):
+ """SIGHASH_NONE should be rejected when the non-standard sighash setting is disabled (default)."""
+ psbt = open_psbt_from_file(f"{tests_root}/psbt/sighash/sighash-none-sign.psbt")
+
+ with pytest.raises(ExceptionRAPDU) as e:
+ client.sign_psbt(psbt, tr_wallet, None, navigator,
+ instructions=sign_psbt_instruction_approve(firmware),
+ testname=test_name)
+ assert e.value.status == SW_SECURITY_STATUS_NOT_SATISFIED
+ assert len(e.value.data) == 2
+ error_code = int.from_bytes(e.value.data, 'big')
+ assert error_code == EC_SIGN_PSBT_NONDEFAULT_SIGHASH_NOT_ALLOWED
+
+
+def test_sighash_single_rejected_by_default(navigator: Navigator, firmware: Firmware,
+ client: RaggerClient, test_name: str):
+ """SIGHASH_SINGLE should be rejected when the non-standard sighash setting is disabled (default)."""
+ psbt = open_psbt_from_file(f"{tests_root}/psbt/sighash/sighash-single-sign.psbt")
+
+ with pytest.raises(ExceptionRAPDU) as e:
+ client.sign_psbt(psbt, tr_wallet, None, navigator,
+ instructions=sign_psbt_instruction_approve(firmware),
+ testname=test_name)
+ assert e.value.status == SW_SECURITY_STATUS_NOT_SATISFIED
+ assert len(e.value.data) == 2
+ error_code = int.from_bytes(e.value.data, 'big')
+ assert error_code == EC_SIGN_PSBT_NONDEFAULT_SIGHASH_NOT_ALLOWED
+
+
+def test_sighash_anyonecanpay_all_rejected_by_default(navigator: Navigator, firmware: Firmware,
+ client: RaggerClient, test_name: str):
+ """SIGHASH_ANYONECANPAY|ALL should be rejected when the setting is disabled (default)."""
+ psbt = open_psbt_from_file(f"{tests_root}/psbt/sighash/sighash-all-anyone-can-pay-sign.psbt")
+
+ with pytest.raises(ExceptionRAPDU) as e:
+ client.sign_psbt(psbt, tr_wallet, None, navigator,
+ instructions=sign_psbt_instruction_approve(firmware),
+ testname=test_name)
+ assert e.value.status == SW_SECURITY_STATUS_NOT_SATISFIED
+ assert len(e.value.data) == 2
+ error_code = int.from_bytes(e.value.data, 'big')
+ assert error_code == EC_SIGN_PSBT_NONDEFAULT_SIGHASH_NOT_ALLOWED
+
+
+def test_sighash_anyonecanpay_none_rejected_by_default(navigator: Navigator, firmware: Firmware,
+ client: RaggerClient, test_name: str):
+ """SIGHASH_ANYONECANPAY|NONE should be rejected when the setting is disabled (default)."""
+ psbt = open_psbt_from_file(f"{tests_root}/psbt/sighash/sighash-none-anyone-can-pay-sign.psbt")
+
+ with pytest.raises(ExceptionRAPDU) as e:
+ client.sign_psbt(psbt, tr_wallet, None, navigator,
+ instructions=sign_psbt_instruction_approve(firmware),
+ testname=test_name)
+ assert e.value.status == SW_SECURITY_STATUS_NOT_SATISFIED
+ assert len(e.value.data) == 2
+ error_code = int.from_bytes(e.value.data, 'big')
+ assert error_code == EC_SIGN_PSBT_NONDEFAULT_SIGHASH_NOT_ALLOWED
+
+
+def test_sighash_anyonecanpay_single_rejected_by_default(navigator: Navigator, firmware: Firmware,
+ client: RaggerClient, test_name: str):
+ """SIGHASH_ANYONECANPAY|SINGLE should be rejected when the setting is disabled (default)."""
+ psbt = open_psbt_from_file(f"{tests_root}/psbt/sighash/sighash-single-anyone-can-pay-sign.psbt")
+
+ with pytest.raises(ExceptionRAPDU) as e:
+ client.sign_psbt(psbt, tr_wallet, None, navigator,
+ instructions=sign_psbt_instruction_approve(firmware),
+ testname=test_name)
+ assert e.value.status == SW_SECURITY_STATUS_NOT_SATISFIED
+ assert len(e.value.data) == 2
+ error_code = int.from_bytes(e.value.data, 'big')
+ assert error_code == EC_SIGN_PSBT_NONDEFAULT_SIGHASH_NOT_ALLOWED
+
+
+def test_sighash_segwitv0_sighash2_rejected_by_default(navigator: Navigator, firmware: Firmware,
+ client: RaggerClient, test_name: str):
+ """SegWit v0 SIGHASH_NONE (0x02) should be rejected when the setting is disabled (default)."""
+ psbt = open_psbt_from_file(f"{tests_root}/psbt/singlesig/wpkh-1to2.psbt")
+ psbt.inputs[0].sighash = 2
+
+ with pytest.raises(ExceptionRAPDU) as e:
+ client.sign_psbt(psbt, wpkh_wallet, None, navigator,
+ instructions=sign_psbt_instruction_approve(firmware),
+ testname=test_name)
+ assert e.value.status == SW_SECURITY_STATUS_NOT_SATISFIED
+ assert len(e.value.data) == 2
+ error_code = int.from_bytes(e.value.data, 'big')
+ assert error_code == EC_SIGN_PSBT_NONDEFAULT_SIGHASH_NOT_ALLOWED
+
+
+# =========================================================================
+# Tests: SIGHASH_ALL is always allowed (regardless of setting)
+# =========================================================================
+
+
+def test_sighash_all_always_allowed(navigator: Navigator, firmware: Firmware,
+ client: RaggerClient, test_name: str):
+ """SIGHASH_ALL should always be allowed, even when the setting is disabled."""
+ psbt = open_psbt_from_file(f"{tests_root}/psbt/sighash/sighash-all-sign.psbt")
+
+ result = client.sign_psbt(psbt, tr_wallet, None, navigator,
+ instructions=sign_psbt_instruction_approve(firmware),
+ testname=test_name)
+
+ pubkey0 = psbt.inputs[0].witness_utxo.scriptPubKey[2:]
+ pubkey1 = psbt.inputs[1].witness_utxo.scriptPubKey[2:]
+
+ assert len(result) == 2
+ _, partial_sig0 = result[0]
+ _, partial_sig1 = result[1]
+
+ assert bip0340.schnorr_verify(sighash_bitcoin_core_all_0, pubkey0, partial_sig0.signature[:-1])
+ assert bip0340.schnorr_verify(sighash_bitcoin_core_all_1, pubkey1, partial_sig1.signature[:-1])
+
+
+# =========================================================================
+# Tests: Unsupported sighash still rejected (regardless of setting)
+# =========================================================================
+
+
+def test_sighash_unsupported_still_rejected_with_setting_enabled(
+ navigator: Navigator, firmware: Firmware, client: RaggerClient, test_name: str):
+ """Unsupported sighash types should still be rejected even when the setting is enabled."""
+ # First, enable the setting
+ toggle_nonstandard_sighash_setting(navigator, firmware)
+
+ psbt = open_psbt_from_file(f"{tests_root}/psbt/sighash/sighash-unsupported.psbt")
+
+ with pytest.raises(ExceptionRAPDU) as e:
+ client.sign_psbt(psbt, tr_wallet, None, navigator,
+ instructions=sign_psbt_instruction_approve(firmware),
+ testname=test_name)
+ assert DeviceException.exc.get(e.value.status) == NotSupportedError
+ assert len(e.value.data) == 0
+
+
+# =========================================================================
+# Tests: After enabling the setting, non-standard sighash accepted with warning
+# =========================================================================
+
+
+def test_sighash_none_allowed_after_enabling_setting(
+ navigator: Navigator, firmware: Firmware, client: RaggerClient, test_name: str):
+ """SIGHASH_NONE should be allowed (with warning) after enabling the setting."""
+ # Enable the setting via UI navigation (with screenshot comparison)
+ toggle_nonstandard_sighash_setting(navigator, firmware,
+ test_case_name=test_name + "_settings")
+
+ psbt = open_psbt_from_file(f"{tests_root}/psbt/sighash/sighash-none-sign.psbt")
+
+ result = client.sign_psbt(psbt, tr_wallet, None, navigator,
+ instructions=sign_psbt_instruction_approve(
+ firmware, has_sighashwarning=True),
+ testname=test_name)
+
+ pubkey0 = psbt.inputs[0].witness_utxo.scriptPubKey[2:]
+ pubkey1 = psbt.inputs[1].witness_utxo.scriptPubKey[2:]
+
+ assert len(result) == 2
+ _, partial_sig0 = result[0]
+ _, partial_sig1 = result[1]
+
+ assert len(partial_sig0.signature) == 64 + 1
+ assert len(partial_sig1.signature) == 64 + 1
+ assert partial_sig0.signature[-1] == 0x02
+ assert partial_sig1.signature[-1] == 0x02
+
+ assert bip0340.schnorr_verify(sighash_bitcoin_core_none_0, pubkey0,
+ partial_sig0.signature[:-1])
+ assert bip0340.schnorr_verify(sighash_bitcoin_core_none_1, pubkey1,
+ partial_sig1.signature[:-1])
+
+
+def test_sighash_single_allowed_after_enabling_setting(
+ navigator: Navigator, firmware: Firmware, client: RaggerClient, test_name: str):
+ """SIGHASH_SINGLE should be allowed (with warning) after enabling the setting."""
+ toggle_nonstandard_sighash_setting(navigator, firmware)
+
+ psbt = open_psbt_from_file(f"{tests_root}/psbt/sighash/sighash-single-sign.psbt")
+
+ result = client.sign_psbt(psbt, tr_wallet, None, navigator,
+ instructions=sign_psbt_instruction_approve(
+ firmware, has_sighashwarning=True),
+ testname=test_name)
+
+ assert len(result) == 2
+ _, partial_sig0 = result[0]
+ _, partial_sig1 = result[1]
+
+ assert partial_sig0.signature[-1] == 0x03
+ assert partial_sig1.signature[-1] == 0x03
+
+
+def test_sighash_anyonecanpay_all_allowed_after_enabling_setting(
+ navigator: Navigator, firmware: Firmware, client: RaggerClient, test_name: str):
+ """SIGHASH_ANYONECANPAY|ALL should be allowed (with warning) after enabling the setting."""
+ toggle_nonstandard_sighash_setting(navigator, firmware)
+
+ psbt = open_psbt_from_file(f"{tests_root}/psbt/sighash/sighash-all-anyone-can-pay-sign.psbt")
+
+ result = client.sign_psbt(psbt, tr_wallet, None, navigator,
+ instructions=sign_psbt_instruction_approve(
+ firmware, has_sighashwarning=True),
+ testname=test_name)
+
+ assert len(result) == 2
+ _, partial_sig0 = result[0]
+ _, partial_sig1 = result[1]
+
+ assert partial_sig0.signature[-1] == 0x81
+ assert partial_sig1.signature[-1] == 0x81
+
+
+def test_sighash_segwitv0_sighash2_allowed_after_enabling_setting(
+ navigator: Navigator, firmware: Firmware, client: RaggerClient, test_name: str):
+ """SegWit v0 SIGHASH_NONE (0x02) should be allowed (with warning) after enabling the setting."""
+ toggle_nonstandard_sighash_setting(navigator, firmware)
+
+ psbt = open_psbt_from_file(f"{tests_root}/psbt/singlesig/wpkh-1to2.psbt")
+ psbt.inputs[0].sighash = 2
+
+ result = client.sign_psbt(psbt, wpkh_wallet, None, navigator,
+ instructions=sign_psbt_instruction_approve(
+ firmware, has_sighashwarning=True),
+ testname=test_name)
+ assert len(result) == 1
diff --git a/tests/test_sign_psbt_with_sighash_types.py b/tests/test_sign_psbt_with_sighash_types.py
index 0bf52b0..2de38bb 100644
--- a/tests/test_sign_psbt_with_sighash_types.py
+++ b/tests/test_sign_psbt_with_sighash_types.py
@@ -10,6 +10,7 @@ from ragger.error import ExceptionRAPDU
from ragger.firmware import Firmware
from ragger_bitcoin import RaggerClient
+from .conftest import toggle_nonstandard_sighash_setting
from .instructions import sign_psbt_instruction_approve
tests_root: Path = Path(__file__).parent
@@ -119,6 +120,7 @@ def test_sighash_all_output_modified(navigator: Navigator, firmware: Firmware, c
def test_sighash_none_sign_psbt(navigator: Navigator, firmware: Firmware, client: RaggerClient, test_name: str):
+ toggle_nonstandard_sighash_setting(navigator, firmware)
psbt = open_psbt_from_file(f"{tests_root}/psbt/sighash/sighash-none-sign.psbt")
result = client.sign_psbt(psbt, tr_wallet, None, navigator,
@@ -144,6 +146,7 @@ def test_sighash_none_sign_psbt(navigator: Navigator, firmware: Firmware, client
def test_sighash_none_input_modified(navigator: Navigator, firmware: Firmware, client: RaggerClient, test_name: str):
+ toggle_nonstandard_sighash_setting(navigator, firmware)
psbt = open_psbt_from_file(f"{tests_root}/psbt/sighash/sighash-none-sign.psbt")
psbt.tx.vin[0].nSequence = psbt.tx.vin[0].nSequence - 1
@@ -164,6 +167,7 @@ def test_sighash_none_input_modified(navigator: Navigator, firmware: Firmware, c
def test_sighash_none_output_modified(navigator: Navigator, firmware: Firmware, client: RaggerClient, test_name: str):
+ toggle_nonstandard_sighash_setting(navigator, firmware)
psbt = open_psbt_from_file(f"{tests_root}/psbt/sighash/sighash-none-sign.psbt")
psbt.tx.vout[0].nValue = psbt.tx.vout[0].nValue - 1
@@ -184,6 +188,7 @@ def test_sighash_none_output_modified(navigator: Navigator, firmware: Firmware,
def test_sighash_single_sign_psbt(navigator: Navigator, firmware: Firmware, client: RaggerClient, test_name: str):
+ toggle_nonstandard_sighash_setting(navigator, firmware)
psbt = open_psbt_from_file(f"{tests_root}/psbt/sighash/sighash-single-sign.psbt")
result = client.sign_psbt(psbt, tr_wallet, None, navigator,
@@ -210,6 +215,7 @@ def test_sighash_single_sign_psbt(navigator: Navigator, firmware: Firmware, clie
def test_sighash_single_input_modified(navigator: Navigator, firmware: Firmware, client:
RaggerClient, test_name: str):
+ toggle_nonstandard_sighash_setting(navigator, firmware)
psbt = open_psbt_from_file(f"{tests_root}/psbt/sighash/sighash-single-sign.psbt")
psbt.tx.vin[1].nSequence = psbt.tx.vin[1].nSequence - 1
@@ -232,6 +238,7 @@ def test_sighash_single_input_modified(navigator: Navigator, firmware: Firmware,
def test_sighash_single_output_same_index_modified(navigator: Navigator, firmware: Firmware, client:
RaggerClient, test_name: str):
+ toggle_nonstandard_sighash_setting(navigator, firmware)
psbt = open_psbt_from_file(f"{tests_root}/psbt/sighash/sighash-single-sign.psbt")
psbt.tx.vout[0].nValue = psbt.tx.vout[0].nValue - 1
@@ -254,6 +261,7 @@ def test_sighash_single_output_same_index_modified(navigator: Navigator, firmwar
def test_sighash_single_output_different_index_modified(navigator: Navigator, firmware: Firmware,
client: RaggerClient, test_name: str):
+ toggle_nonstandard_sighash_setting(navigator, firmware)
psbt = open_psbt_from_file(f"{tests_root}/psbt/sighash/sighash-single-sign.psbt")
psbt.tx.vout[1].nValue = psbt.tx.vout[1].nValue - 1
@@ -275,6 +283,7 @@ def test_sighash_single_output_different_index_modified(navigator: Navigator, fi
def test_sighash_single_3_ins_2_out(navigator: Navigator, firmware: Firmware, client: RaggerClient, test_name: str):
+ toggle_nonstandard_sighash_setting(navigator, firmware)
psbt = open_psbt_from_file(f"{tests_root}/psbt/sighash/sighash-single-3-ins-2-outs.psbt")
with pytest.raises(ExceptionRAPDU) as e:
@@ -292,6 +301,7 @@ def test_sighash_single_3_ins_2_out(navigator: Navigator, firmware: Firmware, cl
def test_sighash_all_anyone_sign(navigator: Navigator, firmware: Firmware, client: RaggerClient, test_name: str):
+ toggle_nonstandard_sighash_setting(navigator, firmware)
psbt = open_psbt_from_file(f"{tests_root}/psbt/sighash/sighash-all-anyone-can-pay-sign.psbt")
result = client.sign_psbt(psbt, tr_wallet, None, navigator,
@@ -318,6 +328,7 @@ def test_sighash_all_anyone_sign(navigator: Navigator, firmware: Firmware, clien
def test_sighash_all_anyone_input_changed(navigator: Navigator, firmware: Firmware, client:
RaggerClient, test_name: str):
+ toggle_nonstandard_sighash_setting(navigator, firmware)
psbt = open_psbt_from_file(f"{tests_root}/psbt/sighash/sighash-all-anyone-can-pay-sign.psbt")
psbt.tx.vin[0].nSequence = psbt.tx.vin[0].nSequence - 1
@@ -340,6 +351,7 @@ def test_sighash_all_anyone_input_changed(navigator: Navigator, firmware: Firmwa
def test_sighash_all_anyone_output_changed(navigator: Navigator, firmware: Firmware, client:
RaggerClient, test_name: str):
+ toggle_nonstandard_sighash_setting(navigator, firmware)
psbt = open_psbt_from_file(f"{tests_root}/psbt/sighash/sighash-all-anyone-can-pay-sign.psbt")
psbt.tx.vout[0].nValue = psbt.tx.vout[0].nValue - 1
@@ -361,6 +373,7 @@ def test_sighash_all_anyone_output_changed(navigator: Navigator, firmware: Firmw
def test_sighash_none_anyone_sign(navigator: Navigator, firmware: Firmware, client: RaggerClient, test_name: str):
+ toggle_nonstandard_sighash_setting(navigator, firmware)
psbt = open_psbt_from_file(f"{tests_root}/psbt/sighash/sighash-none-anyone-can-pay-sign.psbt")
result = client.sign_psbt(psbt, tr_wallet, None, navigator,
@@ -387,6 +400,7 @@ def test_sighash_none_anyone_sign(navigator: Navigator, firmware: Firmware, clie
def test_sighash_none_anyone_input_changed(navigator: Navigator, firmware: Firmware, client:
RaggerClient, test_name: str):
+ toggle_nonstandard_sighash_setting(navigator, firmware)
psbt = open_psbt_from_file(f"{tests_root}/psbt/sighash/sighash-none-anyone-can-pay-sign.psbt")
psbt.tx.vin[0].nSequence = psbt.tx.vin[0].nSequence - 1
@@ -409,6 +423,7 @@ def test_sighash_none_anyone_input_changed(navigator: Navigator, firmware: Firmw
def test_sighash_none_anyone_output_changed(navigator: Navigator, firmware: Firmware, client:
RaggerClient, test_name: str):
+ toggle_nonstandard_sighash_setting(navigator, firmware)
psbt = open_psbt_from_file(f"{tests_root}/psbt/sighash/sighash-none-anyone-can-pay-sign.psbt")
psbt.tx.vout[0].nValue = psbt.tx.vout[0].nValue - 1
@@ -430,6 +445,7 @@ def test_sighash_none_anyone_output_changed(navigator: Navigator, firmware: Firm
def test_sighash_single_anyone_sign(navigator: Navigator, firmware: Firmware, client: RaggerClient, test_name: str):
+ toggle_nonstandard_sighash_setting(navigator, firmware)
psbt = open_psbt_from_file(f"{tests_root}/psbt/sighash/sighash-single-anyone-can-pay-sign.psbt")
result = client.sign_psbt(psbt, tr_wallet, None, navigator,
@@ -456,6 +472,7 @@ def test_sighash_single_anyone_sign(navigator: Navigator, firmware: Firmware, cl
def test_sighash_single_anyone_input_changed(navigator: Navigator, firmware: Firmware, client:
RaggerClient, test_name: str):
+ toggle_nonstandard_sighash_setting(navigator, firmware)
psbt = open_psbt_from_file(f"{tests_root}/psbt/sighash/sighash-single-anyone-can-pay-sign.psbt")
psbt.tx.vin[0].nSequence = psbt.tx.vin[0].nSequence - 1
@@ -478,6 +495,7 @@ def test_sighash_single_anyone_input_changed(navigator: Navigator, firmware: Fir
def test_sighash_single_anyone_output_changed(navigator: Navigator, firmware: Firmware, client:
RaggerClient, test_name: str):
+ toggle_nonstandard_sighash_setting(navigator, firmware)
psbt = open_psbt_from_file(f"{tests_root}/psbt/sighash/sighash-single-anyone-can-pay-sign.psbt")
psbt.tx.vout[0].nValue = psbt.tx.vout[0].nValue - 1
@@ -565,6 +583,7 @@ def test_sighash_segwitv0_sighash1(navigator: Navigator, firmware: Firmware, cli
def test_sighash_segwitv0_sighash2(navigator: Navigator, firmware: Firmware, client: RaggerClient, test_name: str):
+ toggle_nonstandard_sighash_setting(navigator, firmware)
expected_sig = b'0D\x02 o\x86>\xd5\x8b\xb5\xa5\xa2KZ\xcez\xb2\x92\xd0\xce\x04!L_\x8f9\xeb#m3\x9e\xb4\x8d\xc6sK\x02 p\x8d\x95\x0b4B\x02^\xf1nB\xd2\xea\x84b\x14\xc7\x00\x88"\xed\x19o<f}E\xcc\xfa\xc2\xfc\xd3\x02'
psbt = open_psbt_from_file(f"{tests_root}/psbt/singlesig/wpkh-1to2.psbt")
@@ -576,6 +595,7 @@ def test_sighash_segwitv0_sighash2(navigator: Navigator, firmware: Firmware, cli
def test_sighash_segwitv0_sighash3(navigator: Navigator, firmware: Firmware, client: RaggerClient, test_name: str):
+ toggle_nonstandard_sighash_setting(navigator, firmware)
expected_sig = b'0D\x02 \x11.vf\xbe\x1bd2\x1cx\x89\xcf\xca(\x03\xb0\xc1\x03\x86\xcb\x08\xe4\xe9\xbf\xef/\x1e\xa1\x93\x02\x01C\x02 .)XC\x991\xa6\x85\xa2\x06\xa4\xf7\xde\xfc\xb7\xce\x0b\xc7\xf6\xd6ov\x8a\xdd\xa9\xb5\xf9\x8f\xb8\x07\x82\xc2\x03'
psbt = open_psbt_from_file(f"{tests_root}/psbt/singlesig/wpkh-1to2.psbt")
@@ -587,6 +607,7 @@ def test_sighash_segwitv0_sighash3(navigator: Navigator, firmware: Firmware, cli
def test_sighash_segwitv0_sighash81(navigator: Navigator, firmware: Firmware, client: RaggerClient, test_name: str):
+ toggle_nonstandard_sighash_setting(navigator, firmware)
expected_sig = b"0E\x02!\x00\xde\xae\xfd\x1fg\x96\x9a,\xb9\x0e\xfe\xa9\xc343L\xca=\x9f\xeb4\xcfg\xd62u\xc4c\xa5'0\xd9\x02 rd\x88\x7f s\x93\xd0\x97\xea\xc1@\xc8\xbe\xedu 7w4\x04z\x99.&\xd99\xa1Il/\x82\x81"
psbt = open_psbt_from_file(f"{tests_root}/psbt/singlesig/wpkh-1to2.psbt")
@@ -598,6 +619,7 @@ def test_sighash_segwitv0_sighash81(navigator: Navigator, firmware: Firmware, cl
def test_sighash_segwitv0_sighash82(navigator: Navigator, firmware: Firmware, client: RaggerClient, test_name: str):
+ toggle_nonstandard_sighash_setting(navigator, firmware)
expected_sig = b'0E\x02!\x00\xe5\r7m\xa2\x1a\xb4\x89\xd48k\x14\xeb\xd0\xa9\xcc\x00\x17\x9ch\x8b\x16\xb5\x9d&\xab\x94md9\x929\x02 "\x159\xdc\xa3\x06\x06\x9cR\n\xf1\x9a\xfb^\xde)\x1a\xe9\x1e\x07S\x96\xedARN\xfeY\xa4\xc1A\xd4\x82'
psbt = open_psbt_from_file(f"{tests_root}/psbt/singlesig/wpkh-1to2.psbt")
@@ -609,6 +631,7 @@ def test_sighash_segwitv0_sighash82(navigator: Navigator, firmware: Firmware, cl
def test_sighash_segwitv0_sighash83(navigator: Navigator, firmware: Firmware, client: RaggerClient, test_name: str):
+ toggle_nonstandard_sighash_setting(navigator, firmware)
expected_sig = b'0D\x02 \x07q\xb3\xe4\x05\xa3|\xd4\xaa$\x95\x1c\x08\x8d~L7\t:|\xddp7\xa7h\x81\x14\xd5$V\x03v\x02 @\xff\xf9\xbc\xd0|\x00\xfa\x91-}\x1e\xed\x04\x0e\xcc\x9d\xd4\xe4NM\\\xf6\xef\x9a\x94\xaf\x83l\xd8\x7f\xdd\x83'
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.