From 6bd5345021a5d24bdd56f2ac74bd2b622ff3e147 Mon Sep 17 00:00:00 2001 From: matejcik Date: Mon, 29 Apr 2019 18:04:19 +0200 Subject: [PATCH 01/13] common/tools: allow tokens to collide with nontokens if explicitly supported in support.json This reverts commit 7cf22c5227e6911cee49bbbbeab1df27062fa59f. --- common/defs/duplicity_overrides.json | 5 +-- common/defs/support.json | 4 +- common/tools/coin_info.py | 27 ++++++------ common/tools/cointool.py | 66 ++++++++++++++++++---------- common/tools/support.py | 15 +------ 5 files changed, 60 insertions(+), 57 deletions(-) diff --git a/common/defs/duplicity_overrides.json b/common/defs/duplicity_overrides.json index b5e0a11620..7832becea6 100644 --- a/common/defs/duplicity_overrides.json +++ b/common/defs/duplicity_overrides.json @@ -4,8 +4,5 @@ "erc20:eth:LINK Platform": true, "erc20:eth:NXX": false, "erc20:eth:Hdp": true, - "erc20:eth:Hdp.ф": true, - "erc20:eth:USDT": false, - "erc20:eth:BNB": false, - "erc20:eth:QTUM": false + "erc20:eth:Hdp.ф": true } diff --git a/common/defs/support.json b/common/defs/support.json index 65de9178b5..917d9e9fc3 100644 --- a/common/defs/support.json +++ b/common/defs/support.json @@ -289,6 +289,7 @@ "erc20:eth:BRD": "1.6.2", "erc20:eth:BRLN": "1.8.0", "erc20:eth:BSDC": "1.6.2", + "erc20:eth:BST": "1.6.2", "erc20:eth:BTCA": "1.8.0", "erc20:eth:BTCE": "1.6.2", "erc20:eth:BTCL": "1.6.2", @@ -1285,7 +1286,6 @@ "erc20:eth:BNC:ef51": "(AUTO) duplicate key", "erc20:eth:BOX:63f5": "(AUTO) duplicate key", "erc20:eth:BOX:e1a1": "(AUTO) duplicate key", - "erc20:eth:BST": "(AUTO) duplicate key", "erc20:eth:BTL (Battle)": "(AUTO) duplicate key", "erc20:eth:BTL (Bitlle)": "(AUTO) duplicate key", "erc20:eth:BTR:499a": "(AUTO) duplicate key", @@ -1637,6 +1637,7 @@ "erc20:eth:BRD": "2.0.7", "erc20:eth:BRLN": "2.0.10", "erc20:eth:BSDC": "2.0.7", + "erc20:eth:BST": "2.0.7", "erc20:eth:BTCA": "2.0.10", "erc20:eth:BTCE": "2.0.7", "erc20:eth:BTCL": "2.0.7", @@ -2636,7 +2637,6 @@ "erc20:eth:BNC:ef51": "(AUTO) duplicate key", "erc20:eth:BOX:63f5": "(AUTO) duplicate key", "erc20:eth:BOX:e1a1": "(AUTO) duplicate key", - "erc20:eth:BST": "(AUTO) duplicate key", "erc20:eth:BTL (Battle)": "(AUTO) duplicate key", "erc20:eth:BTL (Bitlle)": "(AUTO) duplicate key", "erc20:eth:BTR:499a": "(AUTO) duplicate key", diff --git a/common/tools/coin_info.py b/common/tools/coin_info.py index df0880ebf9..4103256ead 100755 --- a/common/tools/coin_info.py +++ b/common/tools/coin_info.py @@ -304,17 +304,19 @@ def support_info_single(support_data, coin): key = coin["key"] dup = coin.get("duplicate") for device, values in support_data.items(): - if dup and is_token(coin): - support_value = False - elif key in values["unsupported"]: + if key in values["unsupported"]: support_value = False elif key in values["supported"]: support_value = values["supported"][key] elif device in MISSING_SUPPORT_MEANS_NO: support_value = False elif is_token(coin): - # tokens are implicitly supported in next release - support_value = "soon" + if dup: + # if duplicate token that is not explicitly listed, it's unsupported + support_value = False + else: + # otherwise implicitly supported in next + support_value = "soon" else: support_value = None support_info[device] = support_value @@ -409,7 +411,7 @@ def deduplicate_erc20(buckets, networks): This function works on results of `mark_duplicate_shortcuts`. Buckets that contain at least one non-token are ignored - symbol collisions - with non-tokens are always fatal. + with non-tokens always apply. Otherwise the following rules are applied: @@ -502,8 +504,6 @@ def collect_coin_info(): `erc20` for ERC20 tokens, `nem` for NEM mosaics, `misc` for other networks. - - Automatically removes duplicate symbols from the result. """ all_coins = CoinsInfo( bitcoin=_load_btc_coins(), @@ -548,13 +548,14 @@ def coin_info_with_duplicates(): def coin_info(): - """Collects coin info, marks and prunes duplicate ERC20 symbols, fills out support - info and returns the result. + """Collects coin info, fills out support info and returns the result. + + Does not auto-delete duplicates. This should now be based on support info. """ all_coins, _ = coin_info_with_duplicates() - all_coins["erc20"] = [ - coin for coin in all_coins["erc20"] if not coin.get("duplicate") - ] + # all_coins["erc20"] = [ + # coin for coin in all_coins["erc20"] if not coin.get("duplicate") + # ] return all_coins diff --git a/common/tools/cointool.py b/common/tools/cointool.py index 706d1bf724..fb60c2eb79 100755 --- a/common/tools/cointool.py +++ b/common/tools/cointool.py @@ -145,6 +145,13 @@ def render_file(src, dst, coins, support_info): # ====== validation functions ====== +def mark_unsupported(support_info, coins): + for coin in coins: + key = coin["key"] + # checking for explicit False because None means unknown + coin["unsupported"] = all(v is False for v in support_info[key].values()) + + def highlight_key(coin, color): """Return a colorful string where the SYMBOL part is bold.""" keylist = coin["key"].split(":") @@ -193,7 +200,6 @@ def check_eth(coins): def check_btc(coins): check_passed = True - support_infos = coin_info.support_info(coins) # validate individual coin data for coin in coins: @@ -213,7 +219,7 @@ def check_btc(coins): color = "green" elif name == "Bitcoin": color = "red" - elif coin.get("unsupported"): + elif coin["unsupported"]: color = "grey" prefix = crayon("blue", "(X)", bold=True) else: @@ -239,15 +245,9 @@ def check_btc(coins): and not c["name"].endswith("Regtest") ] - have_bitcoin = False - for coin in mainnets: - if coin["name"] == "Bitcoin": - have_bitcoin = True - if all(v is False for k, v in support_infos[coin["key"]].items()): - coin["unsupported"] = True - - supported_mainnets = [c for c in mainnets if not c.get("unsupported")] - supported_networks = [c for c in bucket if not c.get("unsupported")] + have_bitcoin = any(coin["name"] == "Bitcoin" for coin in mainnets) + supported_mainnets = [c for c in mainnets if not c["unsupported"]] + supported_networks = [c for c in bucket if not c["unsupported"]] if len(mainnets) > 1: if (have_bitcoin or strict) and len(supported_networks) > 1: @@ -290,7 +290,7 @@ def check_btc(coins): return check_passed -def check_dups(buckets, print_at_level=logging.ERROR): +def check_dups(buckets, print_at_level=logging.WARNING): """Analyze and pretty-print results of `coin_info.mark_duplicate_shortcuts`. `print_at_level` can be one of logging levels. @@ -305,15 +305,19 @@ def check_dups(buckets, print_at_level=logging.ERROR): """Colorize coins. Tokens are cyan, nontokens are red. Coins that are NOT marked duplicate get a green asterisk. """ - if coin_info.is_token(coin): + prefix = "" + if coin["unsupported"]: + color = "grey" + prefix = crayon("blue", "(X)", bold=True) + elif coin_info.is_token(coin): color = "cyan" else: color = "red" - highlighted = highlight_key(coin, color) + if not coin.get("duplicate"): - prefix = crayon("green", "*", bold=True) - else: - prefix = "" + prefix = crayon("green", "*", bold=True) + prefix + + highlighted = highlight_key(coin, color) return "{}{}".format(prefix, highlighted) check_passed = True @@ -323,17 +327,29 @@ def check_dups(buckets, print_at_level=logging.ERROR): if not bucket: continue + supported = [coin for coin in bucket if not coin["unsupported"]] nontokens = [coin for coin in bucket if not coin_info.is_token(coin)] + cleared = not any(coin.get("duplicate") for coin in bucket) # string generation dup_str = ", ".join(coin_str(coin) for coin in bucket) - if not nontokens: - level = logging.DEBUG - elif len(nontokens) == 1: - level = logging.INFO - else: + if len(nontokens) > 1: + # Two or more colliding nontokens. This is always fatal. + # XXX consider allowing two nontokens as long as only one is supported? level = logging.ERROR check_passed = False + elif len(supported) > 1: + # more than one supported coin in bucket + if cleared: + # some previous step has explicitly marked them as non-duplicate + level = logging.INFO + else: + # at most 1 non-token - we tenatively allow token collisions + # when explicitly marked as supported + level = logging.WARNING + else: + # At most 1 supported coin, at most 1 non-token. This is informational only. + level = logging.DEBUG # deciding whether to print if level < print_at_level: @@ -342,7 +358,7 @@ def check_dups(buckets, print_at_level=logging.ERROR): if symbol == "_override": print_log(level, "force-set duplicates:", dup_str) else: - print_log(level, "duplicate symbol {}:".format(symbol), dup_str) + print_log(level, "duplicate symbol {}:".format(symbol.upper()), dup_str) return check_passed @@ -571,6 +587,8 @@ def check(backend, icons, show_duplicates): raise click.ClickException("Missing requirements for icon check") defs, buckets = coin_info.coin_info_with_duplicates() + support_info = coin_info.support_info(defs) + mark_unsupported(support_info, defs.as_list()) all_checks_passed = True print("Checking BTC-like coins...") @@ -586,7 +604,7 @@ def check(backend, icons, show_duplicates): elif show_duplicates == "nontoken": dup_level = logging.INFO else: - dup_level = logging.ERROR + dup_level = logging.WARNING print("Checking unexpected duplicates...") if not check_dups(buckets, dup_level): all_checks_passed = False diff --git a/common/tools/support.py b/common/tools/support.py index 57bf24d2b6..56c8d770ac 100755 --- a/common/tools/support.py +++ b/common/tools/support.py @@ -72,11 +72,7 @@ def print_support(coin): key, name, shortcut = coin["key"], coin["name"], coin["shortcut"] print(f"{key} - {name} ({shortcut})") if coin.get("duplicate"): - if coin_info.is_token(coin): - print(" * DUPLICATE SYMBOL (no support)") - return - else: - print(" * DUPLICATE SYMBOL") + print(" * DUPLICATE SYMBOL") for dev, where in SUPPORT_INFO.items(): missing_means_no = dev in coin_info.MISSING_SUPPORT_MEANS_NO print(" *", dev, ":", support_value(where, key, missing_means_no)) @@ -131,8 +127,6 @@ def find_unsupported_coins(coins_dict): result[device] = [] for key, coin in coins_dict.items(): - if coin.get("duplicate") and coin_info.is_token(coin): - continue if key not in support_set: result[device].append(coin) @@ -466,12 +460,6 @@ def set_support_value(key, entries, reason): (or null, in case of trezor1/2) Setting variable to empty ("trezor1=") will set to null, or clear the entry. Setting to "soon", "planned", "2.1.1" etc. will set the literal string. - - Entries that are always present: - trezor1 trezor2 webwallet connect - - Entries with other names will be inserted into "others". This is a good place - to store links to 3rd party software, such as Electrum forks or claim tools. """ defs, _ = coin_info.coin_info_with_duplicates() coins = defs.as_dict() @@ -483,7 +471,6 @@ def set_support_value(key, entries, reason): if coins[key].get("duplicate") and coin_info.is_token(coins[key]): shortcut = coins[key]["shortcut"] click.echo(f"Note: shortcut {shortcut} is a duplicate.") - click.echo(f"Coin will NOT be listed regardless of support.json status.") for entry in entries: try: From 4b407a9ac1d11e2b076dfffb954015ef92fd5813 Mon Sep 17 00:00:00 2001 From: matejcik Date: Mon, 29 Apr 2019 18:49:06 +0200 Subject: [PATCH 02/13] common/tools: fix code that only worked by accident --- common/tools/support.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/tools/support.py b/common/tools/support.py index 56c8d770ac..d22c953e1b 100755 --- a/common/tools/support.py +++ b/common/tools/support.py @@ -82,7 +82,7 @@ def print_support(coin): def check_support_values(): - def _check_value_version_soon(val): + def _check_value_version_soon(value): if not isinstance(value, str): raise ValueError(f"non-str value: {value}") From 8ddeff7598ff9c815155f54816d65aaba540193c Mon Sep 17 00:00:00 2001 From: matejcik Date: Mon, 29 Apr 2019 19:08:11 +0200 Subject: [PATCH 03/13] common/tools: do not auto-set duplicate for coin/token combination Also update some auto-set dups to manually-set dups. Leaving TRC token enabled because bitcoin:TRC is unsupported. --- common/defs/support.json | 22 ++++++++++------------ common/tools/support.py | 16 ++++++++++++++-- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/common/defs/support.json b/common/defs/support.json index 917d9e9fc3..944ef899cb 100644 --- a/common/defs/support.json +++ b/common/defs/support.json @@ -1277,7 +1277,7 @@ "erc20:eth:A18:bde8": "(AUTO) duplicate key", "erc20:eth:ATH": "(AUTO) duplicate key", "erc20:eth:ATH (AIgatha Token)": "(AUTO) duplicate key", - "erc20:eth:ATS": "(AUTO) duplicate key", + "erc20:eth:ATS": "duplicate key with eth:ATS", "erc20:eth:BCAP:1f41": "(AUTO) duplicate key", "erc20:eth:BCAP:ff35": "(AUTO) duplicate key", "erc20:eth:BKB:5c39": "(AUTO) duplicate key", @@ -1305,7 +1305,7 @@ "erc20:eth:COIN:eb54": "(AUTO) duplicate key", "erc20:eth:COSS:6529": "(AUTO) duplicate key", "erc20:eth:COSS:9e96": "(AUTO) duplicate key", - "erc20:eth:CPC": "(AUTO) duplicate key", + "erc20:eth:CPC": "duplicate key with bitcoin:CPC", "erc20:eth:CPT:88d5": "(AUTO) duplicate key", "erc20:eth:CPT:9b62": "(AUTO) duplicate key", "erc20:eth:DEPO": "(AUTO) duplicate key", @@ -1332,7 +1332,7 @@ "erc20:eth:FANX:7f67": "(AUTO) duplicate key", "erc20:eth:FLMC:04cc": "(AUTO) duplicate key", "erc20:eth:FLMC:5976": "(AUTO) duplicate key", - "erc20:eth:FTC": "(AUTO) duplicate key", + "erc20:eth:FTC": "duplicate key with bitcoin:FTC", "erc20:eth:FUCK:65be": "(AUTO) duplicate key", "erc20:eth:FUCK:ab16": "(AUTO) duplicate key", "erc20:eth:FXC:4a57": "(AUTO) duplicate key", @@ -1386,7 +1386,7 @@ "erc20:eth:PRPS:7641": "(AUTO) duplicate key", "erc20:eth:PRPS:d94f": "(AUTO) duplicate key", "erc20:eth:PRPS:e40c": "(AUTO) duplicate key", - "erc20:eth:PTC": "(AUTO) duplicate key", + "erc20:eth:PTC": "duplicate key with bitcoin:PTC", "erc20:eth:RCT:13f2": "(AUTO) duplicate key", "erc20:eth:RCT:2a3a": "(AUTO) duplicate key", "erc20:eth:RING:86e5": "(AUTO) duplicate key", @@ -1396,7 +1396,7 @@ "erc20:eth:SKRP:324a": "(AUTO) duplicate key", "erc20:eth:SKRP:6e34": "(AUTO) duplicate key", "erc20:eth:SKRP:fdfe": "(AUTO) duplicate key", - "erc20:eth:SMART": "(AUTO) duplicate key", + "erc20:eth:SMART": "duplicate key with bitcoin:SMART", "erc20:eth:SMT:2dcf": "(AUTO) duplicate key", "erc20:eth:SMT:55f9": "(AUTO) duplicate key", "erc20:eth:SMT:78eb": "(AUTO) duplicate key", @@ -1408,7 +1408,6 @@ "erc20:eth:TIC:7243": "(AUTO) duplicate key", "erc20:eth:TICO:7f4b": "(AUTO) duplicate key", "erc20:eth:TICO:a5db": "(AUTO) duplicate key", - "erc20:eth:TRC": "(AUTO) duplicate key", "erc20:eth:TRX": "switched to custom network", "erc20:eth:UMKA:105d": "(AUTO) duplicate key", "erc20:eth:UMKA:8e5a": "(AUTO) duplicate key", @@ -2628,7 +2627,7 @@ "erc20:eth:A18:bde8": "(AUTO) duplicate key", "erc20:eth:ATH": "(AUTO) duplicate key", "erc20:eth:ATH (AIgatha Token)": "(AUTO) duplicate key", - "erc20:eth:ATS": "(AUTO) duplicate key", + "erc20:eth:ATS": "duplicate key with eth:ATS", "erc20:eth:BCAP:1f41": "(AUTO) duplicate key", "erc20:eth:BCAP:ff35": "(AUTO) duplicate key", "erc20:eth:BKB:5c39": "(AUTO) duplicate key", @@ -2656,7 +2655,7 @@ "erc20:eth:COIN:eb54": "(AUTO) duplicate key", "erc20:eth:COSS:6529": "(AUTO) duplicate key", "erc20:eth:COSS:9e96": "(AUTO) duplicate key", - "erc20:eth:CPC": "(AUTO) duplicate key", + "erc20:eth:CPC": "duplicate key with bitcoin:CPC", "erc20:eth:CPT:88d5": "(AUTO) duplicate key", "erc20:eth:CPT:9b62": "(AUTO) duplicate key", "erc20:eth:DEPO": "(AUTO) duplicate key", @@ -2683,7 +2682,7 @@ "erc20:eth:FANX:7f67": "(AUTO) duplicate key", "erc20:eth:FLMC:04cc": "(AUTO) duplicate key", "erc20:eth:FLMC:5976": "(AUTO) duplicate key", - "erc20:eth:FTC": "(AUTO) duplicate key", + "erc20:eth:FTC": "duplicate key with bitcoin:FTC", "erc20:eth:FUCK:65be": "(AUTO) duplicate key", "erc20:eth:FUCK:ab16": "(AUTO) duplicate key", "erc20:eth:FXC:4a57": "(AUTO) duplicate key", @@ -2737,7 +2736,7 @@ "erc20:eth:PRPS:7641": "(AUTO) duplicate key", "erc20:eth:PRPS:d94f": "(AUTO) duplicate key", "erc20:eth:PRPS:e40c": "(AUTO) duplicate key", - "erc20:eth:PTC": "(AUTO) duplicate key", + "erc20:eth:PTC": "duplicate key with bitcoin:PTC", "erc20:eth:RCT:13f2": "(AUTO) duplicate key", "erc20:eth:RCT:2a3a": "(AUTO) duplicate key", "erc20:eth:RING:86e5": "(AUTO) duplicate key", @@ -2747,7 +2746,7 @@ "erc20:eth:SKRP:324a": "(AUTO) duplicate key", "erc20:eth:SKRP:6e34": "(AUTO) duplicate key", "erc20:eth:SKRP:fdfe": "(AUTO) duplicate key", - "erc20:eth:SMART": "(AUTO) duplicate key", + "erc20:eth:SMART": "duplicate key with bitcoin:SMART", "erc20:eth:SMT:2dcf": "(AUTO) duplicate key", "erc20:eth:SMT:55f9": "(AUTO) duplicate key", "erc20:eth:SMT:78eb": "(AUTO) duplicate key", @@ -2759,7 +2758,6 @@ "erc20:eth:TIC:7243": "(AUTO) duplicate key", "erc20:eth:TICO:7f4b": "(AUTO) duplicate key", "erc20:eth:TICO:a5db": "(AUTO) duplicate key", - "erc20:eth:TRC": "(AUTO) duplicate key", "erc20:eth:TRX": "switched to custom network", "erc20:eth:UMKA:105d": "(AUTO) duplicate key", "erc20:eth:UMKA:8e5a": "(AUTO) duplicate key", diff --git a/common/tools/support.py b/common/tools/support.py index d22c953e1b..8cc7d2447b 100755 --- a/common/tools/support.py +++ b/common/tools/support.py @@ -195,6 +195,16 @@ def process_erc20(coins_dict): clear_support(device, key) +def clear_erc20_mixed_buckets(buckets): + for bucket in buckets.values(): + tokens = [coin for coin in bucket if coin_info.is_token(coin)] + if tokens == bucket: + continue + + if len(tokens) == 1: + tokens[0]["duplicate"] = False + + @click.group() def cli(): pass @@ -207,7 +217,8 @@ def fix(dry_run): Prunes orphaned keys and ensures that ERC20 duplicate info matches support info. """ - all_coins, _ = coin_info.coin_info_with_duplicates() + all_coins, buckets = coin_info.coin_info_with_duplicates() + clear_erc20_mixed_buckets(buckets) coins_dict = all_coins.as_dict() orphaned = find_orphaned_support_keys(coins_dict) @@ -240,7 +251,8 @@ def check(check_tokens, ignore_missing): support info, but will not fail when missing coins are found. This is useful in Travis. """ - all_coins, _ = coin_info.coin_info_with_duplicates() + all_coins, buckets = coin_info.coin_info_with_duplicates() + clear_erc20_mixed_buckets(buckets) coins_dict = all_coins.as_dict() checks_ok = True From a6bd24dfc9bab83d58e197462dcf6960ee96fcdc Mon Sep 17 00:00:00 2001 From: matejcik Date: Mon, 29 Apr 2019 19:11:44 +0200 Subject: [PATCH 04/13] fix link in readme --- README-monorepo.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README-monorepo.md b/README-monorepo.md index d091096b18..df3aedc59d 100644 --- a/README-monorepo.md +++ b/README-monorepo.md @@ -5,9 +5,9 @@ Monorepo notes Generating ---------- -Use the [create-monorepo] script to regenerate from current master(s). +Use the [create_monorepo] script to regenerate from current master(s). -[create-monorepo]: create-monorepo.py +[create_monorepo]: create_monorepo.py Structure From 0fc275a835a806645d075b0dbcbc9ba284479767 Mon Sep 17 00:00:00 2001 From: matejcik Date: Mon, 29 Apr 2019 19:22:07 +0200 Subject: [PATCH 05/13] core: make templates after token handling change --- core/src/apps/ethereum/tokens.py | 1 + 1 file changed, 1 insertion(+) diff --git a/core/src/apps/ethereum/tokens.py b/core/src/apps/ethereum/tokens.py index 1d9ed2e86c..96df77aa19 100644 --- a/core/src/apps/ethereum/tokens.py +++ b/core/src/apps/ethereum/tokens.py @@ -159,6 +159,7 @@ tokens = [ (1, b"\x80\x04\x63\x05\xaa\xab\x08\xf6\x03\x3b\x56\xa3\x60\xc1\x84\x39\x11\x65\xdc\x2d", "BRLN", 18), # eth / Berlin Coin (1, b"\xb2\x2c\x27\x86\xa5\x49\xb0\x08\x51\x7b\x67\x62\x5f\x52\x96\xe8\xfa\xf9\x58\x9e", "BRP", 18), # eth / Rental Processor Token (1, b"\xf2\x6e\xf5\xe0\x54\x53\x84\xb7\xdc\xc0\xf2\x97\xf2\x67\x41\x89\x58\x68\x30\xdf", "BSDC", 18), # eth / BSDC + (1, b"\x50\x9a\x38\xb7\xa1\xcc\x0d\xcd\x83\xaa\x9d\x06\x21\x46\x63\xd9\xec\x7c\x7f\x4a", "BST", 18), # eth / BlocksquareToken (1, b"\x02\x72\x58\x36\xeb\xf3\xec\xdb\x1c\xdf\x1c\x7b\x02\xfc\xbb\xfa\xa2\x73\x6a\xf8", "BTCA", 8), # eth / BitAir (1, b"\x08\x86\x94\x9c\x1b\x8c\x41\x28\x60\xc4\x26\x4c\xeb\x80\x83\xd1\x36\x5e\x86\xcf", "BTCE", 8), # eth / EthereumBitcoin (1, b"\x5a\xcd\x19\xb9\xc9\x1e\x59\x6b\x1f\x06\x2f\x18\xe3\xd0\x2d\xa7\xed\x8d\x1e\x50", "BTCL", 8), # eth / BTC Lite From 467299339344d42cfc39254f351d3abcdd0ea67f Mon Sep 17 00:00:00 2001 From: Sotiris Blad Date: Tue, 30 Apr 2019 13:34:17 +0300 Subject: [PATCH 06/13] common/defs: update MUE vals (#120) --- common/defs/bitcoin/monetaryunit.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/defs/bitcoin/monetaryunit.json b/common/defs/bitcoin/monetaryunit.json index d9be035c4c..4242b4f36a 100644 --- a/common/defs/bitcoin/monetaryunit.json +++ b/common/defs/bitcoin/monetaryunit.json @@ -3,7 +3,7 @@ "coin_shortcut": "MUE", "coin_label": "MonetaryUnit", "website": "https://www.monetaryunit.org", - "github": "https://github.com/muecoin/MUECore", + "github": "https://github.com/muecoin/MUE", "maintainer": "Sotiris Blad ", "curve_name": "secp256k1", "address_type": 16, @@ -11,7 +11,7 @@ "maxfee_kb": 100000, "minfee_kb": 1000, "signed_message_header": "MonetaryUnit Signed Message:\n", - "hash_genesis_block": "000002acd994a815401fbaae0e52404b32857efd0b7b0c77b8e0715ccdd6d437", + "hash_genesis_block": "0b58ed450b3819ca54ab0054c4d220ca4f887d21c9e55d2a333173adf76d987f", "xprv_magic": 76066276, "xpub_magic": 76067358, "xpub_magic_segwit_p2sh": null, From 4b8c418dbc8365136167d3457b807ef59a998570 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Tue, 30 Apr 2019 13:13:57 +0200 Subject: [PATCH 07/13] core: fix docker build --- Pipfile.lock | 10 +++++----- ci/Dockerfile | 2 +- core/build-docker.sh | 3 ++- shell.nix | 2 ++ 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Pipfile.lock b/Pipfile.lock index 9f9cf4f756..46feef5f66 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -247,9 +247,9 @@ }, "inform": { "hashes": [ - "sha256:15814162c32cb245395234767dc6996e13f32623dbaffd94c22af2eab57644b3" + "sha256:9fa86429435552ecba03eeae34fb2864049b16ad59ac888cb125e49f9ad36632" ], - "version": "==1.15.0" + "version": "==1.16.0" }, "isort": { "hashes": [ @@ -381,10 +381,10 @@ }, "pbr": { "hashes": [ - "sha256:8257baf496c8522437e8a6cfe0f15e00aedc6c0e0e7c9d55eeeeab31e0853843", - "sha256:8c361cc353d988e4f5b998555c88098b9d5964c2e11acf7b0d21925a66bb5824" + "sha256:6901995b9b686cb90cceba67a0f6d4d14ae003cd59bc12beb61549bdfbe3bc89", + "sha256:d950c64aeea5456bbd147468382a5bb77fe692c13c9f00f0219814ce5b642755" ], - "version": "==5.1.3" + "version": "==5.2.0" }, "pep8": { "hashes": [ diff --git a/ci/Dockerfile b/ci/Dockerfile index f0fe5966c1..20d453a8c5 100644 --- a/ci/Dockerfile +++ b/ci/Dockerfile @@ -9,7 +9,7 @@ ENV TOOLCHAIN_FLAVOR=$TOOLCHAIN_FLAVOR RUN apt-get update && apt-get install -y \ build-essential wget git libsodium-dev graphviz \ - valgrind check libssl-dev libusb-1.0-0-dev libudev-dev + valgrind check libssl-dev libusb-1.0-0-dev libudev-dev zlib1g-dev # TODO are all apt packages actually needed? diff --git a/core/build-docker.sh b/core/build-docker.sh index 52843e93e1..82b9a73170 100755 --- a/core/build-docker.sh +++ b/core/build-docker.sh @@ -34,4 +34,5 @@ docker run -t -v $(pwd):/local -v $(pwd)/build/core:/build:z --user="$USER:$GROU ln -s /build build && git checkout $TAG && \ git submodule update --init --recursive && \ - PRODUCTION=$PRODUCTION make clean vendor build_boardloader build_bootloader build_firmware" + pipenv install && \ + PRODUCTION=$PRODUCTION pipenv run make clean vendor build_boardloader build_bootloader build_firmware" diff --git a/shell.nix b/shell.nix index 00d9ae5ba0..efbcd3ddd6 100644 --- a/shell.nix +++ b/shell.nix @@ -30,10 +30,12 @@ in gnumake graphviz openssl + pipenv pkgconfig protobuf python2Packages.demjson scons valgrind + zlib ]; } From 0a8995bc86d614296fe0a882e54e870e4369b130 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Tue, 30 Apr 2019 18:22:49 +0200 Subject: [PATCH 08/13] legacy: update firmware changelog --- legacy/firmware/ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/legacy/firmware/ChangeLog b/legacy/firmware/ChangeLog index 6d7ed6be24..9ddd497afd 100644 --- a/legacy/firmware/ChangeLog +++ b/legacy/firmware/ChangeLog @@ -1,4 +1,4 @@ -Version 1.8.1 [unreleased] +Version 1.8.1 [May 2019] * Fix fault when using the device with no PIN * Fix OMNI transactions parsing From 14b2cc336add6f146afcfd71391fcd5762cb9b25 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Tue, 30 Apr 2019 23:31:07 +0200 Subject: [PATCH 09/13] legacy: initialize decoded variable --- legacy/firmware/stellar.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/legacy/firmware/stellar.c b/legacy/firmware/stellar.c index d4f46e4e84..8993cfbd3f 100644 --- a/legacy/firmware/stellar.c +++ b/legacy/firmware/stellar.c @@ -1352,6 +1352,7 @@ size_t stellar_publicAddressAsStr(const uint8_t *bytes, char *out, bool stellar_validateAddress(const char *str_address) { bool valid = false; uint8_t decoded[STELLAR_ADDRESS_SIZE_RAW]; + memzero(decoded, sizeof(decoded)); if (strlen(str_address) != STELLAR_ADDRESS_SIZE) { return false; @@ -1384,6 +1385,7 @@ bool stellar_validateAddress(const char *str_address) { */ bool stellar_getAddressBytes(const char *str_address, uint8_t *out_bytes) { uint8_t decoded[STELLAR_ADDRESS_SIZE_RAW]; + memzero(decoded, sizeof(decoded)); // Ensure address is valid if (!stellar_validateAddress(str_address)) return false; From b865ee76564704db19a78018e0e92fe91c36cb95 Mon Sep 17 00:00:00 2001 From: ilmango <43717671+ilmango-doge@users.noreply.github.com> Date: Wed, 1 May 2019 18:33:19 +0900 Subject: [PATCH 10/13] common/defs: Add Bellcoin (#124) --- common/defs/bitcoin/bellcoin.json | 42 ++++++++++++++++++++++++++++++ common/defs/bitcoin/bellcoin.png | Bin 0 -> 5755 bytes 2 files changed, 42 insertions(+) create mode 100644 common/defs/bitcoin/bellcoin.json create mode 100644 common/defs/bitcoin/bellcoin.png diff --git a/common/defs/bitcoin/bellcoin.json b/common/defs/bitcoin/bellcoin.json new file mode 100644 index 0000000000..2b04245f08 --- /dev/null +++ b/common/defs/bitcoin/bellcoin.json @@ -0,0 +1,42 @@ +{ + "coin_name": "Bellcoin", + "coin_shortcut": "BELL", + "coin_label": "Bellcoin", + "website": "https://bellcoin.web4u.jp", + "github": "https://github.com/bellcoin-org/bellcoin", + "maintainer": "ilmango-doge ", + "curve_name": "secp256k1", + "address_type": 25, + "address_type_p2sh": 85, + "maxfee_kb": 1000000, + "minfee_kb": 1000, + "signed_message_header": "Bellcoin Signed Message:\n", + "hash_genesis_block": "000008f3b6bd10c2d03b06674a006b8d9731f6cb58179ef1eee008cee2209603", + "xprv_magic": 76066276, + "xpub_magic": 76067358, + "xpub_magic_segwit_p2sh": 77429938, + "xpub_magic_segwit_native": 78792518, + "bech32_prefix": "bm", + "cashaddr_prefix": null, + "slip44": 25252, + "segwit": true, + "decred": false, + "fork_id": null, + "force_bip143": false, + "bip115": false, + "default_fee_b": { + "Normal": 20 + }, + "dust_limit": 546, + "blocktime_seconds": 60, + "uri_prefix": "bellcoin", + "min_address_length": 27, + "max_address_length": 34, + "bitcore": [], + "blockbook": [ + "https://bellcoin-blockbook.ilmango.work", + "https://bell.blockbook.ovh" + ], + "cooldown": 100, + "consensus_branch_id": null +} diff --git a/common/defs/bitcoin/bellcoin.png b/common/defs/bitcoin/bellcoin.png new file mode 100644 index 0000000000000000000000000000000000000000..4caf5cd6ca47812de1ad94f1f53b0de3446f2544 GIT binary patch literal 5755 zcmZ`-WmFX0)8AckX_gj{4(TqbrCGWJX_3yAE(ryckVcS>MHUc{?iLAYTtaFU6cCW5 zQDXo5e0)E==bn4#+?adjo;x$YnMpJ@)FvmnM*;u<$aQrzOmW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D>hQ?0vzBMobWT zwcUh1gJ<5fDO;Q>-*Nju$RT>0@mFFK|4b?Ox~!no0Sz+Re(^w)yL=ZuJRXr?HZDtZb&_@i)$g zuRzmyZ0hffS|2e~^4J>c{f-oPvorxqq8SxE9y$i&{DBT4sqKPaNy*@hTxx;NtA`UD z_HVrTX2C6b^2bkUJycd^<`<7Wtt-9v2h*!|&edrD@K}mSmYg0G{mNR|9f;zg2U178 z#E1(5o?pCQ*f>Yg_R_#9~uFIh0F(;3rL=4j1eKlDjTSI$abTwhfm8@drli#!bLyPcwGs|w(r zdV6GgwF%sK$#mu#(vw)B!tp9j8BJ~O>ulppsR1uo^d{wKg?{_Sh0EREDIsDP*E5`#1Cr-x|!X+~d4tUO5%D`_ns+XxjvU~0nBcwEW5tW1I=A<$1( zxv75JATF?0oO^Ly$IB}YZg3oji|ui_#>sMp`px!=$&X`183!=J4I^{S;GuGOAAKeavO~2QAB?5Cc^pB#QJ(J4tQ`p~X;a zx2zrdx8bpRa&AVdnL@<5L3*GNUms>X;Yy|YAfdt zAa5+?59rn7PTF|T?_J3bMw+JCIG8WPNqTIp>Da#$J0ZSbTZ))h+gD*pO0#wD4$#zo zVn<@SudQtG99nAv;lccDXR(rSY#VR**d* z1xq50NfS?)J2!6GP3TAS%jjFO=E?TynXkQjA)F>#>LlYez%L2hzKn*QN{1g`E9mWT zZR0l`jy)-UOe;5iL5{qsNTrdfO4@Us$n~D)wDb1H&RAN{ueH19;k)u*KWo!A?khUV zY%X!qPHUdhyiXlr!spS?97GRY`PlbYzRJy6HsH~&>P{G1k3acH?PA!!sK)M5kWH!V zS|aBU5${ZpeVIgihf^KHJP^!6`&O zo{~2R1rWV|(E zD9p*sFZu78xjC9cVC~0gqt9sxNP{>V Date: Wed, 1 May 2019 13:39:44 +0200 Subject: [PATCH 11/13] core: re-enable frozen modules in the emulator build --- core/Makefile | 3 +++ core/SConscript.firmware | 32 ++++++++++++------------ core/SConscript.unix | 45 ++++++++++++++++++++++++++-------- core/embed/unix/mpconfigport.h | 2 +- tools/help.awk | 2 +- 5 files changed, 57 insertions(+), 27 deletions(-) diff --git a/core/Makefile b/core/Makefile index c684a6eb3a..08b1722875 100644 --- a/core/Makefile +++ b/core/Makefile @@ -108,6 +108,9 @@ build_unix: res ## build unix port build_unix_noui: res ## build unix port without UI support $(SCONS) CFLAGS="$(CFLAGS)" $(UNIX_BUILD_DIR)/micropython $(UNIX_PORT_OPTS) TREZOR_EMULATOR_NOUI=1 +build_unix_noui_frozen: res build_cross ## build unix port without UI support with frozen modules + $(SCONS) CFLAGS="$(CFLAGS)" $(UNIX_BUILD_DIR)/micropython $(UNIX_PORT_OPTS) TREZOR_EMULATOR_NOUI=1 TREZOR_FROZEN=1 + build_unix_raspi: res ## build unix port for Raspberry Pi $(SCONS) CFLAGS="$(CFLAGS)" $(UNIX_BUILD_DIR)/micropython $(UNIX_PORT_OPTS) TREZOR_EMULATOR_RASPI=1 diff --git a/core/SConscript.firmware b/core/SConscript.firmware index 9b98064510..2771a82d71 100644 --- a/core/SConscript.firmware +++ b/core/SConscript.firmware @@ -411,24 +411,25 @@ env.Ignore(qstr_collected, qstr_generated) # Frozen modules # -if env.get('TREZOR_MODEL') == '1': - SOURCE_PY_DIR = 'src1/' -else: - SOURCE_PY_DIR = 'src/' +if True: + if env.get('TREZOR_MODEL') == '1': + SOURCE_PY_DIR = 'src1/' + else: + SOURCE_PY_DIR = 'src/' -# TODO: recursive Glob -SOURCE_PY = Glob(SOURCE_PY_DIR + '*.py') -SOURCE_PY.extend(Glob(SOURCE_PY_DIR + '*/*.py')) -SOURCE_PY.extend(Glob(SOURCE_PY_DIR + '*/*/*.py')) -SOURCE_PY.extend(Glob(SOURCE_PY_DIR + '*/*/*/*.py')) -SOURCE_PY.extend(Glob(SOURCE_PY_DIR + '*/*/*/*/*.py')) + # TODO: recursive Glob + SOURCE_PY = Glob(SOURCE_PY_DIR + '*.py') + SOURCE_PY.extend(Glob(SOURCE_PY_DIR + '*/*.py')) + SOURCE_PY.extend(Glob(SOURCE_PY_DIR + '*/*/*.py')) + SOURCE_PY.extend(Glob(SOURCE_PY_DIR + '*/*/*/*.py')) + SOURCE_PY.extend(Glob(SOURCE_PY_DIR + '*/*/*/*/*.py')) -source_mpy = env.FrozenModule(source=SOURCE_PY, source_dir=SOURCE_PY_DIR) + source_mpy = env.FrozenModule(source=SOURCE_PY, source_dir=SOURCE_PY_DIR) -source_mpyc = env.FrozenCFile( - target='frozen_mpy.c', source=source_mpy, qstr_header=qstr_preprocessed) + source_mpyc = env.FrozenCFile( + target='frozen_mpy.c', source=source_mpy, qstr_header=qstr_preprocessed) -env.Depends(source_mpyc, qstr_generated) + env.Depends(source_mpyc, qstr_generated) # # static secp256-zkp ecmult context @@ -463,7 +464,8 @@ obj_program.extend(env.Object(source=SOURCE_MICROPYTHON)) obj_program.extend(env.Object(source=SOURCE_MICROPYTHON_SPEED, COPT='-O3')) obj_program.extend(env.Object(source=SOURCE_STMHAL)) obj_program.extend(env.Object(source=SOURCE_TREZORHAL)) -obj_program.extend(env.Object(source=source_mpyc)) +if True: + obj_program.extend(env.Object(source=source_mpyc)) VENDORHEADER = 'embed/vendorheader/vendorheader_' + ('unsafe_signed_prod.bin' if ARGUMENTS.get('PRODUCTION', '0') == '0' else 'satoshilabs_signed_prod.bin') diff --git a/core/SConscript.unix b/core/SConscript.unix index b5f53d0c5d..af305ba53e 100644 --- a/core/SConscript.unix +++ b/core/SConscript.unix @@ -5,9 +5,8 @@ import os CCFLAGS_MOD = '' CPPPATH_MOD = [] CPPDEFINES_MOD = [] -SOURCE_MOD_SECP256K1_ZKP = [] SOURCE_MOD = [] -LIBS_MOD = [] +SOURCE_MOD_SECP256K1_ZKP = [] # modtrezorconfig CPPPATH_MOD += [ @@ -73,6 +72,7 @@ SOURCE_MOD += [ 'vendor/trezor-crypto/hasher.c', 'vendor/trezor-crypto/hmac.c', 'vendor/trezor-crypto/memzero.c', + 'vendor/trezor-crypto/nem.c', 'vendor/trezor-crypto/nist256p1.c', 'vendor/trezor-crypto/pbkdf2.c', 'vendor/trezor-crypto/rand.c', @@ -80,12 +80,11 @@ SOURCE_MOD += [ 'vendor/trezor-crypto/secp256k1.c', 'vendor/trezor-crypto/sha2.c', 'vendor/trezor-crypto/sha3.c', - 'vendor/trezor-crypto/nem.c', ] # libsecp256k1-zkp CPPPATH_MOD += [ - 'vendor/secp256k1-zkp/', + 'vendor/secp256k1-zkp', 'vendor/secp256k1-zkp/src', 'vendor/secp256k1-zkp/include', ] @@ -314,12 +313,12 @@ env.Replace( env.Replace( COPT=env.get('OPTIMIZE', env.get('ENV').get('OPTIMIZE', '-Os')), - CCFLAGS='$COPT ' + CCFLAGS='$COPT -DMPZ_DIG_SIZE=16 ' '-g3 ' '-std=gnu99 -Wall -Werror -Wuninitialized ' '-fdata-sections -ffunction-sections ' + CCFLAGS_MOD, CCFLAGS_QSTR='-DNO_QSTR -DN_X64 -DN_X86 -DN_THUMB', - LIBS=['m'] + LIBS_MOD, + LIBS=['m'], CPPPATH=[ '.', 'embed/unix', @@ -373,6 +372,30 @@ qstr_generated = env.GenerateQstrDefs( env.Ignore(qstr_collected, qstr_generated) +# +# Frozen modules +# + +if ARGUMENTS.get('TREZOR_FROZEN', 0): + if env.get('TREZOR_MODEL') == '1': + SOURCE_PY_DIR = 'src1/' + else: + SOURCE_PY_DIR = 'src/' + + # TODO: recursive Glob + SOURCE_PY = Glob(SOURCE_PY_DIR + '*.py') + SOURCE_PY.extend(Glob(SOURCE_PY_DIR + '*/*.py')) + SOURCE_PY.extend(Glob(SOURCE_PY_DIR + '*/*/*.py')) + SOURCE_PY.extend(Glob(SOURCE_PY_DIR + '*/*/*/*.py')) + SOURCE_PY.extend(Glob(SOURCE_PY_DIR + '*/*/*/*/*.py')) + + source_mpy = env.FrozenModule(source=SOURCE_PY, source_dir=SOURCE_PY_DIR) + + source_mpyc = env.FrozenCFile( + target='frozen_mpy.c', source=source_mpy, qstr_header=qstr_preprocessed) + + env.Depends(source_mpyc, qstr_generated) + # # static secp256-zkp ecmult context # @@ -399,10 +422,12 @@ secp256k1_zkp_ecmult_static_context = host_env.Command( # obj_program = [] -obj_program += env.Object(source=SOURCE_MOD) -obj_program += env.Object(source=SOURCE_MOD_SECP256K1_ZKP, CCFLAGS='$CCFLAGS -Wno-unused-function') -obj_program += env.Object(source=SOURCE_MICROPYTHON) -obj_program += env.Object(source=SOURCE_UNIX) +obj_program.extend(env.Object(source=SOURCE_MOD)) +obj_program.extend(env.Object(source=SOURCE_MOD_SECP256K1_ZKP, CCFLAGS='$CCFLAGS -Wno-unused-function')) +obj_program.extend(env.Object(source=SOURCE_MICROPYTHON)) +obj_program.extend(env.Object(source=SOURCE_UNIX)) +if ARGUMENTS.get('TREZOR_FROZEN', 0): + obj_program.extend(env.Object(source=source_mpyc)) env.Depends(obj_program, qstr_generated) env.Depends(obj_program, secp256k1_zkp_ecmult_static_context) diff --git a/core/embed/unix/mpconfigport.h b/core/embed/unix/mpconfigport.h index 6f618d2b76..3ea011c1d5 100644 --- a/core/embed/unix/mpconfigport.h +++ b/core/embed/unix/mpconfigport.h @@ -70,7 +70,7 @@ #define MICROPY_STREAMS_POSIX_API (1) #define MICROPY_OPT_COMPUTED_GOTO (1) #ifndef MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE -#define MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE (1) +#define MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE (0) #endif #define MICROPY_CAN_OVERRIDE_BUILTINS (0) #define MICROPY_PY_FUNCTION_ATTRS (1) diff --git a/tools/help.awk b/tools/help.awk index fbdd4f7b35..7233cf935b 100644 --- a/tools/help.awk +++ b/tools/help.awk @@ -7,7 +7,7 @@ BEGIN { COLOR_RESET = "\033[0m" } /^[a-zA-Z0-9_-]+:.*?## / { printf COLOR_DARKGREEN - printf " make %-20s", $1 + printf " make %-22s", $1 printf COLOR_RESET printf " %s\n", $2 } /^##(.*)/ { From 9f924576ba869d76fd26bd6ddf6ba3ee98e58e81 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Wed, 1 May 2019 13:43:31 +0200 Subject: [PATCH 12/13] ci/core: enable unix frozen build in the ci --- ci/core.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ci/core.yml b/ci/core.yml index d4e6d53633..e0d6a469f1 100644 --- a/ci/core.yml +++ b/ci/core.yml @@ -27,6 +27,12 @@ build core unix: untracked: true expire_in: 1 day +build core unix frozen: + stage: build + script: + - cd core + - pipenv run make build_unix_noui_frozen + test core unix unit: stage: test variables: From 6a3d6b15a9a4143e3c9bcbb4e0d4af2c90ed2560 Mon Sep 17 00:00:00 2001 From: Sotiris Blad Date: Wed, 1 May 2019 17:38:57 +0300 Subject: [PATCH 13/13] common/defs: add MUE blockbook (#127) --- common/defs/bitcoin/monetaryunit.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/common/defs/bitcoin/monetaryunit.json b/common/defs/bitcoin/monetaryunit.json index 4242b4f36a..b42a5b6fbe 100644 --- a/common/defs/bitcoin/monetaryunit.json +++ b/common/defs/bitcoin/monetaryunit.json @@ -33,7 +33,9 @@ "min_address_length": 27, "max_address_length": 34, "bitcore": [], - "blockbook": [], + "blockbook": [ + "https://blockbook.monetaryunit.org" + ], "cooldown": 100, "consensus_branch_id": null }