1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-07-30 10:28:14 +00:00

style: make style, fix a typo

This commit is contained in:
Tomas Krnak 2022-12-17 18:20:42 +07:00
parent 4e8dcfff80
commit 9db9d3ac40
4 changed files with 23 additions and 14 deletions

View File

@ -45,9 +45,9 @@ async def get_address(ctx: Context, msg: ZcashGetAddress) -> ZcashAddress:
title = address_n_to_str(msg.z_address_n) title = address_n_to_str(msg.z_address_n)
address = encode_address(receivers, coin) address = encode_address(receivers, coin)
elif ( # transparent + shielded, unified path elif ( # transparent + shielded, unified path
PathSchema.parse(PATTERN_BIP44, coin.slip44).match(msg.t_address_n) and msg.t_address_n[2] == msg.z_address_n[2] # spending from same account
PathSchema.parse(PATTERN_ZIP32, coin.slip44).match(msg.z_address_n) and and PathSchema.parse(PATTERN_BIP44, coin.slip44).match(msg.t_address_n)
msg.t_address_n[2] == msg.z_address_n[2] and PathSchema.parse(PATTERN_ZIP32, coin.slip44).match(msg.z_address_n)
): ):
title = "u/{coin_type}/{account}/{receivers}".format( title = "u/{coin_type}/{account}/{receivers}".format(
coin_type=msg.z_address_n[1] ^ HARDENED, coin_type=msg.z_address_n[1] ^ HARDENED,
@ -57,17 +57,25 @@ async def get_address(ctx: Context, msg: ZcashGetAddress) -> ZcashAddress:
address = encode_address(receivers, coin) address = encode_address(receivers, coin)
else: # transparent + shielded, incompatible paths else: # transparent + shielded, incompatible paths
title = "Unified address" title = "Unified address"
address_extra = "\n".join(( address_extra = "\n".join(
"Receivers:", (
"- transparent", "Receivers:",
address_n_to_str(msg.t_address_n), "- transparent",
"- Orchard", address_n_to_str(msg.t_address_n),
address_n_to_str(msg.z_address_n), "- Orchard",
)) address_n_to_str(msg.z_address_n),
)
)
address = encode_address(receivers, coin) address = encode_address(receivers, coin)
if msg.show_display: if msg.show_display:
await show_address(ctx, address=address, address_qr=address, title=title, address_extra=address_extra) await show_address(
ctx,
address=address,
address_qr=address,
title=title,
address_extra=address_extra,
)
return ZcashAddress(address=address) return ZcashAddress(address=address)

View File

@ -88,8 +88,8 @@ class OrchardSigner:
# Constant MAX_SILENT_ORCHARD_INPUTS is chosen heruistically. # Constant MAX_SILENT_ORCHARD_INPUTS is chosen heruistically.
# According to the article, shielded transaction with >10 inputs # According to the article, shielded transaction with >10 inputs
# are quite unordinary and thus linkable. # are quite unordinary and thus linkable.
# #
# Since this attack is not severe, we don't abort. # Since this attack is not severe, we don't abort.
if self.params.inputs_count > MAX_SILENT_ORCHARD_INPUTS: if self.params.inputs_count > MAX_SILENT_ORCHARD_INPUTS:
yield ConfirmOrchardInputsCountOverThreshold(self.params.inputs_count) yield ConfirmOrchardInputsCountOverThreshold(self.params.inputs_count)

View File

@ -13,4 +13,5 @@ if utils.ZCASH_SHIELDED:
to_scalar, to_scalar,
Generators, Generators,
) )
generators = Generators() # init generators generators = Generators() # init generators

View File

@ -122,7 +122,7 @@ def sign_tx(
o_outputs = [x for x in outputs if isinstance(x, messages.ZcashOrchardOutput)] o_outputs = [x for x in outputs if isinstance(x, messages.ZcashOrchardOutput)]
if o_inputs and t_inputs: if o_inputs and t_inputs:
raise ValueError("Spending transparent and Orchard funds simultaniously is not supported.") raise ValueError("Spending transparent and Orchard funds simultaneously is not supported.")
if o_inputs or o_outputs: if o_inputs or o_outputs:
if z_address_n is None: if z_address_n is None:
raise ValueError("z_address_n argument is missing") raise ValueError("z_address_n argument is missing")