From 9db9d3ac40e9e0ceb971f85470b2d29cf38d01d0 Mon Sep 17 00:00:00 2001 From: Tomas Krnak Date: Sat, 17 Dec 2022 18:20:42 +0700 Subject: [PATCH] style: make style, fix a typo --- core/src/apps/zcash/get_address.py | 30 +++++++++++++++++---------- core/src/apps/zcash/orchard/signer.py | 4 ++-- core/src/trezor/crypto/pallas.py | 1 + python/src/trezorlib/zcash.py | 2 +- 4 files changed, 23 insertions(+), 14 deletions(-) diff --git a/core/src/apps/zcash/get_address.py b/core/src/apps/zcash/get_address.py index 869d10cf72..9050c6cbe4 100644 --- a/core/src/apps/zcash/get_address.py +++ b/core/src/apps/zcash/get_address.py @@ -45,9 +45,9 @@ async def get_address(ctx: Context, msg: ZcashGetAddress) -> ZcashAddress: title = address_n_to_str(msg.z_address_n) address = encode_address(receivers, coin) elif ( # transparent + shielded, unified path - PathSchema.parse(PATTERN_BIP44, coin.slip44).match(msg.t_address_n) and - PathSchema.parse(PATTERN_ZIP32, coin.slip44).match(msg.z_address_n) and - msg.t_address_n[2] == msg.z_address_n[2] + msg.t_address_n[2] == msg.z_address_n[2] # spending from same account + and PathSchema.parse(PATTERN_BIP44, coin.slip44).match(msg.t_address_n) + and PathSchema.parse(PATTERN_ZIP32, coin.slip44).match(msg.z_address_n) ): title = "u/{coin_type}/{account}/{receivers}".format( 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) else: # transparent + shielded, incompatible paths title = "Unified address" - address_extra = "\n".join(( - "Receivers:", - "- transparent", - address_n_to_str(msg.t_address_n), - "- Orchard", - address_n_to_str(msg.z_address_n), - )) + address_extra = "\n".join( + ( + "Receivers:", + "- transparent", + address_n_to_str(msg.t_address_n), + "- Orchard", + address_n_to_str(msg.z_address_n), + ) + ) address = encode_address(receivers, coin) 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) diff --git a/core/src/apps/zcash/orchard/signer.py b/core/src/apps/zcash/orchard/signer.py index ccdfb935f6..ba767a7843 100644 --- a/core/src/apps/zcash/orchard/signer.py +++ b/core/src/apps/zcash/orchard/signer.py @@ -88,8 +88,8 @@ class OrchardSigner: # Constant MAX_SILENT_ORCHARD_INPUTS is chosen heruistically. # According to the article, shielded transaction with >10 inputs # 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: yield ConfirmOrchardInputsCountOverThreshold(self.params.inputs_count) diff --git a/core/src/trezor/crypto/pallas.py b/core/src/trezor/crypto/pallas.py index 3d78fa7ba9..39fb84bc93 100644 --- a/core/src/trezor/crypto/pallas.py +++ b/core/src/trezor/crypto/pallas.py @@ -13,4 +13,5 @@ if utils.ZCASH_SHIELDED: to_scalar, Generators, ) + generators = Generators() # init generators diff --git a/python/src/trezorlib/zcash.py b/python/src/trezorlib/zcash.py index 75ce41e83d..2973977f2c 100644 --- a/python/src/trezorlib/zcash.py +++ b/python/src/trezorlib/zcash.py @@ -122,7 +122,7 @@ def sign_tx( o_outputs = [x for x in outputs if isinstance(x, messages.ZcashOrchardOutput)] 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 z_address_n is None: raise ValueError("z_address_n argument is missing")