1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-18 20:38:10 +00:00

defs: update backend urls, add backend check to build_coins.py

This commit is contained in:
Pavol Rusnak 2018-07-03 12:23:52 +02:00
parent f2864f892f
commit d522f211fd
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
28 changed files with 80 additions and 64 deletions

View File

@ -38,10 +38,10 @@
"max_address_length": 34, "max_address_length": 34,
"bitcore": [], "bitcore": [],
"blockbook": [ "blockbook": [
"https://bch1.trezor.io", "https://bch1.trezor.io/api",
"https://bch2.trezor.io", "https://bch2.trezor.io/api",
"https://bch3.trezor.io", "https://bch3.trezor.io/api",
"https://bch4.trezor.io", "https://bch4.trezor.io/api",
"https://bch5.trezor.io" "https://bch5.trezor.io/api"
] ]
} }

View File

@ -38,10 +38,10 @@
"max_address_length": 34, "max_address_length": 34,
"bitcore": [], "bitcore": [],
"blockbook": [ "blockbook": [
"https://btg1.trezor.io", "https://btg1.trezor.io/api",
"https://btg2.trezor.io", "https://btg2.trezor.io/api",
"https://btg3.trezor.io", "https://btg3.trezor.io/api",
"https://btg4.trezor.io", "https://btg4.trezor.io/api",
"https://btg5.trezor.io" "https://btg5.trezor.io/api"
] ]
} }

View File

@ -38,10 +38,10 @@
"max_address_length": 34, "max_address_length": 34,
"bitcore": [], "bitcore": [],
"blockbook": [ "blockbook": [
"https://btc1.trezor.io", "https://btc1.trezor.io/api",
"https://btc2.trezor.io", "https://btc2.trezor.io/api",
"https://btc3.trezor.io", "https://btc3.trezor.io/api",
"https://btc4.trezor.io", "https://btc4.trezor.io/api",
"https://btc5.trezor.io" "https://btc5.trezor.io/api"
] ]
} }

View File

@ -34,7 +34,7 @@
"min_address_length": 27, "min_address_length": 27,
"max_address_length": 34, "max_address_length": 34,
"bitcore": [ "bitcore": [
"https://insight.bitcore.cc" "https://insight.bitcore.cc/api"
], ],
"blockbook": [] "blockbook": []
} }

View File

@ -34,7 +34,7 @@
"min_address_length": 35, "min_address_length": 35,
"max_address_length": 95, "max_address_length": 95,
"bitcore": [ "bitcore": [
"https://explorer.btcprivate.org" "https://explorer.btcprivate.org/api"
], ],
"blockbook": [] "blockbook": []
} }

View File

@ -34,8 +34,8 @@
"min_address_length": 27, "min_address_length": 27,
"max_address_length": 34, "max_address_length": 34,
"bitcore": [ "bitcore": [
"https://crw-bitcore.crown.tech", "https://crw-bitcore.crown.tech/api",
"https://crw2-bitcore.crown.tech" "https://crw2-bitcore.crown.tech/api"
], ],
"blockbook": [] "blockbook": []
} }

View File

@ -35,10 +35,10 @@
"max_address_length": 34, "max_address_length": 34,
"bitcore": [], "bitcore": [],
"blockbook": [ "blockbook": [
"https://dash1.trezor.io", "https://dash1.trezor.io/api",
"https://dash2.trezor.io", "https://dash2.trezor.io/api",
"https://dash3.trezor.io", "https://dash3.trezor.io/api",
"https://dash4.trezor.io", "https://dash4.trezor.io/api",
"https://dash5.trezor.io" "https://dash5.trezor.io/api"
] ]
} }

View File

@ -34,7 +34,7 @@
"min_address_length": 35, "min_address_length": 35,
"max_address_length": 35, "max_address_length": 35,
"bitcore": [ "bitcore": [
"https://mainnet.decred.org" "https://mainnet.decred.org/api"
], ],
"blockbook": [] "blockbook": []
} }

View File

@ -34,7 +34,7 @@
"min_address_length": 35, "min_address_length": 35,
"max_address_length": 35, "max_address_length": 35,
"bitcore": [ "bitcore": [
"https://testnet.decred.org" "https://testnet.decred.org/api"
], ],
"blockbook": [] "blockbook": []
} }

View File

@ -37,7 +37,7 @@
"min_address_length": 27, "min_address_length": 27,
"max_address_length": 34, "max_address_length": 34,
"bitcore": [ "bitcore": [
"https://explorer.digibyteprojects.com" "https://explorer.digibyteprojects.com/api"
], ],
"blockbook": [] "blockbook": []
} }

View File

