1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-22 05:10:56 +00:00

feat(core): enable benchmark on bitcoin_only builds

[no changelog]
This commit is contained in:
M1nd3r 2024-10-17 13:51:08 +02:00
parent 66fcd27e2b
commit d9e24e7068
4 changed files with 22 additions and 15 deletions

View File

@ -5,6 +5,10 @@ package hw.trezor.messages.bitcoin;
option java_package = "com.satoshilabs.trezor.lib.protobuf";
option java_outer_classname = "TrezorMessageBenchmark";
import "options.proto";
option (include_in_bitcoin_only) = true;
/**
* Request: Ask device for a list of names of all supported benchmarks
* @start

View File

@ -694,6 +694,9 @@ if FROZEN:
if THP:
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/thp/*.py'))
if BENCHMARK:
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/benchmark/*.py'))
if EVERYTHING:
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/binance/*.py'))
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/enums/Binance*.py'))
@ -746,8 +749,6 @@ if FROZEN:
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/bitcoin/sign_tx/zcash_v4.py'))
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/enums/Zcash*.py'))
if BENCHMARK:
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/benchmark/*.py'))
source_mpy = env.FrozenModule(
source=SOURCE_PY,

View File

@ -29,6 +29,12 @@ def _find_message_handler_module(msg_type: int) -> str:
if __debug__ and msg_type == MessageType.LoadDevice:
return "apps.debug.load_device"
# benchmark
if __debug__ and msg_type == MessageType.BenchmarkListNames:
return "apps.benchmark.list_names"
if __debug__ and msg_type == MessageType.BenchmarkRun:
return "apps.benchmark.run"
if utils.USE_THP:
from trezor.enums import ThpMessageType
@ -211,12 +217,6 @@ def _find_message_handler_module(msg_type: int) -> str:
if msg_type == MessageType.SolanaSignTx:
return "apps.solana.sign_tx"
# benchmark
if __debug__ and msg_type == MessageType.BenchmarkListNames:
return "apps.benchmark.list_names"
if __debug__ and msg_type == MessageType.BenchmarkRun:
return "apps.benchmark.run"
raise ValueError

View File

@ -621,12 +621,13 @@ impl ::protobuf::reflect::ProtobufValue for BenchmarkResult {
}
static file_descriptor_proto_data: &'static [u8] = b"\
\n\x18messages-benchmark.proto\x12\x1ahw.trezor.messages.bitcoin\"\x14\n\
\x12BenchmarkListNames\"&\n\x0eBenchmarkNames\x12\x14\n\x05names\x18\x01\
\x20\x03(\tR\x05names\"\"\n\x0cBenchmarkRun\x12\x12\n\x04name\x18\x01\
\x20\x01(\tR\x04name\";\n\x0fBenchmarkResult\x12\x14\n\x05value\x18\x01\
\x20\x01(\tR\x05value\x12\x12\n\x04unit\x18\x03\x20\x01(\tR\x04unitB=\n#\
com.satoshilabs.trezor.lib.protobufB\x16TrezorMessageBenchmark\
\n\x18messages-benchmark.proto\x12\x1ahw.trezor.messages.bitcoin\x1a\rop\
tions.proto\"\x14\n\x12BenchmarkListNames\"&\n\x0eBenchmarkNames\x12\x14\
\n\x05names\x18\x01\x20\x03(\tR\x05names\"\"\n\x0cBenchmarkRun\x12\x12\n\
\x04name\x18\x01\x20\x01(\tR\x04name\";\n\x0fBenchmarkResult\x12\x14\n\
\x05value\x18\x01\x20\x01(\tR\x05value\x12\x12\n\x04unit\x18\x03\x20\x01\
(\tR\x04unitBA\n#com.satoshilabs.trezor.lib.protobufB\x16TrezorMessageBe\
nchmark\x80\xa6\x1d\x01\
";
/// `FileDescriptorProto` object which was a source for this generated file
@ -643,7 +644,8 @@ pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor {
static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new();
file_descriptor.get(|| {
let generated_file_descriptor = generated_file_descriptor_lazy.get(|| {
let mut deps = ::std::vec::Vec::with_capacity(0);
let mut deps = ::std::vec::Vec::with_capacity(1);
deps.push(super::options::file_descriptor().clone());
let mut messages = ::std::vec::Vec::with_capacity(4);
messages.push(BenchmarkListNames::generated_message_descriptor_data());
messages.push(BenchmarkNames::generated_message_descriptor_data());