1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-21 23:18:13 +00:00

src.trezor.messages: fix and regenerate

This commit is contained in:
Pavol Rusnak 2018-02-26 17:20:28 +01:00
parent ab9a82e95a
commit ee242ea416
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
17 changed files with 105 additions and 2 deletions

View File

@ -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)

View File

@ -12,4 +12,5 @@ InvalidSignature = const(8)
ProcessError = const(9)
NotEnoughFunds = const(10)
NotInitialized = const(11)
PinMismatch = const(12)
FirmwareError = const(99)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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

@ -1 +1 @@
Subproject commit b9f2a1c27fc16f4a33934ef0816a05c834416436
Subproject commit e5db98205a10404aa38ef8a50cdf8f14e3638795