@ -35,10 +35,10 @@
"max_address_length": 34, "max_address_length": 34,
"bitcore": [], "bitcore": [],
"blockbook": [ "blockbook": [
"https://doge1.trezor.io", "https://doge1.trezor.io/api",
"https://doge2.trezor.io", "https://doge2.trezor.io/api",
"https://doge3.trezor.io", "https://doge3.trezor.io/api",
"https://doge4.trezor.io", "https://doge4.trezor.io/api",
"https://doge5.trezor.io" "https://doge5.trezor.io/api"
] ]
} }

View File

@ -34,7 +34,7 @@
"min_address_length": 27, "min_address_length": 27,
"max_address_length": 34, "max_address_length": 34,
"bitcore": [ "bitcore": [
"https://explorer.flashcoin.io" "https://explorer.flashcoin.io/api"
], ],
"blockbook": [] "blockbook": []
} }

View File

@ -37,7 +37,7 @@
"min_address_length": 27, "min_address_length": 27,
"max_address_length": 34, "max_address_length": 34,
"bitcore": [ "bitcore": [
"http://explorer.fujicoin.org" "http://explorer.fujicoin.org/api"
], ],
"blockbook": [] "blockbook": []
} }

View File

@ -34,7 +34,7 @@
"min_address_length": 27, "min_address_length": 27,
"max_address_length": 34, "max_address_length": 34,
"bitcore": [ "bitcore": [
"https://groestlsight.groestlcoin.org" "https://groestlsight.groestlcoin.org/api"
], ],
"blockbook": [] "blockbook": []
} }

View File

@ -34,7 +34,7 @@
"min_address_length": 27, "min_address_length": 27,
"max_address_length": 34, "max_address_length": 34,
"bitcore": [ "bitcore": [
"https://groestlsight-test.groestlcoin.org" "https://groestlsight-test.groestlcoin.org/api"
], ],
"blockbook": [] "blockbook": []
} }

View File

@ -34,7 +34,7 @@
"min_address_length": 35, "min_address_length": 35,
"max_address_length": 95, "max_address_length": 95,
"bitcore": [ "bitcore": [
"https://insight.kotocoin.info" "https://insight.kotocoin.info/api"
], ],
"blockbook": [] "blockbook": []
} }

View File

@ -35,10 +35,10 @@
"max_address_length": 34, "max_address_length": 34,
"bitcore": [], "bitcore": [],
"blockbook": [ "blockbook": [
"https://ltc1.trezor.io", "https://ltc1.trezor.io/api",
"https://ltc2.trezor.io", "https://ltc2.trezor.io/api",
"https://ltc3.trezor.io", "https://ltc3.trezor.io/api",
"https://ltc4.trezor.io", "https://ltc4.trezor.io/api",
"https://ltc5.trezor.io" "https://ltc5.trezor.io/api"
] ]
} }

View File

@ -34,7 +34,7 @@
"min_address_length": 27, "min_address_length": 27,
"max_address_length": 34, "max_address_length": 34,
"bitcore": [ "bitcore": [
"https://testnet.litecore.io" "https://testnet.litecore.io/api"
], ],
"blockbook": [] "blockbook": []
} }

View File

@ -26,7 +26,7 @@
"bip115": false, "bip115": false,
"version_group_id": null, "version_group_id": null,
"default_fee_b": { "default_fee_b": {
"Normal": 100000 "Normal": 1000
}, },
"dust_limit": 54600, "dust_limit": 54600,
"blocktime_seconds": 90, "blocktime_seconds": 90,
@ -34,7 +34,9 @@
"min_address_length": 27, "min_address_length": 27,
"max_address_length": 34, "max_address_length": 34,
"bitcore": [ "bitcore": [
"https://mona.chainsight.info" "https://mona.chainsight.info/api",
"https://mona.insight.monaco-ex.org/insight-api-monacoin",
"https://insight.electrum-mona.org/api"
], ],
"blockbook": [] "blockbook": []
} }

View File

@ -34,7 +34,7 @@
"min_address_length": 27, "min_address_length": 27,
"max_address_length": 34, "max_address_length": 34,
"bitcore": [ "bitcore": [
"http://live.pesetacoin.info" "http://live.pesetacoin.info/api"
], ],
"blockbook": [] "blockbook": []
} }

View File

@ -34,7 +34,7 @@
"min_address_length": 27, "min_address_length": 27,
"max_address_length": 34, "max_address_length": 34,
"bitcore": [ "bitcore": [
"https://insight.terracoin.io" "https://insight.terracoin.io/api"
], ],
"blockbook": [] "blockbook": []
} }

View File

