From 4697e39470c8a4d6af6826ebce46276ca8378371 Mon Sep 17 00:00:00 2001 From: Gene Hoffman <30377676+hoffmang9@users.noreply.github.com> Date: Sat, 13 Mar 2021 14:57:41 -0800 Subject: [PATCH] Various clean ups, spelling thanks @adamfiddler, isort (#1278) * Various clean ups, spelling thanks @adamfiddler, isort * Actually thank @adamfiddler * isort tests * Update changelog, readme, spec, spelling * Readme nit * locales * locales again --- CHANGELOG.md | 9 +++++++-- README.md | 6 +++--- build_scripts/daemon_windows.spec | 7 ++++--- chia-blockchain-gui | 2 +- src/cmds/plots.py | 2 +- src/consensus/pot_iterations.py | 4 ++-- src/farmer/farmer.py | 7 +++---- src/full_node/full_node.py | 5 ++--- src/protocols/shared_protocol.py | 4 ++-- src/server/rate_limits.py | 3 +-- src/server/server.py | 4 +--- src/server/start_service.py | 2 +- src/server/ws_connection.py | 2 +- src/ssl/create_ssl.py | 3 +-- src/timelord/timelord.py | 2 +- src/wallet/puzzles/lowlevel_generator.py | 5 +++-- src/wallet/wallet_node.py | 2 +- tests/blockchain/test_blockchain.py | 9 ++++----- tests/clvm/test_chialisp_deserialization.py | 5 ++--- tests/core/daemon/test_daemon_alerts.py | 4 ++-- tests/core/fixtures.py | 7 +++---- tests/core/full_node/test_full_node_store.py | 2 +- tests/core/server/test_rate_limits.py | 1 + tests/core/test_farmer_harvester_rpc.py | 2 +- 24 files changed, 49 insertions(+), 50 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bf015e123157..d3d2ac4a3432 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project does not yet adhere to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) for setuptools_scm/PEP 440 reasons. -## 1.0rc7 aka Release Candidate 7 - 2020-03-12 +## 1.0rc7 aka Release Candidate 7 - 2020-03-13 ### Changed @@ -16,8 +16,13 @@ for setuptools_scm/PEP 440 reasons. ### Fixed +- Setting difficulty way too low on the testnet_6 launch revealed a Timelord edge case. The full node was hardcoding the default difficulty if block height is < EPOCH_BLOCKS. However there were many overlapping blocks, so none of the blocks reached the height, and therefore the timelord infused the wrong difficulty. +- Fixed a race condition in the Timelord, where it took time to update the state, so it ignored the new_peak_timelord form the full_node, which should have reset the timelord to a good state. +- Wallet notoriously showed "not synced" when it was in sync. - Installers were not correctly placing root TLS certificates into the bundle. - Weight proofs had a logic typo. +- There was a typo in `chia netspace`. Thanks @altendky. +- There was a typo in `chia plots`. Thanks @adamfiddler. ## 1.0rc6 aka Release Candidate 6 - 2020-03-11 @@ -78,7 +83,7 @@ for setuptools_scm/PEP 440 reasons. - The RC5 release is a new breaking change/hard fork blockchain. Plots and keys from previous chains will work fine on RC5 but balances of TXCH will not come forward. - We now support a "green flag" chain launch process. A new version of the software will poll download.chia.net/notify/ for a signed json file that will be the genesis block of the chain for that version. This will allow unattended start at mainnet. - Bluebox Timelords are back. These are Timelords most anyone can run. They search through the historical chain and find large proofs of times and compact them down to their smallest representation. This significantly speeds up syncing for newly started nodes. Currently this is only supported on Linux and MacOS x86_64 but we will expand that. Any desktop or server of any age will be fast enough to be a useful Bluebox Timelord. -- Thanks to @jespino there is now `chia farm show`. You can now get almost exactly the same farming information on the CLI as the GUI. +- Thanks to @jespino there is now `chia farm summary`. You can now get almost exactly the same farming information on the CLI as the GUI. - We have added Romanian to the GUI translations. Thank you to @bicilis on [Crowdin](https://crowdin.com/project/chia-blockchain). We also added a couple of additional target languages. Klingon anyone? - `chia wallet` now takes get_address to get a new wallet receive address from the CLI. - `chia plots check` will list out all the failed plot filenames at the end of the report. Thanks for the PR go to @eFishCent. diff --git a/README.md b/README.md index 1ce1c6c45a17..8d4be6f6ffc7 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ | Current Release/main | Development Branch/dev | | :---: | :---: | -| ![Build Ubuntu on 3.7 and 3.8](https://github.com/Chia-Network/chia-blockchain/workflows/Build%20Ubuntu%20on%20Python%203.7%20and%203.8/badge.svg) ![Build MacOS](https://github.com/Chia-Network/chia-blockchain/workflows/Build%20MacOS/badge.svg) ![Build Windows](https://github.com/Chia-Network/chia-blockchain/workflows/Build%20Windows/badge.svg) | ![Build Ubuntu on 3.7 and 3.8](https://github.com/Chia-Network/chia-blockchain/workflows/Build%20Ubuntu%20on%20Python%203.7%20and%203.8/badge.svg?branch=dev) ![Build MacOS](https://github.com/Chia-Network/chia-blockchain/workflows/Build%20MacOS/badge.svg?branch=dev) ![Build Windows](https://github.com/Chia-Network/chia-blockchain/workflows/Build%20Windows/badge.svg?branch=dev) | +| [![Ubuntu Core Tests](https://github.com/Chia-Network/chia-blockchain/actions/workflows/build-test-ubuntu-core.yml/badge.svg)](https://github.com/Chia-Network/chia-blockchain/actions/workflows/build-test-ubuntu-core.yml) [![MacOS Core Tests](https://github.com/Chia-Network/chia-blockchain/actions/workflows/build-test-macos-core.yml/badge.svg)](https://github.com/Chia-Network/chia-blockchain/actions/workflows/build-test-macos-core.yml) [![Windows Installer on Windows 10 and Python 3.7](https://github.com/Chia-Network/chia-blockchain/actions/workflows/build-windows-installer.yml/badge.svg)](https://github.com/Chia-Network/chia-blockchain/actions/workflows/build-windows-installer.yml) | [![Ubuntu Core Tests](https://github.com/Chia-Network/chia-blockchain/actions/workflows/build-test-ubuntu-core.yml/badge.svg?branch=dev)](https://github.com/Chia-Network/chia-blockchain/actions/workflows/build-test-ubuntu-core.yml) [![MacOS Core Tests](https://github.com/Chia-Network/chia-blockchain/actions/workflows/build-test-macos-core.yml/badge.svg?branch=dev)](https://github.com/Chia-Network/chia-blockchain/actions/workflows/build-test-macos-core.yml) [![Windows Installer on Windows 10 and Python 3.7](https://github.com/Chia-Network/chia-blockchain/actions/workflows/build-windows-installer.yml/badge.svg?branch=dev)](https://github.com/Chia-Network/chia-blockchain/actions/workflows/build-windows-installer.yml) | ![GitHub contributors](https://img.shields.io/github/contributors/Chia-Network/chia-blockchain?logo=GitHub) @@ -22,9 +22,9 @@ TCP port 8444 access to your peer. These methods tend to be router make/model specific. Most should only install harvesters, farmers, plotter, full nodes, and wallets. -Building timelords and VDFs is for sophisticated users in most environments. +Building Timelords and VDFs is for sophisticated users in most environments. Chia Network and additional volunteers are running sufficient Timelords -for testnet consensus. +for consensus. ## Installing Install instructions are available in the diff --git a/build_scripts/daemon_windows.spec b/build_scripts/daemon_windows.spec index 52386884fde6..3bfbcc42d8f3 100644 --- a/build_scripts/daemon_windows.spec +++ b/build_scripts/daemon_windows.spec @@ -22,17 +22,18 @@ keyring_datas = copy_metadata('keyring')[0] version_data = copy_metadata(get_distribution("chia-blockchain"))[0] SUBCOMMANDS = [ + "configure", + "farm", "init", "keys", + "netspace", "plots", + "run_daemon", "show", "start", "stop", "version", - "netspace", - "run_daemon", "wallet", - "configure", ] block_cipher = None subcommand_modules = [f"../src.cmds.%s" % _ for _ in SUBCOMMANDS] diff --git a/chia-blockchain-gui b/chia-blockchain-gui index 470880dd35ed..56b1be7b0c9a 160000 --- a/chia-blockchain-gui +++ b/chia-blockchain-gui @@ -1 +1 @@ -Subproject commit 470880dd35ed2ab808f667d8c29bd0daab7ada4f +Subproject commit 56b1be7b0c9a9ace872b4915a214312e2cd538a2 diff --git a/src/cmds/plots.py b/src/cmds/plots.py index 5ce839edecc9..c228be144f50 100644 --- a/src/cmds/plots.py +++ b/src/cmds/plots.py @@ -128,7 +128,7 @@ def __init__(self): print("If you are testing and you want to use smaller size please add the --override-k flag.") sys.exit(1) elif size < 25 and override_k: - print("Error: The minimun k size allowed from the cli is k=25.") + print("Error: The minimum k size allowed from the cli is k=25.") sys.exit(1) create_plots(Params(), ctx.obj["root_path"]) diff --git a/src/consensus/pot_iterations.py b/src/consensus/pot_iterations.py index aa960055e87d..8987406be690 100644 --- a/src/consensus/pot_iterations.py +++ b/src/consensus/pot_iterations.py @@ -1,7 +1,7 @@ +from src.consensus.constants import ConsensusConstants +from src.consensus.pos_quality import _expected_plot_size from src.types.blockchain_format.sized_bytes import bytes32 from src.util.hash import std_hash -from src.consensus.pos_quality import _expected_plot_size -from src.consensus.constants import ConsensusConstants from src.util.ints import uint8, uint64, uint128 diff --git a/src/farmer/farmer.py b/src/farmer/farmer.py index 0b37b01df4c2..9ae339390520 100644 --- a/src/farmer/farmer.py +++ b/src/farmer/farmer.py @@ -6,10 +6,8 @@ from blspy import G1Element -from src.consensus.coinbase import create_puzzlehash_for_pk -from src.util.config import load_config, save_config - import src.server.ws_connection as ws # lgtm [py/import-and-import-from] +from src.consensus.coinbase import create_puzzlehash_for_pk from src.consensus.constants import ConsensusConstants from src.protocols import farmer_protocol, harvester_protocol from src.protocols.protocol_message_types import ProtocolMessageTypes @@ -18,7 +16,8 @@ from src.types.blockchain_format.proof_of_space import ProofOfSpace from src.types.blockchain_format.sized_bytes import bytes32 from src.util.bech32m import decode_puzzle_hash -from src.util.ints import uint64, uint32 +from src.util.config import load_config, save_config +from src.util.ints import uint32, uint64 from src.util.keychain import Keychain from src.wallet.derive_keys import master_sk_to_farmer_sk, master_sk_to_pool_sk, master_sk_to_wallet_sk diff --git a/src/full_node/full_node.py b/src/full_node/full_node.py index 04c212824ff7..2f586be0bf7e 100644 --- a/src/full_node/full_node.py +++ b/src/full_node/full_node.py @@ -33,20 +33,19 @@ from src.server.outbound_message import Message, NodeType, make_msg from src.server.server import ChiaServer from src.types.blockchain_format.classgroup import ClassgroupElement -from src.types.end_of_slot_bundle import EndOfSubSlotBundle from src.types.blockchain_format.pool_target import PoolTarget from src.types.blockchain_format.sized_bytes import bytes32 from src.types.blockchain_format.sub_epoch_summary import SubEpochSummary from src.types.blockchain_format.vdf import CompressibleVDFField, VDFInfo, VDFProof +from src.types.end_of_slot_bundle import EndOfSubSlotBundle from src.types.full_block import FullBlock from src.types.header_block import HeaderBlock from src.types.mempool_inclusion_status import MempoolInclusionStatus from src.types.spend_bundle import SpendBundle from src.types.unfinished_block import UnfinishedBlock from src.util.errors import ConsensusError, Err -from src.util.ints import uint8, uint32, uint64, uint128 from src.util.genesis_wait import wait_for_genesis_challenge - +from src.util.ints import uint8, uint32, uint64, uint128 from src.util.path import mkdir, path_from_root diff --git a/src/protocols/shared_protocol.py b/src/protocols/shared_protocol.py index 62aa7967fd86..5735aec21651 100644 --- a/src/protocols/shared_protocol.py +++ b/src/protocols/shared_protocol.py @@ -1,7 +1,7 @@ from dataclasses import dataclass -from typing import Tuple, List - from enum import IntEnum +from typing import List, Tuple + from src.util.ints import uint8, uint16 from src.util.streamable import Streamable, streamable diff --git a/src/server/rate_limits.py b/src/server/rate_limits.py index 5a950aa383c6..19e82cf3a645 100644 --- a/src/server/rate_limits.py +++ b/src/server/rate_limits.py @@ -1,11 +1,10 @@ import dataclasses import logging import time +from collections import Counter from typing import Optional from src.protocols.protocol_message_types import ProtocolMessageTypes -from collections import Counter - from src.server.outbound_message import Message log = logging.getLogger(__name__) diff --git a/src/server/server.py b/src/server/server.py index a2323bf1167d..d3fbe59570e9 100644 --- a/src/server/server.py +++ b/src/server/server.py @@ -8,7 +8,7 @@ from secrets import token_bytes from typing import Any, Callable, Dict, List, Optional, Set, Tuple -from aiohttp import ClientSession, ClientTimeout, WSCloseCode, client_exceptions, web, ServerDisconnectedError +from aiohttp import ClientSession, ClientTimeout, ServerDisconnectedError, WSCloseCode, client_exceptions, web from aiohttp.web_app import Application from aiohttp.web_runner import TCPSite from cryptography import x509 @@ -25,7 +25,6 @@ from src.types.peer_info import PeerInfo from src.util.errors import Err, ProtocolError from src.util.ints import uint16 - from src.util.network import is_localhost @@ -527,7 +526,6 @@ async def wrapped_coroutine(): connection.log.error(f"Exception: {e}, closing connection {connection.get_peer_info()}. {tb}") else: connection.log.debug(f"Exception: {e} while closing connection") - pass # TODO: actually throw one of the errors from errors.py and pass this to close await connection.close(self.api_exception_ban_seconds, WSCloseCode.PROTOCOL_ERROR, Err.UNKNOWN) finally: diff --git a/src/server/start_service.py b/src/server/start_service.py index a6a713fb244c..76934f460699 100644 --- a/src/server/start_service.py +++ b/src/server/start_service.py @@ -5,7 +5,7 @@ from sys import platform from typing import Any, Callable, List, Optional, Tuple -from src.server.ssl_context import private_ssl_ca_paths, chia_ssl_ca_paths +from src.server.ssl_context import chia_ssl_ca_paths, private_ssl_ca_paths try: import uvloop diff --git a/src/server/ws_connection.py b/src/server/ws_connection.py index 5e86420c9eb5..020e6b6722af 100644 --- a/src/server/ws_connection.py +++ b/src/server/ws_connection.py @@ -8,7 +8,7 @@ from src.cmds.init import chia_full_version_str from src.protocols.protocol_message_types import ProtocolMessageTypes -from src.protocols.shared_protocol import Handshake, Capability +from src.protocols.shared_protocol import Capability, Handshake from src.server.outbound_message import Message, NodeType, make_msg from src.server.rate_limits import RateLimiter from src.types.blockchain_format.sized_bytes import bytes32 diff --git a/src/ssl/create_ssl.py b/src/ssl/create_ssl.py index b93613e4c83d..31f1b2c7a31b 100644 --- a/src/ssl/create_ssl.py +++ b/src/ssl/create_ssl.py @@ -1,5 +1,4 @@ import datetime -import pathlib from pathlib import Path from typing import Any, Tuple @@ -19,7 +18,7 @@ def get_chia_ca_crt_key() -> Tuple[Any, Any]: def get_mozzila_ca_crt() -> str: - mozilla_path = pathlib.Path(__file__).parent.parent.parent.absolute() / "mozilla-ca/cacert.pem" + mozilla_path = Path(__file__).parent.parent.parent.absolute() / "mozilla-ca/cacert.pem" return str(mozilla_path) diff --git a/src/timelord/timelord.py b/src/timelord/timelord.py index 195cb0e28b83..3aa517b1faed 100644 --- a/src/timelord/timelord.py +++ b/src/timelord/timelord.py @@ -27,10 +27,10 @@ RewardChainSubSlot, SubSlotProofs, ) -from src.util.genesis_wait import wait_for_genesis_challenge from src.types.blockchain_format.sub_epoch_summary import SubEpochSummary from src.types.blockchain_format.vdf import VDFInfo, VDFProof from src.types.end_of_slot_bundle import EndOfSubSlotBundle +from src.util.genesis_wait import wait_for_genesis_challenge from src.util.ints import uint8, uint32, uint64 log = logging.getLogger(__name__) diff --git a/src/wallet/puzzles/lowlevel_generator.py b/src/wallet/puzzles/lowlevel_generator.py index f0820a40f4a9..e115c2012004 100644 --- a/src/wallet/puzzles/lowlevel_generator.py +++ b/src/wallet/puzzles/lowlevel_generator.py @@ -1,7 +1,8 @@ -from src.wallet.chialisp import eval, sexp, args, make_if, quote, make_list, rest, cons, sha256tree -from src.types.blockchain_format.program import SerializedProgram, Program from clvm_tools import binutils +from src.types.blockchain_format.program import Program, SerializedProgram +from src.wallet.chialisp import args, cons, eval, make_if, make_list, quote, rest, sexp, sha256tree + def get_generator(): diff --git a/src/wallet/wallet_node.py b/src/wallet/wallet_node.py index 4b73ef3dc899..5fc198b72ec5 100644 --- a/src/wallet/wallet_node.py +++ b/src/wallet/wallet_node.py @@ -35,7 +35,7 @@ from src.types.header_block import HeaderBlock from src.types.peer_info import PeerInfo from src.util.byte_types import hexstr_to_bytes -from src.util.errors import ValidationError, Err +from src.util.errors import Err, ValidationError from src.util.genesis_wait import wait_for_genesis_challenge from src.util.ints import uint32, uint128 from src.util.keychain import Keychain diff --git a/tests/blockchain/test_blockchain.py b/tests/blockchain/test_blockchain.py index 89d4019e6938..4ef343492e44 100644 --- a/tests/blockchain/test_blockchain.py +++ b/tests/blockchain/test_blockchain.py @@ -14,23 +14,22 @@ from src.types.blockchain_format.classgroup import ClassgroupElement from src.types.blockchain_format.sized_bytes import bytes32 from src.types.blockchain_format.slots import InfusedChallengeChainSubSlot +from src.types.blockchain_format.vdf import VDFInfo, VDFProof from src.types.end_of_slot_bundle import EndOfSubSlotBundle from src.types.full_block import FullBlock from src.types.unfinished_block import UnfinishedBlock -from src.types.blockchain_format.vdf import VDFInfo, VDFProof -from src.util.block_tools import get_vdf_info_and_proof, BlockTools +from src.util.block_tools import BlockTools, get_vdf_info_and_proof from src.util.errors import Err from src.util.hash import std_hash from src.util.ints import uint8, uint64 from src.util.recursive_replace import recursive_replace -from tests.core.fixtures import empty_blockchain, create_blockchain # noqa: F401 -from tests.core.fixtures import default_1000_blocks # noqa: F401 from src.util.wallet_tools import WalletTool -from tests.core.fixtures import default_400_blocks # noqa: F401 +from tests.core.fixtures import default_400_blocks # noqa: F401; noqa: F401 from tests.core.fixtures import default_1000_blocks # noqa: F401 from tests.core.fixtures import default_10000_blocks # noqa: F401 from tests.core.fixtures import default_10000_blocks_compact # noqa: F401 from tests.core.fixtures import empty_blockchain # noqa: F401 +from tests.core.fixtures import create_blockchain from tests.setup_nodes import bt, test_constants log = logging.getLogger(__name__) diff --git a/tests/clvm/test_chialisp_deserialization.py b/tests/clvm/test_chialisp_deserialization.py index 0508f3c2f100..c9203c0b6381 100644 --- a/tests/clvm/test_chialisp_deserialization.py +++ b/tests/clvm/test_chialisp_deserialization.py @@ -1,9 +1,8 @@ from unittest import TestCase -from src.wallet.puzzles.load_clvm import load_clvm -from src.util.byte_types import hexstr_to_bytes from src.types.blockchain_format.program import Program - +from src.util.byte_types import hexstr_to_bytes +from src.wallet.puzzles.load_clvm import load_clvm DESERIALIZE_MOD = load_clvm("chialisp_deserialisation.clvm", package_or_requirement="src.wallet.puzzles") diff --git a/tests/core/daemon/test_daemon_alerts.py b/tests/core/daemon/test_daemon_alerts.py index e1a7c2e00afe..bb0a2166fba4 100644 --- a/tests/core/daemon/test_daemon_alerts.py +++ b/tests/core/daemon/test_daemon_alerts.py @@ -10,10 +10,10 @@ from src.util.ints import uint16 from src.util.validate_alert import create_alert_file, create_not_ready_alert_file from tests.core.full_node.test_full_sync import node_height_at_least -from tests.setup_nodes import setup_daemon, self_hostname, setup_full_system +from tests.setup_nodes import self_hostname, setup_daemon, setup_full_system from tests.simulation.test_simulation import test_constants_modified -from tests.util.alert_server import AlertServer from tests.time_out_assert import time_out_assert, time_out_assert_custom_interval +from tests.util.alert_server import AlertServer no_genesis = dataclasses.replace(test_constants_modified, GENESIS_CHALLENGE=None) b_tools = BlockTools(constants=no_genesis) diff --git a/tests/core/fixtures.py b/tests/core/fixtures.py index d9c6c6347f6b..a8b05baba619 100644 --- a/tests/core/fixtures.py +++ b/tests/core/fixtures.py @@ -1,14 +1,13 @@ import pickle from os import path +from pathlib import Path +from typing import List import aiosqlite import pytest -from typing import List -from pathlib import Path - -from src.consensus.constants import ConsensusConstants from src.consensus.blockchain import Blockchain +from src.consensus.constants import ConsensusConstants from src.full_node.block_store import BlockStore from src.full_node.coin_store import CoinStore from src.types.full_block import FullBlock diff --git a/tests/core/full_node/test_full_node_store.py b/tests/core/full_node/test_full_node_store.py index 3c77327cf664..d9040270c5ae 100644 --- a/tests/core/full_node/test_full_node_store.py +++ b/tests/core/full_node/test_full_node_store.py @@ -18,7 +18,7 @@ from src.util.block_tools import get_signage_point from src.util.hash import std_hash from src.util.ints import uint8, uint32, uint64, uint128 -from tests.core.fixtures import empty_blockchain, default_1000_blocks # noqa: F401 +from tests.core.fixtures import default_1000_blocks, empty_blockchain # noqa: F401 from tests.setup_nodes import bt, test_constants log = logging.getLogger(__name__) diff --git a/tests/core/server/test_rate_limits.py b/tests/core/server/test_rate_limits.py index 98a85981e96d..dab6d7c36f8a 100644 --- a/tests/core/server/test_rate_limits.py +++ b/tests/core/server/test_rate_limits.py @@ -1,4 +1,5 @@ import asyncio + import pytest from src.protocols.protocol_message_types import ProtocolMessageTypes diff --git a/tests/core/test_farmer_harvester_rpc.py b/tests/core/test_farmer_harvester_rpc.py index 3a82e4d24220..5786e133df49 100644 --- a/tests/core/test_farmer_harvester_rpc.py +++ b/tests/core/test_farmer_harvester_rpc.py @@ -16,7 +16,7 @@ from src.util.bech32m import decode_puzzle_hash, encode_puzzle_hash from src.util.block_tools import get_plot_dir from src.util.hash import std_hash -from src.util.ints import uint8, uint16, uint64, uint32 +from src.util.ints import uint8, uint16, uint32, uint64 from src.wallet.derive_keys import master_sk_to_wallet_sk from tests.setup_nodes import bt, self_hostname, setup_farmer_harvester, test_constants from tests.time_out_assert import time_out_assert