Skip to content

Commit

Permalink
feat(all): re-enable Firo (fixes #1767)
Browse files Browse the repository at this point in the history
  • Loading branch information
matejcik committed Aug 23, 2021
1 parent f37ca13 commit 7aed8d5
Show file tree
Hide file tree
Showing 7 changed files with 145 additions and 8 deletions.
15 changes: 7 additions & 8 deletions common/defs/support.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"bitcoin:DASH": true,
"bitcoin:DGB": true,
"bitcoin:DOGE": true,
"bitcoin:FIRO": true,
"bitcoin:FJC": true,
"bitcoin:FLO": true,
"bitcoin:FTC": true,
Expand Down Expand Up @@ -42,6 +43,7 @@
"bitcoin:ZEC": true,
"bitcoin:ZNY": true,
"bitcoin:tDASH": true,
"bitcoin:tFIRO": true,
"bitcoin:tLTC": true,
"bitcoin:tPPC": true,
"eth:AKA": true,
Expand Down Expand Up @@ -77,10 +79,7 @@
"nem:PAC:HRT": true,
"nem:XEM": true
},
"unsupported": {
"bitcoin:FIRO": "See issue #1588",
"bitcoin:tFIRO": "See issue #1588"
}
"unsupported": {}
},
"suite": {
"supported": {
Expand Down Expand Up @@ -141,6 +140,7 @@
"bitcoin:DGB": "1.6.3",
"bitcoin:DOGE": "1.5.2",
"bitcoin:ELEMENTS": "1.8.3",
"bitcoin:FIRO": "1.6.2",
"bitcoin:FJC": "1.6.1",
"bitcoin:FLO": "1.7.2",
"bitcoin:FTC": "1.7.1",
Expand Down Expand Up @@ -179,6 +179,7 @@
"bitcoin:ZEC": "1.8.1",
"bitcoin:ZNY": "1.8.2",
"bitcoin:tDASH": "1.6.2",
"bitcoin:tFIRO": "1.6.2",
"bitcoin:tGRS": "1.6.2",
"bitcoin:tLTC": "1.6.2",
"bitcoin:tPART": "1.8.3",
Expand Down Expand Up @@ -2098,9 +2099,7 @@
"nem:XEM": "1.6.2"
},
"unsupported": {
"bitcoin:FIRO": "See issue #1588",
"bitcoin:TRC": "address_type collides with Bitcoin",
"bitcoin:tFIRO": "See issue #1588",
"erc20:etc:PLAY": "(AUTO) duplicate key",
"erc20:eth:A18:ba7d": "(AUTO) duplicate key",
"erc20:eth:A18:bde8": "(AUTO) duplicate key",
Expand Down Expand Up @@ -2361,6 +2360,7 @@
"bitcoin:DGB": "2.0.7",
"bitcoin:DOGE": "2.0.5",
"bitcoin:ELEMENTS": "2.1.4",
"bitcoin:FIRO": "2.0.7",
"bitcoin:FJC": "2.0.5",
"bitcoin:FLO": "2.0.11",
"bitcoin:FTC": "2.0.8",
Expand Down Expand Up @@ -2399,6 +2399,7 @@
"bitcoin:ZEC": "2.1.1",
"bitcoin:ZNY": "2.1.1",
"bitcoin:tDASH": "2.0.8",
"bitcoin:tFIRO": "2.0.7",
"bitcoin:tGRS": "2.0.8",
"bitcoin:tLTC": "2.0.7",
"bitcoin:tPART": "2.1.4",
Expand Down Expand Up @@ -4326,9 +4327,7 @@
"nem:XEM": "2.0.7"
},
"unsupported": {
"bitcoin:FIRO": "See issue #1588",
"bitcoin:TRC": "address_type collides with Bitcoin",
"bitcoin:tFIRO": "See issue #1588",
"erc20:etc:PLAY": "(AUTO) duplicate key",
"erc20:eth:A18:ba7d": "(AUTO) duplicate key",
"erc20:eth:A18:bde8": "(AUTO) duplicate key",
Expand Down
1 change: 1 addition & 0 deletions core/.changelog.d/1767.added
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Re-enabled Firo support
56 changes: 56 additions & 0 deletions core/src/apps/common/coininfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,62 @@ def by_name(name: str) -> CoinInfo:
overwintered=False,
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":
return CoinInfo(
coin_name=name,
Expand Down
1 change: 1 addition & 0 deletions legacy/firmware/.changelog.d/1767.added
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Re-enabled Firo support
56 changes: 56 additions & 0 deletions tests/device_tests/test_msg_signtx_firo.py
Original file line number Diff line number Diff line change
@@ -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"
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"bin_outputs": [
{
"amount": 1000000000,
"script_pubkey": "76a914548cb80e45b1d36312fe0cb075e5e337e3c54cef88ac"
},
{
"amount": 0,
"script_pubkey": "c6c9e854d2ec2e886fa2a66367f0af2045d408e555031ac9af1d83dbd944ac598d0000caed2ca7d111c17af2e5fc461c73592cdae2e899a9b139b22d3117e16a48657e89f7dc47f14eaada9ea2e4cc4476a1fd"
}
],
"extra_data": "fd1d0e01aa57e91a078a85ba27f37f1c773b8cc6e5f4cc0425ddc7e2a33d074b1b5a945a000029eafc4edbbf8514dc20eca843f3536e26eb9b0b73b48cb69ed85a20030de6830000dde2cf89058baedfb60b3370d48b1c1e827b93445b28930a02476f2ea6759cc60100fe6c04fbe717425cd1932ce0c7b447bf742a651a724a1ba532c693cc5c60994401003c3a12ac078c52bd33e18f86c005b1852caa4f4d7346691f6733e364eeaebb0ef9ab7633e2801179aeaa1cc72a78d0fb1b94f24b67eef95b425ff7133cbc9020a1e8b7d1bdbb5e77d0d6ecf2bc31224d4652279e9846cef828bfe4d63ed5581aceb6f7f67fbd34f9b513cd08b3b20320121b193a1dba4568b8a02b5312974984496b9589193faed2b7f59d46446f34b301ca627b907920bb12f880bc0cca4cdc0be59d2159fef5c0cbe6ac8933c57da96ac698233e7dc8802109930fa90fc19ae7013fa27f09de4b8d2c3620ed2e3c03bc6459b59933004b58b808e4bf37937fb3825e7560e30b8f1216e15d4298cae1ab3101e612d6eddf205781e2bb5b517004068f3a35c8e8fed321f7bd42683d25206ca775c6c6fa228d7a29deff17dfc6c52ea13250a1c0fa9ea5b316e8db6d734c8a714d2725b9a0b68070c8731d4ccd12e5f668fb75674e8b5483089c2c9a74e09808cae20b43bf44c65564161e3ec93415f861e2f04aa7d295d3753f9b98f9f27224fcb9b8ec1f4e1ffa6aac4dc505a3a03271ba3b3c2221f3448110b20074069956ea2e2d395d46918148fb9db2238be7eec5cd40f98dfd7b96b284e5f1b302dc5ec3a9952bc82942c9f88c9fd6191001340af15bcd152078b130c24bcc286cee2e2641e2031532919dac82b8adca3b2ee8275afc0c7e3e5776755baf661e2fced9176e536ae539fd40dcf8b257e7a0e1986b9bc3991a0a0cbd3ab1bc55af842e0e95765f801e08f34f7fdf714e2bfc793e45c25ad5965630debec62d58e442ba1767055f5ab0ff75283953b8bae4061534b073d2e491c9c40d6c0b7da7fccf613a87412a11c9a379ba36a8ccdf54165d3df05f5e71108ff3d5fbfda34a45584220ea1e7b03b9b747fa307ea89523dec69e49ea2df891baa15bc1ee204213b01ba0101402ba41c332bbbf425c2be44e417bc2420bcd2c4d35e00910e3dc0c291240aa3eee4cef4be28ea5dfbe1288ba93df9ca9285ef8e00df2893a191b302d56314f9f6802f3f5ff3891fd4f5647da358435e3fda0cc7b121aeeb095d1bf06a0f3997834ed4f4ef9e5e037052f26ea9d3c8b047917bbf9742bb82af8d939e9e0b433e63b52ac404f17e0d54e4f5fd35a50f6491d26d7c5e5e58a11f089c5c46e8e5592328c4152b9059d30bd5c3f0f222fc20c0092861bcf648d5fd9d44acfaa78799ce4351f545773634987a22c7f9dff7420c7ef2689f8d1bf5106b022177d53f99e8e3209c65621e0a7e1b1e6269e701b56abdf638423c47e674301af5235c6587081157f949c0c374462d53fdb30ad2a3496240180f8a027b3d23ae033ea37744ec5e24dfa63bc012fdc132cb888b8fafd3b49cf7c585ceb24e4614022f4e69cd337a67c7d336923a669bac45ddae2606f1e416ee1b8d3db0d3be37a97a1a15ea4fa99b31ebca880e51cb0d65661eef58df9ec9a27e5eeecf5066a21b6583e9be944491056fba6d933e027cdaa945e52b83a31b14b09e0a39e576a5caa0dcaf97f047f2d658742d67193de0b1012a3d14d870c6fd5aa9a156ce030e667d8c897b98814c8a3efa318166f9ab676e9879f1de28806884512928ecee59214d0f8e81ffc6e97b033e887ea4e9faa78e6871ff1d544ed25e6cf91c9d87ab7dea2b9f82f058eff60c6a0c60cb263bd7c110636827e5abcd219b7e65ecc71ec9f17480c939fa721ecea1265e662af0254e21d6d60b787e7751e063b14a94843afacdeb8869ed01b4b87c0effcf4943e5eb64e5e1e6b2df8222bed44002626322cf5dbe4aadac41e1890ebec428d25d149f3511c8b0bf16dbc7470c7bbb8f1367bcbbb164d26bc094157db3fd3871e2c5c87ecfc892e21978f3e9d6d411ec64547ce71353501aa521d7e22f32ba9f7f46cf6c8f00cbbb5afc1d1ac55c1b6c94fe92feefe3479ed38765dc0025665c001e53049d5d615b333e072fd3cae5e7f15a5fef9ac7e984b7a78d0c78429e189a5367fef324535019de91c60c43d82f17f40ba9ad0686c947e37e9bdfa5a4c90b753bb06aac0149b0fd96704541caea2e8b4a1f1d8599428f519515bf6ce8a50d26e9df0c022b50549cd232213435d8ee8aa8a45ffd7b195ebb0a043beae279bf00a972bd66d8c411bd7753d32aed11c032ac822dbbd08f6637d72e55b3029e63f0abe0422d9aacaa1eb2f1257c31b62dd4b8d236a3ce07db7c7556931a15204d119a3093ea1c0ab094859306cd668c894d62177786ce5b40c53e2f83fb2e4bd0890c63c848aa58ab2eba42e30aa3fb35d407fa0e15f5980814bdfe7e6dcebe89a604cb3b54e265acd20aa803027eccf937f7a7f05caca1053fc066642a93d466a0e78a2fb1cea049af90b5a97f95830894c620c25c55d484459bc68bc63f627c200b7f4c7662d30e7092c3a8d36e66eeab28e54f436c1813067efd0a92aa94352899a931fe7c38f6942e79a5e79564d51db8adb2394e518beef983653680e5f9f9772e4b1de96e4acc42ff35b826b25584ce349f7ff0055e73b7b0ea8b6e928f425c898c3bbebbff389881249381f897d8b3affd09ea2fdb3e5e2db45a9ae9c834f08701da262bb9279acdb55f20858f17e5bf56def07f7efc8e56642a296d474c50376c6923841eeb63e98c685aac4ed72c6f2cb7b2a1a98da9ad743d9f027a620f850907755310b2483550c8cdedd08333e737a5761d10df09cdb5109cd360ccebdfd0ef48e76c48794ccc961ee3383cdbaa9cd4161a9e6ae9d04366cfda4080286faaba798de3fa63bfb0dd47b7a215e2e1b3d1d46937ae4af656b875ebc482a04faa9ccdac400c3d97fe4499336eca2ea1a0bfd8ff9455a9870d773e464ab3af60100e7f64bf42a820960518d68d578bcf46a50fa7d265c4c3010437935d7f1e7b6e600000f896823be587be1f7e9f4b4795bcf7dba7137d424e726fba4a9fa4e1da043e00100e6a31f0b239cf949514ce92d991353444e3259f1acec6c34d2042d289e23b48100000468f37f0df482a25871161d2f3afc30c81b09d0b8b3bf16e300bc25233abf1cb50000b5a497ab25a684b314e6126b982555ef399cb6c08c05c06d76144733461848cf000006ad7c7118055fb86dc887a26a3f8620ac007e4dd9a78fb66dfdf82d1a81e9140000511a3c385b163a3e46e8fdebd439e5ef3e6a8afcc9900a9d4b384622a99c82000100649e25ecef4edaba75807a641b3a3bd78cc3104e315cae38992dc102ca95d2a2d62f6d630ba0882d73106aa375e239ad4002f8de60620d78dd578dc20d07adbb70a656222b67e94f503041c1a1a2ef10df6b32a321b79c9ab92d8f01f81524ac0100b6be45c75eb6a2a9101092deac29a5b00aed191a6144283a2b6b2c2765cf922601008eacc497b8de007a9de96f00a9ec885bd4aaeb6b0b2a4a5875d78e2ce101a9910100a5227f870e1193ace890b74261cef8db103fd7a86f4f0564d9472b850964fe9f0100a0e58d1bf8933f943f485b5d9f593b632e70c9a9e7af7911760f01dbe5e398592e5d41c3e0ab60a09f4fbe615e439f8b84a024f9f2f873324ab8eaee0b28e4b4ba4ca094801ce35d15130910d8cd36af5321445af396448fe2ae0995a4d959258bfe82c9570243051e566ec3291f849011d41f045abb2ae35289c8d3e15bf5075c5a329967b06a9a9f739e53f840f3829d71ab61be8a4c445feff6896bb2c369ccca3be53e63c01367fab98f594bc022b6a3c7e936ff67508ec2a1a7ad390f73076e6b8513171cc8020444b89d73f64f1f99a3f912771d74cbdb9808a8fe9ddf0101004def97cb6450e6f4e8ced4d8709b5f6724bdd23f77d55497c6218fb797314d4d00009e7554b70e59952b622157b823b92d71ba2ca98dbf55d3d95c38b5bb3b0c320f01004b3b9afa7e0ff0da58029572d2a448db5c7916d2a21c31af62ab4ca1a55fd0c00000c5a0ba4d975d34745cabff6e1269e14cb6acb59a223f4cfaea6287ff25f92a8c0000f8be729b35e23b1ad6fe4eb52498f8da87fc84d5723a733a5af3dfe565691ae50100d9ea9f82c8fa2ec0af361ee043ab894c07e3d181e1101503b1163574756e1db7000007c8d174b5affbb42568adf882dc9177bd40779d86d93d1871e94eab460fbd1b110100bf1189a7522cacdbcb9d8c256ad779ca06675da8bdd578321aa44585f8b30fbc00006d8036a21cbf6cbfd7a6a6687d6e9a58a37aadc24c37280f99a0762426715f6c000073d733c80a5a9882156ea93c1195ca4232e02fccf8b03e642bd8e4e60d63cba10100e75899602564539ed307fb8ba10d75737fe548b24a8e2a9be7541c766758a2820100a487999d23a4d667bf93580b5ddcf42d97ccf332b9437f50862e7a15218d0f710100507123b600de61cf118611d6f3b400199ac2989653bed8bc1c5374876a800ae30100536e0da97e3b6cf64bcaa0ec362ce233c3fb348da6c58d2d5319fece29caa04d0100ec5918bc63b273b9bafd5ca86ff8cb0d4e9e47543112341a75ca9fdc27feac7b60ac73912ede45db365b687df3c0fa1ec71ce3bc466a3d1e4087c74b67bfc6ae0101000000dd375beda7ac52f82a3146ad3b30fb8feb4068a43fd368361c644a439c8425763ff0a52b995410549bc3bf899c0846b59a19ee78fbb291c69c6aa7119ddeb9ff0222f48e03a47b89c3192955fbf2ab3d56deebe80d312d0ffe9dd3ef2f90cca58d0101000000bac9019fa6a427585e5c57d2613e9bca1c5a0a0334453f72db5f4756b324f5abb72a0100000000002f0000004bf51569fbece0fe32e9382530fd8cab7093cf397f638aae5253a9a05e6393e10000ed00ad15179e3d2acf96bf75219c29ba573cfdd8befc82db1c7e09402ed8c1fa25cd08cd08703ed24e991f51917910f58814074e21118a8b88b113c108f6b991",
"inputs": [
{
"prev_hash": "0000000000000000000000000000000000000000000000000000000000000000",
"prev_index": 4294967295,
"script_sig": "c9",
"sequence": 4294967295
}
],
"lock_time": 36850,
"version": 524291
}
1 change: 1 addition & 0 deletions tests/ui_tests/fixtures.json
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,7 @@
"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_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_change": "8dfc140534bdaa08f6916831dc0d510f57b07617f30df748e4e0456d4dd93ece",
"test_msg_signtx_grs.py-test_send_segwit_native": "82dfa15178d33e757da58943aff36dcc0eebb984e34832b71f6ca09b2a525cbc",
Expand Down

0 comments on commit 7aed8d5

Please sign in to comment.