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

feat(core): allow benchmark on BITCOIN_ONLY debug build

[no changelog]
This commit is contained in:
M1nd3r 2024-10-24 13:33:03 +02:00 committed by Petr Sedláček
parent 48b9c8456f
commit 74655931ce
4 changed files with 21 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

@ -699,6 +699,8 @@ if FROZEN:
SOURCE_PY_DIR + 'apps/bitcoin/sign_tx/zcash_v4.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'))
@ -754,8 +756,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

@ -31,6 +31,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"
# management
if msg_type == MessageType.ResetDevice:
return "apps.management.reset_device"
@ -206,12 +212,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());