Skip to content

Commit

Permalink
more
Browse files Browse the repository at this point in the history
  • Loading branch information
altendky committed Jan 10, 2024
1 parent 5fe7d55 commit 15bb550
Show file tree
Hide file tree
Showing 373 changed files with 367 additions and 362 deletions.
22 changes: 11 additions & 11 deletions benchmarks/block_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,17 @@
from typing import List

from benchmarks.utils import setup_db
from chia._tests.util.benchmarks import (
clvm_generator,
rand_bytes,
rand_class_group_element,
rand_g1,
rand_g2,
rand_hash,
rand_vdf,
rand_vdf_proof,
rewards,
)
from chia.consensus.block_record import BlockRecord
from chia.full_node.block_store import BlockStore
from chia.types.blockchain_format.foliage import Foliage, FoliageBlockData, FoliageTransactionBlock, TransactionsInfo
Expand All @@ -20,17 +31,6 @@
from chia.types.blockchain_format.sub_epoch_summary import SubEpochSummary
from chia.types.full_block import FullBlock
from chia.util.ints import uint8, uint32, uint64, uint128
from tests.util.benchmarks import (
clvm_generator,
rand_bytes,
rand_class_group_element,
rand_g1,
rand_g2,
rand_hash,
rand_vdf,
rand_vdf_proof,
rewards,
)

# to run this benchmark:
# python -m benchmarks.coin_store
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/coin_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
from typing import List, Tuple

from benchmarks.utils import setup_db
from chia._tests.util.benchmarks import rand_hash, rewards
from chia.full_node.coin_store import CoinStore
from chia.types.blockchain_format.coin import Coin
from chia.types.blockchain_format.sized_bytes import bytes32
from chia.util.ints import uint32, uint64
from tests.util.benchmarks import rand_hash, rewards

# to run this benchmark:
# python -m benchmarks.coin_store
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/streamable.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
import click

from benchmarks.utils import EnumType, get_commit_hash
from chia._tests.util.benchmarks import rand_bytes, rand_full_block, rand_hash
from chia.types.blockchain_format.sized_bytes import bytes32
from chia.types.full_block import FullBlock
from chia.util.ints import uint8, uint64
from chia.util.streamable import Streamable, streamable
from tests.util.benchmarks import rand_bytes, rand_full_block, rand_hash

# to run this benchmark:
# python -m benchmarks.streamable
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@
from chia_rs import AugSchemeMPL, G2Element
from clvm.casts import int_to_bytes

from chia._tests.blockchain.blockchain_test_utils import (
_validate_and_add_block,
_validate_and_add_block_multi_error,
_validate_and_add_block_multi_result,
_validate_and_add_block_no_error,
check_block_store_invariant,
)
from chia._tests.conftest import ConsensusMode
from chia._tests.util.blockchain import create_blockchain
from chia.consensus.block_body_validation import ForkInfo
from chia.consensus.block_header_validation import validate_finished_header_block
from chia.consensus.block_rewards import calculate_base_farmer_reward
Expand Down Expand Up @@ -51,15 +60,6 @@
DEFAULT_HIDDEN_PUZZLE_HASH,
calculate_synthetic_secret_key,
)
from tests.blockchain.blockchain_test_utils import (
_validate_and_add_block,
_validate_and_add_block_multi_error,
_validate_and_add_block_multi_result,
_validate_and_add_block_no_error,
check_block_store_invariant,
)
from tests.conftest import ConsensusMode
from tests.util.blockchain import create_blockchain

log = logging.getLogger(__name__)
bad_element = ClassgroupElement.create(b"\x00")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import pytest
from clvm.casts import int_to_bytes

