1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-22 15:38:11 +00:00

protob: more meta info in monero messages

This commit is contained in:
Pavol Rusnak 2018-07-22 20:56:41 +02:00
parent a5e6dff3ff
commit 9fa3a7a399
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
2 changed files with 36 additions and 14 deletions

View File

@ -7,6 +7,8 @@ from graphviz import Digraph
class Message(object): class Message(object):
def __init__(self, name, attrs): def __init__(self, name, attrs):
self.name = name self.name = name
if len(attrs) == 0:
raise ValueError("message '%s' has no attributes" % name)
t = attrs[0][0] t = attrs[0][0]
if t in ["start", "end", "auxstart", "auxend", "embed", "ignore"]: if t in ["start", "end", "auxstart", "auxend", "embed", "ignore"]:
self.typ = t self.typ = t
@ -14,12 +16,18 @@ class Message(object):
elif t == "next": elif t == "next":
self.typ = "normal" self.typ = "normal"
attrs = attrs attrs = attrs
elif t == "wrap":
self.typ = "normal"
attrs = attrs
else: else:
raise ValueError("wrong message type in message '%s'" % m.name) raise ValueError("wrong message type in message '%s'" % name)
self.next = [] self.next = []
self.wrap = []
for a in attrs: for a in attrs:
if a[0] == "next": if a[0] == "next":
self.next.append(a[1]) self.next.append(a[1])
elif a[0] == "wrap":
self.wrap.append(a[1])
def generate_messages(files): def generate_messages(files):
@ -55,6 +63,8 @@ def generate_graph(msgs, fn):
for m in msgs.values(): for m in msgs.values():
for n in m.next: for n in m.next:
dot.edge(m.name, n) dot.edge(m.name, n)
for n in m.wrap:
dot.edge(m.name, n)
dot.render(fn) dot.render(fn)

View File

