From ee242ea41667f968f3823afa7981c9702807e809 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Mon, 26 Feb 2018 17:20:28 +0100 Subject: [PATCH] src.trezor.messages: fix and regenerate --- src/trezor/messages/CoinType.py | 3 +++ src/trezor/messages/FailureType.py | 1 + src/trezor/messages/Features.py | 21 +++++++++++++++++ src/trezor/messages/Initialize.py | 5 +++++ src/trezor/messages/MessageType.py | 2 ++ src/trezor/messages/NEMDecryptMessage.py | 26 ++++++++++++++++++++++ src/trezor/messages/NEMDecryptedMessage.py | 17 ++++++++++++++ src/trezor/messages/PassphraseAck.py | 3 +++ src/trezor/messages/PassphraseRequest.py | 5 +++++ src/trezor/messages/SignTx.py | 3 +++ src/trezor/messages/TransactionType.py | 3 +++ src/trezor/messages/TxInputType.py | 6 +++++ src/trezor/messages/TxOutputBinType.py | 3 +++ src/trezor/messages/TxOutputType.py | 3 +++ src/trezor/messages/wire_types.py | 2 ++ tools/build_protobuf | 2 +- vendor/trezor-common | 2 +- 17 files changed, 105 insertions(+), 2 deletions(-) create mode 100644 src/trezor/messages/NEMDecryptMessage.py create mode 100644 src/trezor/messages/NEMDecryptedMessage.py diff --git a/src/trezor/messages/CoinType.py b/src/trezor/messages/CoinType.py index 5ed7fa140c..3da0aaa45e 100644 --- a/src/trezor/messages/CoinType.py +++ b/src/trezor/messages/CoinType.py @@ -14,6 +14,7 @@ class CoinType(p.MessageType): 10: ('xprv_magic', p.UVarintType, 0), # default=76066276 11: ('segwit', p.BoolType, 0), 12: ('forkid', p.UVarintType, 0), + 13: ('force_bip143', p.BoolType, 0), } def __init__( @@ -28,6 +29,7 @@ class CoinType(p.MessageType): xprv_magic: int = None, segwit: bool = None, forkid: int = None, + force_bip143: bool = None, **kwargs, ): self.coin_name = coin_name @@ -40,4 +42,5 @@ class CoinType(p.MessageType): self.xprv_magic = xprv_magic self.segwit = segwit self.forkid = forkid + self.force_bip143 = force_bip143 p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/FailureType.py b/src/trezor/messages/FailureType.py index a785f73292..8d075b41cd 100644 --- a/src/trezor/messages/FailureType.py +++ b/src/trezor/messages/FailureType.py @@ -12,4 +12,5 @@ InvalidSignature = const(8) ProcessError = const(9) NotEnoughFunds = const(10) NotInitialized = const(11) +PinMismatch = const(12) FirmwareError = const(99) diff --git a/src/trezor/messages/Features.py b/src/trezor/messages/Features.py index 598931fd71..2057ca97ae 100644 --- a/src/trezor/messages/Features.py +++ b/src/trezor/messages/Features.py @@ -25,6 +25,13 @@ class Features(p.MessageType): 18: ('firmware_present', p.BoolType, 0), 19: ('needs_backup', p.BoolType, 0), 20: ('flags', p.UVarintType, 0), + 21: ('model', p.UnicodeType, 0), + 22: ('fw_major', p.UVarintType, 0), + 23: ('fw_minor', p.UVarintType, 0), + 24: ('fw_patch', p.UVarintType, 0), + 25: ('fw_vendor', p.UnicodeType, 0), + 26: ('fw_vendor_keys', p.BytesType, 0), + 27: ('state', p.BytesType, 0), } MESSAGE_WIRE_TYPE = 17 @@ -50,6 +57,13 @@ class Features(p.MessageType): firmware_present: bool = None, needs_backup: bool = None, flags: int = None, + model: str = None, + fw_major: int = None, + fw_minor: int = None, + fw_patch: int = None, + fw_vendor: str = None, + fw_vendor_keys: bytes = None, + state: bytes = None, **kwargs, ): self.vendor = vendor @@ -72,4 +86,11 @@ class Features(p.MessageType): self.firmware_present = firmware_present self.needs_backup = needs_backup self.flags = flags + self.model = model + self.fw_major = fw_major + self.fw_minor = fw_minor + self.fw_patch = fw_patch + self.fw_vendor = fw_vendor + self.fw_vendor_keys = fw_vendor_keys + self.state = state p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/Initialize.py b/src/trezor/messages/Initialize.py index 9562713e8e..4a6f51d361 100644 --- a/src/trezor/messages/Initialize.py +++ b/src/trezor/messages/Initialize.py @@ -3,10 +3,15 @@ import protobuf as p class Initialize(p.MessageType): + FIELDS = { + 1: ('state', p.BytesType, 0), + } MESSAGE_WIRE_TYPE = 0 def __init__( self, + state: bytes = None, **kwargs, ): + self.state = state p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/MessageType.py b/src/trezor/messages/MessageType.py index 93c2a0125d..ca870dd54d 100644 --- a/src/trezor/messages/MessageType.py +++ b/src/trezor/messages/MessageType.py @@ -73,6 +73,8 @@ CosiCommit = const(71) CosiCommitment = const(72) CosiSign = const(73) CosiSignature = const(74) +NEMDecryptMessage = const(75) +NEMDecryptedMessage = const(76) DebugLinkDecision = const(100) DebugLinkGetState = const(101) DebugLinkState = const(102) diff --git a/src/trezor/messages/NEMDecryptMessage.py b/src/trezor/messages/NEMDecryptMessage.py new file mode 100644 index 0000000000..9ca8f339c4 --- /dev/null +++ b/src/trezor/messages/NEMDecryptMessage.py @@ -0,0 +1,26 @@ +# Automatically generated by pb2py +import protobuf as p + + +class NEMDecryptMessage(p.MessageType): + FIELDS = { + 1: ('address_n', p.UVarintType, p.FLAG_REPEATED), + 2: ('network', p.UVarintType, 0), + 3: ('public_key', p.BytesType, 0), + 4: ('payload', p.BytesType, 0), + } + MESSAGE_WIRE_TYPE = 75 + + def __init__( + self, + address_n: list = [], + network: int = None, + public_key: bytes = None, + payload: bytes = None, + **kwargs, + ): + self.address_n = address_n + self.network = network + self.public_key = public_key + self.payload = payload + p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/NEMDecryptedMessage.py b/src/trezor/messages/NEMDecryptedMessage.py new file mode 100644 index 0000000000..02cccb71f6 --- /dev/null +++ b/src/trezor/messages/NEMDecryptedMessage.py @@ -0,0 +1,17 @@ +# Automatically generated by pb2py +import protobuf as p + + +class NEMDecryptedMessage(p.MessageType): + FIELDS = { + 1: ('payload', p.BytesType, 0), + } + MESSAGE_WIRE_TYPE = 76 + + def __init__( + self, + payload: bytes = None, + **kwargs, + ): + self.payload = payload + p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/PassphraseAck.py b/src/trezor/messages/PassphraseAck.py index d8adf5f20c..13ae498177 100644 --- a/src/trezor/messages/PassphraseAck.py +++ b/src/trezor/messages/PassphraseAck.py @@ -5,13 +5,16 @@ import protobuf as p class PassphraseAck(p.MessageType): FIELDS = { 1: ('passphrase', p.UnicodeType, 0), # required + 2: ('state', p.BytesType, 0), } MESSAGE_WIRE_TYPE = 42 def __init__( self, passphrase: str = None, + state: bytes = None, **kwargs, ): self.passphrase = passphrase + self.state = state p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/PassphraseRequest.py b/src/trezor/messages/PassphraseRequest.py index 7e89a4676a..18823de783 100644 --- a/src/trezor/messages/PassphraseRequest.py +++ b/src/trezor/messages/PassphraseRequest.py @@ -3,10 +3,15 @@ import protobuf as p class PassphraseRequest(p.MessageType): + FIELDS = { + 1: ('on_device', p.BoolType, 0), + } MESSAGE_WIRE_TYPE = 41 def __init__( self, + on_device: bool = None, **kwargs, ): + self.on_device = on_device p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/SignTx.py b/src/trezor/messages/SignTx.py index 3ef8609efb..fc2425b302 100644 --- a/src/trezor/messages/SignTx.py +++ b/src/trezor/messages/SignTx.py @@ -9,6 +9,7 @@ class SignTx(p.MessageType): 3: ('coin_name', p.UnicodeType, 0), # default='Bitcoin' 4: ('version', p.UVarintType, 0), # default=1 5: ('lock_time', p.UVarintType, 0), # default=0 + 6: ('decred_expiry', p.UVarintType, 0), } MESSAGE_WIRE_TYPE = 15 @@ -19,6 +20,7 @@ class SignTx(p.MessageType): coin_name: str = None, version: int = None, lock_time: int = None, + decred_expiry: int = None, **kwargs, ): self.outputs_count = outputs_count @@ -26,4 +28,5 @@ class SignTx(p.MessageType): self.coin_name = coin_name self.version = version self.lock_time = lock_time + self.decred_expiry = decred_expiry p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/TransactionType.py b/src/trezor/messages/TransactionType.py index 2a9f398cbf..655c42cf4f 100644 --- a/src/trezor/messages/TransactionType.py +++ b/src/trezor/messages/TransactionType.py @@ -16,6 +16,7 @@ class TransactionType(p.MessageType): 7: ('outputs_cnt', p.UVarintType, 0), 8: ('extra_data', p.BytesType, 0), 9: ('extra_data_len', p.UVarintType, 0), + 10: ('decred_expiry', p.UVarintType, 0), } def __init__( @@ -29,6 +30,7 @@ class TransactionType(p.MessageType): outputs_cnt: int = None, extra_data: bytes = None, extra_data_len: int = None, + decred_expiry: int = None, **kwargs, ): self.version = version @@ -40,4 +42,5 @@ class TransactionType(p.MessageType): self.outputs_cnt = outputs_cnt self.extra_data = extra_data self.extra_data_len = extra_data_len + self.decred_expiry = decred_expiry p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/TxInputType.py b/src/trezor/messages/TxInputType.py index f5a0333cb3..4dae303d0f 100644 --- a/src/trezor/messages/TxInputType.py +++ b/src/trezor/messages/TxInputType.py @@ -13,6 +13,8 @@ class TxInputType(p.MessageType): 6: ('script_type', p.UVarintType, 0), # default=0 7: ('multisig', MultisigRedeemScriptType, 0), 8: ('amount', p.UVarintType, 0), + 9: ('decred_tree', p.UVarintType, 0), + 10: ('decred_script_version', p.UVarintType, 0), } def __init__( @@ -25,6 +27,8 @@ class TxInputType(p.MessageType): script_type: int = None, multisig: MultisigRedeemScriptType = None, amount: int = None, + decred_tree: int = None, + decred_script_version: int = None, **kwargs, ): self.address_n = address_n @@ -35,4 +39,6 @@ class TxInputType(p.MessageType): self.script_type = script_type self.multisig = multisig self.amount = amount + self.decred_tree = decred_tree + self.decred_script_version = decred_script_version p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/TxOutputBinType.py b/src/trezor/messages/TxOutputBinType.py index 4dd3cddcc9..427fbdd7f8 100644 --- a/src/trezor/messages/TxOutputBinType.py +++ b/src/trezor/messages/TxOutputBinType.py @@ -6,14 +6,17 @@ class TxOutputBinType(p.MessageType): FIELDS = { 1: ('amount', p.UVarintType, 0), # required 2: ('script_pubkey', p.BytesType, 0), # required + 3: ('decred_script_version', p.UVarintType, 0), } def __init__( self, amount: int = None, script_pubkey: bytes = None, + decred_script_version: int = None, **kwargs, ): self.amount = amount self.script_pubkey = script_pubkey + self.decred_script_version = decred_script_version p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/TxOutputType.py b/src/trezor/messages/TxOutputType.py index 837b98ca96..f8e03a1f06 100644 --- a/src/trezor/messages/TxOutputType.py +++ b/src/trezor/messages/TxOutputType.py @@ -11,6 +11,7 @@ class TxOutputType(p.MessageType): 4: ('script_type', p.UVarintType, 0), # required 5: ('multisig', MultisigRedeemScriptType, 0), 6: ('op_return_data', p.BytesType, 0), + 7: ('decred_script_version', p.UVarintType, 0), } def __init__( @@ -21,6 +22,7 @@ class TxOutputType(p.MessageType): script_type: int = None, multisig: MultisigRedeemScriptType = None, op_return_data: bytes = None, + decred_script_version: int = None, **kwargs, ): self.address = address @@ -29,4 +31,5 @@ class TxOutputType(p.MessageType): self.script_type = script_type self.multisig = multisig self.op_return_data = op_return_data + self.decred_script_version = decred_script_version p.MessageType.__init__(self, **kwargs) diff --git a/src/trezor/messages/wire_types.py b/src/trezor/messages/wire_types.py index ceec1509b9..11ae6e11d9 100644 --- a/src/trezor/messages/wire_types.py +++ b/src/trezor/messages/wire_types.py @@ -56,6 +56,8 @@ Initialize = const(0) LoadDevice = const(13) MessageSignature = const(40) NEMAddress = const(68) +NEMDecryptMessage = const(75) +NEMDecryptedMessage = const(76) NEMGetAddress = const(67) NEMSignTx = const(69) NEMSignedTx = const(70) diff --git a/tools/build_protobuf b/tools/build_protobuf index 9d0cd60309..12087d1e39 100755 --- a/tools/build_protobuf +++ b/tools/build_protobuf @@ -23,7 +23,7 @@ for i in types messages ; do done # hack to make output python 3 compatible -sed -i '' 's/^import types_pb2/from . import types_pb2/g' $CURDIR/pb2/messages_pb2.py +sed -i 's/^import types_pb2/from . import types_pb2/g' $CURDIR/pb2/messages_pb2.py for i in types messages ; do # Convert google protobuf library to trezor's internal format diff --git a/vendor/trezor-common b/vendor/trezor-common index b9f2a1c27f..e5db98205a 160000 --- a/vendor/trezor-common +++ b/vendor/trezor-common @@ -1 +1 @@ -Subproject commit b9f2a1c27fc16f4a33934ef0816a05c834416436 +Subproject commit e5db98205a10404aa38ef8a50cdf8f14e3638795