diff --git a/.travis.yml b/.travis.yml index 2c2dbd9002..ab1b58f1b4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,6 +25,7 @@ script: - jsonlint defs/*/*.json - python tools/cointool.py check - python tools/support.py check --ignore-missing + - cd protob && python check.py - python protob/graph.py protob/*.proto notifications: diff --git a/protob/check.py b/protob/check.py new file mode 100755 index 0000000000..95ed433f95 --- /dev/null +++ b/protob/check.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python3 +from glob import glob +import sys + +error = False + +for fn in sorted(glob("messages-*.proto")): + with open(fn, "rt") as f: + prefix = fn.split(".")[0][9:].capitalize() + if prefix in ["Bitcoin", "Bootloader", "Common", "Crypto", "Management"]: + continue + if prefix == "Nem": + prefix = "NEM" + for line in f: + line = line.strip().split(" ") + if line[0] not in ["enum", "message"]: + continue + if not line[1].startswith(prefix) and not line[1].startswith("Debug" + prefix): + print("ERROR:", fn, line[1]) + error = True + +if error: + sys.exit(1) diff --git a/protob/messages-binance.proto b/protob/messages-binance.proto index 7afa466a5f..95c04a383a 100644 --- a/protob/messages-binance.proto +++ b/protob/messages-binance.proto @@ -76,17 +76,17 @@ message BinanceTxRequest { * @next Failure */ message BinanceTransferMsg { - repeated InputOutput inputs = 1; - repeated InputOutput outputs = 2; + repeated BinanceInputOutput inputs = 1; + repeated BinanceInputOutput outputs = 2; - message Coin { - optional sint64 amount = 1; - optional string denom = 2; + message BinanceInputOutput { + optional string address = 1; + repeated BinanceCoin coins = 2; } - message InputOutput { - optional string address = 1; - repeated Coin coins = 2; + message BinanceCoin { + optional sint64 amount = 1; + optional string denom = 2; } } @@ -98,28 +98,28 @@ message BinanceTransferMsg { */ message BinanceOrderMsg { optional string id = 1; - optional OrderType ordertype = 2; + optional BinanceOrderType ordertype = 2; optional sint64 price = 3; optional sint64 quantity = 4; optional string sender = 5; - optional OrderSide side = 6; + optional BinanceOrderSide side = 6; optional string symbol = 7; - optional TimeInForce timeinforce = 8; + optional BinanceTimeInForce timeinforce = 8; - enum OrderType { + enum BinanceOrderType { OT_UNKNOWN = 0; MARKET = 1; LIMIT = 2; OT_RESERVED = 3; } - enum OrderSide { + enum BinanceOrderSide { SIDE_UNKNOWN = 0; BUY = 1; SELL = 2; } - enum TimeInForce { + enum BinanceTimeInForce { TIF_UNKNOWN = 0; GTE = 1; TIF_RESERVED = 2;