@ -35,10 +35,10 @@
"max_address_length": 34, "max_address_length": 34,
"bitcore": [], "bitcore": [],
"blockbook": [ "blockbook": [
"https://vtc1.trezor.io", "https://vtc1.trezor.io/api",
"https://vtc2.trezor.io", "https://vtc2.trezor.io/api",
"https://vtc3.trezor.io", "https://vtc3.trezor.io/api",
"https://vtc4.trezor.io", "https://vtc4.trezor.io/api",
"https://vtc5.trezor.io" "https://vtc5.trezor.io/api"
] ]
} }

View File

@ -37,7 +37,7 @@
"min_address_length": 27, "min_address_length": 27,
"max_address_length": 34, "max_address_length": 34,
"bitcore": [ "bitcore": [
"https://explorer.viacoin.org" "https://explorer.viacoin.org/api"
], ],
"blockbook": [] "blockbook": []
} }

View File

@ -35,10 +35,10 @@
"max_address_length": 95, "max_address_length": 95,
"bitcore": [], "bitcore": [],
"blockbook": [ "blockbook": [
"https://zec1.trezor.io", "https://zec1.trezor.io/api",
"https://zec2.trezor.io", "https://zec2.trezor.io/api",
"https://zec3.trezor.io", "https://zec3.trezor.io/api",
"https://zec4.trezor.io", "https://zec4.trezor.io/api",
"https://zec5.trezor.io" "https://zec5.trezor.io/api"
] ]
} }

View File

@ -34,7 +34,7 @@
"min_address_length": 35, "min_address_length": 35,
"max_address_length": 95, "max_address_length": 95,
"bitcore": [ "bitcore": [
"https://explorer.testnet.z.cash" "https://explorer.testnet.z.cash/api"
], ],
"blockbook": [] "blockbook": []
} }

View File

@ -37,7 +37,7 @@
"min_address_length": 27, "min_address_length": 27,
"max_address_length": 34, "max_address_length": 34,
"bitcore": [ "bitcore": [
"https://insight.zcoin.io" "https://insight.zcoin.io/api"
], ],
"blockbook": [] "blockbook": []
} }

View File

@ -34,7 +34,7 @@
"min_address_length": 35, "min_address_length": 35,
"max_address_length": 95, "max_address_length": 95,
"bitcore": [ "bitcore": [
"https://explorer.zen-solutions.io" "https://explorer.zen-solutions.io/api"
], ],
"blockbook": [] "blockbook": []
} }

View File

@ -16,7 +16,9 @@ import re
import os import os
import sys import sys
if '--defs' in sys.argv:
BUILD_DEFS = '--defs' in sys.argv
if BUILD_DEFS:
from binascii import unhexlify from binascii import unhexlify
from hashlib import sha256 from hashlib import sha256
import ed25519 import ed25519
@ -24,8 +26,10 @@ if '--defs' in sys.argv:
from trezorlib.protobuf import dump_message from trezorlib.protobuf import dump_message
from coindef import CoinDef from coindef import CoinDef
BUILD_DEFS = True BUILD_DEFS = True
else:
BUILD_DEFS = False TEST_BACKEND = '--test-backend' in sys.argv
if TEST_BACKEND:
import requests
def check_type(val, types, nullable=False, empty=False, regex=None, choice=None): # noqa:E501 def check_type(val, types, nullable=False, empty=False, regex=None, choice=None): # noqa:E501
@ -56,6 +60,12 @@ def check_type(val, types, nullable=False, empty=False, regex=None, choice=None)
return isinstance(val, types) return isinstance(val, types)
def get_hash_genesis_block(api):
r = requests.get(api + '/block-index/0')
j = r.json()
return j['blockHash']
def validate_coin(coin): def validate_coin(coin):
assert check_type(coin['coin_name'], str, regex=r'^[A-Z]') assert check_type(coin['coin_name'], str, regex=r'^[A-Z]')
assert check_type(coin['coin_shortcut'], str, regex=r'^[A-Zt][A-Z][A-Z]+$') assert check_type(coin['coin_shortcut'], str, regex=r'^[A-Zt][A-Z][A-Z]+$')
@ -101,9 +111,13 @@ def validate_coin(coin):
assert check_type(coin['bitcore'], list, empty=True) assert check_type(coin['bitcore'], list, empty=True)
for bc in coin['bitcore']: for bc in coin['bitcore']:
assert not bc.endswith('/') assert not bc.endswith('/')
if TEST_BACKEND:
assert get_hash_genesis_block(bc) == coin['hash_genesis_block']
assert check_type(coin['blockbook'], list, empty=True) assert check_type(coin['blockbook'], list, empty=True)
for bb in coin['blockbook']: for bb in coin['blockbook']:
assert not bb.endswith('/') assert not bb.endswith('/')
if TEST_BACKEND:
assert get_hash_genesis_block(bb) == coin['hash_genesis_block']
def validate_icon(icon): def validate_icon(icon):