From 2f03ace311584988d5aeab58fd1acf24ef54711a Mon Sep 17 00:00:00 2001 From: Andrew Kozlik Date: Wed, 2 Nov 2022 12:05:42 +0100 Subject: [PATCH] chore(common): Rename "unstable" protobuf tag to "experimental_message". [no changelog] (cherry picked from commit 3d645d609a3f20bd88b8c44e969b9e4489c496d0) --- common/protob/messages-bitcoin.proto | 6 +++--- common/protob/messages-management.proto | 4 ++-- common/protob/messages.proto | 4 ++-- common/protob/pb2py | 4 ++-- core/src/trezor/wire/__init__.py | 2 +- python/src/trezorlib/protobuf.py | 1 - 6 files changed, 10 insertions(+), 11 deletions(-) diff --git a/common/protob/messages-bitcoin.proto b/common/protob/messages-bitcoin.proto index 0a9503d75..772fec186 100644 --- a/common/protob/messages-bitcoin.proto +++ b/common/protob/messages-bitcoin.proto @@ -343,7 +343,7 @@ message TxAck { // optional uint32 block_height_bip115 = 9; // BIP-115 support dropped optional bytes orig_hash = 10; // tx_hash of the original transaction where this output was present (used when creating a replacement transaction) optional uint32 orig_index = 11; // index of the output in the original transaction (used when creating a replacement transaction) - optional uint32 payment_req_index = 12 [(experimental)=true]; // index of the PaymentRequest containing this output + optional uint32 payment_req_index = 12 [(experimental_field)=true]; // index of the PaymentRequest containing this output } } } @@ -388,7 +388,7 @@ message TxOutput { reserved 7, 8, 9; // fields which are in use, or have been in the past, in TxOutputType optional bytes orig_hash = 10; // tx_hash of the original transaction where this output was present (used when creating a replacement transaction) optional uint32 orig_index = 11; // index of the output in the original transaction (used when creating a replacement transaction) - optional uint32 payment_req_index = 12 [(experimental)=true]; // index of the PaymentRequest containing this output + optional uint32 payment_req_index = 12 [(experimental_field)=true]; // index of the PaymentRequest containing this output } /** Data type for metadata about previous transaction which contains the UTXO being spent. @@ -438,7 +438,7 @@ message PrevOutput { * @next TxRequest */ message TxAckPaymentRequest { - option (unstable) = true; + option (experimental_message) = true; optional bytes nonce = 1; // the nonce used in the signature computation required string recipient_name = 2; // merchant's name diff --git a/common/protob/messages-management.proto b/common/protob/messages-management.proto index adde7b885..eb732fc6d 100644 --- a/common/protob/messages-management.proto +++ b/common/protob/messages-management.proto @@ -456,7 +456,7 @@ message RebootToBootloader { * @next Nonce */ message GetNonce { - option (unstable) = true; + option (experimental_message) = true; } /** @@ -464,7 +464,7 @@ message GetNonce { * @end */ message Nonce { - option (unstable) = true; + option (experimental_message) = true; required bytes nonce = 1; // a 32-byte random value generated by Trezor } diff --git a/common/protob/messages.proto b/common/protob/messages.proto index 00c19eaaa..c0ea0ff75 100644 --- a/common/protob/messages.proto +++ b/common/protob/messages.proto @@ -54,13 +54,13 @@ extend google.protobuf.EnumOptions { /** Options for tagging message types */ extend google.protobuf.MessageOptions { - optional bool unstable = 52001; // indicate that a message is experimental, intended for development and beta testing only and its definition may change at any time + optional bool experimental_message = 52001; // indicate that a message is intended for development and beta testing only and its definition may change at any time optional uint32 wire_type = 52002; // override wire type specified in the MessageType enum } /** Options for tagging field types */ extend google.protobuf.FieldOptions { - optional bool experimental = 53001; // indicate that a field is intended for development and beta testing only + optional bool experimental_field = 53001; // indicate that a field is intended for development and beta testing only } /** Options for tagging files with protobuf definitions */ diff --git a/common/protob/pb2py b/common/protob/pb2py index cf5280bfd..28b6ae037 100755 --- a/common/protob/pb2py +++ b/common/protob/pb2py @@ -164,7 +164,7 @@ class ProtoField: @property def experimental(self): - return bool(self.extensions.get("experimental")) + return bool(self.extensions.get("experimental_field")) @property def is_message(self): @@ -573,7 +573,7 @@ class RustBlobRenderer: raise ValueError("Unsupported wire type") flags_and_wire_type = wire_type - if message.extensions.get("unstable"): + if message.extensions.get("experimental_message"): flags_and_wire_type |= 0x8000 return flags_and_wire_type diff --git a/core/src/trezor/wire/__init__.py b/core/src/trezor/wire/__init__.py index 5d53e0bef..d38f9087a 100644 --- a/core/src/trezor/wire/__init__.py +++ b/core/src/trezor/wire/__init__.py @@ -87,7 +87,7 @@ if TYPE_CHECKING: ... -# If set to False protobuf messages marked with "unstable" option are rejected. +# If set to False protobuf messages marked with "experimental_message" option are rejected. experimental_enabled = False diff --git a/python/src/trezorlib/protobuf.py b/python/src/trezorlib/protobuf.py index 05cc40b01..101bfccfe 100644 --- a/python/src/trezorlib/protobuf.py +++ b/python/src/trezorlib/protobuf.py @@ -188,7 +188,6 @@ class _MessageTypeMeta(type): class MessageType(metaclass=_MessageTypeMeta): MESSAGE_WIRE_TYPE: Optional[int] = None - UNSTABLE: bool = False FIELDS: Dict[int, Field] = {}