mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-13 17:00:59 +00:00
core/messages: don't generate unused messages
This commit is contained in:
parent
5aa592a69a
commit
bf3c257f96
@ -1,28 +0,0 @@
|
||||
# Automatically generated by pb2py
|
||||
# fmt: off
|
||||
import protobuf as p
|
||||
|
||||
if __debug__:
|
||||
try:
|
||||
from typing import List
|
||||
except ImportError:
|
||||
List = None # type: ignore
|
||||
|
||||
|
||||
class CosiCommit(p.MessageType):
|
||||
MESSAGE_WIRE_TYPE = 71
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
address_n: List[int] = None,
|
||||
data: bytes = None,
|
||||
) -> None:
|
||||
self.address_n = address_n if address_n is not None else []
|
||||
self.data = data
|
||||
|
||||
@classmethod
|
||||
def get_fields(cls):
|
||||
return {
|
||||
1: ('address_n', p.UVarintType, p.FLAG_REPEATED),
|
||||
2: ('data', p.BytesType, 0),
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
# Automatically generated by pb2py
|
||||
# fmt: off
|
||||
import protobuf as p
|
||||
|
||||
|
||||
class CosiCommitment(p.MessageType):
|
||||
MESSAGE_WIRE_TYPE = 72
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
commitment: bytes = None,
|
||||
pubkey: bytes = None,
|
||||
) -> None:
|
||||
self.commitment = commitment
|
||||
self.pubkey = pubkey
|
||||
|
||||
@classmethod
|
||||
def get_fields(cls):
|
||||
return {
|
||||
1: ('commitment', p.BytesType, 0),
|
||||
2: ('pubkey', p.BytesType, 0),
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
# Automatically generated by pb2py
|
||||
# fmt: off
|
||||
import protobuf as p
|
||||
|
||||
if __debug__:
|
||||
try:
|
||||
from typing import List
|
||||
except ImportError:
|
||||
List = None # type: ignore
|
||||
|
||||
|
||||
class CosiSign(p.MessageType):
|
||||
MESSAGE_WIRE_TYPE = 73
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
address_n: List[int] = None,
|
||||
data: bytes = None,
|
||||
global_commitment: bytes = None,
|
||||
global_pubkey: bytes = None,
|
||||
) -> None:
|
||||
self.address_n = address_n if address_n is not None else []
|
||||
self.data = data
|
||||
self.global_commitment = global_commitment
|
||||
self.global_pubkey = global_pubkey
|
||||
|
||||
@classmethod
|
||||
def get_fields(cls):
|
||||
return {
|
||||
1: ('address_n', p.UVarintType, p.FLAG_REPEATED),
|
||||
2: ('data', p.BytesType, 0),
|
||||
3: ('global_commitment', p.BytesType, 0),
|
||||
4: ('global_pubkey', p.BytesType, 0),
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
# Automatically generated by pb2py
|
||||
# fmt: off
|
||||
import protobuf as p
|
||||
|
||||
|
||||
class CosiSignature(p.MessageType):
|
||||
MESSAGE_WIRE_TYPE = 74
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
signature: bytes = None,
|
||||
) -> None:
|
||||
self.signature = signature
|
||||
|
||||
@classmethod
|
||||
def get_fields(cls):
|
||||
return {
|
||||
1: ('signature', p.BytesType, 0),
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
# Automatically generated by pb2py
|
||||
# fmt: off
|
||||
import protobuf as p
|
||||
|
||||
|
||||
class DebugLinkFlashErase(p.MessageType):
|
||||
MESSAGE_WIRE_TYPE = 113
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
sector: int = None,
|
||||
) -> None:
|
||||
self.sector = sector
|
||||
|
||||
@classmethod
|
||||
def get_fields(cls):
|
||||
return {
|
||||
1: ('sector', p.UVarintType, 0),
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
# Automatically generated by pb2py
|
||||
# fmt: off
|
||||
import protobuf as p
|
||||
|
||||
|
||||
class DebugLinkLog(p.MessageType):
|
||||
MESSAGE_WIRE_TYPE = 104
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
level: int = None,
|
||||
bucket: str = None,
|
||||
text: str = None,
|
||||
) -> None:
|
||||
self.level = level
|
||||
self.bucket = bucket
|
||||
self.text = text
|
||||
|
||||
@classmethod
|
||||
def get_fields(cls):
|
||||
return {
|
||||
1: ('level', p.UVarintType, 0),
|
||||
2: ('bucket', p.UnicodeType, 0),
|
||||
3: ('text', p.UnicodeType, 0),
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
# Automatically generated by pb2py
|
||||
# fmt: off
|
||||
import protobuf as p
|
||||
|
||||
|
||||
class DebugLinkMemory(p.MessageType):
|
||||
MESSAGE_WIRE_TYPE = 111
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
memory: bytes = None,
|
||||
) -> None:
|
||||
self.memory = memory
|
||||
|
||||
@classmethod
|
||||
def get_fields(cls):
|
||||
return {
|
||||
1: ('memory', p.BytesType, 0),
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
# Automatically generated by pb2py
|
||||
# fmt: off
|
||||
import protobuf as p
|
||||
|
||||
|
||||
class DebugLinkMemoryRead(p.MessageType):
|
||||
MESSAGE_WIRE_TYPE = 110
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
address: int = None,
|
||||
length: int = None,
|
||||
) -> None:
|
||||
self.address = address
|
||||
self.length = length
|
||||
|
||||
@classmethod
|
||||
def get_fields(cls):
|
||||
return {
|
||||
1: ('address', p.UVarintType, 0),
|
||||
2: ('length', p.UVarintType, 0),
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
# Automatically generated by pb2py
|
||||
# fmt: off
|
||||
import protobuf as p
|
||||
|
||||
|
||||
class DebugLinkMemoryWrite(p.MessageType):
|
||||
MESSAGE_WIRE_TYPE = 112
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
address: int = None,
|
||||
memory: bytes = None,
|
||||
flash: bool = None,
|
||||
) -> None:
|
||||
self.address = address
|
||||
self.memory = memory
|
||||
self.flash = flash
|
||||
|
||||
@classmethod
|
||||
def get_fields(cls):
|
||||
return {
|
||||
1: ('address', p.UVarintType, 0),
|
||||
2: ('memory', p.BytesType, 0),
|
||||
3: ('flash', p.BoolType, 0),
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
# Automatically generated by pb2py
|
||||
# fmt: off
|
||||
import protobuf as p
|
||||
|
||||
|
||||
class DebugLinkStop(p.MessageType):
|
||||
MESSAGE_WIRE_TYPE = 103
|
@ -1,34 +0,0 @@
|
||||
# Automatically generated by pb2py
|
||||
# fmt: off
|
||||
import protobuf as p
|
||||
|
||||
if __debug__:
|
||||
try:
|
||||
from typing import List
|
||||
except ImportError:
|
||||
List = None # type: ignore
|
||||
|
||||
|
||||
class NEMDecryptMessage(p.MessageType):
|
||||
MESSAGE_WIRE_TYPE = 75
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
address_n: List[int] = None,
|
||||
network: int = None,
|
||||
public_key: bytes = None,
|
||||
payload: bytes = None,
|
||||
) -> None:
|
||||
self.address_n = address_n if address_n is not None else []
|
||||
self.network = network
|
||||
self.public_key = public_key
|
||||
self.payload = payload
|
||||
|
||||
@classmethod
|
||||
def get_fields(cls):
|
||||
return {
|
||||
1: ('address_n', p.UVarintType, p.FLAG_REPEATED),
|
||||
2: ('network', p.UVarintType, 0),
|
||||
3: ('public_key', p.BytesType, 0),
|
||||
4: ('payload', p.BytesType, 0),
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
# Automatically generated by pb2py
|
||||
# fmt: off
|
||||
import protobuf as p
|
||||
|
||||
|
||||
class NEMDecryptedMessage(p.MessageType):
|
||||
MESSAGE_WIRE_TYPE = 76
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
payload: bytes = None,
|
||||
) -> None:
|
||||
self.payload = payload
|
||||
|
||||
@classmethod
|
||||
def get_fields(cls):
|
||||
return {
|
||||
1: ('payload', p.BytesType, 0),
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
# Automatically generated by pb2py
|
||||
# fmt: off
|
||||
import protobuf as p
|
||||
|
||||
|
||||
class PinMatrixAck(p.MessageType):
|
||||
MESSAGE_WIRE_TYPE = 19
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
pin: str = None,
|
||||
) -> None:
|
||||
self.pin = pin
|
||||
|
||||
@classmethod
|
||||
def get_fields(cls):
|
||||
return {
|
||||
1: ('pin', p.UnicodeType, 0), # required
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
# Automatically generated by pb2py
|
||||
# fmt: off
|
||||
import protobuf as p
|
||||
|
||||
|
||||
class PinMatrixRequest(p.MessageType):
|
||||
MESSAGE_WIRE_TYPE = 18
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
type: int = None,
|
||||
) -> None:
|
||||
self.type = type
|
||||
|
||||
@classmethod
|
||||
def get_fields(cls):
|
||||
return {
|
||||
1: ('type', p.UVarintType, 0),
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
# Automatically generated by pb2py
|
||||
# fmt: off
|
||||
Current = 1
|
||||
NewFirst = 2
|
||||
NewSecond = 3
|
@ -1,4 +0,0 @@
|
||||
# Automatically generated by pb2py
|
||||
# fmt: off
|
||||
ScrambledWords = 0
|
||||
Matrix = 1
|
@ -1,19 +0,0 @@
|
||||
# Automatically generated by pb2py
|
||||
# fmt: off
|
||||
import protobuf as p
|
||||
|
||||
|
||||
class WordAck(p.MessageType):
|
||||
MESSAGE_WIRE_TYPE = 47
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
word: str = None,
|
||||
) -> None:
|
||||
self.word = word
|
||||
|
||||
@classmethod
|
||||
def get_fields(cls):
|
||||
return {
|
||||
1: ('word', p.UnicodeType, 0), # required
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
# Automatically generated by pb2py
|
||||
# fmt: off
|
||||
import protobuf as p
|
||||
|
||||
|
||||
class WordRequest(p.MessageType):
|
||||
MESSAGE_WIRE_TYPE = 46
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
type: int = None,
|
||||
) -> None:
|
||||
self.type = type
|
||||
|
||||
@classmethod
|
||||
def get_fields(cls):
|
||||
return {
|
||||
1: ('type', p.UVarintType, 0),
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
# Automatically generated by pb2py
|
||||
# fmt: off
|
||||
Plain = 0
|
||||
Matrix9 = 1
|
||||
Matrix6 = 2
|
@ -23,6 +23,30 @@ CORE_PROTOBUF_SOURCES="\
|
||||
|
||||
PYTHON_PROTOBUF_SOURCES=$PROTOB/*.proto
|
||||
|
||||
CORE_MESSAGES_IGNORE="\
|
||||
CosiCommit \
|
||||
CosiCommitment \
|
||||
CosiSign \
|
||||
CosiSignature \
|
||||
DebugLinkFlashErase \
|
||||
DebugLinkLog \
|
||||
DebugLinkMemory \
|
||||
DebugLinkMemoryRead \
|
||||
DebugLinkMemoryWrite \
|
||||
DebugLinkStop \
|
||||
NEMDecryptMessage \
|
||||
NEMDecryptedMessage \
|
||||
PinMatrixAck \
|
||||
PinMatrixRequest \
|
||||
PinMatrixRequestType \
|
||||
RecoveryDeviceType \
|
||||
WordAck \
|
||||
WordRequest \
|
||||
WordRequestType \
|
||||
"
|
||||
|
||||
PYTHON_MESSAGES_IGNORE=""
|
||||
|
||||
RETURN=0
|
||||
|
||||
do_rebuild() {
|
||||
@ -31,12 +55,19 @@ do_rebuild() {
|
||||
shift
|
||||
local SOURCES="$1"
|
||||
shift
|
||||
local IGNORE="$1"
|
||||
shift
|
||||
|
||||
mkdir -p "$DESTDIR"
|
||||
rm -f "$DESTDIR"/[A-Z]*.py
|
||||
|
||||
# note $SOURCES is unquoted - we want wildcard expansion and multiple args
|
||||
$PROTOB/pb2py "$@" -o "$DESTDIR" $SOURCES
|
||||
|
||||
# delete unused messages
|
||||
for F in $IGNORE; do
|
||||
rm -f "$DESTDIR"/"$F".py
|
||||
done
|
||||
}
|
||||
|
||||
do_check() {
|
||||
@ -61,7 +92,7 @@ else
|
||||
func=do_rebuild
|
||||
fi
|
||||
|
||||
$func core/src/trezor/messages "$CORE_PROTOBUF_SOURCES" --no-init-py
|
||||
$func python/trezorlib/messages "$PYTHON_PROTOBUF_SOURCES" -P ..protobuf
|
||||
$func core/src/trezor/messages "$CORE_PROTOBUF_SOURCES" "$CORE_MESSAGES_IGNORE" --no-init-py
|
||||
$func python/trezorlib/messages "$PYTHON_PROTOBUF_SOURCES" "$PYTHON_MESSAGES_IGNORE" -P ..protobuf
|
||||
|
||||
exit $RETURN
|
||||
|
Loading…
Reference in New Issue
Block a user