@ -94,6 +94,7 @@ message MoneroTransactionInitRequest {
/** /**
* Response: Response to transaction signing initialization. * Response: Response to transaction signing initialization.
* @next MoneroTransactionSignRequest
*/ */
message MoneroTransactionInitAck { message MoneroTransactionInitAck {
optional uint32 version = 1; optional uint32 version = 1;
@ -115,6 +116,7 @@ message MoneroTransactionSetInputRequest {
/** /**
* Response: Response to setting UTXO for signature. Contains sealed values needed for further protocol steps. * Response: Response to setting UTXO for signature. Contains sealed values needed for further protocol steps.
* @next MoneroTransactionSignRequest
*/ */
message MoneroTransactionSetInputAck { message MoneroTransactionSetInputAck {
optional bytes vini = 1; // xmrtypes.TxinToKey optional bytes vini = 1; // xmrtypes.TxinToKey
@ -135,6 +137,7 @@ message MoneroTransactionInputsPermutationRequest {
/** /**
* Response: Response to setting permutation on key images * Response: Response to setting permutation on key images
* @next MoneroTransactionSignRequest
*/ */
message MoneroTransactionInputsPermutationAck { message MoneroTransactionInputsPermutationAck {
} }
@ -153,6 +156,7 @@ message MoneroTransactionInputViniRequest {
/** /**
* Response: Response to setting UTXO to the device * Response: Response to setting UTXO to the device
* @next MoneroTransactionSignRequest
*/ */
message MoneroTransactionInputViniAck { message MoneroTransactionInputViniAck {
} }
@ -168,6 +172,7 @@ message MoneroTransactionSetOutputRequest {
/** /**
* Response: Response to setting transaction destination. Contains sealed values needed for further protocol steps. * Response: Response to setting transaction destination. Contains sealed values needed for further protocol steps.
* @next MoneroTransactionSignRequest
*/ */
message MoneroTransactionSetOutputAck { message MoneroTransactionSetOutputAck {
optional bytes tx_out = 1; // xmrtypes.TxOut optional bytes tx_out = 1; // xmrtypes.TxOut
@ -186,6 +191,7 @@ message MoneroTransactionAllOutSetRequest {
/** /**
* Response: After all outputs are sent the initial RCT signature fields are sent. * Response: After all outputs are sent the initial RCT signature fields are sent.
* @next MoneroTransactionSignRequest
*/ */
message MoneroTransactionAllOutSetAck { message MoneroTransactionAllOutSetAck {
optional bytes extra = 1; optional bytes extra = 1;
@ -210,6 +216,7 @@ message MoneroTransactionMlsagDoneRequest {
/** /**
* Response: Contains full message hash needed for the signature * Response: Contains full message hash needed for the signature
* @next MoneroTransactionSignRequest
*/ */
message MoneroTransactionMlsagDoneAck { message MoneroTransactionMlsagDoneAck {
optional bytes full_message_hash = 1; optional bytes full_message_hash = 1;
@ -231,6 +238,7 @@ message MoneroTransactionSignInputRequest {
/** /**
* Response: Contains full MG signature of the UTXO + multisig data if applicable. * Response: Contains full MG signature of the UTXO + multisig data if applicable.
* @next MoneroTransactionSignRequest
*/ */
message MoneroTransactionSignInputAck { message MoneroTransactionSignInputAck {
optional bytes signature = 1; optional bytes signature = 1;
@ -257,15 +265,15 @@ message MoneroTransactionFinalAck {
/** /**
* Request: Wrapping request for transaction signature protocol. * Request: Wrapping request for transaction signature protocol.
* @next MoneroTransactionInitAck * @wrap MoneroTransactionInitRequest
* @next MoneroTransactionSetInputAck * @wrap MoneroTransactionSetInputRequest
* @next MoneroTransactionInputsPermutationAck * @wrap MoneroTransactionInputsPermutationRequest
* @next MoneroTransactionInputViniAck * @wrap MoneroTransactionInputViniRequest
* @next MoneroTransactionSetOutputAck * @wrap MoneroTransactionSetOutputRequest
* @next MoneroTransactionAllOutSetAck * @wrap MoneroTransactionAllOutSetRequest
* @next MoneroTransactionMlsagDoneAck * @wrap MoneroTransactionMlsagDoneRequest
* @next MoneroTransactionSignInputAck * @wrap MoneroTransactionSignInputRequest
* @next MoneroTransactionFinalAck * @wrap MoneroTransactionFinalRequest
*/ */
message MoneroTransactionSignRequest { message MoneroTransactionSignRequest {
optional MoneroTransactionInitRequest init = 1; optional MoneroTransactionInitRequest init = 1;
@ -281,6 +289,7 @@ message MoneroTransactionSignRequest {
/** /**
* Request: Sub request of MoneroKeyImageSync. Initializing key image sync. * Request: Sub request of MoneroKeyImageSync. Initializing key image sync.
* @start
* @next MoneroKeyImageExportInitAck * @next MoneroKeyImageExportInitAck
*/ */
message MoneroKeyImageExportInitRequest { message MoneroKeyImageExportInitRequest {
@ -300,9 +309,9 @@ message MoneroKeyImageExportInitRequest {
/** /**
* Response: Response to key image sync initialization. * Response: Response to key image sync initialization.
* @next MoneroKeyImageSyncRequest
*/ */
message MoneroKeyImageExportInitAck { message MoneroKeyImageExportInitAck {
} }
/** /**
@ -324,6 +333,7 @@ message MoneroKeyImageSyncStepRequest {
/** /**
* Response: Response to key image sync step. Contains encrypted exported key image. * Response: Response to key image sync step. Contains encrypted exported key image.
* @next MoneroKeyImageSyncRequest
*/ */
message MoneroKeyImageSyncStepAck { message MoneroKeyImageSyncStepAck {
repeated MoneroExportedKeyImage kis = 1; repeated MoneroExportedKeyImage kis = 1;
@ -346,6 +356,7 @@ message MoneroKeyImageSyncFinalRequest {
/** /**
* Response: Response to key image sync step. Contains encryption keys for exported key images. * Response: Response to key image sync step. Contains encryption keys for exported key images.
* @end
*/ */
message MoneroKeyImageSyncFinalAck { message MoneroKeyImageSyncFinalAck {
optional bytes enc_key = 1; optional bytes enc_key = 1;
@ -353,9 +364,9 @@ message MoneroKeyImageSyncFinalAck {
/** /**
* Request: Wrapping request for key image sync protocol. * Request: Wrapping request for key image sync protocol.
* @next MoneroKeyImageExportInitAck * @wrap MoneroKeyImageExportInitRequest
* @next MoneroKeyImageSyncStepAck * @wrap MoneroKeyImageSyncStepRequest
* @next MoneroKeyImageSyncFinalAck * @wrap MoneroKeyImageSyncFinalRequest
*/ */
message MoneroKeyImageSyncRequest { message MoneroKeyImageSyncRequest {
optional MoneroKeyImageExportInitRequest init = 1; optional MoneroKeyImageExportInitRequest init = 1;
@ -365,6 +376,7 @@ message MoneroKeyImageSyncRequest {
/** /**
* Request: Universal Monero protocol implementation diagnosis request. * Request: Universal Monero protocol implementation diagnosis request.
* @start
* @next DebugMoneroDiagAck * @next DebugMoneroDiagAck
*/ */
message DebugMoneroDiagRequest { message DebugMoneroDiagRequest {