1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-18 04:18:10 +00:00

chore(tests): run isort and put "from common import *" at the beginning

[no changelog]
This commit is contained in:
grdddj 2023-06-28 12:58:54 +02:00 committed by Vít Obrusník
parent 4bd7cf4b04
commit 4bca28bac0
67 changed files with 347 additions and 316 deletions

View File

@ -2,12 +2,12 @@ import sys
sys.path.append("../src")
from ubinascii import hexlify, unhexlify # noqa: F401
import unittest # noqa: F401
from typing import Any, Awaitable
from ubinascii import hexlify, unhexlify # noqa: F401
from trezor import utils # noqa: F401
from apps.common.paths import HARDENED

View File

@ -1,10 +1,10 @@
from ubinascii import unhexlify # noqa: F401
from trezor import messages, protobuf
from trezor.enums import EthereumDefinitionType
from trezor.crypto import cosi
from trezor.crypto.curve import ed25519
from trezor.crypto.hashlib import sha256
from trezor.enums import EthereumDefinitionType
PRIVATE_KEYS_DEV = [byte * 32 for byte in (b"\xdd", b"\xde", b"\xdf")]

View File

@ -1,7 +1,7 @@
from mock import patch
import storage.common
from mock import patch
class MockStorage:
PATCH_METHODS = ("get", "set", "delete")

View File

@ -1,20 +1,21 @@
from common import *
from trezor.crypto import bip32, bip39
from trezor import wire
from trezor.messages import GetAddress
from trezor.crypto import bip32, bip39
from trezor.enums import InputScriptType
from trezor.messages import GetAddress
from trezor.utils import HashWriter
from apps.common import coins
from apps.bitcoin.addresses import *
from apps.bitcoin.addresses import (
_address_multisig_p2sh,
_address_multisig_p2wsh_in_p2sh,
_address_p2wsh,
_address_p2wsh_in_p2sh,
_address_multisig_p2wsh_in_p2sh,
_address_multisig_p2sh,
)
from apps.bitcoin.keychain import validate_path_against_script_type
from apps.bitcoin.writers import *
from apps.common import coins
def node_derive(root, path):

View File

@ -1,10 +1,11 @@
from common import *
from apps.bitcoin.common import *
from apps.bitcoin.addresses import *
from apps.common import coins
from trezor.crypto import bip32, bip39
from apps.bitcoin.addresses import *
from apps.bitcoin.common import *
from apps.common import coins
def node_derive(root, path):
node = root.clone()

View File

@ -1,24 +1,26 @@
from common import unittest, await_result, H_
from common import H_, await_result, unittest
import storage.cache
from trezor import wire
from trezor.crypto import bip32
from trezor.crypto.curve import bip340, secp256k1
from trezor.crypto.hashlib import sha256
from trezor.messages import AuthorizeCoinJoin
from trezor.messages import TxInput
from trezor.messages import TxOutput
from trezor.messages import SignTx
from trezor.messages import CoinJoinRequest
from trezor.enums import InputScriptType, OutputScriptType
from trezor.messages import (
AuthorizeCoinJoin,
CoinJoinRequest,
SignTx,
TxInput,
TxOutput,
)
from trezor.utils import HashWriter
from apps.common import coins
from apps.bitcoin import writers
from apps.bitcoin.authorization import FEE_RATE_DECIMALS, CoinJoinAuthorization
from apps.bitcoin.sign_tx.approvers import CoinJoinApprover
from apps.bitcoin.sign_tx.bitcoin import Bitcoin
from apps.bitcoin.sign_tx.tx_info import TxInfo
from apps.bitcoin import writers
from apps.common import coins
class TestApprover(unittest.TestCase):

View File

@ -1,13 +1,11 @@
from common import unittest, H_
from common import H_, unittest
import storage.cache
from trezor.messages import AuthorizeCoinJoin
from trezor.messages import GetOwnershipProof
from trezor.messages import SignTx
from trezor.enums import InputScriptType
from trezor.messages import AuthorizeCoinJoin, GetOwnershipProof, SignTx
from apps.common import coins
from apps.bitcoin.authorization import CoinJoinAuthorization
from apps.common import coins
_ROUND_ID_LEN = 32

View File

@ -1,4 +1,5 @@
from common import *
from storage import cache
from trezor import wire
from trezor.crypto import bip39

View File

