From 08a4a56cbcfa54366c2c0bb52bb147fc2740edc5 Mon Sep 17 00:00:00 2001 From: stratospher <44024636+stratospher@users.noreply.github.com> Date: Sat, 9 Sep 2023 14:31:53 +0530 Subject: [PATCH] [test] Move test framework crypto functions to crypto/ --- test/functional/feature_taproot.py | 2 +- test/functional/feature_utxo_set_hash.py | 2 +- test/functional/test_framework/blockfilter.py | 2 +- test/functional/test_framework/{ => crypto}/ellswift.py | 2 +- .../{ => crypto}/ellswift_decode_test_vectors.csv | 0 test/functional/test_framework/{ => crypto}/muhash.py | 0 test/functional/test_framework/{ => crypto}/ripemd160.py | 0 test/functional/test_framework/{ => crypto}/secp256k1.py | 0 test/functional/test_framework/{ => crypto}/siphash.py | 0 .../{ => crypto}/xswiftec_inv_test_vectors.csv | 0 test/functional/test_framework/key.py | 2 +- test/functional/test_framework/messages.py | 2 +- test/functional/test_framework/script.py | 2 +- test/functional/test_runner.py | 6 +++--- 14 files changed, 10 insertions(+), 10 deletions(-) rename test/functional/test_framework/{ => crypto}/ellswift.py (99%) rename test/functional/test_framework/{ => crypto}/ellswift_decode_test_vectors.csv (100%) rename test/functional/test_framework/{ => crypto}/muhash.py (100%) rename test/functional/test_framework/{ => crypto}/ripemd160.py (100%) rename test/functional/test_framework/{ => crypto}/secp256k1.py (100%) rename test/functional/test_framework/{ => crypto}/siphash.py (100%) rename test/functional/test_framework/{ => crypto}/xswiftec_inv_test_vectors.csv (100%) diff --git a/test/functional/feature_taproot.py b/test/functional/feature_taproot.py index e32319961e..d17e2f4c20 100755 --- a/test/functional/feature_taproot.py +++ b/test/functional/feature_taproot.py @@ -105,7 +105,7 @@ from test_framework.key import ( tweak_add_privkey, ECKey, ) -from test_framework import secp256k1 +from test_framework.crypto import secp256k1 from test_framework.address import ( hash160, program_to_witness, diff --git a/test/functional/feature_utxo_set_hash.py b/test/functional/feature_utxo_set_hash.py index 0f510ced89..b1d23c96c4 100755 --- a/test/functional/feature_utxo_set_hash.py +++ b/test/functional/feature_utxo_set_hash.py @@ -11,7 +11,7 @@ from test_framework.messages import ( COutPoint, from_hex, ) -from test_framework.muhash import MuHash3072 +from test_framework.crypto.muhash import MuHash3072 from test_framework.test_framework import BitcoinTestFramework from test_framework.util import assert_equal from test_framework.wallet import MiniWallet diff --git a/test/functional/test_framework/blockfilter.py b/test/functional/test_framework/blockfilter.py index a30e37ea5b..3d6b38a23d 100644 --- a/test/functional/test_framework/blockfilter.py +++ b/test/functional/test_framework/blockfilter.py @@ -4,7 +4,7 @@ # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Helper routines relevant for compact block filters (BIP158). """ -from .siphash import siphash +from .crypto.siphash import siphash def bip158_basic_element_hash(script_pub_key, N, block_hash): diff --git a/test/functional/test_framework/ellswift.py b/test/functional/test_framework/crypto/ellswift.py similarity index 99% rename from test/functional/test_framework/ellswift.py rename to test/functional/test_framework/crypto/ellswift.py index 97b10118e6..429b7b9f4d 100644 --- a/test/functional/test_framework/ellswift.py +++ b/test/functional/test_framework/crypto/ellswift.py @@ -12,7 +12,7 @@ import os import random import unittest -from test_framework.secp256k1 import FE, G, GE +from test_framework.crypto.secp256k1 import FE, G, GE # Precomputed constant square root of -3 (mod p). MINUS_3_SQRT = FE(-3).sqrt() diff --git a/test/functional/test_framework/ellswift_decode_test_vectors.csv b/test/functional/test_framework/crypto/ellswift_decode_test_vectors.csv similarity index 100% rename from test/functional/test_framework/ellswift_decode_test_vectors.csv rename to test/functional/test_framework/crypto/ellswift_decode_test_vectors.csv diff --git a/test/functional/test_framework/muhash.py b/test/functional/test_framework/crypto/muhash.py similarity index 100% rename from test/functional/test_framework/muhash.py rename to test/functional/test_framework/crypto/muhash.py diff --git a/test/functional/test_framework/ripemd160.py b/test/functional/test_framework/crypto/ripemd160.py similarity index 100% rename from test/functional/test_framework/ripemd160.py rename to test/functional/test_framework/crypto/ripemd160.py diff --git a/test/functional/test_framework/secp256k1.py b/test/functional/test_framework/crypto/secp256k1.py similarity index 100% rename from test/functional/test_framework/secp256k1.py rename to test/functional/test_framework/crypto/secp256k1.py diff --git a/test/functional/test_framework/siphash.py b/test/functional/test_framework/crypto/siphash.py similarity index 100% rename from test/functional/test_framework/siphash.py rename to test/functional/test_framework/crypto/siphash.py diff --git a/test/functional/test_framework/xswiftec_inv_test_vectors.csv b/test/functional/test_framework/crypto/xswiftec_inv_test_vectors.csv similarity index 100% rename from test/functional/test_framework/xswiftec_inv_test_vectors.csv rename to test/functional/test_framework/crypto/xswiftec_inv_test_vectors.csv diff --git a/test/functional/test_framework/key.py b/test/functional/test_framework/key.py index c250fc6fe8..02ede2b787 100644 --- a/test/functional/test_framework/key.py +++ b/test/functional/test_framework/key.py @@ -13,7 +13,7 @@ import os import random import unittest -from test_framework import secp256k1 +from test_framework.crypto import secp256k1 # Point with no known discrete log. H_POINT = "50929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0" diff --git a/test/functional/test_framework/messages.py b/test/functional/test_framework/messages.py index 4d635556f4..19b61c9235 100755 --- a/test/functional/test_framework/messages.py +++ b/test/functional/test_framework/messages.py @@ -29,7 +29,7 @@ import struct import time import unittest -from test_framework.siphash import siphash256 +from test_framework.crypto.siphash import siphash256 from test_framework.util import assert_equal MAX_LOCATOR_SZ = 101 diff --git a/test/functional/test_framework/script.py b/test/functional/test_framework/script.py index 78f58cf11f..3b55afed84 100644 --- a/test/functional/test_framework/script.py +++ b/test/functional/test_framework/script.py @@ -24,7 +24,7 @@ from .messages import ( uint256_from_str, ) -from .ripemd160 import ripemd160 +from .crypto.ripemd160 import ripemd160 MAX_SCRIPT_ELEMENT_SIZE = 520 MAX_PUBKEYS_PER_MULTI_A = 999 diff --git a/test/functional/test_runner.py b/test/functional/test_runner.py index db04bb8bdb..99030070d1 100755 --- a/test/functional/test_runner.py +++ b/test/functional/test_runner.py @@ -74,11 +74,11 @@ TEST_EXIT_SKIPPED = 77 TEST_FRAMEWORK_MODULES = [ "address", "blocktools", - "ellswift", + "crypto.ellswift", "key", "messages", - "muhash", - "ripemd160", + "crypto.muhash", + "crypto.ripemd160", "script", "segwit_addr", ]