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

feat(core): Remove authorization when rounds are depleted.

[no changelog]
This commit is contained in:
Andrew Kozlik 2023-01-05 10:32:11 +01:00 committed by matejcik
parent a3149bcf97
commit 4372d19ceb
4 changed files with 20 additions and 13 deletions

View File

@ -56,7 +56,11 @@ class CoinJoinAuthorization:
return False
params.max_rounds -= 1
authorization.set(params)
if params.max_rounds >= 1:
authorization.set(params)
else:
authorization.clear()
return True

View File

@ -39,6 +39,9 @@ async def authorize_coinjoin(
):
raise DataError("Invalid coordinator name.")
if msg.max_rounds < 1:
raise DataError("Invalid number of rounds.")
if msg.max_rounds > _MAX_ROUNDS and safety_checks_is_strict:
raise DataError("The number of rounds is unexpectedly large.")

View File

@ -250,7 +250,7 @@ def test_sign_tx(client: Client):
)
# Test for a third time, number of rounds should be exceeded.
with pytest.raises(TrezorFailure, match="Exceeded number of coinjoin rounds"):
with pytest.raises(TrezorFailure, match="No preauthorized operation"):
btc.sign_tx(
client,
"Testnet",

View File

@ -1,16 +1,16 @@
{
"T1": {
"device_tests": {
"T1_bitcoin-test_authorize_coinjoin.py::test_cancel_authorization": "60e18060db1756fd0199dd381b41c4b20da89ed1acfe3e1378e2f511d97732bf",
"T1_bitcoin-test_authorize_coinjoin.py::test_get_address": "402c3f89f6ad5fd3bc78f804b376c36c918fc685cc2c77b38c6ae030af738d22",
"T1_bitcoin-test_authorize_coinjoin.py::test_get_public_key": "9b3c916759b79048a4ab3e3fe8ce0ea0cf8d4ae6cfb66a5d712f21edfdb01782",
"T1_bitcoin-test_authorize_coinjoin.py::test_multisession_authorization": "d2ac218c6bc361f732a65daee2ae7183ca935a7b246545ebe6346dbd33d0a702",
"T1_bitcoin-test_authorize_coinjoin.py::test_sign_tx": "f630f414daeeb8e0aa3d01ed38a512cb9bfb83abd0c022e01dd02d6824ade61d",
"T1_bitcoin-test_authorize_coinjoin.py::test_sign_tx_large": "4365228d89327c72b2d0fa4d487fb28c19ed832e94d8c0c71db83b060c06074a",
"T1_bitcoin-test_authorize_coinjoin.py::test_sign_tx_migration": "6aa2d358998e2297b7995c260bf7ee1245c8a10242fe50c9ce96784dc8aa7b79",
"T1_bitcoin-test_authorize_coinjoin.py::test_sign_tx_spend": "edeb75022cc6bff15d1274ba9bac4cf41dd8ea5771436010ae07fd441dc73b69",
"T1_bitcoin-test_authorize_coinjoin.py::test_wrong_account_type": "60e18060db1756fd0199dd381b41c4b20da89ed1acfe3e1378e2f511d97732bf",
"T1_bitcoin-test_authorize_coinjoin.py::test_wrong_coordinator": "60e18060db1756fd0199dd381b41c4b20da89ed1acfe3e1378e2f511d97732bf",
"T1_bitcoin-test_authorize_coinjoin.py::test_cancel_authorization": "84d5223f94a7a31dc23d278121c4829f446611582065a67673be3b7d6a5b1274",
"T1_bitcoin-test_authorize_coinjoin.py::test_get_address": "de722e195777717f2e35233a5124765794a75ed46de5c35cae362f6c6218c04a",
"T1_bitcoin-test_authorize_coinjoin.py::test_get_public_key": "1257ec89d4620ed9f34c986cd925717676c9b1e9e143e040c33f1a88d1f8c8a7",
"T1_bitcoin-test_authorize_coinjoin.py::test_multisession_authorization": "5628b8419edd4c5211aab8af46f146542c605e8e24e6cd79ef0d3b378c98982a",
"T1_bitcoin-test_authorize_coinjoin.py::test_sign_tx": "0ffc9ee5242b69975c12aa901d47dc80e44c2bbc42f98e12bf35d36adbca70b7",
"T1_bitcoin-test_authorize_coinjoin.py::test_sign_tx_large": "39ce1d721b7516f90c027c8abf28ebad28dce18b82618764624c93a5e2bf1736",
"T1_bitcoin-test_authorize_coinjoin.py::test_sign_tx_migration": "8ffec72e7a13934583ec68257e60dd707c6c33f6f62b8d8cdb81168795446ff3",
"T1_bitcoin-test_authorize_coinjoin.py::test_sign_tx_spend": "dd06d17f855486ae857c7d26e19f738e0743cabd2c88d6aad23e5aead1e51ba8",
"T1_bitcoin-test_authorize_coinjoin.py::test_wrong_account_type": "84d5223f94a7a31dc23d278121c4829f446611582065a67673be3b7d6a5b1274",
"T1_bitcoin-test_authorize_coinjoin.py::test_wrong_coordinator": "84d5223f94a7a31dc23d278121c4829f446611582065a67673be3b7d6a5b1274",
"T1_bitcoin-test_bcash.py::test_attack_change_input": "6111e313995d38c3970c92e48047fe4088c83666c64c6c859f69a232ad62829b",
"T1_bitcoin-test_bcash.py::test_send_bch_change": "6111e313995d38c3970c92e48047fe4088c83666c64c6c859f69a232ad62829b",
"T1_bitcoin-test_bcash.py::test_send_bch_multisig_change": "0962a2e630e06b6d20282cc241be40f41bc1648d0a26247c7c008f32a197d0cb",
@ -680,7 +680,7 @@
"TT_bitcoin-test_authorize_coinjoin.py::test_get_address": "eda238e95c759391b5cd746720f2319f4f5b0b23327909457c79d0735eaa002d",
"TT_bitcoin-test_authorize_coinjoin.py::test_get_public_key": "a29b9f19da5cb70a24c2cc89a8c8425d9f085a1f614affdacde891a531180223",
"TT_bitcoin-test_authorize_coinjoin.py::test_multisession_authorization": "ba3ceb1ebc867d4be866a84714e78581563c0d6d185a20d1e154a4be70e4432c",
"TT_bitcoin-test_authorize_coinjoin.py::test_sign_tx": "70223a1375d75eb940c59435c830bb7117c2af439467c26881bea0343ca15c84",
"TT_bitcoin-test_authorize_coinjoin.py::test_sign_tx": "e7de0c58771e783bb71058b86760259143fd0fc8f6fb3e1ba9b9f18578972ed6",
"TT_bitcoin-test_authorize_coinjoin.py::test_sign_tx_large": "8954120be7d17be42e0ac881c728fdfe79b7512e1d8744272751215f2502375e",
"TT_bitcoin-test_authorize_coinjoin.py::test_sign_tx_migration": "8fa348051144e983e90c118cb26bc2c6a332650b5ff78cea910ed5ee162eb921",
"TT_bitcoin-test_authorize_coinjoin.py::test_sign_tx_spend": "cd668beb0174f9142b78fb1573611c46669b066d84f1a09e7d3d0f99687883bf",