1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-10 15:30:55 +00:00

fix(core): Use lowercase in the name coinjoin.

[no changelog]
This commit is contained in:
Andrew Kozlik 2023-01-11 18:03:23 +01:00 committed by matejcik
parent 5ef6c3975d
commit ab65b18b07
8 changed files with 24 additions and 34 deletions

View File

@ -262,8 +262,8 @@ async def handle_UnlockPath(ctx: wire.Context, msg: UnlockPath) -> protobuf.Mess
await confirm_action(
ctx,
"confirm_coinjoin_access",
title="CoinJoin account",
description="Do you want to allow access to your CoinJoin account?",
title="Coinjoin account",
description="Do you want to allow access to your coinjoin account?",
)
wire_types = (MessageType.GetAddress, MessageType.GetPublicKey, MessageType.SignTx)

View File

@ -86,4 +86,4 @@ async def authorize_coinjoin(
authorization.set(msg)
return Success(message="CoinJoin authorized")
return Success(message="Coinjoin authorized")

View File

@ -63,7 +63,7 @@ PATTERN_BIP49 = "m/49'/coin_type'/account'/change/address_index"
PATTERN_BIP84 = "m/84'/coin_type'/account'/change/address_index"
# BIP-86 for taproot: https://github.com/bitcoin/bips/blob/master/bip-0086.mediawiki
PATTERN_BIP86 = "m/86'/coin_type'/account'/change/address_index"
# SLIP-25 for CoinJoin: https://github.com/satoshilabs/slips/blob/master/slip-0025.md
# SLIP-25 for coinjoin: https://github.com/satoshilabs/slips/blob/master/slip-0025.md
# Only account=0 and script_type=1 are supported for now.
PATTERN_SLIP25_TAPROOT = "m/10025'/coin_type'/0'/1'/change/address_index"
PATTERN_SLIP25_TAPROOT_EXTERNAL = "m/10025'/coin_type'/0'/1'/0/address_index"
@ -298,7 +298,7 @@ def _get_unlock_schemas(
patterns = []
if SignTx.is_type_of(msg) or GetOwnershipProof.is_type_of(msg):
# SignTx and GetOwnershipProof need access to all SLIP-25 addresses
# to create CoinJoin outputs.
# to create coinjoin outputs.
patterns.append(PATTERN_SLIP25_TAPROOT)
else:
# In case of other messages like GetAddress or SignMessage there is

View File

@ -336,8 +336,8 @@ class BasicApprover(Approver):
class CoinJoinApprover(Approver):
# Minimum registrable output amount accepted by the CoinJoin coordinator.
# The CoinJoin request may specify an even lower amount.
# Minimum registrable output amount accepted by the coinjoin coordinator.
# The coinjoin request may specify an even lower amount.
MIN_REGISTRABLE_OUTPUT_AMOUNT = const(5000)
# Largest possible weight of an output supported by Trezor (P2TR or P2WSH).
@ -363,14 +363,14 @@ class CoinJoinApprover(Approver):
super().__init__(tx, coin)
if not tx.coinjoin_request:
raise DataError("Missing CoinJoin request.")
raise DataError("Missing coinjoin request.")
self.request = tx.coinjoin_request
self.authorization = authorization
self.coordination_fee_base = 0
# Begin hashing the CoinJoin request.
self.h_request = HashWriter(sha256(b"CJR1")) # "CJR1" = CoinJoin Request v1.
# Begin hashing the coinjoin request.
self.h_request = HashWriter(sha256(b"CJR1")) # "CJR1" = Coinjoin Request v1.
writers.write_bytes_prefixed(
self.h_request, authorization.params.coordinator.encode()
)
@ -428,9 +428,9 @@ class CoinJoinApprover(Approver):
def add_external_input(self, txi: TxInput) -> None:
super().add_external_input(txi)
# External inputs should always be verifiable in CoinJoin. This check
# External inputs should always be verifiable in coinjoin. This check
# is not critical for security, we are just being cautious, because
# CoinJoin is automated and this is not a very legitimate use-case.
# coinjoin is automated and this is not a very legitimate use-case.
if input_is_external_unverified(txi):
raise ProcessError("Unverifiable external input.")
@ -447,7 +447,7 @@ class CoinJoinApprover(Approver):
if not isinstance(tx_info.sig_hasher, BitcoinSigHasher):
raise ProcessError("Unexpected signature hasher.")
# Finish hashing the CoinJoin request.
# Finish hashing the coinjoin request.
writers.write_bytes_fixed(
self.h_request, tx_info.sig_hasher.h_prevouts.get_digest(), 32
)
@ -455,7 +455,7 @@ class CoinJoinApprover(Approver):
self.h_request, tx_info.sig_hasher.h_outputs.get_digest(), 32
)
# Verify the CoinJoin request signature.
# Verify the coinjoin request signature.
if __debug__ or self.coin.slip44 == SLIP44_TESTNET:
if secp256k1.verify(
self.COINJOIN_REQ_PUBKEY_TEST,
@ -476,7 +476,7 @@ class CoinJoinApprover(Approver):
await super().approve_tx(tx_info, orig_txs)
if not self._verify_coinjoin_request(tx_info):
raise DataError("Invalid signature in CoinJoin request.")
raise DataError("Invalid signature in coinjoin request.")
# The mining fee of the transaction as a whole.
mining_fee = self.total_in - self.total_out
@ -508,7 +508,7 @@ class CoinJoinApprover(Approver):
self.weight.get_weight() - self.weight.get_base_weight()
)
# Calculate the minimum registrable output amount in a CoinJoin plus the mining fee that it
# Calculate the minimum registrable output amount in a coinjoin plus the mining fee that it
# would cost to register. Amounts below this value are left to the coordinator or miners
# and effectively constitute an extra fee for the user.
min_allowed_output_amount_plus_fee = (
@ -524,7 +524,7 @@ class CoinJoinApprover(Approver):
raise ProcessError("Total fee over threshold.")
if not self.authorization.approve_sign_tx(tx_info.tx):
raise ProcessError("Exceeded number of CoinJoin rounds.")
raise ProcessError("Exceeded number of coinjoin rounds.")
def _add_output(self, txo: TxOutput, script_pubkey: bytes) -> None:
super()._add_output(txo, script_pubkey)

View File

@ -998,16 +998,6 @@ async def confirm_coinjoin(
)
def show_coinjoin() -> None:
draw_simple(
trezorui2.show_info(
title="CoinJoin in progress.",
description="Do not disconnect your Trezor.",
button="",
)
)
# TODO cleanup @ redesign
async def confirm_sign_identity(
ctx: GenericContext, proto: str, identity: str, challenge_visual: str | None

View File

@ -116,7 +116,7 @@ class Busyscreen(HomescreenBase):
super().__init__(
layout=trezorui2.show_busyscreen(
title="PLEASE WAIT",
description="CoinJoin in progress.\n\nDo not disconnect your\nTrezor.",
description="Coinjoin in progress.\n\nDo not disconnect your\nTrezor.",
time_ms=delay_ms,
skip_first_paint=skip,
)

View File

@ -240,7 +240,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="Exceeded number of coinjoin rounds"):
btc.sign_tx(
client,
"Testnet",

View File

@ -628,12 +628,12 @@
"TT_binance-test_sign_tx.py::test_binance_sign_message[message1-expected_response1]": "4f5881a2edea4b9b79f997f26bc95d4202abb3838a819159018a728f33f23910",
"TT_binance-test_sign_tx.py::test_binance_sign_message[message2-expected_response2]": "a81ef73007d6d998b34662d6f1e67e7241a5289f61487f80260a7926ab5e9615",
"TT_bitcoin-test_authorize_coinjoin.py::test_cancel_authorization": "d74994a3bc389bdbbcc83233c33f4c6f8a588a33348ea50dd9bd817f33c54fbc",
"TT_bitcoin-test_authorize_coinjoin.py::test_get_address": "944b727d34029ca763dc3358c0d9d453bf42e2e1e17518a614f2e1f2fb489ba2",
"TT_bitcoin-test_authorize_coinjoin.py::test_get_public_key": "4aee7552e2373e5e58eee5fcc92d386f0b9282add3bf0e0fc64ad7dca3f57d78",
"TT_bitcoin-test_authorize_coinjoin.py::test_get_address": "d2fb3ada8f5c4b0beaca2599bd71af46619bb4e671a60850042284c63273a280",
"TT_bitcoin-test_authorize_coinjoin.py::test_get_public_key": "06f25a1049ec44afc938d7e4df906339d6d5f140e0bac1a7a4a14335c8f1bc65",
"TT_bitcoin-test_authorize_coinjoin.py::test_multisession_authorization": "9c69ab1147927a30babba4cad51cb277e44684ab80d7089033c217b1515a65ea",
"TT_bitcoin-test_authorize_coinjoin.py::test_sign_tx": "94e231b0c404623f44be12a49ed5d2cf7bbd88ddf5f7330100a743b80d894401",
"TT_bitcoin-test_authorize_coinjoin.py::test_sign_tx_large": "d357dd9007639568e02b884bf0b24f9fff85c66212715ce2bddbb62995313109",
"TT_bitcoin-test_authorize_coinjoin.py::test_sign_tx_spend": "0b7b9b8293b903c7f03f37eb92db05b801dd6b711d669a099ba285b17fbea8a8",
"TT_bitcoin-test_authorize_coinjoin.py::test_sign_tx_spend": "e5f42b4435cf4a6cd81dc00a1e652bf52e8ec4e82d9119c0f2c053bb33bbf0cb",
"TT_bitcoin-test_authorize_coinjoin.py::test_wrong_account_type": "d74994a3bc389bdbbcc83233c33f4c6f8a588a33348ea50dd9bd817f33c54fbc",
"TT_bitcoin-test_authorize_coinjoin.py::test_wrong_coordinator": "d74994a3bc389bdbbcc83233c33f4c6f8a588a33348ea50dd9bd817f33c54fbc",
"TT_bitcoin-test_bcash.py::test_attack_change_input": "5278b9863db3ff62a47afcee59dfea954888ef5ffd0e5f7a2ed4a4e1da2d6534",
@ -1581,8 +1581,8 @@
"TT_test_basic.py::test_device_id_same": "72d6d1cdc13cd36c83c4e6dff0e1533515be8fe181a3305a29cd88a18fbaf4ba",
"TT_test_basic.py::test_features": "72d6d1cdc13cd36c83c4e6dff0e1533515be8fe181a3305a29cd88a18fbaf4ba",
"TT_test_basic.py::test_ping": "72d6d1cdc13cd36c83c4e6dff0e1533515be8fe181a3305a29cd88a18fbaf4ba",
"TT_test_busy_state.py::test_busy_expiry": "9521e6a76f75598221324d6beb23eeabfb57cc6f8c859e16edaa46311ce4dc12",
"TT_test_busy_state.py::test_busy_state": "0abc314db72d2fbcae5975453e38b455b1cfded5c69a1ad9c52b0b3c09961d25",
"TT_test_busy_state.py::test_busy_expiry": "dcb7bf38a2f4fdf6c19a27e84d8019411ad3e69c6e5199eeb438c6e1560a6109",
"TT_test_busy_state.py::test_busy_state": "1da5a5163ada64911d61459cb768253aa0bca627ff38afc73cbf06405825b585",
"TT_test_cancel.py::test_cancel_message_via_cancel[message0]": "2a894da9d3fcbecfb4839dad5be4b3b4274f47564ff4a9d4c8f66cbac45bbb19",
"TT_test_cancel.py::test_cancel_message_via_cancel[message1]": "2a894da9d3fcbecfb4839dad5be4b3b4274f47564ff4a9d4c8f66cbac45bbb19",
"TT_test_cancel.py::test_cancel_message_via_initialize[message0]": "2a894da9d3fcbecfb4839dad5be4b3b4274f47564ff4a9d4c8f66cbac45bbb19",