mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-17 13:12:05 +00:00
chore(tests): re-run black and isort on core/tests
isort set to skip the first necessary "from common import *" line. A better solution would be to get rid of the need of this import in the future. [no changelog]
This commit is contained in:
parent
dd38aff8e2
commit
e073e619c9
@ -1,5 +1,4 @@
|
||||
import storage.common
|
||||
|
||||
from mock import patch
|
||||
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
import utime
|
||||
|
||||
import trezorio as io
|
||||
import trezorui as ui
|
||||
import utime
|
||||
|
||||
usb_vcp = io.VCP(
|
||||
iface_num=0x00,
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor.crypto.curve import secp256k1
|
||||
|
||||
|
@ -1,16 +1,19 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor.crypto.curve import secp256k1
|
||||
from trezor.crypto.hashlib import sha256
|
||||
|
||||
if not utils.BITCOIN_ONLY:
|
||||
from trezor.messages import (
|
||||
BinanceCancelMsg,
|
||||
BinanceCoin,
|
||||
BinanceInputOutput,
|
||||
BinanceOrderMsg,
|
||||
BinanceSignTx,
|
||||
BinanceTransferMsg,
|
||||
)
|
||||
|
||||
from apps.binance.helpers import produce_json_for_signing
|
||||
from trezor.messages import BinanceCancelMsg
|
||||
from trezor.messages import BinanceCoin
|
||||
from trezor.messages import BinanceInputOutput
|
||||
from trezor.messages import BinanceOrderMsg
|
||||
from trezor.messages import BinanceSignTx
|
||||
from trezor.messages import BinanceTransferMsg
|
||||
|
||||
|
||||
# NOTE: copy-pasted from apps.binance.sign_tx
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor import wire
|
||||
from trezor.crypto import bip32, bip39
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor.crypto import bip32, bip39
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import H_, await_result, unittest
|
||||
from common import H_, await_result, unittest # isort:skip
|
||||
|
||||
import storage.cache
|
||||
from trezor import wire
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import H_, unittest
|
||||
from common import H_, unittest # isort:skip
|
||||
|
||||
import storage.cache
|
||||
from trezor.enums import InputScriptType
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from storage import cache
|
||||
from trezor import wire
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import unhexlify, unittest
|
||||
from common import unhexlify, unittest # isort:skip
|
||||
|
||||
from trezor.crypto import bip39
|
||||
from trezor.enums import InputScriptType
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor.crypto import bip39
|
||||
from trezor.enums import InputScriptType, OutputScriptType
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor.crypto import bip39
|
||||
from trezor.enums import InputScriptType, OutputScriptType
|
||||
|
@ -1,12 +1,12 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor.enums import InputScriptType
|
||||
from trezor.messages import PrevOutput, SignTx, TxInput
|
||||
|
||||
from apps.bitcoin.common import SigHashType
|
||||
from apps.bitcoin.sign_tx.sig_hasher import BitcoinSigHasher
|
||||
from apps.bitcoin.writers import get_tx_hash
|
||||
|
||||
from trezor.enums import InputScriptType
|
||||
from trezor.messages import PrevOutput, SignTx, TxInput
|
||||
|
||||
VECTORS = [
|
||||
{ # https://github.com/bitcoin/bips/pull/1225/commits/f7af1f73b287c14cf2f63afcb8d199feaf6ab5e1
|
||||
"sign_tx": SignTx(
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor import wire
|
||||
from trezor.crypto import bip39
|
||||
@ -112,7 +112,6 @@ class TestSignSegwitTxNativeP2WPKH(unittest.TestCase):
|
||||
serialized=EMPTY_SERIALIZED,
|
||||
),
|
||||
TxAckOutput(tx=TxAckOutputWrapper(output=out1)),
|
||||
|
||||
helpers.UiConfirmOutput(out1, coin, AmountUnit.BITCOIN, 0, False),
|
||||
True,
|
||||
TxRequest(
|
||||
@ -121,7 +120,6 @@ class TestSignSegwitTxNativeP2WPKH(unittest.TestCase):
|
||||
serialized=EMPTY_SERIALIZED,
|
||||
),
|
||||
TxAckOutput(tx=TxAckOutputWrapper(output=out2)),
|
||||
|
||||
helpers.UiConfirmOutput(out2, coin, AmountUnit.BITCOIN, 1, False),
|
||||
True,
|
||||
helpers.UiConfirmTotal(
|
||||
@ -311,7 +309,6 @@ class TestSignSegwitTxNativeP2WPKH(unittest.TestCase):
|
||||
serialized=EMPTY_SERIALIZED,
|
||||
),
|
||||
TxAckOutput(tx=TxAckOutputWrapper(output=out1)),
|
||||
|
||||
helpers.UiConfirmOutput(out1, coin, AmountUnit.BITCOIN, 0, False),
|
||||
True,
|
||||
TxRequest(
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor.crypto import bip39
|
||||
from trezor.enums import AmountUnit, InputScriptType, OutputScriptType
|
||||
@ -123,7 +123,6 @@ class TestSignSegwitTxNativeP2WPKH_GRS(unittest.TestCase):
|
||||
serialized=EMPTY_SERIALIZED,
|
||||
),
|
||||
TxAckOutput(tx=TxAckOutputWrapper(output=out1)),
|
||||
|
||||
helpers.UiConfirmOutput(out1, coin, AmountUnit.BITCOIN, 0, False),
|
||||
True,
|
||||
TxRequest(
|
||||
@ -132,7 +131,6 @@ class TestSignSegwitTxNativeP2WPKH_GRS(unittest.TestCase):
|
||||
serialized=EMPTY_SERIALIZED,
|
||||
),
|
||||
TxAckOutput(tx=TxAckOutputWrapper(output=out2)),
|
||||
|
||||
helpers.UiConfirmOutput(out2, coin, AmountUnit.BITCOIN, 1, False),
|
||||
True,
|
||||
helpers.UiConfirmNonDefaultLocktime(tx.lock_time, lock_time_disabled=False),
|
||||
@ -334,7 +332,6 @@ class TestSignSegwitTxNativeP2WPKH_GRS(unittest.TestCase):
|
||||
serialized=EMPTY_SERIALIZED,
|
||||
),
|
||||
TxAckOutput(tx=TxAckOutputWrapper(output=out1)),
|
||||
|
||||
helpers.UiConfirmOutput(out1, coin, AmountUnit.BITCOIN, 0, False),
|
||||
True,
|
||||
TxRequest(
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor import wire
|
||||
from trezor.crypto import bip39
|
||||
@ -114,7 +114,6 @@ class TestSignSegwitTxP2WPKHInP2SH(unittest.TestCase):
|
||||
serialized=EMPTY_SERIALIZED,
|
||||
),
|
||||
TxAckOutput(tx=TxAckOutputWrapper(output=out1)),
|
||||
|
||||
helpers.UiConfirmOutput(out1, coin, AmountUnit.BITCOIN, 0, False),
|
||||
True,
|
||||
TxRequest(
|
||||
@ -123,7 +122,6 @@ class TestSignSegwitTxP2WPKHInP2SH(unittest.TestCase):
|
||||
serialized=EMPTY_SERIALIZED,
|
||||
),
|
||||
TxAckOutput(tx=TxAckOutputWrapper(output=out2)),
|
||||
|
||||
helpers.UiConfirmOutput(out2, coin, AmountUnit.BITCOIN, 1, False),
|
||||
True,
|
||||
helpers.UiConfirmTotal(
|
||||
@ -319,7 +317,6 @@ class TestSignSegwitTxP2WPKHInP2SH(unittest.TestCase):
|
||||
serialized=EMPTY_SERIALIZED,
|
||||
),
|
||||
TxAckOutput(tx=TxAckOutputWrapper(output=out1)),
|
||||
|
||||
helpers.UiConfirmOutput(out1, coin, AmountUnit.BITCOIN, 0, False),
|
||||
True,
|
||||
TxRequest(
|
||||
@ -534,7 +531,6 @@ class TestSignSegwitTxP2WPKHInP2SH(unittest.TestCase):
|
||||
serialized=EMPTY_SERIALIZED,
|
||||
),
|
||||
TxAckOutput(tx=TxAckOutputWrapper(output=out1)),
|
||||
|
||||
helpers.UiConfirmOutput(out1, coin, AmountUnit.BITCOIN, 0, False),
|
||||
True,
|
||||
TxRequest(
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor.crypto import bip39
|
||||
from trezor.enums import AmountUnit, InputScriptType, OutputScriptType
|
||||
@ -123,7 +123,6 @@ class TestSignSegwitTxP2WPKHInP2SH_GRS(unittest.TestCase):
|
||||
serialized=EMPTY_SERIALIZED,
|
||||
),
|
||||
TxAckOutput(tx=TxAckOutputWrapper(output=out1)),
|
||||
|
||||
helpers.UiConfirmOutput(out1, coin, AmountUnit.BITCOIN, 0, False),
|
||||
True,
|
||||
TxRequest(
|
||||
@ -132,7 +131,6 @@ class TestSignSegwitTxP2WPKHInP2SH_GRS(unittest.TestCase):
|
||||
serialized=EMPTY_SERIALIZED,
|
||||
),
|
||||
TxAckOutput(tx=TxAckOutputWrapper(output=out2)),
|
||||
|
||||
helpers.UiConfirmOutput(out2, coin, AmountUnit.BITCOIN, 1, False),
|
||||
True,
|
||||
helpers.UiConfirmNonDefaultLocktime(tx.lock_time, lock_time_disabled=False),
|
||||
@ -338,7 +336,6 @@ class TestSignSegwitTxP2WPKHInP2SH_GRS(unittest.TestCase):
|
||||
serialized=EMPTY_SERIALIZED,
|
||||
),
|
||||
TxAckOutput(tx=TxAckOutputWrapper(output=out1)),
|
||||
|
||||
helpers.UiConfirmOutput(out1, coin, AmountUnit.BITCOIN, 0, False),
|
||||
True,
|
||||
TxRequest(
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor.enums import InputScriptType
|
||||
from trezor.messages import TxInput
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor.crypto import bip39
|
||||
from trezor.enums import AmountUnit, OutputScriptType
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from apps.bitcoin.sign_tx.omni import is_valid, parse
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor.crypto import bip39
|
||||
from trezor.enums import AmountUnit, OutputScriptType
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor.crypto import bip39
|
||||
from trezor.enums import AmountUnit, OutputScriptType
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor.crypto import bip39
|
||||
from trezor.enums import AmountUnit, OutputScriptType
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor.crypto import bip39
|
||||
from trezor.enums import OutputScriptType
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor.enums import InputScriptType
|
||||
from trezor.messages import PrevOutput, SignTx, TxInput
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor import wire
|
||||
from trezor.crypto import cardano, slip39
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from apps.cardano.helpers import bech32
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor import wire
|
||||
from trezor.enums import CardanoCertificateType
|
||||
@ -8,7 +8,7 @@ from apps.common.paths import HARDENED
|
||||
|
||||
if not utils.BITCOIN_ONLY:
|
||||
from apps.cardano import certificates
|
||||
from apps.cardano.helpers import protocol_magics, network_ids
|
||||
from apps.cardano.helpers import network_ids, protocol_magics
|
||||
from apps.cardano.helpers.account_path_check import AccountPathChecker
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor.enums import CardanoAddressType
|
||||
from trezor.messages import CardanoAddressParametersType, CardanoBlockchainPointerType
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor.crypto import cardano, slip39
|
||||
|
||||
|
@ -1,17 +1,16 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor import wire
|
||||
from trezor.crypto import cardano
|
||||
from trezor.enums import CardanoNativeScriptType
|
||||
from trezor.messages import CardanoNativeScript
|
||||
|
||||
|
||||
if not utils.BITCOIN_ONLY:
|
||||
from apps.cardano.seed import Keychain
|
||||
from apps.cardano.native_script import (
|
||||
get_native_script_hash,
|
||||
validate_native_script,
|
||||
)
|
||||
from apps.cardano.seed import Keychain
|
||||
|
||||
VALID_NATIVE_SCRIPTS = [
|
||||
# PUB_KEY
|
||||
|
@ -1,12 +1,12 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor.crypto import cardano
|
||||
|
||||
from apps.common.paths import HARDENED
|
||||
|
||||
if not utils.BITCOIN_ONLY:
|
||||
from apps.cardano.seed import Keychain
|
||||
from apps.cardano.get_public_key import _get_public_key
|
||||
from apps.cardano.seed import Keychain
|
||||
|
||||
|
||||
@unittest.skipUnless(not utils.BITCOIN_ONLY, "altcoin")
|
||||
|
@ -1,9 +1,9 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
if not utils.BITCOIN_ONLY:
|
||||
from apps.cardano.helpers.utils import (
|
||||
variable_length_encode,
|
||||
format_asset_fingerprint,
|
||||
variable_length_encode,
|
||||
)
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from apps.common.cbor import (
|
||||
IndefiniteLengthArray,
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from apps.common import coins
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from mock_storage import mock_storage
|
||||
from storage import cache
|
||||
from trezor import wire
|
||||
from trezor.crypto import bip39
|
||||
@ -8,7 +9,6 @@ from trezor.enums import SafetyCheckLevel
|
||||
from apps.common import safety_checks
|
||||
from apps.common.keychain import Keychain, LRUCache, get_keychain, with_slip44_keychain
|
||||
from apps.common.paths import PATTERN_SEP5, PathSchema
|
||||
from mock_storage import mock_storage
|
||||
|
||||
|
||||
class TestKeychain(unittest.TestCase):
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor.utils import ensure
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor import wire
|
||||
from trezor.crypto import bip39
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
import apps.common.writers as writers
|
||||
|
||||
|
@ -1,9 +1,10 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
if not utils.BITCOIN_ONLY:
|
||||
from apps.eos.actions import _check_action
|
||||
from trezor.messages import EosTxActionAck
|
||||
|
||||
from apps.eos.actions import _check_action
|
||||
|
||||
|
||||
@unittest.skipUnless(not utils.BITCOIN_ONLY, "altcoin")
|
||||
class TestEosActions(unittest.TestCase):
|
||||
|
@ -1,9 +1,10 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
if not utils.BITCOIN_ONLY:
|
||||
from apps.eos import helpers
|
||||
from trezor.messages import EosAsset
|
||||
|
||||
from apps.eos import helpers
|
||||
|
||||
|
||||
@unittest.skipUnless(not utils.BITCOIN_ONLY, "altcoin")
|
||||
class TestEosConversions(unittest.TestCase):
|
||||
|
@ -1,9 +1,8 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor.crypto import bip32, bip39
|
||||
from trezor.crypto.curve import secp256k1
|
||||
|
||||
|
||||
if not utils.BITCOIN_ONLY:
|
||||
from apps.eos.helpers import public_key_to_wif
|
||||
|
||||
|
@ -1,21 +1,18 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
import typing as t
|
||||
import unittest
|
||||
|
||||
from trezor import utils, wire
|
||||
|
||||
|
||||
if not utils.BITCOIN_ONLY:
|
||||
|
||||
from apps.ethereum import networks, tokens
|
||||
from apps.ethereum.definitions import decode_definition, Definitions
|
||||
from ethereum_common import *
|
||||
from trezor.enums import EthereumDefinitionType
|
||||
from trezor.messages import (
|
||||
EthereumNetworkInfo,
|
||||
EthereumTokenInfo,
|
||||
)
|
||||
from trezor.messages import EthereumNetworkInfo, EthereumTokenInfo
|
||||
|
||||
from apps.ethereum import networks, tokens
|
||||
from apps.ethereum.definitions import Definitions, decode_definition
|
||||
|
||||
TETHER_ADDRESS = b"\xda\xc1\x7f\x95\x8d\x2e\xe5\x23\xa2\x20\x62\x06\x99\x45\x97\xc1\x3d\x83\x1e\xc7"
|
||||
|
||||
|
@ -1,9 +1,10 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
if not utils.BITCOIN_ONLY:
|
||||
from apps.ethereum.helpers import address_from_bytes
|
||||
from ethereum_common import make_network
|
||||
|
||||
from apps.ethereum.helpers import address_from_bytes
|
||||
|
||||
|
||||
@unittest.skipUnless(not utils.BITCOIN_ONLY, "altcoin")
|
||||
class TestEthereumGetAddress(unittest.TestCase):
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
import unittest
|
||||
|
||||
@ -10,27 +10,26 @@ from apps.common.keychain import get_keychain
|
||||
from apps.common.paths import HARDENED
|
||||
|
||||
if not utils.BITCOIN_ONLY:
|
||||
from ethereum_common import encode_network, make_network
|
||||
from trezor.messages import (
|
||||
EthereumDefinitions,
|
||||
EthereumGetAddress,
|
||||
EthereumSignMessage,
|
||||
EthereumSignTx,
|
||||
EthereumSignTxEIP1559,
|
||||
EthereumSignTypedData,
|
||||
)
|
||||
|
||||
from apps.ethereum import CURVE
|
||||
from apps.ethereum.networks import UNKNOWN_NETWORK
|
||||
from apps.ethereum.keychain import (
|
||||
PATTERNS_ADDRESS,
|
||||
_schemas_from_network,
|
||||
_defs_from_message,
|
||||
_schemas_from_network,
|
||||
_slip44_from_address_n,
|
||||
with_keychain_from_path,
|
||||
with_keychain_from_chain_id,
|
||||
with_keychain_from_path,
|
||||
)
|
||||
|
||||
from trezor.messages import (
|
||||
EthereumGetAddress,
|
||||
EthereumSignTx,
|
||||
EthereumDefinitions,
|
||||
EthereumSignMessage,
|
||||
EthereumSignTypedData,
|
||||
EthereumSignTxEIP1559,
|
||||
)
|
||||
|
||||
from ethereum_common import make_network, encode_network
|
||||
from apps.ethereum.networks import UNKNOWN_NETWORK
|
||||
|
||||
|
||||
@unittest.skipUnless(not utils.BITCOIN_ONLY, "altcoin")
|
||||
|
@ -1,12 +1,12 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
if not utils.BITCOIN_ONLY:
|
||||
from ethereum_common import make_network, make_token
|
||||
|
||||
from apps.ethereum import networks
|
||||
from apps.ethereum.layout import format_ethereum_amount
|
||||
from apps.ethereum.tokens import UNKNOWN_TOKEN
|
||||
|
||||
from ethereum_common import make_network, make_token
|
||||
|
||||
ETH = networks.by_chain_id(1)
|
||||
|
||||
|
||||
|
@ -1,27 +1,21 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor import wire
|
||||
from trezor.wire import context
|
||||
from trezor.enums import EthereumDataType as EDT
|
||||
from trezor.messages import (
|
||||
EthereumFieldType as EFT,
|
||||
EthereumStructMember as ESM,
|
||||
EthereumTypedDataStructAck as ETDSA,
|
||||
EthereumTypedDataValueAck,
|
||||
)
|
||||
|
||||
from trezor.messages import EthereumFieldType as EFT
|
||||
from trezor.messages import EthereumStructMember as ESM
|
||||
from trezor.messages import EthereumTypedDataStructAck as ETDSA
|
||||
from trezor.messages import EthereumTypedDataValueAck
|
||||
from trezor.wire import context
|
||||
|
||||
if not utils.BITCOIN_ONLY:
|
||||
from apps.ethereum.helpers import decode_typed_data, get_type_name
|
||||
from apps.ethereum.sign_typed_data import (
|
||||
encode_field,
|
||||
_validate_value,
|
||||
validate_field_type,
|
||||
keccak256,
|
||||
TypedDataEnvelope,
|
||||
)
|
||||
from apps.ethereum.helpers import (
|
||||
get_type_name,
|
||||
decode_typed_data,
|
||||
_validate_value,
|
||||
encode_field,
|
||||
keccak256,
|
||||
validate_field_type,
|
||||
)
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
if not utils.BITCOIN_ONLY:
|
||||
from apps.ethereum import tokens
|
||||
|
@ -1,7 +1,8 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
import storage
|
||||
import storage.recovery
|
||||
from mock_storage import mock_storage
|
||||
from trezor.enums import BackupType
|
||||
|
||||
from apps.management.recovery_device.recover import process_slip39
|
||||
@ -11,7 +12,6 @@ from apps.management.recovery_device.word_validity import (
|
||||
ThresholdReached,
|
||||
check,
|
||||
)
|
||||
from mock_storage import mock_storage
|
||||
|
||||
MNEMONIC_SLIP39_BASIC_20_3of6 = [
|
||||
"extra extend academic bishop cricket bundle tofu goat apart victim enlarge program behavior permit course armed jerky faint language modern",
|
||||
|
@ -1,7 +1,8 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
if not utils.BITCOIN_ONLY:
|
||||
from apps.monero.xmr import bulletproof as bp, crypto
|
||||
from apps.monero.xmr import bulletproof as bp
|
||||
from apps.monero.xmr import crypto
|
||||
from apps.monero.xmr.serialize_messages.tx_rsig_bulletproof import BulletproofPlus
|
||||
|
||||
|
||||
|
@ -1,11 +1,13 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
if not utils.BITCOIN_ONLY:
|
||||
from apps.monero.xmr import crypto, crypto_helpers, clsag
|
||||
from apps.monero.xmr.serialize_messages.tx_ct_key import CtKey
|
||||
import ubinascii
|
||||
|
||||
from trezor.crypto import monero as tcry
|
||||
from trezor.crypto import random
|
||||
import ubinascii
|
||||
|
||||
from apps.monero.xmr import clsag, crypto, crypto_helpers
|
||||
from apps.monero.xmr.serialize_messages.tx_ct_key import CtKey
|
||||
|
||||
point_mul8_into = tcry.ge25519_mul8
|
||||
|
||||
|
@ -1,8 +1,9 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
if not utils.BITCOIN_ONLY:
|
||||
from trezor.crypto import monero as tcry
|
||||
from trezor.enums import MoneroNetworkType
|
||||
|
||||
from apps.monero.xmr import crypto, crypto_helpers, monero
|
||||
from apps.monero.xmr.addresses import encode_addr
|
||||
from apps.monero.xmr.credentials import AccountCreds
|
||||
|
@ -1,12 +1,13 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
if not utils.BITCOIN_ONLY:
|
||||
from trezor.crypto import chacha20poly1305
|
||||
from apps.monero.signing import offloading_keys
|
||||
from apps.monero.signing import step_09_sign_input
|
||||
from apps.monero.signing.state import State
|
||||
import ubinascii
|
||||
|
||||
from trezor.crypto import chacha20poly1305
|
||||
|
||||
from apps.monero.signing import offloading_keys, step_09_sign_input
|
||||
from apps.monero.signing.state import State
|
||||
|
||||
|
||||
@unittest.skipUnless(not utils.BITCOIN_ONLY, "altcoin")
|
||||
class TestMoneroProto(unittest.TestCase):
|
||||
|
@ -1,13 +1,9 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor import utils
|
||||
|
||||
|
||||
if not utils.BITCOIN_ONLY:
|
||||
from apps.monero.xmr.serialize.int_serialize import (
|
||||
dump_uvarint,
|
||||
load_uvarint,
|
||||
)
|
||||
from apps.monero.xmr.serialize.int_serialize import dump_uvarint, load_uvarint
|
||||
from apps.monero.xmr.serialize.readwriter import MemoryReaderWriter
|
||||
from apps.monero.xmr.serialize_messages.base import ECPoint
|
||||
from apps.monero.xmr.serialize_messages.tx_prefix import TxinToKey
|
||||
|
@ -1,14 +1,15 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from apps.common.paths import HARDENED
|
||||
|
||||
if not utils.BITCOIN_ONLY:
|
||||
from trezor.crypto import nem
|
||||
|
||||
from apps.nem.helpers import (
|
||||
check_path,
|
||||
NEM_NETWORK_MAINNET,
|
||||
NEM_NETWORK_TESTNET,
|
||||
NEM_NETWORK_MIJIN,
|
||||
NEM_NETWORK_TESTNET,
|
||||
check_path,
|
||||
)
|
||||
|
||||
|
||||
|
@ -1,8 +1,7 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor.crypto import bip32
|
||||
|
||||
|
||||
if not utils.BITCOIN_ONLY:
|
||||
from apps.nem import CURVE
|
||||
from apps.nem.helpers import NEM_NETWORK_MAINNET
|
||||
|
@ -1,7 +1,8 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
if not utils.BITCOIN_ONLY:
|
||||
from trezor.messages import NEMMosaic
|
||||
|
||||
from apps.nem.mosaic.helpers import get_mosaic_definition
|
||||
from apps.nem.transfer import *
|
||||
from apps.nem.transfer.serialize import *
|
||||
|
@ -1,15 +1,15 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor.crypto import hashlib
|
||||
|
||||
|
||||
if not utils.BITCOIN_ONLY:
|
||||
from trezor.messages import (
|
||||
NEMSignTx,
|
||||
NEMMosaicCreation,
|
||||
NEMMosaicDefinition,
|
||||
NEMSignTx,
|
||||
NEMTransactionCommon,
|
||||
)
|
||||
|
||||
from apps.nem.helpers import *
|
||||
from apps.nem.mosaic import *
|
||||
from apps.nem.mosaic.serialize import *
|
||||
|
@ -1,13 +1,13 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor.crypto import hashlib
|
||||
|
||||
|
||||
if not utils.BITCOIN_ONLY:
|
||||
from trezor.messages import NEMMosaicSupplyChange, NEMSignTx, NEMTransactionCommon
|
||||
|
||||
from apps.nem.helpers import *
|
||||
from apps.nem.mosaic import *
|
||||
from apps.nem.mosaic.serialize import *
|
||||
from trezor.messages import NEMSignTx, NEMMosaicSupplyChange, NEMTransactionCommon
|
||||
|
||||
|
||||
@unittest.skipUnless(not utils.BITCOIN_ONLY, "altcoin")
|
||||
|
@ -1,13 +1,15 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor.crypto import hashlib
|
||||
|
||||
|
||||
if not utils.BITCOIN_ONLY:
|
||||
from trezor.messages import NEMAggregateModification
|
||||
from trezor.messages import NEMCosignatoryModification
|
||||
from trezor.messages import NEMSignTx
|
||||
from trezor.messages import NEMTransactionCommon
|
||||
from trezor.messages import (
|
||||
NEMAggregateModification,
|
||||
NEMCosignatoryModification,
|
||||
NEMSignTx,
|
||||
NEMTransactionCommon,
|
||||
)
|
||||
|
||||
from apps.nem.helpers import *
|
||||
from apps.nem.multisig import *
|
||||
from apps.nem.multisig.serialize import *
|
||||
|
@ -1,18 +1,19 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
if not utils.BITCOIN_ONLY:
|
||||
from trezor.messages import (
|
||||
NEMAggregateModification,
|
||||
NEMCosignatoryModification,
|
||||
NEMProvisionNamespace,
|
||||
NEMSignTx,
|
||||
NEMTransactionCommon,
|
||||
)
|
||||
|
||||
from apps.nem.helpers import *
|
||||
from apps.nem.multisig import *
|
||||
from apps.nem.multisig.serialize import *
|
||||
from apps.nem.namespace import *
|
||||
from apps.nem.namespace.serialize import *
|
||||
from trezor.messages import (
|
||||
NEMSignTx,
|
||||
NEMAggregateModification,
|
||||
NEMProvisionNamespace,
|
||||
NEMCosignatoryModification,
|
||||
NEMTransactionCommon,
|
||||
)
|
||||
|
||||
|
||||
@unittest.skipUnless(not utils.BITCOIN_ONLY, "altcoin")
|
||||
|
@ -1,14 +1,13 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor.crypto import hashlib
|
||||
|
||||
|
||||
if not utils.BITCOIN_ONLY:
|
||||
from trezor.messages import NEMProvisionNamespace, NEMSignTx, NEMTransactionCommon
|
||||
|
||||
from apps.nem.helpers import *
|
||||
from apps.nem.namespace import *
|
||||
from apps.nem.namespace.serialize import *
|
||||
from trezor.messages import NEMProvisionNamespace, NEMTransactionCommon
|
||||
from trezor.messages import NEMSignTx
|
||||
|
||||
|
||||
@unittest.skipUnless(not utils.BITCOIN_ONLY, "altcoin")
|
||||
|
@ -1,14 +1,14 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor.crypto import hashlib
|
||||
|
||||
|
||||
if not utils.BITCOIN_ONLY:
|
||||
from trezor.messages import NEMMosaic, NEMSignTx, NEMTransactionCommon, NEMTransfer
|
||||
|
||||
from apps.nem.helpers import *
|
||||
from apps.nem.mosaic import *
|
||||
from apps.nem.transfer import *
|
||||
from apps.nem.transfer.serialize import *
|
||||
from trezor.messages import NEMTransfer, NEMTransactionCommon, NEMSignTx, NEMMosaic
|
||||
|
||||
|
||||
@unittest.skipUnless(not utils.BITCOIN_ONLY, "altcoin")
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
if not utils.BITCOIN_ONLY:
|
||||
from apps.ripple.helpers import address_from_public_key
|
||||
|
@ -1,10 +1,10 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
if not utils.BITCOIN_ONLY:
|
||||
from trezor.messages import RipplePayment
|
||||
from trezor.messages import RippleSignTx
|
||||
from apps.ripple.serialize import serialize
|
||||
from trezor.messages import RipplePayment, RippleSignTx
|
||||
|
||||
from apps.ripple import helpers
|
||||
from apps.ripple.serialize import serialize
|
||||
|
||||
|
||||
@unittest.skipUnless(not utils.BITCOIN_ONLY, "altcoin")
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor.crypto import base58
|
||||
|
||||
|
@ -1,8 +1,7 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor.wire import ProcessError
|
||||
|
||||
|
||||
if not utils.BITCOIN_ONLY:
|
||||
from apps.stellar.helpers import address_from_public_key, public_key_from_address
|
||||
|
||||
|
@ -1,10 +1,11 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
if not utils.BITCOIN_ONLY:
|
||||
from apps.tezos.sign_tx import _get_address_from_contract
|
||||
from trezor.enums import TezosContractType
|
||||
from trezor.messages import TezosContractID
|
||||
|
||||
from apps.tezos.sign_tx import _get_address_from_contract
|
||||
|
||||
|
||||
@unittest.skipUnless(not utils.BITCOIN_ONLY, "altcoin")
|
||||
class TestTezosAddress(unittest.TestCase):
|
||||
|
@ -1,15 +1,16 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
if not utils.BITCOIN_ONLY:
|
||||
from trezor.enums import TezosContractType
|
||||
from trezor.messages import TezosContractID
|
||||
from apps.tezos.helpers import base58_encode_check, write_bool, CONTRACT_ID_SIZE
|
||||
|
||||
from apps.tezos.helpers import CONTRACT_ID_SIZE, base58_encode_check, write_bool
|
||||
from apps.tezos.sign_tx import (
|
||||
write_uint8,
|
||||
write_bytes_fixed,
|
||||
_encode_data_with_bool_prefix,
|
||||
_encode_zarith,
|
||||
_encode_natural,
|
||||
_encode_zarith,
|
||||
write_bytes_fixed,
|
||||
write_uint8,
|
||||
)
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
import storage
|
||||
import storage.device
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from apps.zcash.f4jumble import f4jumble, f4unjumble
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from apps.common import coininfo
|
||||
from apps.zcash import unified_addresses
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor.enums import InputScriptType
|
||||
from trezor.messages import PrevOutput, SignTx, TxInput
|
||||
|
@ -1,10 +1,10 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from mock_storage import mock_storage
|
||||
from storage import cache
|
||||
from trezor.messages import EndSession, Initialize
|
||||
|
||||
from apps.base import handle_EndSession, handle_Initialize
|
||||
from mock_storage import mock_storage
|
||||
|
||||
KEY = 0
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from storage import device
|
||||
from trezor import config
|
||||
|
@ -1,9 +1,8 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor import config
|
||||
from trezor.crypto import random
|
||||
|
||||
|
||||
PINAPP = 0x00
|
||||
PINKEY = 0x00
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor.crypto import aes
|
||||
|
||||
|
@ -1,9 +1,8 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor.crypto import base32
|
||||
|
||||
|
||||
|
||||
class TestCryptoBase32(unittest.TestCase):
|
||||
|
||||
# test vectors from:
|
||||
@ -26,13 +25,15 @@ class TestCryptoBase32(unittest.TestCase):
|
||||
b"zlutoucky kun upel dabelske ody",
|
||||
"PJWHK5DPOVRWW6JANN2W4IDVOBSWYIDEMFRGK3DTNNSSA33EPE======",
|
||||
),
|
||||
# fmt: off
|
||||
(b"中文", "4S4K3ZUWQ4======"), # noqa:E999
|
||||
(b"中文1", "4S4K3ZUWQ4YQ===="), # noqa:E999
|
||||
(b"中文12", "4S4K3ZUWQ4YTE==="), # noqa:E999
|
||||
(b"aécio", "MHB2SY3JN4======"), # noqa:E999
|
||||
(b"𠜎", "6CQJZDQ="), # noqa:E999
|
||||
(b"Base64是一種基於64個可列印字元來表示二進制資料的表示方法", # noqa:E999
|
||||
"IJQXGZJWGTTJRL7EXCAOPKFO4WP3VZUWXQ3DJZMARPSY7L7FRCL6LDNQ4WWZPZMFQPSL5BXIUGUOPJF24S5IZ2MAWLSYRNXIWOD6NFUZ46NIJ2FBVDT2JOXGS246NM4V")
|
||||
"IJQXGZJWGTTJRL7EXCAOPKFO4WP3VZUWXQ3DJZMARPSY7L7FRCL6LDNQ4WWZPZMFQPSL5BXIUGUOPJF24S5IZ2MAWLSYRNXIWOD6NFUZ46NIJ2FBVDT2JOXGS246NM4V"),
|
||||
# fmt: on
|
||||
]
|
||||
|
||||
def test_encode(self):
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor.crypto import base58
|
||||
from trezor.crypto.hashlib import ripemd160
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
# Copyright (c) 2017, 2020 Pieter Wuille
|
||||
#
|
||||
|
@ -1,8 +1,7 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor.crypto import bip32
|
||||
|
||||
|
||||
SECP256K1_NAME = "secp256k1"
|
||||
HARDENED = 0x80000000
|
||||
VERSION_PUBLIC = 0x0488B21E
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor.crypto import bip39
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
# Copyright (c) 2017 Pieter Wuille
|
||||
# Copyright (c) 2018 Pavol Rusnak
|
||||
@ -26,7 +26,6 @@ from common import *
|
||||
|
||||
from trezor.crypto import base58, cashaddr
|
||||
|
||||
|
||||
VALID_CHECKSUM = [
|
||||
"prefix:x64nx6hz",
|
||||
"p:gpf8m4h7",
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor.crypto import chacha20poly1305
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor.crypto import cosi, random
|
||||
from trezor.crypto.curve import ed25519
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor.crypto import crc
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor.crypto import random
|
||||
from trezor.crypto.curve import bip340
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor.crypto.curve import curve25519
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor.crypto import random
|
||||
from trezor.crypto.curve import ed25519
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor.crypto import random
|
||||
from trezor.crypto.curve import nist256p1
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor.crypto import random
|
||||
from trezor.crypto.curve import secp256k1
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor.crypto import der
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor.crypto import hashlib
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor.crypto import hashlib
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor.crypto import hashlib
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor.crypto import hashlib
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor.crypto import hashlib
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor.crypto import hashlib
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor.crypto import hashlib
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
from common import *
|
||||
from common import * # isort:skip
|
||||
|
||||
from trezor.crypto import hashlib
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user