@ -1,22 +1,22 @@
from common import unhexlify, unittest
from trezor.crypto import bip39
from trezor.enums import InputScriptType
from trezor.messages import MultisigRedeemScriptType
from trezor.messages import HDNodeType
from trezor.messages import HDNodeType, MultisigRedeemScriptType
from apps.common import coins
from apps.common.keychain import Keychain
from apps.common.paths import HARDENED, AlwaysMatchingSchema
from apps.bitcoin import ownership, scripts
from apps.bitcoin.addresses import (
_address_multisig_p2sh,
_address_multisig_p2wsh,
_address_multisig_p2wsh_in_p2sh,
_address_p2tr,
address_p2wpkh,
address_p2wpkh_in_p2sh,
_address_multisig_p2wsh,
_address_multisig_p2wsh_in_p2sh,
_address_multisig_p2sh,
)
from apps.bitcoin.multisig import multisig_get_pubkeys
from apps.common import coins
from apps.common.keychain import Keychain
from apps.common.paths import HARDENED, AlwaysMatchingSchema
class TestOwnershipProof(unittest.TestCase):

View File

@ -1,5 +1,9 @@
from common import *
from trezor.crypto import bip39
from trezor.enums import InputScriptType, OutputScriptType
from trezor.messages import PrevOutput, SignTx, TxInput, TxOutput
from apps.bitcoin.common import SigHashType
from apps.bitcoin.scripts import output_derive_script
from apps.bitcoin.sign_tx.sig_hasher import BitcoinSigHasher
@ -7,13 +11,6 @@ from apps.bitcoin.writers import get_tx_hash
from apps.common import coins
from apps.common.keychain import Keychain
from apps.common.paths import AlwaysMatchingSchema
from trezor.messages import SignTx
from trezor.messages import TxInput
from trezor.messages import TxOutput
from trezor.messages import PrevOutput
from trezor.enums import InputScriptType
from trezor.enums import OutputScriptType
from trezor.crypto import bip39
class TestSegwitBip143NativeP2WPKH(unittest.TestCase):

View File

@ -1,5 +1,9 @@
from common import *
from trezor.crypto import bip39
from trezor.enums import InputScriptType, OutputScriptType
from trezor.messages import PrevOutput, SignTx, TxInput, TxOutput
from apps.bitcoin.common import SigHashType
from apps.bitcoin.scripts import output_derive_script
from apps.bitcoin.sign_tx.sig_hasher import BitcoinSigHasher
@ -7,13 +11,6 @@ from apps.bitcoin.writers import get_tx_hash
from apps.common import coins
from apps.common.keychain import Keychain
from apps.common.paths import AlwaysMatchingSchema
from trezor.messages import SignTx
from trezor.messages import TxInput
from trezor.messages import TxOutput
from trezor.messages import PrevOutput
from trezor.enums import InputScriptType
from trezor.enums import OutputScriptType
from trezor.crypto import bip39
class TestSegwitBip143(unittest.TestCase):

View File

