1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-22 07:28:10 +00:00

feat(all): re-enable Firo (fixes #1767)

This commit is contained in:
matejcik 2021-08-20 16:19:34 +02:00 committed by matejcik
parent f37ca13f1a
commit 7aed8d535d
7 changed files with 145 additions and 8 deletions

View File

@ -11,6 +11,7 @@
"bitcoin:DASH": true, "bitcoin:DASH": true,
"bitcoin:DGB": true, "bitcoin:DGB": true,
"bitcoin:DOGE": true, "bitcoin:DOGE": true,
"bitcoin:FIRO": true,
"bitcoin:FJC": true, "bitcoin:FJC": true,
"bitcoin:FLO": true, "bitcoin:FLO": true,
"bitcoin:FTC": true, "bitcoin:FTC": true,
@ -42,6 +43,7 @@
"bitcoin:ZEC": true, "bitcoin:ZEC": true,
"bitcoin:ZNY": true, "bitcoin:ZNY": true,
"bitcoin:tDASH": true, "bitcoin:tDASH": true,
"bitcoin:tFIRO": true,
"bitcoin:tLTC": true, "bitcoin:tLTC": true,
"bitcoin:tPPC": true, "bitcoin:tPPC": true,
"eth:AKA": true, "eth:AKA": true,
@ -77,10 +79,7 @@
"nem:PAC:HRT": true, "nem:PAC:HRT": true,
"nem:XEM": true "nem:XEM": true
}, },
"unsupported": { "unsupported": {}
"bitcoin:FIRO": "See issue #1588",
"bitcoin:tFIRO": "See issue #1588"
}
}, },
"suite": { "suite": {
"supported": { "supported": {
@ -141,6 +140,7 @@
"bitcoin:DGB": "1.6.3", "bitcoin:DGB": "1.6.3",
"bitcoin:DOGE": "1.5.2", "bitcoin:DOGE": "1.5.2",
"bitcoin:ELEMENTS": "1.8.3", "bitcoin:ELEMENTS": "1.8.3",
"bitcoin:FIRO": "1.6.2",
"bitcoin:FJC": "1.6.1", "bitcoin:FJC": "1.6.1",
"bitcoin:FLO": "1.7.2", "bitcoin:FLO": "1.7.2",
"bitcoin:FTC": "1.7.1", "bitcoin:FTC": "1.7.1",
@ -179,6 +179,7 @@
"bitcoin:ZEC": "1.8.1", "bitcoin:ZEC": "1.8.1",
"bitcoin:ZNY": "1.8.2", "bitcoin:ZNY": "1.8.2",
"bitcoin:tDASH": "1.6.2", "bitcoin:tDASH": "1.6.2",
"bitcoin:tFIRO": "1.6.2",
"bitcoin:tGRS": "1.6.2", "bitcoin:tGRS": "1.6.2",
"bitcoin:tLTC": "1.6.2", "bitcoin:tLTC": "1.6.2",
"bitcoin:tPART": "1.8.3", "bitcoin:tPART": "1.8.3",
@ -2098,9 +2099,7 @@
"nem:XEM": "1.6.2" "nem:XEM": "1.6.2"
}, },
"unsupported": { "unsupported": {
"bitcoin:FIRO": "See issue #1588",
"bitcoin:TRC": "address_type collides with Bitcoin", "bitcoin:TRC": "address_type collides with Bitcoin",
"bitcoin:tFIRO": "See issue #1588",
"erc20:etc:PLAY": "(AUTO) duplicate key", "erc20:etc:PLAY": "(AUTO) duplicate key",
"erc20:eth:A18:ba7d": "(AUTO) duplicate key", "erc20:eth:A18:ba7d": "(AUTO) duplicate key",
"erc20:eth:A18:bde8": "(AUTO) duplicate key", "erc20:eth:A18:bde8": "(AUTO) duplicate key",
@ -2361,6 +2360,7 @@
"bitcoin:DGB": "2.0.7", "bitcoin:DGB": "2.0.7",
"bitcoin:DOGE": "2.0.5", "bitcoin:DOGE": "2.0.5",
"bitcoin:ELEMENTS": "2.1.4", "bitcoin:ELEMENTS": "2.1.4",
"bitcoin:FIRO": "2.0.7",
"bitcoin:FJC": "2.0.5", "bitcoin:FJC": "2.0.5",
"bitcoin:FLO": "2.0.11", "bitcoin:FLO": "2.0.11",
"bitcoin:FTC": "2.0.8", "bitcoin:FTC": "2.0.8",
@ -2399,6 +2399,7 @@
"bitcoin:ZEC": "2.1.1", "bitcoin:ZEC": "2.1.1",
"bitcoin:ZNY": "2.1.1", "bitcoin:ZNY": "2.1.1",
"bitcoin:tDASH": "2.0.8", "bitcoin:tDASH": "2.0.8",
"bitcoin:tFIRO": "2.0.7",
"bitcoin:tGRS": "2.0.8", "bitcoin:tGRS": "2.0.8",
"bitcoin:tLTC": "2.0.7", "bitcoin:tLTC": "2.0.7",
"bitcoin:tPART": "2.1.4", "bitcoin:tPART": "2.1.4",
@ -4326,9 +4327,7 @@
"nem:XEM": "2.0.7" "nem:XEM": "2.0.7"
}, },
"unsupported": { "unsupported": {
"bitcoin:FIRO": "See issue #1588",
"bitcoin:TRC": "address_type collides with Bitcoin", "bitcoin:TRC": "address_type collides with Bitcoin",
"bitcoin:tFIRO": "See issue #1588",
"erc20:etc:PLAY": "(AUTO) duplicate key", "erc20:etc:PLAY": "(AUTO) duplicate key",
"erc20:eth:A18:ba7d": "(AUTO) duplicate key", "erc20:eth:A18:ba7d": "(AUTO) duplicate key",
"erc20:eth:A18:bde8": "(AUTO) duplicate key", "erc20:eth:A18:bde8": "(AUTO) duplicate key",

View File

@ -0,0 +1 @@
Re-enabled Firo support

View File

@ -766,6 +766,62 @@ def by_name(name: str) -> CoinInfo:
overwintered=False, overwintered=False,
confidential_assets=None, confidential_assets=None,
) )
elif name == "Firo":
return CoinInfo(
coin_name=name,
coin_shortcut="FIRO",
decimals=8,
address_type=82,
address_type_p2sh=7,
maxfee_kb=640000000,
signed_message_header="Zcoin Signed Message:\n",
xpub_magic=0x0488b21e,
xpub_magic_segwit_p2sh=None,
xpub_magic_segwit_native=None,
xpub_magic_multisig_segwit_p2sh=None,
xpub_magic_multisig_segwit_native=None,
bech32_prefix=None,
cashaddr_prefix=None,
slip44=136,
segwit=False,
fork_id=None,
force_bip143=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
extra_data=True,
timestamp=False,
overwintered=False,
confidential_assets=None,
)
elif name == "Firo Testnet":
return CoinInfo(
coin_name=name,
coin_shortcut="tFIRO",
decimals=8,
address_type=65,
address_type_p2sh=178,
maxfee_kb=1000000,
signed_message_header="Zcoin Signed Message:\n",
xpub_magic=0x043587cf,
xpub_magic_segwit_p2sh=None,
xpub_magic_segwit_native=None,
xpub_magic_multisig_segwit_p2sh=None,
xpub_magic_multisig_segwit_native=None,
bech32_prefix=None,
cashaddr_prefix=None,
slip44=1,
segwit=False,
fork_id=None,
force_bip143=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
extra_data=True,
timestamp=False,
overwintered=False,
confidential_assets=None,
)
elif name == "Florincoin": elif name == "Florincoin":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,

View File

@ -0,0 +1 @@
Re-enabled Firo support

View File

@ -0,0 +1,56 @@
# This file is part of the Trezor project.
#
# Copyright (C) 2012-2019 SatoshiLabs and contributors
#
# This library is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3
# as published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the License along with this library.
# If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
import pytest
from trezorlib import btc, messages
from trezorlib.tools import btc_hash, parse_path
from ..tx_cache import TxCache
TX_API = TxCache("Firo Testnet")
TXHASH_8a34cc = bytes.fromhex(
"8a34ccceaf138fd14398303340afb37871cb0ea6719ceba315172edb9ff6d625"
)
@pytest.mark.altcoin
def test_spend_lelantus(client):
inp1 = messages.TxInputType(
# THgGLVqfzJcaxRVPWE5fd8YJ1GpVePq2Uk
address_n=parse_path("m/44'/1'/0'/0/4"),
amount=1_000_000_000,
prev_hash=TXHASH_8a34cc,
prev_index=0,
)
out1 = messages.TxOutputType(
# m/44'/1'/0'/0/5
address="TPypFKi3aziXmiH1MiwagaK71apv5XARGY",
amount=1_000_000_000 - 1_000,
script_type=messages.OutputScriptType.PAYTOADDRESS,
)
_, serialized_tx = btc.sign_tx(
client, "Firo Testnet", [inp1], [out1], prev_txes=TX_API
)
assert (
serialized_tx.hex()
== "010000000125d6f69fdb2e1715a3eb9c71a60ecb7178b3af4033309843d18f13afcecc348a000000006a47304402207b490135583a2ac6650806c706dfd15954f9ac85b64a75d7264653e4b1cd4e29022052946b28f97a415bd0b2b02c3a71ac8cb26f9a9387ac82856b4c7116848d090c01210313a443e806f25052ac7363adc689fcfa72893f2a51a35ab5e096ed5e6cd8517effffffff0118c69a3b000000001976a91499af2ecbf5892079e0297c59b91981b067da36a988ac00000000"
)
# accepted by network: https://testblockbook.firo.org/tx/866bc7041989ad038e5b38b7577325d015b67238ea9387cde6ba837fff4a61be
assert (
btc_hash(serialized_tx)[::-1].hex()
== "866bc7041989ad038e5b38b7577325d015b67238ea9387cde6ba837fff4a61be"
)

File diff suppressed because one or more lines are too long

View File

@ -519,6 +519,7 @@
"test_msg_signtx_external.py::test_p2wpkh_with_false_proof": "180fa10c6aab6dafa764dc598ce7cc4ac216ad27051e6f414503fc000f85cae9", "test_msg_signtx_external.py::test_p2wpkh_with_false_proof": "180fa10c6aab6dafa764dc598ce7cc4ac216ad27051e6f414503fc000f85cae9",
"test_msg_signtx_external.py::test_p2wpkh_with_proof": "209ddfa68c6bc1c885712d39ffc07cce8c1fb7b80c6497f21b34492f7d3de22c", "test_msg_signtx_external.py::test_p2wpkh_with_proof": "209ddfa68c6bc1c885712d39ffc07cce8c1fb7b80c6497f21b34492f7d3de22c",
"test_msg_signtx_external.py::test_p2wsh_external_presigned": "8374d50b803db0160de39ce7e5a4170112f4c99d703490920a2de735bd261bda", "test_msg_signtx_external.py::test_p2wsh_external_presigned": "8374d50b803db0160de39ce7e5a4170112f4c99d703490920a2de735bd261bda",
"test_msg_signtx_firo.py::test_spend_lelantus": "cc2de1647ce965776cc4aa7406ba69ba1ec63ed05183b5afcff80a7c20a43052",
"test_msg_signtx_grs.py-test_legacy": "3a80ea724a93ed225d64f8def739d63b11f8c096455f971feabec8be6f7597fb", "test_msg_signtx_grs.py-test_legacy": "3a80ea724a93ed225d64f8def739d63b11f8c096455f971feabec8be6f7597fb",
"test_msg_signtx_grs.py-test_legacy_change": "8dfc140534bdaa08f6916831dc0d510f57b07617f30df748e4e0456d4dd93ece", "test_msg_signtx_grs.py-test_legacy_change": "8dfc140534bdaa08f6916831dc0d510f57b07617f30df748e4e0456d4dd93ece",
"test_msg_signtx_grs.py-test_send_segwit_native": "82dfa15178d33e757da58943aff36dcc0eebb984e34832b71f6ca09b2a525cbc", "test_msg_signtx_grs.py-test_send_segwit_native": "82dfa15178d33e757da58943aff36dcc0eebb984e34832b71f6ca09b2a525cbc",