1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-27 08:38:07 +00:00

Merge remote-tracking branch 'origin/master' into andrewkozlik/slip0039

This commit is contained in:
Andrew Kozlik 2019-05-02 15:08:43 +02:00
commit 0a99ad3f13
22 changed files with 211 additions and 112 deletions

10
Pipfile.lock generated
View File

@ -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": [

View File

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

View File

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

View File

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

View File

@ -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 <ilmango.doge@gmail.com>",
"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
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

@ -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 <swthrhs@protonmail.com>",
"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,
@ -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
}

View File

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

View File

@ -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",
@ -1276,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",
@ -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",
@ -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",
@ -1637,6 +1636,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",
@ -2627,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",
@ -2636,7 +2636,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",
@ -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",

View File

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

View File

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

View File

@ -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))
@ -86,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}")
@ -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)
@ -201,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
@ -213,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)
@ -246,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
@ -466,12 +472,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 +483,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:

View File

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

View File

@ -412,24 +412,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
@ -464,7 +465,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')

View File

@ -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',
@ -81,12 +81,11 @@ SOURCE_MOD += [
'vendor/trezor-crypto/sha2.c',
'vendor/trezor-crypto/sha3.c',
'vendor/trezor-crypto/shamir.c',
'vendor/trezor-crypto/nem.c',
]
# libsecp256k1-zkp
CPPPATH_MOD += [
'vendor/secp256k1-zkp/',
'vendor/secp256k1-zkp',
'vendor/secp256k1-zkp/src',
'vendor/secp256k1-zkp/include',
]
@ -315,12 +314,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',
@ -374,6 +373,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
#
@ -400,10 +423,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)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -30,10 +30,12 @@ in
gnumake
graphviz
openssl
pipenv
pkgconfig
protobuf
python2Packages.demjson
scons
valgrind
zlib
];
}

View File

@ -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
} /^##(.*)/ {