from chia._tests.blockchain.blockchain_test_utils import _validate_and_add_block
from chia._tests.util.generator_tools_testing import run_and_get_removals_and_additions
from chia.full_node.full_node_api import FullNodeAPI
from chia.protocols import wallet_protocol
from chia.server.server import ChiaServer
Expand All @@ -18,8 +20,6 @@
from chia.types.spend_bundle import SpendBundle, estimate_fees
from chia.util.errors import ConsensusError, Err
from chia.util.ints import uint32, uint64
from tests.blockchain.blockchain_test_utils import _validate_and_add_block
from tests.util.generator_tools_testing import run_and_get_removals_and_additions

BURN_PUZZLE_HASH = bytes32(b"0" * 32)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@

import pytest

from chia._tests.util.benchmarks import rand_hash
from chia.consensus.block_record import BlockRecord
from chia.consensus.blockchain_interface import BlockchainInterface
from chia.consensus.find_fork_point import find_fork_point_in_chain, lookup_fork_chain
from chia.types.blockchain_format.sized_bytes import bytes32
from chia.util.ints import uint32
from tests.util.benchmarks import rand_hash


class DummyChain:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from chia_rs import AugSchemeMPL, G1Element, G2Element

from chia._tests.util.key_tool import KeyTool
from chia.consensus.default_constants import DEFAULT_CONSTANTS
from chia.types.blockchain_format.program import Program
from chia.types.blockchain_format.sized_bytes import bytes32
Expand All @@ -20,7 +21,6 @@
p2_puzzle_hash,
)
from chia.wallet.puzzles.puzzle_utils import make_create_coin_condition
from tests.util.key_tool import KeyTool

from ..core.make_block_generator import int_to_public_key
from .coin_store import CoinStore, CoinTimestamp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import pytest
from chia_rs import AugSchemeMPL, G1Element, G2Element, PrivateKey

from chia._tests.clvm.test_puzzles import public_key_for_index, secret_exponent_for_index
from chia._tests.util.key_tool import KeyTool
from chia.clvm.spend_sim import CostLogger, SimClient, SpendSim, sim_and_client
from chia.consensus.default_constants import DEFAULT_CONSTANTS
from chia.types.blockchain_format.coin import Coin
Expand All @@ -17,8 +19,6 @@
from chia.util.ints import uint64
from chia.wallet.lineage_proof import LineageProof
from chia.wallet.puzzles import p2_conditions, p2_delegated_puzzle_or_hidden_puzzle
from tests.clvm.test_puzzles import public_key_for_index, secret_exponent_for_index
from tests.util.key_tool import KeyTool