@ -3,11 +3,9 @@ from common import *
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.messages import SignTx
from trezor.messages import TxInput
from trezor.messages import PrevOutput
from trezor.enums import InputScriptType
from trezor.enums import InputScriptType
from trezor.messages import PrevOutput, SignTx, TxInput
VECTORS = [
{ # https://github.com/bitcoin/bips/pull/1225/commits/f7af1f73b287c14cf2f63afcb8d199feaf6ab5e1

View File

@ -1,36 +1,35 @@
from common import *
from trezor.utils import chunks
from trezor.crypto import bip39
from trezor.messages import SignTx
from trezor.messages import TxAckInput
from trezor.messages import TxAckInputWrapper
from trezor.messages import TxInput
from trezor.messages import TxAckOutput
from trezor.messages import TxAckOutputWrapper
from trezor.messages import TxOutput
from trezor.messages import TxAckPrevMeta
from trezor.messages import PrevTx
from trezor.messages import TxAckPrevInput
from trezor.messages import TxAckPrevInputWrapper
from trezor.messages import PrevInput
from trezor.messages import TxAckPrevOutput
from trezor.messages import TxAckPrevOutputWrapper
from trezor.messages import PrevOutput
from trezor.messages import TxRequest
from trezor.enums.RequestType import TXINPUT, TXMETA, TXOUTPUT, TXFINISHED
from trezor.messages import TxRequestDetailsType
from trezor.messages import TxRequestSerializedType
from trezor.enums import AmountUnit
from trezor.enums import InputScriptType
from trezor.enums import OutputScriptType
from trezor import wire
from trezor.crypto import bip39
from trezor.enums import AmountUnit, InputScriptType, OutputScriptType
from trezor.enums.RequestType import TXFINISHED, TXINPUT, TXMETA, TXOUTPUT
from trezor.messages import (
PrevInput,
PrevOutput,
PrevTx,
SignTx,
TxAckInput,
TxAckInputWrapper,
TxAckOutput,
TxAckOutputWrapper,
TxAckPrevInput,
TxAckPrevInputWrapper,
TxAckPrevMeta,
TxAckPrevOutput,
TxAckPrevOutputWrapper,
TxInput,
TxOutput,
TxRequest,
TxRequestDetailsType,
TxRequestSerializedType,
)
from trezor.utils import chunks
from apps.bitcoin.keychain import _get_schemas_for_coin
from apps.bitcoin.sign_tx import bitcoin, helpers
from apps.common import coins
from apps.common.keychain import Keychain
from apps.bitcoin.keychain import _get_schemas_for_coin
from apps.bitcoin.sign_tx import helpers, bitcoin
EMPTY_SERIALIZED = TxRequestSerializedType(serialized_tx=bytearray())

View File

@ -1,35 +1,34 @@
from common import *
from trezor.utils import chunks
from trezor.crypto import bip39
from trezor.messages import SignTx
from trezor.messages import TxAckInput
from trezor.messages import TxAckInputWrapper
from trezor.messages import TxInput
from trezor.messages import TxAckOutput
from trezor.messages import TxAckOutputWrapper
from trezor.messages import TxOutput
from trezor.messages import TxAckPrevMeta
from trezor.messages import PrevTx
from trezor.messages import TxAckPrevInput
from trezor.messages import TxAckPrevInputWrapper
from trezor.messages import PrevInput
from trezor.messages import TxAckPrevOutput
from trezor.messages import TxAckPrevOutputWrapper
from trezor.messages import PrevOutput
from trezor.messages import TxRequest
from trezor.enums.RequestType import TXINPUT, TXMETA, TXOUTPUT, TXFINISHED
from trezor.messages import TxRequestDetailsType
from trezor.messages import TxRequestSerializedType
from trezor.enums import AmountUnit
from trezor.enums import InputScriptType
from trezor.enums import OutputScriptType
from trezor.enums import AmountUnit, InputScriptType, OutputScriptType
from trezor.enums.RequestType import TXFINISHED, TXINPUT, TXMETA, TXOUTPUT
from trezor.messages import (
PrevInput,
PrevOutput,
PrevTx,
SignTx,
TxAckInput,
TxAckInputWrapper,
TxAckOutput,
TxAckOutputWrapper,
TxAckPrevInput,
TxAckPrevInputWrapper,
TxAckPrevMeta,
TxAckPrevOutput,
TxAckPrevOutputWrapper,
TxInput,
TxOutput,
TxRequest,
TxRequestDetailsType,
TxRequestSerializedType,
)
from trezor.utils import chunks
from apps.common import coins
from apps.common.keychain import Keychain
from apps.bitcoin.keychain import _get_schemas_for_coin
from apps.bitcoin.sign_tx import bitcoinlike, helpers
from apps.common import coins
from apps.common.keychain import Keychain
EMPTY_SERIALIZED = TxRequestSerializedType(serialized_tx=bytearray())

View File

@ -1,36 +1,35 @@
from common import *
from trezor.utils import chunks
from trezor.crypto import bip39
from trezor.messages import SignTx
from trezor.messages import TxAckInput
from trezor.messages import TxAckInputWrapper
from trezor.messages import TxInput
from trezor.messages import TxAckOutput
from trezor.messages import TxAckOutputWrapper
from trezor.messages import TxOutput
from trezor.messages import TxAckPrevMeta
from trezor.messages import PrevTx
from trezor.messages import TxAckPrevInput
from trezor.messages import TxAckPrevInputWrapper
from trezor.messages import PrevInput
from trezor.messages import TxAckPrevOutput
from trezor.messages import TxAckPrevOutputWrapper
from trezor.messages import PrevOutput
from trezor.messages import TxRequest
from trezor.enums.RequestType import TXINPUT, TXMETA, TXOUTPUT, TXFINISHED
from trezor.messages import TxRequestDetailsType
from trezor.messages import TxRequestSerializedType
from trezor.enums import AmountUnit
from trezor.enums import InputScriptType
from trezor.enums import OutputScriptType
from trezor import wire
from trezor.crypto import bip39
from trezor.enums import AmountUnit, InputScriptType, OutputScriptType
from trezor.enums.RequestType import TXFINISHED, TXINPUT, TXMETA, TXOUTPUT
from trezor.messages import (
PrevInput,
PrevOutput,
PrevTx,
SignTx,
TxAckInput,
TxAckInputWrapper,
TxAckOutput,
TxAckOutputWrapper,
TxAckPrevInput,
TxAckPrevInputWrapper,
TxAckPrevMeta,
TxAckPrevOutput,
TxAckPrevOutputWrapper,
TxInput,
TxOutput,
TxRequest,
TxRequestDetailsType,
TxRequestSerializedType,
)
from trezor.utils import chunks
from apps.common import coins
from apps.common.keychain import Keychain
from apps.bitcoin.keychain import _get_schemas_for_coin
from apps.bitcoin.sign_tx import bitcoin, helpers
from apps.common import coins
from apps.common.keychain import Keychain
EMPTY_SERIALIZED = TxRequestSerializedType(serialized_tx=bytearray())

View File

@ -1,35 +1,34 @@
from common import *
from trezor.utils import chunks
from trezor.crypto import bip39
from trezor.messages import SignTx
from trezor.messages import TxAckInput
from trezor.messages import TxAckInputWrapper
from trezor.messages import TxInput
from trezor.messages import TxAckOutput
from trezor.messages import TxAckOutputWrapper
from trezor.messages import TxOutput
from trezor.messages import TxAckPrevMeta
from trezor.messages import PrevTx
from trezor.messages import TxAckPrevInput
from trezor.messages import TxAckPrevInputWrapper
from trezor.messages import PrevInput
from trezor.messages import TxAckPrevOutput
from trezor.messages import TxAckPrevOutputWrapper
from trezor.messages import PrevOutput
from trezor.messages import TxRequest
from trezor.enums.RequestType import TXINPUT, TXMETA, TXOUTPUT, TXFINISHED
from trezor.messages import TxRequestDetailsType
from trezor.messages import TxRequestSerializedType
from trezor.enums import AmountUnit
from trezor.enums import InputScriptType
from trezor.enums import OutputScriptType
from trezor.enums import AmountUnit, InputScriptType, OutputScriptType
from trezor.enums.RequestType import TXFINISHED, TXINPUT, TXMETA, TXOUTPUT
from trezor.messages import (
PrevInput,
PrevOutput,
PrevTx,
SignTx,
TxAckInput,
TxAckInputWrapper,
TxAckOutput,
TxAckOutputWrapper,
TxAckPrevInput,
TxAckPrevInputWrapper,
TxAckPrevMeta,
TxAckPrevOutput,
TxAckPrevOutputWrapper,
TxInput,
TxOutput,
TxRequest,
TxRequestDetailsType,
TxRequestSerializedType,
)
from trezor.utils import chunks
from apps.common import coins
from apps.common.keychain import Keychain
from apps.bitcoin.keychain import _get_schemas_for_coin
from apps.bitcoin.sign_tx import bitcoinlike, helpers
from apps.common import coins
from apps.common.keychain import Keychain
EMPTY_SERIALIZED = TxRequestSerializedType(serialized_tx=bytearray())

View File

@ -1,7 +1,7 @@
from common import *
from trezor.messages import TxInput
from trezor.enums import InputScriptType
from trezor.messages import TxInput
from apps.bitcoin import writers

View File

@ -1,34 +1,34 @@
from common import *
from trezor.utils import chunks
from trezor.crypto import bip32, bip39
from trezor.messages import SignTx
from trezor.messages import TxAckInput
from trezor.messages import TxAckInputWrapper
from trezor.messages import TxInput
from trezor.messages import TxAckOutput
from trezor.messages import TxAckOutputWrapper
from trezor.messages import TxOutput
from trezor.messages import TxAckPrevMeta
from trezor.messages import PrevTx
from trezor.messages import TxAckPrevInput
from trezor.messages import TxAckPrevInputWrapper
from trezor.messages import PrevInput
from trezor.messages import TxAckPrevOutput
from trezor.messages import TxAckPrevOutputWrapper
from trezor.messages import PrevOutput
from trezor.messages import TxRequest
from trezor.enums.RequestType import TXINPUT, TXOUTPUT, TXMETA
from trezor.messages import TxRequestDetailsType
from trezor.messages import TxRequestSerializedType
from trezor.enums import AmountUnit
from trezor.enums import OutputScriptType
from trezor.enums import AmountUnit, OutputScriptType
from trezor.enums.RequestType import TXINPUT, TXMETA, TXOUTPUT
from trezor.messages import (
PrevInput,
PrevOutput,
PrevTx,
SignTx,
TxAckInput,
TxAckInputWrapper,
TxAckOutput,
TxAckOutputWrapper,
TxAckPrevInput,
TxAckPrevInputWrapper,
TxAckPrevMeta,
TxAckPrevOutput,
TxAckPrevOutputWrapper,
TxInput,
TxOutput,
TxRequest,
TxRequestDetailsType,
TxRequestSerializedType,
)
from trezor.utils import chunks
from apps.bitcoin.sign_tx import bitcoin, helpers
from apps.common import coins
from apps.common.keychain import Keychain
from apps.common.paths import AlwaysMatchingSchema
from apps.bitcoin.sign_tx import bitcoin, helpers
EMPTY_SERIALIZED = TxRequestSerializedType(serialized_tx=bytearray())

View File

@ -1,34 +1,34 @@
from common import *
from trezor.utils import chunks
from trezor.crypto import bip39
from trezor.messages import SignTx
from trezor.messages import TxAckInput
from trezor.messages import TxAckInputWrapper
from trezor.messages import TxInput
from trezor.messages import TxAckOutput
from trezor.messages import TxAckOutputWrapper
from trezor.messages import TxOutput
from trezor.messages import TxAckPrevMeta
from trezor.messages import PrevTx
from trezor.messages import TxAckPrevInput
from trezor.messages import TxAckPrevInputWrapper
from trezor.messages import PrevInput
from trezor.messages import TxAckPrevOutput
from trezor.messages import TxAckPrevOutputWrapper
from trezor.messages import PrevOutput
from trezor.messages import TxRequest
from trezor.enums.RequestType import TXINPUT, TXOUTPUT, TXMETA, TXFINISHED
from trezor.messages import TxRequestDetailsType
from trezor.messages import TxRequestSerializedType
from trezor.enums import AmountUnit
from trezor.enums import OutputScriptType
from trezor.enums import AmountUnit, OutputScriptType
from trezor.enums.RequestType import TXFINISHED, TXINPUT, TXMETA, TXOUTPUT
from trezor.messages import (
PrevInput,
PrevOutput,
PrevTx,
SignTx,
TxAckInput,
TxAckInputWrapper,
TxAckOutput,
TxAckOutputWrapper,
TxAckPrevInput,
TxAckPrevInputWrapper,
TxAckPrevMeta,
TxAckPrevOutput,
TxAckPrevOutputWrapper,
TxInput,
TxOutput,
TxRequest,
TxRequestDetailsType,
TxRequestSerializedType,
)
from trezor.utils import chunks
from apps.common import coins
from apps.common.keychain import Keychain
from apps.bitcoin.keychain import _get_schemas_for_coin
from apps.bitcoin.sign_tx import bitcoin, helpers
from apps.common import coins
from apps.common.keychain import Keychain
EMPTY_SERIALIZED = TxRequestSerializedType(serialized_tx=bytearray())

View File

@ -1,34 +1,34 @@
from common import *
from trezor.utils import chunks
from trezor.crypto import bip39
from trezor.messages import SignTx
from trezor.messages import TxAckInput
from trezor.messages import TxAckInputWrapper
from trezor.messages import TxInput
from trezor.messages import TxAckOutput
from trezor.messages import TxAckOutputWrapper
from trezor.messages import TxOutput
from trezor.messages import TxAckPrevMeta
from trezor.messages import PrevTx
from trezor.messages import TxAckPrevInput
from trezor.messages import TxAckPrevInputWrapper
from trezor.messages import PrevInput
from trezor.messages import TxAckPrevOutput
from trezor.messages import TxAckPrevOutputWrapper
from trezor.messages import PrevOutput
from trezor.messages import TxRequest
from trezor.enums.RequestType import TXINPUT, TXOUTPUT, TXMETA, TXFINISHED
from trezor.messages import TxRequestDetailsType
from trezor.messages import TxRequestSerializedType
from trezor.enums import AmountUnit
from trezor.enums import OutputScriptType
from trezor.enums import AmountUnit, OutputScriptType
from trezor.enums.RequestType import TXFINISHED, TXINPUT, TXMETA, TXOUTPUT
from trezor.messages import (
PrevInput,
PrevOutput,
PrevTx,
SignTx,
TxAckInput,
TxAckInputWrapper,
TxAckOutput,
TxAckOutputWrapper,
TxAckPrevInput,
TxAckPrevInputWrapper,
TxAckPrevMeta,
TxAckPrevOutput,
TxAckPrevOutputWrapper,
TxInput,
TxOutput,
TxRequest,
TxRequestDetailsType,
TxRequestSerializedType,
)
from trezor.utils import chunks
from apps.common import coins
from apps.common.keychain import Keychain
from apps.bitcoin.keychain import _get_schemas_for_coin
from apps.bitcoin.sign_tx import decred, helpers
from apps.common import coins
from apps.common.keychain import Keychain
EMPTY_SERIALIZED = TxRequestSerializedType(serialized_tx=bytearray())

View File

@ -1,34 +1,34 @@
from common import *
from trezor.utils import chunks
from trezor.crypto import bip39
from trezor.messages import SignTx
from trezor.messages import TxAckInput
from trezor.messages import TxAckInputWrapper
from trezor.messages import TxInput
from trezor.messages import TxAckOutput
from trezor.messages import TxAckOutputWrapper
from trezor.messages import TxOutput
from trezor.messages import TxAckPrevMeta
from trezor.messages import PrevTx
from trezor.messages import TxAckPrevInput
from trezor.messages import TxAckPrevInputWrapper
from trezor.messages import PrevInput
from trezor.messages import TxAckPrevOutput
from trezor.messages import TxAckPrevOutputWrapper
from trezor.messages import PrevOutput
from trezor.messages import TxRequest
from trezor.enums.RequestType import TXINPUT, TXOUTPUT, TXMETA, TXFINISHED
from trezor.messages import TxRequestDetailsType
from trezor.messages import TxRequestSerializedType
from trezor.enums import AmountUnit
from trezor.enums import OutputScriptType
from trezor.enums import AmountUnit, OutputScriptType
from trezor.enums.RequestType import TXFINISHED, TXINPUT, TXMETA, TXOUTPUT
from trezor.messages import (
PrevInput,
PrevOutput,
PrevTx,
SignTx,
TxAckInput,
TxAckInputWrapper,
TxAckOutput,
TxAckOutputWrapper,
TxAckPrevInput,
TxAckPrevInputWrapper,
TxAckPrevMeta,
TxAckPrevOutput,
TxAckPrevOutputWrapper,
TxInput,
TxOutput,
TxRequest,
TxRequestDetailsType,
TxRequestSerializedType,
)
from trezor.utils import chunks
from apps.common import coins
from apps.common.keychain import Keychain
from apps.bitcoin.keychain import _get_schemas_for_coin
from apps.bitcoin.sign_tx import bitcoinlike, helpers
from apps.common import coins
from apps.common.keychain import Keychain
EMPTY_SERIALIZED = TxRequestSerializedType(serialized_tx=bytearray())

View File

@ -1,17 +1,14 @@
from common import *
from trezor.messages import MultisigRedeemScriptType
from trezor.messages import TxInput
from trezor.messages import TxOutput
from trezor.messages import HDNodeType
from trezor.enums import OutputScriptType
from trezor.crypto import bip39
from trezor.enums import OutputScriptType
from trezor.messages import HDNodeType, MultisigRedeemScriptType, TxInput, TxOutput
from apps.bitcoin.scripts import output_derive_script, output_script_paytoopreturn
from apps.bitcoin.sign_tx.tx_weight import *
from apps.common import coins
from apps.common.keychain import Keychain
from apps.common.paths import AlwaysMatchingSchema
from apps.bitcoin.sign_tx.tx_weight import *
from apps.bitcoin.scripts import output_derive_script, output_script_paytoopreturn
class TestCalculateTxWeight(unittest.TestCase):

View File

@ -1,12 +1,11 @@
from common import *
from trezor.enums import InputScriptType
from trezor.messages import SignTx
from trezor.messages import TxInput
from trezor.messages import PrevOutput
from apps.common import coins
from trezor.enums import InputScriptType
from trezor.messages import PrevOutput, SignTx, TxInput
from apps.bitcoin.common import SigHashType
from apps.bitcoin.writers import get_tx_hash
from apps.common import coins
if not utils.BITCOIN_ONLY:
from apps.bitcoin.sign_tx.zcash_v4 import Zip243SigHasher

View File

@ -1,9 +1,9 @@
from common import *
from trezor import wire
from trezor.crypto import cardano, slip39
from trezor.enums import CardanoAddressType
from trezor.messages import CardanoAddressParametersType
from trezor.messages import CardanoBlockchainPointerType
from trezor.messages import CardanoAddressParametersType, CardanoBlockchainPointerType
from apps.common import seed
from apps.common.paths import HARDENED

View File

@ -1,7 +1,8 @@
from common import *
from trezor import wire
from trezor.enums import CardanoCertificateType
from trezor.messages import CardanoTxCertificate, CardanoPoolParametersType
from trezor.messages import CardanoPoolParametersType, CardanoTxCertificate
from apps.common.paths import HARDENED

View File

@ -1,10 +1,10 @@
from common import *
from apps.cardano.helpers.credential import Credential
from apps.common.paths import HARDENED
from trezor.enums import CardanoAddressType
from trezor.messages import CardanoAddressParametersType, CardanoBlockchainPointerType
from apps.cardano.helpers.credential import Credential
from apps.common.paths import HARDENED
CERTIFICATE_POINTER = CardanoBlockchainPointerType(
block_index=24157,

View File

@ -1,9 +1,10 @@
from common import *
from apps.cardano.seed import Keychain
from apps.cardano.get_public_key import _get_public_key
from trezor.crypto import cardano, slip39
from apps.cardano.get_public_key import _get_public_key
from apps.cardano.seed import Keychain
@unittest.skipUnless(not utils.BITCOIN_ONLY, "altcoin")
class TestCardanoGetPublicKey(unittest.TestCase):

View File

@ -1,9 +1,11 @@
from common import *
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 (

View File

@ -1,4 +1,5 @@
from common import *
from trezor.crypto import cardano
from apps.common.paths import HARDENED

View File

@ -5,8 +5,8 @@ from apps.common.cbor import (
OrderedMap,
Tagged,
create_array_header,
create_map_header,
create_embedded_cbor_bytes_header,
create_map_header,
decode,
encode,
encode_streamed,

View File

@ -1,15 +1,15 @@
from common import *
from mock_storage import mock_storage
from storage import cache
from apps.common import safety_checks
from apps.common.paths import PATTERN_SEP5, PathSchema
from apps.common.keychain import LRUCache, Keychain, with_slip44_keychain, get_keychain
from trezor import wire
from trezor.crypto import bip39
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):
def setUp(self):

View File

@ -1,7 +1,10 @@
from common import *
from trezor.utils import ensure
from apps.common.paths import *
# NOTE: moved into tests not to occupy flash space
# in firmware binary, when it is not used in production
class NeverMatchingSchema:

View File

@ -1,9 +1,10 @@
from common import *
from trezor import wire
from trezor.crypto import bip39
from apps.common.keychain import Keychain
from apps.common.seed import Slip21Node
from trezor import wire
from trezor.crypto import bip39
class TestSeed(unittest.TestCase):

View File

@ -3,6 +3,7 @@ from common import *
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

View File

@ -1,9 +1,12 @@
from common import *
import unittest
import typing as t
from trezor import utils, wire
import unittest
from ubinascii import hexlify # noqa: F401
from trezor import utils, wire
if not utils.BITCOIN_ONLY:
from apps.ethereum import networks, tokens

View File

@ -1,4 +1,5 @@
from common import *
from apps.common.paths import HARDENED
if not utils.BITCOIN_ONLY:

View File

@ -3,8 +3,9 @@ from common import *
import unittest
from storage import cache
from trezor import wire, utils
from trezor import utils, wire
from trezor.crypto import bip39
from apps.common.keychain import get_keychain
from apps.common.paths import HARDENED

View File

@ -2,11 +2,13 @@ from common import *
from trezor import wire
from trezor.wire import context
from trezor.messages import EthereumTypedDataStructAck as ETDSA
from trezor.messages import EthereumStructMember as ESM
from trezor.messages import EthereumFieldType as EFT
from trezor.messages import EthereumTypedDataValueAck
from trezor.enums import EthereumDataType as EDT
from trezor.messages import (
EthereumFieldType as EFT,
EthereumStructMember as ESM,
EthereumTypedDataStructAck as ETDSA,
EthereumTypedDataValueAck,
)
if not utils.BITCOIN_ONLY:

View File

@ -1,16 +1,17 @@
from common import *
from mock_storage import mock_storage
import storage
import storage.recovery
from apps.management.recovery_device.recover import process_slip39
from trezor.enums import BackupType
from apps.management.recovery_device.recover import process_slip39
from apps.management.recovery_device.word_validity import (
check,
IdentifierMismatch,
AlreadyAdded,
IdentifierMismatch,
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",

View File

@ -1,6 +1,8 @@
from common import *
from trezor import utils
if not utils.BITCOIN_ONLY:
from apps.monero.xmr.serialize.int_serialize import (
dump_uvarint,

View File

@ -1,4 +1,5 @@
from common import *
from apps.common.paths import HARDENED
if not utils.BITCOIN_ONLY:

View File

@ -1,6 +1,8 @@
from common import *
from trezor.crypto import bip32
if not utils.BITCOIN_ONLY:
from apps.nem import CURVE
from apps.nem.helpers import NEM_NETWORK_MAINNET

View File

@ -2,6 +2,7 @@ from common import *
from trezor.crypto import hashlib
if not utils.BITCOIN_ONLY:
from trezor.messages import (
NEMSignTx,

View File

@ -2,6 +2,7 @@ from common import *
from trezor.crypto import hashlib
if not utils.BITCOIN_ONLY:
from apps.nem.helpers import *
from apps.nem.mosaic import *

View File

@ -1,6 +1,8 @@
from common import *
from trezor.crypto import hashlib
if not utils.BITCOIN_ONLY:
from trezor.messages import NEMAggregateModification
from trezor.messages import NEMCosignatoryModification

View File

@ -2,6 +2,7 @@ from common import *
from trezor.crypto import hashlib
if not utils.BITCOIN_ONLY:
from apps.nem.helpers import *
from apps.nem.namespace import *

View File

@ -2,6 +2,7 @@ from common import *
from trezor.crypto import hashlib
if not utils.BITCOIN_ONLY:
from apps.nem.helpers import *
from apps.nem.mosaic import *

View File

@ -1,6 +1,8 @@
from common import *
from trezor.wire import ProcessError
if not utils.BITCOIN_ONLY:
from apps.stellar.helpers import address_from_public_key, public_key_from_address

View File

@ -1,11 +1,13 @@
from common import *
import storage
import storage.device
from apps.common import mnemonic
from apps.webauthn.credential import Fido2Credential, U2fCredential, _NAME_MAX_LENGTH
from apps.webauthn.fido2 import _distinguishable_cred_list
from trezor.crypto.hashlib import sha256
from apps.common import mnemonic
from apps.webauthn.credential import _NAME_MAX_LENGTH, Fido2Credential, U2fCredential
from apps.webauthn.fido2 import _distinguishable_cred_list
class TestCredential(unittest.TestCase):
def test_fido2_credential_decode(self):

View File

@ -1,7 +1,9 @@
from common import *
from trezor.messages import TxInput, SignTx, PrevOutput
from trezor.enums import InputScriptType
from trezor.messages import PrevOutput, SignTx, TxInput
from trezor.utils import HashWriter
from apps.zcash.hasher import ZcashHasher, blake2b, write_hash
from apps.common.coininfo import by_name

View File

@ -1,11 +1,10 @@
from common import *
from mock_storage import mock_storage
from storage import cache
from trezor.messages import Initialize
from trezor.messages import EndSession
from trezor.messages import EndSession, Initialize
from apps.base import handle_Initialize, handle_EndSession
from apps.base import handle_EndSession, handle_Initialize
from mock_storage import mock_storage
KEY = 0

View File

@ -1,6 +1,7 @@
from common import *
from trezor import config
from storage import device
from trezor import config
class TestConfig(unittest.TestCase):

View File

@ -1,8 +1,8 @@
from common import *
from trezor import config
from trezor.crypto import random
from trezor import config
PINAPP = 0x00
PINKEY = 0x00

View File

@ -1,7 +1,9 @@
from common import *
from trezor.crypto import base32
class TestCryptoBase32(unittest.TestCase):
# test vectors from:

View File

@ -1,8 +1,7 @@
from common import *
from trezor.crypto.hashlib import ripemd160
from trezor.crypto import base58
from trezor.crypto.hashlib import ripemd160
def digestfunc_graphene(x):

View File

@ -1,3 +1,5 @@
from common import *
# Copyright (c) 2017, 2020 Pieter Wuille
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
@ -21,7 +23,6 @@
"""Reference tests for segwit adresses"""
from common import *
from trezor.crypto import bech32

View File

@ -2,6 +2,7 @@ from common import *
from trezor.crypto import bip32
SECP256K1_NAME = "secp256k1"
HARDENED = 0x80000000
VERSION_PUBLIC = 0x0488B21E

View File

@ -1,3 +1,5 @@
from common import *
# Copyright (c) 2017 Pieter Wuille
# Copyright (c) 2018 Pavol Rusnak
#
@ -22,7 +24,6 @@
"""Reference tests for cashaddr adresses"""
from common import *
from trezor.crypto import base58, cashaddr

View File

@ -1,7 +1,6 @@
from common import *
from trezor.crypto import random
from trezor.crypto.curve import ed25519

View File

@ -1,5 +1,7 @@
from common import *
from trezor.crypto import slip39, random
from trezor.crypto import random, slip39
from slip39_vectors import vectors

View File

@ -1,6 +1,7 @@
from common import *
from trezorio import sdcard, fatfs
from trezorio import fatfs, sdcard
class TestTrezorIoFatfs(unittest.TestCase):

View File

@ -3,6 +3,7 @@ from common import *
from trezor import io
class TestTrezorIoSdcard(unittest.TestCase):
def test_start(self):
self.assertTrue(io.sdcard.is_present())

View File

@ -2,10 +2,10 @@ from common import *
from trezor import protobuf
from trezor.messages import (
WebAuthnCredential,
DebugLinkMemoryRead,
Failure,
SignMessage,
DebugLinkMemoryRead,
WebAuthnCredential,
)

View File

@ -2,6 +2,7 @@ from common import *
from trezor import io, sdcard
fatfs = io.fatfs

View File

@ -1,6 +1,7 @@
from common import *
from ubinascii import unhexlify
import ustruct
from ubinascii import unhexlify
from trezor import io
from trezor.loop import wait