diff --git a/common/protob/messages-benchmark.proto b/common/protob/messages-benchmark.proto new file mode 100644 index 0000000000..1b31b2c345 --- /dev/null +++ b/common/protob/messages-benchmark.proto @@ -0,0 +1,42 @@ +syntax = "proto2"; +package hw.trezor.messages.bitcoin; + +// Sugar for easier handling in Java +option java_package = "com.satoshilabs.trezor.lib.protobuf"; +option java_outer_classname = "TrezorMessageBenchmark"; + +/** + * Request: Ask device for a list of names of all supported benchmarks + * @start + * @next Benchmarks + * @next Failure + */ +message BenchmarkListNames { +} + +/** + * Response: Contains the list of names of all supported benchmarks + * @end + */ +message BenchmarkNames { + repeated string names = 1; +} + +/** + * Request: Ask device to run a benchmark + * @start + * @next BenchmarkResult + * @next Failure + */ +message BenchmarkRun { + optional string name = 1; +} + +/** + * Response: Contains the result of the benchmark + * @end + */ +message BenchmarkResult { + optional string value = 1; + optional string unit = 3; +} diff --git a/common/protob/messages.proto b/common/protob/messages.proto index 8156bc119c..4838ea2de2 100644 --- a/common/protob/messages.proto +++ b/common/protob/messages.proto @@ -376,4 +376,10 @@ enum MessageType { MessageType_SolanaAddress = 903 [(wire_out) = true]; MessageType_SolanaSignTx = 904 [(wire_in) = true]; MessageType_SolanaTxSignature = 905 [(wire_out) = true]; + + // Benchmark + MessageType_BenchmarkListNames = 9100 [(bitcoin_only) = true]; + MessageType_BenchmarkNames = 9101 [(bitcoin_only) = true]; + MessageType_BenchmarkRun = 9102 [(bitcoin_only) = true]; + MessageType_BenchmarkResult = 9103 [(bitcoin_only) = true]; } diff --git a/core/src/all_modules.py b/core/src/all_modules.py index 00abd550e1..386a6a3c91 100644 --- a/core/src/all_modules.py +++ b/core/src/all_modules.py @@ -215,6 +215,24 @@ apps import apps apps.base import apps.base +apps.benchmark +import apps.benchmark +apps.benchmark.benchmark +import apps.benchmark.benchmark +apps.benchmark.benchmarks +import apps.benchmark.benchmarks +apps.benchmark.cipher_benchmark +import apps.benchmark.cipher_benchmark +apps.benchmark.common +import apps.benchmark.common +apps.benchmark.curve_benchmark +import apps.benchmark.curve_benchmark +apps.benchmark.hash_benchmark +import apps.benchmark.hash_benchmark +apps.benchmark.list_names +import apps.benchmark.list_names +apps.benchmark.run +import apps.benchmark.run apps.bitcoin import apps.bitcoin apps.bitcoin.addresses diff --git a/core/src/trezor/enums/MessageType.py b/core/src/trezor/enums/MessageType.py index ae94e76ace..ae32cd7f69 100644 --- a/core/src/trezor/enums/MessageType.py +++ b/core/src/trezor/enums/MessageType.py @@ -95,6 +95,10 @@ DebugLinkEraseSdCard = 9005 DebugLinkWatchLayout = 9006 DebugLinkResetDebugEvents = 9007 DebugLinkOptigaSetSecMax = 9008 +BenchmarkListNames = 9100 +BenchmarkNames = 9101 +BenchmarkRun = 9102 +BenchmarkResult = 9103 if not utils.BITCOIN_ONLY: SetU2FCounter = 63 GetNextU2FCounter = 80 diff --git a/core/src/trezor/enums/__init__.py b/core/src/trezor/enums/__init__.py index 24e9278053..7db42bbe86 100644 --- a/core/src/trezor/enums/__init__.py +++ b/core/src/trezor/enums/__init__.py @@ -266,6 +266,10 @@ if TYPE_CHECKING: SolanaAddress = 903 SolanaSignTx = 904 SolanaTxSignature = 905 + BenchmarkListNames = 9100 + BenchmarkNames = 9101 + BenchmarkRun = 9102 + BenchmarkResult = 9103 class FailureType(IntEnum): UnexpectedMessage = 1 diff --git a/core/src/trezor/messages.py b/core/src/trezor/messages.py index 86418c4b88..5a5bb25245 100644 --- a/core/src/trezor/messages.py +++ b/core/src/trezor/messages.py @@ -67,6 +67,56 @@ if TYPE_CHECKING: from trezor.enums import TezosContractType # noqa: F401 from trezor.enums import WordRequestType # noqa: F401 + class BenchmarkListNames(protobuf.MessageType): + + @classmethod + def is_type_of(cls, msg: Any) -> TypeGuard["BenchmarkListNames"]: + return isinstance(msg, cls) + + class BenchmarkNames(protobuf.MessageType): + names: "list[str]" + + def __init__( + self, + *, + names: "list[str] | None" = None, + ) -> None: + pass + + @classmethod + def is_type_of(cls, msg: Any) -> TypeGuard["BenchmarkNames"]: + return isinstance(msg, cls) + + class BenchmarkRun(protobuf.MessageType): + name: "str | None" + + def __init__( + self, + *, + name: "str | None" = None, + ) -> None: + pass + + @classmethod + def is_type_of(cls, msg: Any) -> TypeGuard["BenchmarkRun"]: + return isinstance(msg, cls) + + class BenchmarkResult(protobuf.MessageType): + value: "str | None" + unit: "str | None" + + def __init__( + self, + *, + value: "str | None" = None, + unit: "str | None" = None, + ) -> None: + pass + + @classmethod + def is_type_of(cls, msg: Any) -> TypeGuard["BenchmarkResult"]: + return isinstance(msg, cls) + class BinanceGetAddress(protobuf.MessageType): address_n: "list[int]" show_display: "bool | None" diff --git a/legacy/firmware/protob/Makefile b/legacy/firmware/protob/Makefile index 1acdb5348b..ab039c3025 100644 --- a/legacy/firmware/protob/Makefile +++ b/legacy/firmware/protob/Makefile @@ -12,6 +12,7 @@ SKIPPED_MESSAGES := Binance Cardano DebugMonero Eos Monero Ontology Ripple SdPro Solana StellarClaimClaimableBalanceOp \ ChangeLanguage TranslationDataRequest TranslationDataAck \ SetBrightness DebugLinkOptigaSetSecMax \ + BenchmarkListNames BenchmarkRun BenchmarkNames BenchmarkResult ifeq ($(BITCOIN_ONLY), 1) SKIPPED_MESSAGES += Ethereum NEM Stellar diff --git a/python/src/trezorlib/messages.py b/python/src/trezorlib/messages.py index c2aff8a1cf..21db565f45 100644 --- a/python/src/trezorlib/messages.py +++ b/python/src/trezorlib/messages.py @@ -270,6 +270,10 @@ class MessageType(IntEnum): SolanaAddress = 903 SolanaSignTx = 904 SolanaTxSignature = 905 + BenchmarkListNames = 9100 + BenchmarkNames = 9101 + BenchmarkRun = 9102 + BenchmarkResult = 9103 class FailureType(IntEnum): @@ -626,6 +630,55 @@ class TezosBallotType(IntEnum): Pass = 2 +class BenchmarkListNames(protobuf.MessageType): + MESSAGE_WIRE_TYPE = 9100 + + +class BenchmarkNames(protobuf.MessageType): + MESSAGE_WIRE_TYPE = 9101 + FIELDS = { + 1: protobuf.Field("names", "string", repeated=True, required=False, default=None), + } + + def __init__( + self, + *, + names: Optional[Sequence["str"]] = None, + ) -> None: + self.names: Sequence["str"] = names if names is not None else [] + + +class BenchmarkRun(protobuf.MessageType): + MESSAGE_WIRE_TYPE = 9102 + FIELDS = { + 1: protobuf.Field("name", "string", repeated=False, required=False, default=None), + } + + def __init__( + self, + *, + name: Optional["str"] = None, + ) -> None: + self.name = name + + +class BenchmarkResult(protobuf.MessageType): + MESSAGE_WIRE_TYPE = 9103 + FIELDS = { + 1: protobuf.Field("value", "string", repeated=False, required=False, default=None), + 3: protobuf.Field("unit", "string", repeated=False, required=False, default=None), + } + + def __init__( + self, + *, + value: Optional["str"] = None, + unit: Optional["str"] = None, + ) -> None: + self.value = value + self.unit = unit + + class BinanceGetAddress(protobuf.MessageType): MESSAGE_WIRE_TYPE = 700 FIELDS = { diff --git a/rust/trezor-client/src/messages/generated.rs b/rust/trezor-client/src/messages/generated.rs index 1493a93867..83a0c4b0b7 100644 --- a/rust/trezor-client/src/messages/generated.rs +++ b/rust/trezor-client/src/messages/generated.rs @@ -80,6 +80,10 @@ trezor_message_impl! { DebugLinkWatchLayout => MessageType_DebugLinkWatchLayout, DebugLinkResetDebugEvents => MessageType_DebugLinkResetDebugEvents, DebugLinkOptigaSetSecMax => MessageType_DebugLinkOptigaSetSecMax, + BenchmarkListNames => MessageType_BenchmarkListNames, + BenchmarkNames => MessageType_BenchmarkNames, + BenchmarkRun => MessageType_BenchmarkRun, + BenchmarkResult => MessageType_BenchmarkResult, } #[cfg(feature = "binance")] diff --git a/rust/trezor-client/src/protos/generated/messages.rs b/rust/trezor-client/src/protos/generated/messages.rs index 7cf263a1fe..c7ecacb6d2 100644 --- a/rust/trezor-client/src/protos/generated/messages.rs +++ b/rust/trezor-client/src/protos/generated/messages.rs @@ -510,6 +510,14 @@ pub enum MessageType { MessageType_SolanaSignTx = 904, // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_SolanaTxSignature) MessageType_SolanaTxSignature = 905, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_BenchmarkListNames) + MessageType_BenchmarkListNames = 9100, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_BenchmarkNames) + MessageType_BenchmarkNames = 9101, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_BenchmarkRun) + MessageType_BenchmarkRun = 9102, + // @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_BenchmarkResult) + MessageType_BenchmarkResult = 9103, } impl ::protobuf::Enum for MessageType { @@ -762,6 +770,10 @@ impl ::protobuf::Enum for MessageType { 903 => ::std::option::Option::Some(MessageType::MessageType_SolanaAddress), 904 => ::std::option::Option::Some(MessageType::MessageType_SolanaSignTx), 905 => ::std::option::Option::Some(MessageType::MessageType_SolanaTxSignature), + 9100 => ::std::option::Option::Some(MessageType::MessageType_BenchmarkListNames), + 9101 => ::std::option::Option::Some(MessageType::MessageType_BenchmarkNames), + 9102 => ::std::option::Option::Some(MessageType::MessageType_BenchmarkRun), + 9103 => ::std::option::Option::Some(MessageType::MessageType_BenchmarkResult), _ => ::std::option::Option::None } } @@ -1009,6 +1021,10 @@ impl ::protobuf::Enum for MessageType { "MessageType_SolanaAddress" => ::std::option::Option::Some(MessageType::MessageType_SolanaAddress), "MessageType_SolanaSignTx" => ::std::option::Option::Some(MessageType::MessageType_SolanaSignTx), "MessageType_SolanaTxSignature" => ::std::option::Option::Some(MessageType::MessageType_SolanaTxSignature), + "MessageType_BenchmarkListNames" => ::std::option::Option::Some(MessageType::MessageType_BenchmarkListNames), + "MessageType_BenchmarkNames" => ::std::option::Option::Some(MessageType::MessageType_BenchmarkNames), + "MessageType_BenchmarkRun" => ::std::option::Option::Some(MessageType::MessageType_BenchmarkRun), + "MessageType_BenchmarkResult" => ::std::option::Option::Some(MessageType::MessageType_BenchmarkResult), _ => ::std::option::Option::None } } @@ -1255,6 +1271,10 @@ impl ::protobuf::Enum for MessageType { MessageType::MessageType_SolanaAddress, MessageType::MessageType_SolanaSignTx, MessageType::MessageType_SolanaTxSignature, + MessageType::MessageType_BenchmarkListNames, + MessageType::MessageType_BenchmarkNames, + MessageType::MessageType_BenchmarkRun, + MessageType::MessageType_BenchmarkResult, ]; } @@ -1507,6 +1527,10 @@ impl ::protobuf::EnumFull for MessageType { MessageType::MessageType_SolanaAddress => 238, MessageType::MessageType_SolanaSignTx => 239, MessageType::MessageType_SolanaTxSignature => 240, + MessageType::MessageType_BenchmarkListNames => 241, + MessageType::MessageType_BenchmarkNames => 242, + MessageType::MessageType_BenchmarkRun => 243, + MessageType::MessageType_BenchmarkResult => 244, }; Self::enum_descriptor().value_by_index(index) } @@ -1558,7 +1582,7 @@ pub mod exts { static file_descriptor_proto_data: &'static [u8] = b"\ \n\x0emessages.proto\x12\x12hw.trezor.messages\x1a\x20google/protobuf/de\ - scriptor.proto*\xe2S\n\x0bMessageType\x12(\n\x16MessageType_Initialize\ + scriptor.proto*\x81U\n\x0bMessageType\x12(\n\x16MessageType_Initialize\ \x10\0\x1a\x0c\x80\xa6\x1d\x01\xb0\xb5\x18\x01\x90\xb5\x18\x01\x12\x1e\n\ \x10MessageType_Ping\x10\x01\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12\ %\n\x13MessageType_Success\x10\x02\x1a\x0c\x80\xa6\x1d\x01\xa8\xb5\x18\ @@ -1831,31 +1855,35 @@ static file_descriptor_proto_data: &'static [u8] = b"\ \x07\x1a\x04\x90\xb5\x18\x01\x12$\n\x19MessageType_SolanaAddress\x10\x87\ \x07\x1a\x04\x98\xb5\x18\x01\x12#\n\x18MessageType_SolanaSignTx\x10\x88\ \x07\x1a\x04\x90\xb5\x18\x01\x12(\n\x1dMessageType_SolanaTxSignature\x10\ - \x89\x07\x1a\x04\x98\xb5\x18\x01\x1a\x04\xc8\xf3\x18\x01\"\x04\x08Z\x10\ - \\\"\x04\x08G\x10J\"\x04\x08r\x10z\"\x06\x08\xdb\x01\x10\xdb\x01\"\x06\ - \x08\xe0\x01\x10\xe0\x01\"\x06\x08\xac\x02\x10\xb0\x02\"\x06\x08\xb5\x02\ - \x10\xb8\x02:<\n\x07wire_in\x18\xd2\x86\x03\x20\x01(\x08\x12!.google.pro\ - tobuf.EnumValueOptionsR\x06wireIn:>\n\x08wire_out\x18\xd3\x86\x03\x20\ - \x01(\x08\x12!.google.protobuf.EnumValueOptionsR\x07wireOut:G\n\rwire_de\ - bug_in\x18\xd4\x86\x03\x20\x01(\x08\x12!.google.protobuf.EnumValueOption\ - sR\x0bwireDebugIn:I\n\x0ewire_debug_out\x18\xd5\x86\x03\x20\x01(\x08\x12\ - !.google.protobuf.EnumValueOptionsR\x0cwireDebugOut:@\n\twire_tiny\x18\ - \xd6\x86\x03\x20\x01(\x08\x12!.google.protobuf.EnumValueOptionsR\x08wire\ - Tiny:L\n\x0fwire_bootloader\x18\xd7\x86\x03\x20\x01(\x08\x12!.google.pro\ - tobuf.EnumValueOptionsR\x0ewireBootloader:C\n\x0bwire_no_fsm\x18\xd8\x86\ - \x03\x20\x01(\x08\x12!.google.protobuf.EnumValueOptionsR\twireNoFsm:F\n\ - \x0cbitcoin_only\x18\xe0\xd4\x03\x20\x01(\x08\x12!.google.protobuf.EnumV\ - alueOptionsR\x0bbitcoinOnly:U\n\x17has_bitcoin_only_values\x18\xb9\x8e\ - \x03\x20\x01(\x08\x12\x1c.google.protobuf.EnumOptionsR\x14hasBitcoinOnly\ - Values:T\n\x14experimental_message\x18\xa1\x96\x03\x20\x01(\x08\x12\x1f.\ - google.protobuf.MessageOptionsR\x13experimentalMessage:>\n\twire_type\ - \x18\xa2\x96\x03\x20\x01(\r\x12\x1f.google.protobuf.MessageOptionsR\x08w\ - ireType:F\n\rinternal_only\x18\xa3\x96\x03\x20\x01(\x08\x12\x1f.google.p\ - rotobuf.MessageOptionsR\x0cinternalOnly:N\n\x12experimental_field\x18\ - \x89\x9e\x03\x20\x01(\x08\x12\x1d.google.protobuf.FieldOptionsR\x11exper\ - imentalField:U\n\x17include_in_bitcoin_only\x18\xe0\xd4\x03\x20\x01(\x08\ - \x12\x1c.google.protobuf.FileOptionsR\x14includeInBitcoinOnlyB8\n#com.sa\ - toshilabs.trezor.lib.protobufB\rTrezorMessage\x80\xa6\x1d\x01\ + \x89\x07\x1a\x04\x98\xb5\x18\x01\x12)\n\x1eMessageType_BenchmarkListName\ + s\x10\x8cG\x1a\x04\x80\xa6\x1d\x01\x12%\n\x1aMessageType_BenchmarkNames\ + \x10\x8dG\x1a\x04\x80\xa6\x1d\x01\x12#\n\x18MessageType_BenchmarkRun\x10\ + \x8eG\x1a\x04\x80\xa6\x1d\x01\x12&\n\x1bMessageType_BenchmarkResult\x10\ + \x8fG\x1a\x04\x80\xa6\x1d\x01\x1a\x04\xc8\xf3\x18\x01\"\x04\x08Z\x10\\\"\ + \x04\x08G\x10J\"\x04\x08r\x10z\"\x06\x08\xdb\x01\x10\xdb\x01\"\x06\x08\ + \xe0\x01\x10\xe0\x01\"\x06\x08\xac\x02\x10\xb0\x02\"\x06\x08\xb5\x02\x10\ + \xb8\x02:<\n\x07wire_in\x18\xd2\x86\x03\x20\x01(\x08\x12!.google.protobu\ + f.EnumValueOptionsR\x06wireIn:>\n\x08wire_out\x18\xd3\x86\x03\x20\x01(\ + \x08\x12!.google.protobuf.EnumValueOptionsR\x07wireOut:G\n\rwire_debug_i\ + n\x18\xd4\x86\x03\x20\x01(\x08\x12!.google.protobuf.EnumValueOptionsR\ + \x0bwireDebugIn:I\n\x0ewire_debug_out\x18\xd5\x86\x03\x20\x01(\x08\x12!.\ + google.protobuf.EnumValueOptionsR\x0cwireDebugOut:@\n\twire_tiny\x18\xd6\ + \x86\x03\x20\x01(\x08\x12!.google.protobuf.EnumValueOptionsR\x08wireTiny\ + :L\n\x0fwire_bootloader\x18\xd7\x86\x03\x20\x01(\x08\x12!.google.protobu\ + f.EnumValueOptionsR\x0ewireBootloader:C\n\x0bwire_no_fsm\x18\xd8\x86\x03\ + \x20\x01(\x08\x12!.google.protobuf.EnumValueOptionsR\twireNoFsm:F\n\x0cb\ + itcoin_only\x18\xe0\xd4\x03\x20\x01(\x08\x12!.google.protobuf.EnumValueO\ + ptionsR\x0bbitcoinOnly:U\n\x17has_bitcoin_only_values\x18\xb9\x8e\x03\ + \x20\x01(\x08\x12\x1c.google.protobuf.EnumOptionsR\x14hasBitcoinOnlyValu\ + es:T\n\x14experimental_message\x18\xa1\x96\x03\x20\x01(\x08\x12\x1f.goog\ + le.protobuf.MessageOptionsR\x13experimentalMessage:>\n\twire_type\x18\ + \xa2\x96\x03\x20\x01(\r\x12\x1f.google.protobuf.MessageOptionsR\x08wireT\ + ype:F\n\rinternal_only\x18\xa3\x96\x03\x20\x01(\x08\x12\x1f.google.proto\ + buf.MessageOptionsR\x0cinternalOnly:N\n\x12experimental_field\x18\x89\ + \x9e\x03\x20\x01(\x08\x12\x1d.google.protobuf.FieldOptionsR\x11experimen\ + talField:U\n\x17include_in_bitcoin_only\x18\xe0\xd4\x03\x20\x01(\x08\x12\ + \x1c.google.protobuf.FileOptionsR\x14includeInBitcoinOnlyB8\n#com.satosh\ + ilabs.trezor.lib.protobufB\rTrezorMessage\x80\xa6\x1d\x01\ "; /// `FileDescriptorProto` object which was a source for this generated file diff --git a/rust/trezor-client/src/protos/generated/messages_benchmark.rs b/rust/trezor-client/src/protos/generated/messages_benchmark.rs new file mode 100644 index 0000000000..0ddf065a72 --- /dev/null +++ b/rust/trezor-client/src/protos/generated/messages_benchmark.rs @@ -0,0 +1,662 @@ +// This file is generated by rust-protobuf 3.3.0. Do not edit +// .proto file is parsed by protoc 3.19.6 +// @generated + +// https://github.com/rust-lang/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy::all)] + +#![allow(unused_attributes)] +#![cfg_attr(rustfmt, rustfmt::skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unused_results)] +#![allow(unused_mut)] + +//! Generated file from `messages-benchmark.proto` + +/// Generated files are compatible only with the same version +/// of protobuf runtime. +const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_3_0; + +// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.BenchmarkListNames) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct BenchmarkListNames { + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.BenchmarkListNames.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a BenchmarkListNames { + fn default() -> &'a BenchmarkListNames { + ::default_instance() + } +} + +impl BenchmarkListNames { + pub fn new() -> BenchmarkListNames { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(0); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "BenchmarkListNames", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for BenchmarkListNames { + const NAME: &'static str = "BenchmarkListNames"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> BenchmarkListNames { + BenchmarkListNames::new() + } + + fn clear(&mut self) { + self.special_fields.clear(); + } + + fn default_instance() -> &'static BenchmarkListNames { + static instance: BenchmarkListNames = BenchmarkListNames { + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for BenchmarkListNames { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("BenchmarkListNames").unwrap()).clone() + } +} + +impl ::std::fmt::Display for BenchmarkListNames { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for BenchmarkListNames { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.BenchmarkNames) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct BenchmarkNames { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.BenchmarkNames.names) + pub names: ::std::vec::Vec<::std::string::String>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.BenchmarkNames.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a BenchmarkNames { + fn default() -> &'a BenchmarkNames { + ::default_instance() + } +} + +impl BenchmarkNames { + pub fn new() -> BenchmarkNames { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "names", + |m: &BenchmarkNames| { &m.names }, + |m: &mut BenchmarkNames| { &mut m.names }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "BenchmarkNames", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for BenchmarkNames { + const NAME: &'static str = "BenchmarkNames"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.names.push(is.read_string()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.names { + my_size += ::protobuf::rt::string_size(1, &value); + }; + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.names { + os.write_string(1, &v)?; + }; + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> BenchmarkNames { + BenchmarkNames::new() + } + + fn clear(&mut self) { + self.names.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static BenchmarkNames { + static instance: BenchmarkNames = BenchmarkNames { + names: ::std::vec::Vec::new(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for BenchmarkNames { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("BenchmarkNames").unwrap()).clone() + } +} + +impl ::std::fmt::Display for BenchmarkNames { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for BenchmarkNames { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.BenchmarkRun) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct BenchmarkRun { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.BenchmarkRun.name) + pub name: ::std::option::Option<::std::string::String>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.BenchmarkRun.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a BenchmarkRun { + fn default() -> &'a BenchmarkRun { + ::default_instance() + } +} + +impl BenchmarkRun { + pub fn new() -> BenchmarkRun { + ::std::default::Default::default() + } + + // optional string name = 1; + + pub fn name(&self) -> &str { + match self.name.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_name(&mut self) { + self.name = ::std::option::Option::None; + } + + pub fn has_name(&self) -> bool { + self.name.is_some() + } + + // Param is passed by value, moved + pub fn set_name(&mut self, v: ::std::string::String) { + self.name = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_name(&mut self) -> &mut ::std::string::String { + if self.name.is_none() { + self.name = ::std::option::Option::Some(::std::string::String::new()); + } + self.name.as_mut().unwrap() + } + + // Take field + pub fn take_name(&mut self) -> ::std::string::String { + self.name.take().unwrap_or_else(|| ::std::string::String::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "name", + |m: &BenchmarkRun| { &m.name }, + |m: &mut BenchmarkRun| { &mut m.name }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "BenchmarkRun", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for BenchmarkRun { + const NAME: &'static str = "BenchmarkRun"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.name = ::std::option::Option::Some(is.read_string()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.name.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.name.as_ref() { + os.write_string(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> BenchmarkRun { + BenchmarkRun::new() + } + + fn clear(&mut self) { + self.name = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static BenchmarkRun { + static instance: BenchmarkRun = BenchmarkRun { + name: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for BenchmarkRun { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("BenchmarkRun").unwrap()).clone() + } +} + +impl ::std::fmt::Display for BenchmarkRun { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for BenchmarkRun { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.bitcoin.BenchmarkResult) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct BenchmarkResult { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.BenchmarkResult.value) + pub value: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.BenchmarkResult.unit) + pub unit: ::std::option::Option<::std::string::String>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.BenchmarkResult.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a BenchmarkResult { + fn default() -> &'a BenchmarkResult { + ::default_instance() + } +} + +impl BenchmarkResult { + pub fn new() -> BenchmarkResult { + ::std::default::Default::default() + } + + // optional string value = 1; + + pub fn value(&self) -> &str { + match self.value.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_value(&mut self) { + self.value = ::std::option::Option::None; + } + + pub fn has_value(&self) -> bool { + self.value.is_some() + } + + // Param is passed by value, moved + pub fn set_value(&mut self, v: ::std::string::String) { + self.value = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_value(&mut self) -> &mut ::std::string::String { + if self.value.is_none() { + self.value = ::std::option::Option::Some(::std::string::String::new()); + } + self.value.as_mut().unwrap() + } + + // Take field + pub fn take_value(&mut self) -> ::std::string::String { + self.value.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional string unit = 3; + + pub fn unit(&self) -> &str { + match self.unit.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_unit(&mut self) { + self.unit = ::std::option::Option::None; + } + + pub fn has_unit(&self) -> bool { + self.unit.is_some() + } + + // Param is passed by value, moved + pub fn set_unit(&mut self, v: ::std::string::String) { + self.unit = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_unit(&mut self) -> &mut ::std::string::String { + if self.unit.is_none() { + self.unit = ::std::option::Option::Some(::std::string::String::new()); + } + self.unit.as_mut().unwrap() + } + + // Take field + pub fn take_unit(&mut self) -> ::std::string::String { + self.unit.take().unwrap_or_else(|| ::std::string::String::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "value", + |m: &BenchmarkResult| { &m.value }, + |m: &mut BenchmarkResult| { &mut m.value }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "unit", + |m: &BenchmarkResult| { &m.unit }, + |m: &mut BenchmarkResult| { &mut m.unit }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "BenchmarkResult", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for BenchmarkResult { + const NAME: &'static str = "BenchmarkResult"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.value = ::std::option::Option::Some(is.read_string()?); + }, + 26 => { + self.unit = ::std::option::Option::Some(is.read_string()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.value.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + if let Some(v) = self.unit.as_ref() { + my_size += ::protobuf::rt::string_size(3, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.value.as_ref() { + os.write_string(1, v)?; + } + if let Some(v) = self.unit.as_ref() { + os.write_string(3, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> BenchmarkResult { + BenchmarkResult::new() + } + + fn clear(&mut self) { + self.value = ::std::option::Option::None; + self.unit = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static BenchmarkResult { + static instance: BenchmarkResult = BenchmarkResult { + value: ::std::option::Option::None, + unit: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for BenchmarkResult { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("BenchmarkResult").unwrap()).clone() + } +} + +impl ::std::fmt::Display for BenchmarkResult { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for BenchmarkResult { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +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\ +"; + +/// `FileDescriptorProto` object which was a source for this generated file +fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { + static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); + file_descriptor_proto_lazy.get(|| { + ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() + }) +} + +/// `FileDescriptor` object which allows dynamic access to files +pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { + static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); + 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 messages = ::std::vec::Vec::with_capacity(4); + messages.push(BenchmarkListNames::generated_message_descriptor_data()); + messages.push(BenchmarkNames::generated_message_descriptor_data()); + messages.push(BenchmarkRun::generated_message_descriptor_data()); + messages.push(BenchmarkResult::generated_message_descriptor_data()); + let mut enums = ::std::vec::Vec::with_capacity(0); + ::protobuf::reflect::GeneratedFileDescriptor::new_generated( + file_descriptor_proto(), + deps, + messages, + enums, + ) + }); + ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) + }) +} diff --git a/rust/trezor-client/src/protos/mod.rs b/rust/trezor-client/src/protos/mod.rs index 20bcebe924..651834353c 100644 --- a/rust/trezor-client/src/protos/mod.rs +++ b/rust/trezor-client/src/protos/mod.rs @@ -21,6 +21,7 @@ mod generated { messages_crypto messages_debug messages_management + messages_benchmark "bitcoin" => messages_bitcoin "ethereum" => messages_ethereum