add travis check for coins.json

This commit is contained in:
Pavol Rusnak 2017-11-14 02:18:28 +01:00
parent 21ea45bc0e
commit 05ab19e58e
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
4 changed files with 77 additions and 1 deletions

23
.travis.yml Normal file
View File

@ -0,0 +1,23 @@
language: python
# Runs jobs on container based infrastructure
sudo: false
# Saves pip downloads/wheels between builds
cache:
directories:
- $HOME/.cache/pip
python:
- "3.5"
script:
- python coins-check.py
notifications:
webhooks:
urls:
- http://ci-bot.satoshilabs.com:5000/travis
on_success: always
on_failure: always
on_start: always

View File

@ -1,6 +1,7 @@
# trezor-common
[![gitter](https://badges.gitter.im/trezor/community.svg)](https://gitter.im/trezor/community)
[![Build Status](https://travis-ci.org/trezor/trezor-common.svg?branch=master)](https://travis-ci.org/trezor/trezor-common)
[![Gitter](https://badges.gitter.im/trezor/community.svg)](https://gitter.im/trezor/community)
Common files shared among TREZOR repositories.

42
coins-check.py Executable file
View File

@ -0,0 +1,42 @@
#!/usr/bin/env python3
import json
def is_hex(val):
try:
int(val, 16)
return True
except:
return False
for coin in json.load(open('coins.json')):
assert isinstance(coin['coin_name'], str)
assert isinstance(coin['coin_shortcut'], str)
assert isinstance(coin['coin_label'], str)
assert isinstance(coin['address_type'], int)
assert isinstance(coin['address_type_p2sh'], int)
assert coin['address_type'] != coin['address_type_p2sh']
assert isinstance(coin['maxfee_kb'], int)
assert isinstance(coin['minfee_kb'], int)
assert coin['maxfee_kb'] > coin['minfee_kb']
assert coin['signed_message_header']
assert is_hex(coin['hash_genesis_block'])
assert is_hex(coin['xprv_magic'])
assert is_hex(coin['xpub_magic'])
assert isinstance(coin['bip44'], int)
assert isinstance(coin['segwit'], bool)
assert coin['forkid'] is None or isinstance(coin['forkid'], int)
assert isinstance(coin['force_bip143'], bool)
assert isinstance(coin['default_fee_b'], dict)
assert isinstance(coin['dust_limit'], int)
assert isinstance(coin['blocktime_minutes'], int) or isinstance(coin['blocktime_minutes'], float)
assert coin['firmware'] is None or coin['firmware'] in ['stable', 'debug']
assert isinstance(coin['signed_message_header'], str)
assert isinstance(coin['min_address_length'], int)
assert isinstance(coin['max_address_length'], int)
assert isinstance(coin['bitcore'], list)
assert coin['xpub_magic_segwit_p2sh'] is None or is_hex(coin['xpub_magic_segwit_p2sh'])
assert coin['bech32_prefix'] is None or isinstance(coin['bech32_prefix'], str)
print('OK')

View File

@ -78,6 +78,7 @@
"hash_genesis_block": "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f",
"xprv_magic": "0488ade4",
"xpub_magic": "0488b21e",
"xpub_magic_segwit_p2sh": null,
"bech32_prefix": null,
"bip44": 145,
"segwit": false,
@ -111,6 +112,7 @@
"hash_genesis_block": "000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943",
"xprv_magic": "04358394",
"xpub_magic": "043587cf",
"xpub_magic_segwit_p2sh": null,
"bech32_prefix": null,
"bip44": 1,
"segwit": false,
@ -139,6 +141,7 @@
"hash_genesis_block": "000000000062b72c5e2ceb45fbc8587e807c155b0da735e6483dfba2f0a9c770",
"xprv_magic": "019d9cfe",
"xpub_magic": "019da462",
"xpub_magic_segwit_p2sh": null,
"bech32_prefix": null,
"bip44": 7,
"segwit": false,
@ -198,6 +201,7 @@
"hash_genesis_block": "1a91e3dace36e2be3bf030a65679fe821aa1d6ef92e7c9902eb318182c355691",
"xprv_magic": "02fac398",
"xpub_magic": "02facafd",
"xpub_magic_segwit_p2sh": null,
"bech32_prefix": null,
"bip44": 3,
"segwit": false,
@ -226,6 +230,7 @@
"hash_genesis_block": "00000ffd590b1485b3caadc19b22e6379c733355108f107a430458cdf3407ab6",
"xprv_magic": "02fe52f8",
"xpub_magic": "02fe52cc",
"xpub_magic_segwit_p2sh": null,
"bech32_prefix": null,
"bip44": 5,
"segwit": false,
@ -257,6 +262,7 @@
"hash_genesis_block": "00040fe8ec8471911baa1db1266ea15dd06b4a8a5c453883c000b031973dce08",
"xprv_magic": "0488ade4",
"xpub_magic": "0488b21e",
"xpub_magic_segwit_p2sh": null,
"bech32_prefix": null,
"bip44": 133,
"segwit": false,
@ -287,6 +293,7 @@
"hash_genesis_block": "05a60a92d99d85997cce3b87616c089f6124d7342af37106edc76126334a2c38",
"xprv_magic": "04358394",
"xpub_magic": "043587cf",
"xpub_magic_segwit_p2sh": null,
"bech32_prefix": null,
"bip44": 1,
"segwit": false,
@ -372,6 +379,7 @@
{
"coin_name": "Monacoin",
"coin_shortcut": "MONA",
"coin_label": "Monacoin",
"address_type": 50,
"address_type_p2sh": 55,
"maxfee_kb": 5000000,
@ -402,6 +410,7 @@
{
"coin_name": "Fujicoin",
"coin_shortcut": "FJC",
"coin_label": "Fujicoin",
"address_type": 36,
"address_type_p2sh": 16,
"maxfee_kb": 1000000,
@ -410,6 +419,7 @@
"hash_genesis_block": "adb6d9cfd74075e7f91608add4bd2a2ea636f70856183086842667a1597714a0",
"xpub_magic": "0488b21e",
"xprv_magic": "0488ade4",
"xpub_magic_segwit_p2sh": null,
"bech32_prefix": null,
"bip44": 75,
"segwit": false,