1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-25 00:48:19 +00:00

feat(core): allow benchmark only in debug

[no changelog]
This commit is contained in:
Ondřej Vejpustek 2024-10-02 18:06:32 +02:00
parent e8f8d0e7af
commit 2d5d7201d5
4 changed files with 14 additions and 2 deletions

View File

@ -19,6 +19,10 @@ NEW_RENDERING = ARGUMENTS.get('NEW_RENDERING', '1') == '1'
MODEL_IDENTIFIER = models.get_model_identifier(TREZOR_MODEL)
BENCHMARK = ARGUMENTS.get('BENCHMARK', '0') == '1'
if BENCHMARK and PYOPT != '0':
print("BENCHMARK=1 works only with PYOPT=0.")
exit(1)
FEATURE_FLAGS = {
"RDI": True,
"SECP256K1_ZKP": True, # required for trezor.crypto.curve.bip340 (BIP340/Taproot)

View File

@ -17,6 +17,10 @@ FROZEN = ARGUMENTS.get('TREZOR_EMULATOR_FROZEN', 0)
RASPI = os.getenv('TREZOR_EMULATOR_RASPI') == '1'
if BENCHMARK and PYOPT != '0':
print("BENCHMARK=1 works only with PYOPT=0.")
exit(1)
FEATURES_WANTED = ["input", "sd_card", "dma2d", "optiga", "sbu"]
if NEW_RENDERING:
FEATURES_WANTED.append("new_rendering")

View File

@ -0,0 +1,4 @@
if not __debug__:
from trezor import utils
utils.halt("Disabled in production mode")

View File

@ -207,9 +207,9 @@ def _find_message_handler_module(msg_type: int) -> str:
return "apps.solana.sign_tx"
# benchmark
if msg_type == MessageType.BenchmarkListNames:
if __debug__ and msg_type == MessageType.BenchmarkListNames:
return "apps.benchmark.list_names"
if msg_type == MessageType.BenchmarkRun:
if __debug__ and msg_type == MessageType.BenchmarkRun:
return "apps.benchmark.run"
raise ValueError