"""
This test suite aims to test:
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from chia_rs import Coin, G2Element

import chia.cmds.wallet_funcs
from chia._tests.cmds.testing_classes import create_test_block_record
from chia.cmds.chia import cli as chia_cli
from chia.cmds.cmds_util import _T_RpcClient, node_config_section_names
from chia.consensus.block_record import BlockRecord
Expand All @@ -33,7 +34,6 @@
from chia.wallet.util.transaction_type import TransactionType
from chia.wallet.util.tx_config import CoinSelectionConfig, TXConfig
from chia.wallet.util.wallet_types import WalletType
from tests.cmds.testing_classes import create_test_block_record

# Any functions that are the same for every command being tested should be below.
# Functions that are specific to a command should be in the test file for that command.
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/cmds/conftest.py → chia/_tests/cmds/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

import pytest

from chia._tests.cmds.cmd_test_utils import TestRpcClients, create_service_and_wallet_client_generators
from chia.util.config import create_default_chia_config
from tests.cmds.cmd_test_utils import TestRpcClients, create_service_and_wallet_client_generators


@pytest.fixture(scope="module") # every file has its own config generated, just to be safe
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
import pytest
from _pytest.capture import CaptureFixture

from chia._tests.util.time_out_assert import time_out_assert
from chia.cmds.farm_funcs import summary
from chia.farmer.farmer import Farmer
from chia.harvester.harvester import Harvester
from chia.simulator.block_tools import BlockTools
from chia.types.aliases import FarmerService, HarvesterService, SimulatorFullNodeService, WalletService
from tests.util.time_out_assert import time_out_assert


@pytest.mark.anyio
Expand Down
6 changes: 3 additions & 3 deletions tests/cmds/test_show.py → chia/_tests/cmds/test_show.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
from pathlib import Path
from typing import Any, Dict, List, Optional, Tuple

from chia._tests.cmds.cmd_test_utils import TestFullNodeRpcClient, TestRpcClients, run_cli_command_and_assert
from chia._tests.cmds.testing_classes import hash_to_height, height_hash
from chia._tests.util.test_full_block_utils import get_foliage, get_reward_chain_block, get_transactions_info, vdf_proof
from chia.types.blockchain_format.foliage import FoliageTransactionBlock
from chia.types.blockchain_format.serialized_program import SerializedProgram
from chia.types.blockchain_format.sized_bytes import bytes32
from chia.types.full_block import FullBlock
from chia.util.ints import uint32, uint64
from tests.cmds.cmd_test_utils import TestFullNodeRpcClient, TestRpcClients, run_cli_command_and_assert
from tests.cmds.testing_classes import hash_to_height, height_hash
from tests.util.test_full_block_utils import get_foliage, get_reward_chain_block, get_transactions_info, vdf_proof


@dataclass
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@

from chia_rs import Coin

from chia._tests.cmds.cmd_test_utils import TestRpcClients, TestWalletRpcClient, logType, run_cli_command_and_assert
from chia._tests.cmds.wallet.test_consts import FINGERPRINT, FINGERPRINT_ARG, get_bytes32
from chia.types.blockchain_format.sized_bytes import bytes32
from chia.types.coin_record import CoinRecord
from chia.util.ints import uint32, uint64
from chia.wallet.util.tx_config import DEFAULT_TX_CONFIG, CoinSelectionConfig, TXConfig
from tests.cmds.cmd_test_utils import TestRpcClients, TestWalletRpcClient, logType, run_cli_command_and_assert
from tests.cmds.wallet.test_consts import FINGERPRINT, FINGERPRINT_ARG, get_bytes32

# Coin Commands

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

import pytest

from chia._tests.cmds.cmd_test_utils import TestRpcClients, TestWalletRpcClient, run_cli_command_and_assert
from chia._tests.cmds.wallet.test_consts import FINGERPRINT_ARG
from chia.types.blockchain_format.sized_bytes import bytes32
from chia.util.bech32m import encode_puzzle_hash
from chia.util.ints import uint8, uint32, uint64
Expand All @@ -15,8 +17,6 @@
from chia.wallet.util.transaction_type import TransactionType
from chia.wallet.util.tx_config import TXConfig
from chia.wallet.util.wallet_types import WalletType
from tests.cmds.cmd_test_utils import TestRpcClients, TestWalletRpcClient, run_cli_command_and_assert
from tests.cmds.wallet.test_consts import FINGERPRINT_ARG

# DAO Commands

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
from pathlib import Path
from typing import Dict, List, Optional, Tuple, Union

from chia._tests.cmds.cmd_test_utils import TestRpcClients, TestWalletRpcClient, logType, run_cli_command_and_assert
from chia._tests.cmds.wallet.test_consts import FINGERPRINT_ARG, get_bytes32
from chia.types.blockchain_format.sized_bytes import bytes48
from chia.types.signing_mode import SigningMode
from chia.util.bech32m import encode_puzzle_hash
from chia.wallet.util.tx_config import DEFAULT_TX_CONFIG, TXConfig
from tests.cmds.cmd_test_utils import TestRpcClients, TestWalletRpcClient, logType, run_cli_command_and_assert
from tests.cmds.wallet.test_consts import FINGERPRINT_ARG, get_bytes32

# DID Commands

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
from pathlib import Path
from typing import Any, List, Optional, Tuple

from chia._tests.cmds.cmd_test_utils import TestRpcClients, TestWalletRpcClient, logType, run_cli_command_and_assert
from chia._tests.cmds.wallet.test_consts import FINGERPRINT, FINGERPRINT_ARG, get_bytes32
from chia.types.blockchain_format.sized_bytes import bytes32
from chia.types.signing_mode import SigningMode
from chia.util.bech32m import encode_puzzle_hash
from chia.util.ints import uint8, uint16, uint32, uint64
from chia.wallet.nft_wallet.nft_info import NFTInfo
from chia.wallet.util.tx_config import DEFAULT_TX_CONFIG, TXConfig
from tests.cmds.cmd_test_utils import TestRpcClients, TestWalletRpcClient, logType, run_cli_command_and_assert
from tests.cmds.wallet.test_consts import FINGERPRINT, FINGERPRINT_ARG, get_bytes32

# NFT Commands

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
from pathlib import Path
from typing import List, Optional, Tuple, cast

from chia._tests.cmds.cmd_test_utils import TestRpcClients, TestWalletRpcClient, logType, run_cli_command_and_assert
from chia._tests.cmds.wallet.test_consts import FINGERPRINT, FINGERPRINT_ARG, get_bytes32
from chia.types.blockchain_format.sized_bytes import bytes32
from chia.util.bech32m import encode_puzzle_hash
from chia.util.ints import uint32, uint64
from chia.wallet.notification_store import Notification
from chia.wallet.transaction_record import TransactionRecord
from tests.cmds.cmd_test_utils import TestRpcClients, TestWalletRpcClient, logType, run_cli_command_and_assert
from tests.cmds.wallet.test_consts import FINGERPRINT, FINGERPRINT_ARG, get_bytes32

# Notifications Commands

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@

from chia_rs import Coin

from chia._tests.cmds.cmd_test_utils import TestRpcClients, TestWalletRpcClient, logType, run_cli_command_and_assert
from chia._tests.cmds.wallet.test_consts import FINGERPRINT_ARG, STD_TX, get_bytes32
from chia.types.blockchain_format.sized_bytes import bytes32
from chia.util.bech32m import encode_puzzle_hash
from chia.util.ints import uint32, uint64
from chia.wallet.transaction_record import TransactionRecord
from chia.wallet.util.tx_config import DEFAULT_TX_CONFIG, TXConfig
from chia.wallet.vc_wallet.vc_store import VCRecord
from tests.cmds.cmd_test_utils import TestRpcClients, TestWalletRpcClient, logType, run_cli_command_and_assert
from tests.cmds.wallet.test_consts import FINGERPRINT_ARG, STD_TX, get_bytes32

# VC Commands

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@
import pkg_resources
from chia_rs import Coin, G2Element

from chia._tests.cmds.cmd_test_utils import TestRpcClients, TestWalletRpcClient, logType, run_cli_command_and_assert
from chia._tests.cmds.wallet.test_consts import (
CAT_FINGERPRINT_ARG,
FINGERPRINT,
FINGERPRINT_ARG,
STD_TX,
WALLET_ID,
WALLET_ID_ARG,
bytes32_hexstr,
get_bytes32,
)
from chia.server.outbound_message import NodeType
from chia.types.blockchain_format.program import Program
from chia.types.blockchain_format.sized_bytes import bytes32
Expand All @@ -24,17 +35,6 @@
from chia.wallet.util.tx_config import DEFAULT_TX_CONFIG, TXConfig
from chia.wallet.util.wallet_types import WalletType
from chia.wallet.wallet_coin_store import GetCoinRecords
from tests.cmds.cmd_test_utils import TestRpcClients, TestWalletRpcClient, logType, run_cli_command_and_assert
from tests.cmds.wallet.test_consts import (
CAT_FINGERPRINT_ARG,
FINGERPRINT,
FINGERPRINT_ARG,
STD_TX,
WALLET_ID,
WALLET_ID_ARG,
bytes32_hexstr,
get_bytes32,
)

test_offer_file_path: Path = Path(pkg_resources.resource_filename(__name__, "test_offer.toffer"))
test_offer_file_name: str = str(test_offer_file_path)
Expand Down
File renamed without changes.
Loading

0 comments on commit 15bb550

Please sign in to comment.