1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-21 22:08:08 +00:00
trezor-firmware/core/tests
JoeGruff e3ea32a986 multi: Add decred staking.
Add two new input and four output script types.

Decred ticket purchases consist of a stake submission, op returns, and
change addresses. Although change addresses are allowed by consensus,
they are no longer used in practice and so have been given the
restrictions of a null pubkey and no value. Stake scripts are almost
identical to p2pkh or p2sh except for an extra opcode in front. Inputs
are currently only used in the form of one input three outputs with the
first output, or stake submission, paying to a public key hash, or with
two inputs and five outputs with the stake submission paying to a
multisig script hash. The op returns are directed to the user in the
case of one and the voting service provider and user in the case of two.

One of the sstx commitment for a ticket must pay back to the trezor
wallet. This is checked and an error is thrown if we don't find the
expected public key hash.

Because this adds the ability to create new types of outputs once the
ticket votes, two new input script types are also needed. A successful
vote will lead to a stake generation script that must be spent, and an
unsuccessful vote will lead to a revocation script that must be spent.
If we allowed stake change scripts to have a valid pubkey, that too
would require another op code, but we disallow those for output.
2021-03-17 12:16:08 +01:00
..
production_tests core: show webusb popup only in bootloader and only if firmware is not installed 2020-02-12 20:47:05 +00:00
common.py core/tests: Add unit tests for CoinJoinApprover and CoinJoinAuthorization. 2020-08-04 17:32:44 +02:00
mock_storage.py core/tests: fix test suite after storage move 2019-10-31 16:34:16 +01:00
mock.py core: draft unit test for process_slip39 2019-10-03 16:01:01 +02:00
README.md ci: enable editorconfig checks, fix whitespace issues 2020-11-11 14:43:50 +01:00
run_tests_click_emu.sh core: rename emulator to trezor-emu-core 2020-07-30 15:27:34 +02:00
run_tests_device_emu_monero.sh ci: handle full dependencies in shell.nix 2020-10-15 15:59:20 +02:00
run_tests.sh core: rename emulator to trezor-emu-core 2020-07-30 15:27:34 +02:00
slip39_vectors.py core/slip39: Update code logic, tests and test vectors in accordance with the new requirement that the number of shares provided is equal to the threshold. 2019-05-03 18:28:14 +02:00
test_apps.binance.address.py chore(core/tests): update unit tests for new APIs, drop unnecessary ones 2020-11-05 14:30:11 +01:00
test_apps.binance.sign_tx.py ci: enable editorconfig checks, fix whitespace issues 2020-11-11 14:43:50 +01:00
test_apps.bitcoin.address_grs.py core/bitcoin: finalize bitcoin refactor 2020-05-18 14:31:51 +02:00
test_apps.bitcoin.address.py chore(core/tests): update unit tests for new APIs, drop unnecessary ones 2020-11-05 14:30:11 +01:00
test_apps.bitcoin.approver.py feat(core): In apps.bitcoin implement replacement transaction flow. 2020-10-23 15:07:15 +02:00
test_apps.bitcoin.authorization.py core/tests: Add unit tests for CoinJoinApprover and CoinJoinAuthorization. 2020-08-04 17:32:44 +02:00
test_apps.bitcoin.keychain.py chore(core/tests): update unit tests for new APIs, drop unnecessary ones 2020-11-05 14:30:11 +01:00
test_apps.bitcoin.ownership_proof.py chore(core/tests): update unit tests for new APIs, drop unnecessary ones 2020-11-05 14:30:11 +01:00
test_apps.bitcoin.segwit.bip143.native_p2wpkh.py refactor(core): call super().__init__() in subclasses 2020-11-30 14:48:08 +01:00
test_apps.bitcoin.segwit.bip143.p2wpkh_in_p2sh.py refactor(core): call super().__init__() in subclasses 2020-11-30 14:48:08 +01:00
test_apps.bitcoin.segwit.signtx.native_p2wpkh_grs.py feat(core): implement amount_unit for AuthorizeCoinJoin and SignTx 2021-01-22 14:07:36 +01:00
test_apps.bitcoin.segwit.signtx.native_p2wpkh.py feat(core): implement amount_unit for AuthorizeCoinJoin and SignTx 2021-01-22 14:07:36 +01:00
test_apps.bitcoin.segwit.signtx.p2wpkh_in_p2sh_grs.py feat(core): implement amount_unit for AuthorizeCoinJoin and SignTx 2021-01-22 14:07:36 +01:00
test_apps.bitcoin.segwit.signtx.p2wpkh_in_p2sh.py feat(core): implement amount_unit for AuthorizeCoinJoin and SignTx 2021-01-22 14:07:36 +01:00
test_apps.bitcoin.sign_tx.writers.py chore: make tx type names shorter 2020-09-23 16:00:10 +02:00
test_apps.bitcoin.signtx_decred.py multi: Add decred staking. 2021-03-17 12:16:08 +01:00
test_apps.bitcoin.signtx_grs.py feat(core): implement amount_unit for AuthorizeCoinJoin and SignTx 2021-01-22 14:07:36 +01:00
test_apps.bitcoin.signtx.fee_threshold.py feat(core): implement amount_unit for AuthorizeCoinJoin and SignTx 2021-01-22 14:07:36 +01:00
test_apps.bitcoin.signtx.omni.py core/bitcoin: finalize bitcoin refactor 2020-05-18 14:31:51 +02:00
test_apps.bitcoin.signtx.py feat(core): implement amount_unit for AuthorizeCoinJoin and SignTx 2021-01-22 14:07:36 +01:00
test_apps.bitcoin.txweight.py chore: make tx type names shorter 2020-09-23 16:00:10 +02:00
test_apps.bitcoin.zcash.zip243.py chore(core): In apps.bitcoin move BIP143 hashing back to a separate class. 2020-10-23 15:07:15 +02:00
test_apps.cardano.address.py feat(core/cardano): enable typing for Cardano app 2021-02-10 10:56:52 +01:00
test_apps.cardano.bech32.py Cardano shelley update 2/3 (#1112) 2020-07-27 13:11:23 +02:00
test_apps.cardano.get_public_key.py Refactor mnemonic_to_entropy to not (misleadingly) return checksum 2020-12-19 20:17:16 +01:00
test_apps.cardano.keychain.py Cardano shelley update 2/3 (#1112) 2020-07-27 13:11:23 +02:00
test_apps.cardano.sign_tx.py fix(core/Cardano): account index validation in _should_hide_output() 2021-02-25 16:41:12 +01:00
test_apps.cardano.staking_use_cases.py Cardano shelley update 2/3 (#1112) 2020-07-27 13:11:23 +02:00
test_apps.cardano.utils.py ci: enable editorconfig checks, fix whitespace issues 2020-11-11 14:43:50 +01:00
test_apps.common.cbor.py chore(core): Use BufferReader for CBOR decoding. 2021-02-10 23:20:56 +01:00
test_apps.common.coins.py core: fix unit tests for Bitcoin only firmware 2019-08-27 12:38:29 +02:00
test_apps.common.keychain.py feat(core): implement BIP-32 path schemas 2020-11-05 14:30:11 +01:00
test_apps.common.paths.py fix(core): do not subclass range 2020-11-13 16:01:35 +01:00
test_apps.common.seed.py core/tests: add unit tests for new functionality 2020-07-24 16:37:58 +02:00
test_apps.eos.check_action.py core: fix unit tests for Bitcoin only firmware 2019-08-27 12:38:29 +02:00
test_apps.eos.conversions.py core: fix unit tests for Bitcoin only firmware 2019-08-27 12:38:29 +02:00
test_apps.eos.get_public_key.py chore(core/tests): update unit tests for new APIs, drop unnecessary ones 2020-11-05 14:30:11 +01:00
test_apps.ethereum.address.py chore(core/tests): update unit tests for new APIs, drop unnecessary ones 2020-11-05 14:30:11 +01:00
test_apps.ethereum.keychain.py feat(core): re-allow unknown Ethereum networks, using Ethereum or Testnet paths (fixes #1335) 2020-11-20 18:55:35 +01:00
test_apps.ethereum.layout.py core: fix unit tests for Bitcoin only firmware 2019-08-27 12:38:29 +02:00
test_apps.ethereum.tokens.py core: fix unit tests for Bitcoin only firmware 2019-08-27 12:38:29 +02:00
test_apps.management.recovery_device.py core/recovery: change exceptions types; modifications in tests 2019-12-30 11:35:56 +00:00
test_apps.monero.bulletproof.py xmr/bp: memory optimizations and improvements 2020-03-02 12:17:03 +01:00
test_apps.monero.clsag.py xmr: major protocol upgrade, CLSAG support added 2020-05-13 11:13:19 +02:00
test_apps.monero.crypto.py core: fix unit tests for Bitcoin only firmware 2019-08-27 12:38:29 +02:00
test_apps.monero.proto.py xmr: major protocol upgrade, CLSAG support added 2020-05-13 11:13:19 +02:00
test_apps.monero.serializer.py xmr: major protocol upgrade, CLSAG support added 2020-05-13 11:13:19 +02:00
test_apps.nem.address.py ci: enable editorconfig checks, fix whitespace issues 2020-11-11 14:43:50 +01:00
test_apps.nem.hdnode.py core: fix unit tests for Bitcoin only firmware 2019-08-27 12:38:29 +02:00
test_apps.nem.mosaic_creation.py core: fix unit tests for Bitcoin only firmware 2019-08-27 12:38:29 +02:00
test_apps.nem.mosaic_supply_change.py core: fix unit tests for Bitcoin only firmware 2019-08-27 12:38:29 +02:00
test_apps.nem.mosaic.py core: fix unit tests for Bitcoin only firmware 2019-08-27 12:38:29 +02:00
test_apps.nem.multisig.aggregate_modification.py core: fix unit tests for Bitcoin only firmware 2019-08-27 12:38:29 +02:00
test_apps.nem.multisig.py core: fix unit tests for Bitcoin only firmware 2019-08-27 12:38:29 +02:00
test_apps.nem.namespace.py core: fix unit tests for Bitcoin only firmware 2019-08-27 12:38:29 +02:00
test_apps.nem.transfer.py core: fix unit tests for Bitcoin only firmware 2019-08-27 12:38:29 +02:00
test_apps.ripple.address.py chore(core/tests): update unit tests for new APIs, drop unnecessary ones 2020-11-05 14:30:11 +01:00
test_apps.ripple.serializer.py chore(core): update unit tests to kwargs usage and new TxAck subtypes 2020-09-23 16:00:10 +02:00
test_apps.stellar.address.py chore(core/tests): update unit tests for new APIs, drop unnecessary ones 2020-11-05 14:30:11 +01:00
test_apps.tezos.address.py chore(core/tests): update unit tests for new APIs, drop unnecessary ones 2020-11-05 14:30:11 +01:00
test_apps.tezos.encode.py fix(core/tezos): Implement strict length checking. 2021-02-10 16:37:26 +01:00
test_apps.webauthn.credential.py core: wipe before reset and recovery; introduce 'intialized' field 2020-06-16 11:31:29 +02:00
test_protobuf.py feat(core): make protobuf.dump_uvarint more reusable 2021-02-10 16:37:26 +01:00
test_storage.cache.py all: use a specific error code for "invalid session" 2020-08-28 15:37:06 +02:00
test_storage.py core/tests: fix test suite after storage move 2019-10-31 16:34:16 +01:00
test_trezor.config.py core: Implement SD card protection. 2019-09-18 18:55:58 +02:00
test_trezor.crypto.aes.py MONOREPO CREATE FROM trezor-core 2019-04-15 19:14:40 +02:00
test_trezor.crypto.base32.py MONOREPO CREATE FROM trezor-core 2019-04-15 19:14:40 +02:00
test_trezor.crypto.base58.py MONOREPO CREATE FROM trezor-core 2019-04-15 19:14:40 +02:00
test_trezor.crypto.bech32.py MONOREPO CREATE FROM trezor-core 2019-04-15 19:14:40 +02:00
test_trezor.crypto.bip32.py core/crypto: remove unused bip32.deserialize function 2020-04-06 18:04:24 +02:00
test_trezor.crypto.bip39.py MONOREPO CREATE FROM trezor-core 2019-04-15 19:14:40 +02:00
test_trezor.crypto.cashaddr.py MONOREPO CREATE FROM trezor-core 2019-04-15 19:14:40 +02:00
test_trezor.crypto.chacha20poly1305.py MONOREPO CREATE FROM trezor-core 2019-04-15 19:14:40 +02:00
test_trezor.crypto.crc.py MONOREPO CREATE FROM trezor-core 2019-04-15 19:14:40 +02:00
test_trezor.crypto.curve.curve25519.py MONOREPO CREATE FROM trezor-core 2019-04-15 19:14:40 +02:00
test_trezor.crypto.curve.ed25519_cosi.py MONOREPO CREATE FROM trezor-core 2019-04-15 19:14:40 +02:00
test_trezor.crypto.curve.ed25519.py MONOREPO CREATE FROM trezor-core 2019-04-15 19:14:40 +02:00
test_trezor.crypto.curve.nist256p1.py MONOREPO CREATE FROM trezor-core 2019-04-15 19:14:40 +02:00
test_trezor.crypto.curve.secp256k1.py refactor(core): turn SECP256K1_ZKP into a firmware feature flag 2021-01-22 14:06:29 +01:00
test_trezor.crypto.der.py core/crypto: Add functions for verifying DER encoded signatures. 2020-07-03 11:17:19 +02:00
test_trezor.crypto.hashlib.blake2b.py MONOREPO CREATE FROM trezor-core 2019-04-15 19:14:40 +02:00
test_trezor.crypto.hashlib.blake2s.py MONOREPO CREATE FROM trezor-core 2019-04-15 19:14:40 +02:00
test_trezor.crypto.hashlib.blake256.py MONOREPO CREATE FROM trezor-core 2019-04-15 19:14:40 +02:00
test_trezor.crypto.hashlib.groestl512.py MONOREPO CREATE FROM trezor-core 2019-04-15 19:14:40 +02:00
test_trezor.crypto.hashlib.ripemd160.py MONOREPO CREATE FROM trezor-core 2019-04-15 19:14:40 +02:00
test_trezor.crypto.hashlib.sha1.py docs: switch http to https in links (#419) 2019-08-16 17:28:15 +02:00
test_trezor.crypto.hashlib.sha3_256.py MONOREPO CREATE FROM trezor-core 2019-04-15 19:14:40 +02:00
test_trezor.crypto.hashlib.sha3_512.py docs: switch http to https in links (#419) 2019-08-16 17:28:15 +02:00
test_trezor.crypto.hashlib.sha256.py MONOREPO CREATE FROM trezor-core 2019-04-15 19:14:40 +02:00
test_trezor.crypto.hashlib.sha512.py MONOREPO CREATE FROM trezor-core 2019-04-15 19:14:40 +02:00
test_trezor.crypto.hmac.py perf(core/extmod): replace HMAC Python implementation with C 2020-10-12 16:33:13 +02:00
test_trezor.crypto.pbkdf2.py MONOREPO CREATE FROM trezor-core 2019-04-15 19:14:40 +02:00
test_trezor.crypto.random.py MONOREPO CREATE FROM trezor-core 2019-04-15 19:14:40 +02:00
test_trezor.crypto.rlp.py MONOREPO CREATE FROM trezor-core 2019-04-15 19:14:40 +02:00
test_trezor.crypto.slip39.py core/tests: update tests for modified slip39 API 2020-01-09 16:00:33 +01:00
test_trezor.io.fatfs.py core/sdcard: modify exception handling in fatfs 2020-03-20 14:03:28 +01:00
test_trezor.io.sdcard.py core: fix unit tests 2020-02-20 12:51:48 +01:00
test_trezor.sdcard.py core: update Python facing APIs 2020-02-27 10:56:23 +01:00
test_trezor.strings.py core: raise error on auto-lock value out of range 2020-07-22 21:38:42 +02:00
test_trezor.ui.display.py perf(core): enable rendering of substrings to avoid slicing 2021-01-11 16:47:59 +01:00
test_trezor.ui.text.py refactor(core): model-dependent UI component directories 2021-02-10 13:57:19 +01:00
test_trezor.utils.py core/webauthn: Truncate names in credential data to at most 100 bytes. 2020-03-20 15:07:06 +01:00
test_trezor.wire.codec_v1.py core/tests: update unit tests 2020-07-24 14:09:31 +02:00
test_unittest.py core/tests: test debug is on 2019-12-23 12:01:00 +00:00
unittest.py core/tests: improve test harness (fixes #1157) 2020-08-04 10:27:44 +02:00

Unit tests

Unit tests test some smaller individual parts of code (mainly functions and classes) and are run by micropython directly.

Usage

Please use the unittest.TestCase class:

from common import *

class TestSomething(unittest.TestCase):

    test_something(self):
        self.assertTrue(True)

Usage of assert is discouraged because it is not evaluated in production code (when PYOPT=1). Use self.assertXY instead, see unittest.py.