diff --git a/common/defs/bitcoin/groestlcoin.json b/common/defs/bitcoin/groestlcoin.json index d436d24acb..19cad0893d 100644 --- a/common/defs/bitcoin/groestlcoin.json +++ b/common/defs/bitcoin/groestlcoin.json @@ -23,7 +23,7 @@ "cashaddr_prefix": null, "slip44": 17, "segwit": true, - "taproot": false, + "taproot": true, "decred": false, "fork_id": null, "force_bip143": false, diff --git a/common/defs/bitcoin/groestlcoin_testnet.json b/common/defs/bitcoin/groestlcoin_testnet.json index 0cb3ecb5ad..ce600b3c43 100644 --- a/common/defs/bitcoin/groestlcoin_testnet.json +++ b/common/defs/bitcoin/groestlcoin_testnet.json @@ -23,7 +23,7 @@ "cashaddr_prefix": null, "slip44": 1, "segwit": true, - "taproot": false, + "taproot": true, "decred": false, "fork_id": null, "force_bip143": false, diff --git a/core/src/apps/common/coininfo.py b/core/src/apps/common/coininfo.py index 8457cbf4f2..5c2157f8c6 100644 --- a/core/src/apps/common/coininfo.py +++ b/core/src/apps/common/coininfo.py @@ -868,7 +868,7 @@ def by_name(name: str) -> CoinInfo: cashaddr_prefix=None, slip44=17, segwit=True, - taproot=False, + taproot=True, fork_id=None, force_bip143=False, decred=False, @@ -897,7 +897,7 @@ def by_name(name: str) -> CoinInfo: cashaddr_prefix=None, slip44=1, segwit=True, - taproot=False, + taproot=True, fork_id=None, force_bip143=False, decred=False, diff --git a/tests/device_tests/bitcoin/test_getaddress.py b/tests/device_tests/bitcoin/test_getaddress.py index dc1b981eda..231635b9e7 100644 --- a/tests/device_tests/bitcoin/test_getaddress.py +++ b/tests/device_tests/bitcoin/test_getaddress.py @@ -111,6 +111,22 @@ def test_grs(client): ) +@pytest.mark.altcoin +def test_tgrs(client): + assert ( + btc.get_address(client, "Groestlcoin Testnet", parse_path("44'/1'/0'/0/0")) + == "mvbu1Gdy8SUjTenqerxUaZyYjmvedc787y" + ) + assert ( + btc.get_address(client, "Groestlcoin Testnet", parse_path("44'/1'/0'/1/0")) + == "mm6kLYbGEL1tGe4ZA8xacfgRPdW1LMq8cN" + ) + assert ( + btc.get_address(client, "Groestlcoin Testnet", parse_path("44'/1'/0'/1/1")) + == "mjXZwmEi1z1MzveZrKUAo4DBgbdq6ZhGD6" + ) + + @pytest.mark.altcoin def test_elements(client): assert ( diff --git a/tests/device_tests/bitcoin/test_getaddress_segwit.py b/tests/device_tests/bitcoin/test_getaddress_segwit.py index 7e51d4b773..0e0a4db54c 100644 --- a/tests/device_tests/bitcoin/test_getaddress_segwit.py +++ b/tests/device_tests/bitcoin/test_getaddress_segwit.py @@ -70,6 +70,17 @@ def test_show_segwit(client): @pytest.mark.altcoin def test_show_segwit_altcoin(client): + assert ( + btc.get_address( + client, + "Groestlcoin Testnet", + parse_path("49'/1'/0'/1/0"), + True, + None, + script_type=messages.InputScriptType.SPENDP2SHWITNESS, + ) + == "2N1LGaGg836mqSQqiuUBLfcyGBhyZYBtBZ7" + ) assert ( btc.get_address( client, @@ -81,6 +92,28 @@ def test_show_segwit_altcoin(client): ) == "2N4Q5FhU2497BryFfUgbqkAJE87aKDv3V3e" ) + assert ( + btc.get_address( + client, + "Groestlcoin Testnet", + parse_path("44'/1'/0'/0/0"), + False, + None, + script_type=messages.InputScriptType.SPENDP2SHWITNESS, + ) + == "2N6UeBoqYEEnybg4cReFYDammpsyDzLXvCT" + ) + assert ( + btc.get_address( + client, + "Groestlcoin Testnet", + parse_path("44'/1'/0'/0/0"), + False, + None, + script_type=messages.InputScriptType.SPENDADDRESS, + ) + == "mvbu1Gdy8SUjTenqerxUaZyYjmvedc787y" + ) assert ( btc.get_address( client, diff --git a/tests/device_tests/bitcoin/test_getaddress_segwit_native.py b/tests/device_tests/bitcoin/test_getaddress_segwit_native.py index a2bc2a5f10..3805ded31e 100644 --- a/tests/device_tests/bitcoin/test_getaddress_segwit_native.py +++ b/tests/device_tests/bitcoin/test_getaddress_segwit_native.py @@ -69,6 +69,20 @@ VECTORS = ( # coin, path, script_type, address messages.InputScriptType.SPENDTAPROOT, "bc1pgypgja2hmcx2l6s2ssq75k6ev68ved6nujcspt47dgvkp8euc70s6uegk6", ), + pytest.param( + "Groestlcoin Testnet", + "84'/1'/0'/0/0", + messages.InputScriptType.SPENDWITNESS, + "tgrs1qkvwu9g3k2pdxewfqr7syz89r3gj557l3ued7ja", + marks=pytest.mark.altcoin, + ), + pytest.param( + "Groestlcoin Testnet", + "84'/1'/0'/1/0", + messages.InputScriptType.SPENDWITNESS, + "tgrs1qejqxwzfld7zr6mf7ygqy5s5se5xq7vmt9lkd57", + marks=pytest.mark.altcoin, + ), pytest.param( "Groestlcoin", "84'/17'/0'/0/0", @@ -76,6 +90,27 @@ VECTORS = ( # coin, path, script_type, address "grs1qw4teyraux2s77nhjdwh9ar8rl9dt7zww8r6lne", marks=pytest.mark.altcoin, ), + pytest.param( + "Groestlcoin", + "84'/17'/0'/1/0", + messages.InputScriptType.SPENDWITNESS, + "grs1qzfpwn55tvkxcw0xwfa0g8k2gtlzlgkcq3z000e", + marks=pytest.mark.altcoin, + ), + pytest.param( + "Groestlcoin Testnet", + "86'/1'/0'/0/0", + messages.InputScriptType.SPENDTAPROOT, + "tgrs1pswrqtykue8r89t9u4rprjs0gt4qzkdfuursfnvqaa3f2yql07zmq5v2q7z", + marks=pytest.mark.altcoin, + ), + pytest.param( + "Groestlcoin", + "86'/17'/0'/0/0", + messages.InputScriptType.SPENDTAPROOT, + "grs1pnacleslusvh6gdjd3j2y5kv3drq09038sww2zx4za68jssndmu6qkm698g", + marks=pytest.mark.altcoin, + ), pytest.param( "Elements", "84'/1'/0'/0/0", diff --git a/tests/device_tests/bitcoin/test_grs.py b/tests/device_tests/bitcoin/test_grs.py index c00bd5b9c0..8f29cfb1f7 100644 --- a/tests/device_tests/bitcoin/test_grs.py +++ b/tests/device_tests/bitcoin/test_grs.py @@ -1,6 +1,6 @@ # This file is part of the Trezor project. # -# Copyright (C) 2012-2019 SatoshiLabs and contributors +# Copyright (C) 2012-2021 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 @@ -34,6 +34,9 @@ TXHASH_09a48b = bytes.fromhex( TXHASH_4f2f85 = bytes.fromhex( "4f2f857f39ed1afe05542d058fb0be865a387446e32fc876d086203f483f61d1" ) +TXHASH_f79cf5 = bytes.fromhex( + "f79cf536f6516fb2808b4728c403be98aebef49fec5ba206a0a397527214e929" +) pytestmark = pytest.mark.altcoin @@ -214,3 +217,27 @@ def test_send_segwit_native_change(client): serialized_tx.hex() == "01000000000101d1613f483f2086d076c82fe34674385a86beb08f052d5405fe1aed397f852f4f0000000000feffffff02404b4c000000000017a9147a55d61848e77ca266e79a39bfc85c580a6426c987a8386f0000000000160014cc8067093f6f843d6d3e22004a4290cd0c0f336b02483045022100ea8780bc1e60e14e945a80654a41748bbf1aa7d6f2e40a88d91dfc2de1f34bd10220181a474a3420444bd188501d8d270736e1e9fe379da9970de992ff445b0972e3012103adc58245cf28406af0ef5cc24b8afba7f1be6c72f279b642d85c48798685f862d9ed0900" ) + + +def test_send_p2tr(client): + inp1 = messages.TxInputType( + # tgrs1pswrqtykue8r89t9u4rprjs0gt4qzkdfuursfnvqaa3f2yql07zmq5v2q7z + address_n=parse_path("86'/1'/0'/0/0"), + amount=4600, + prev_hash=TXHASH_f79cf5, + prev_index=1, + script_type=messages.InputScriptType.SPENDTAPROOT, + ) + out1 = messages.TxOutputType( + # 86'/1'/1'/0/0 + address="tgrs1paxhjl357yzctuf3fe58fcdx6nul026hhh6kyldpfsf3tckj9a3wsvuqrgn", + amount=4450, + script_type=messages.OutputScriptType.PAYTOADDRESS, + ) + _, serialized_tx = btc.sign_tx( + client, "Groestlcoin Testnet", [inp1], [out1], prev_txes=TX_API_TESTNET + ) + assert ( + serialized_tx.hex() + == "0100000000010129e914725297a3a006a25bec9ff4beae98be03c428478b80b26f51f636f59cf70100000000ffffffff016211000000000000225120e9af2fc69e20b0be2629cd0e9c34da9f3ef56af7beac4fb4298262bc5a45ec5d01400925acfe20ef34929aab585d0fe0a9c1b11219c1fc512f56572a0201e38f3bc38721a6afc9e19801a5c5bc6e806e07a6fc7412b2fc863057f528e3003855491600000000" + )