No network type (#12783)

* No network type

* Use selected network

* remove NETWORK_TYPE

* Don't warn on invalid key, and remove from config

* Remove bytes32

* Put back the warning log
This commit is contained in:
Mariano Sorgente 2022-08-06 01:53:02 +07:00 committed by GitHub
parent 105f02993f
commit e314040d8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 5 additions and 22 deletions

View File

@ -56,7 +56,6 @@ class ConsensusConstants:
WEIGHT_PROOF_RECENT_BLOCKS: uint32
MAX_BLOCK_COUNT_PER_REQUESTS: uint32
BLOCKS_CACHE_SIZE: uint32
NETWORK_TYPE: int
MAX_GENERATOR_SIZE: uint32
MAX_GENERATOR_REF_LIST_SIZE: uint32
POOL_SUB_SLOT_ITERS: uint64
@ -72,7 +71,9 @@ class ConsensusConstants:
filtered_changes = {}
for k, v in changes.items():
if not hasattr(self, k):
log.warn(f'invalid key in network configuration (config.yaml) "{k}". Ignoring')
# NETWORK_TYPE used to be present in default config, but has been removed
if k not in ["NETWORK_TYPE"]:
log.warning(f'invalid key in network configuration (config.yaml) "{k}". Ignoring')
continue
if isinstance(v, str):
filtered_changes[k] = hexstr_to_bytes(v)

View File

@ -50,7 +50,6 @@ default_kwargs = {
"BLOCKS_CACHE_SIZE": 4608 + (128 * 4),
"WEIGHT_PROOF_RECENT_BLOCKS": 1000,
"MAX_BLOCK_COUNT_PER_REQUESTS": 32, # Allow up to 32 blocks per request
"NETWORK_TYPE": 0,
"MAX_GENERATOR_SIZE": 1000000,
"MAX_GENERATOR_REF_LIST_SIZE": 512, # Number of references allowed in the block generator ref list
"POOL_SUB_SLOT_ITERS": 37600000000, # iters limit * NUM_SPS

View File

@ -1,6 +0,0 @@
from enum import IntEnum
class NetworkType(IntEnum):
MAINNET = 0
TESTNET = 1

View File

@ -7,7 +7,6 @@ from blspy import AugSchemeMPL, G2Element, PrivateKey
import chia.server.ws_connection as ws
from chia import __version__
from chia.consensus.network_type import NetworkType
from chia.consensus.pot_iterations import calculate_iterations_quality, calculate_sp_interval_iters
from chia.farmer.farmer import Farmer
from chia.protocols import farmer_protocol, harvester_protocol
@ -65,7 +64,7 @@ class FarmerAPI:
max_pos_per_sp = 5
if self.farmer.constants.NETWORK_TYPE != NetworkType.MAINNET:
if self.farmer.config.get("selected_network") != "mainnet":
# This is meant to make testnets more stable, when difficulty is very low
if self.farmer.number_of_responses[new_proof_of_space.sp_hash] > max_pos_per_sp:
self.farmer.log.info(

View File

@ -122,7 +122,6 @@ test_constants = DEFAULT_CONSTANTS.replace(
* 10, # Allows creating blockchains with timestamps up to 10 days in the future, for testing
"COST_PER_BYTE": 1337,
"MEMPOOL_BLOCK_BUFFER": 6,
"NETWORK_TYPE": 1,
}
)

View File

@ -12,20 +12,17 @@ outbound_rate_limit_percent: 30
network_overrides: &network_overrides
constants:
mainnet:
NETWORK_TYPE: 0
GENESIS_CHALLENGE: ccd5bb71183532bff220ba46c268991a3ff07eb358e8255a65c30a2dce0e5fbb
GENESIS_PRE_FARM_POOL_PUZZLE_HASH: "d23da14695a188ae5708dd152263c4db883eb27edeb936178d4d988b8f3ce5fc"
GENESIS_PRE_FARM_FARMER_PUZZLE_HASH: "3d8765d3a597ec1d99663f6c9816d915b9f68613ac94009884c4addaefcce6af"
testnet0:
MIN_PLOT_SIZE: 18
GENESIS_CHALLENGE: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
NETWORK_TYPE: 1
GENESIS_PRE_FARM_POOL_PUZZLE_HASH: "d23da14695a188ae5708dd152263c4db883eb27edeb936178d4d988b8f3ce5fc"
GENESIS_PRE_FARM_FARMER_PUZZLE_HASH: "3d8765d3a597ec1d99663f6c9816d915b9f68613ac94009884c4addaefcce6af"
testnet2:
MIN_PLOT_SIZE: 18
GENESIS_CHALLENGE: ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad
NETWORK_TYPE: 1
DIFFICULTY_CONSTANT_FACTOR: 10052721566054
GENESIS_PRE_FARM_POOL_PUZZLE_HASH: "d23da14695a188ae5708dd152263c4db883eb27edeb936178d4d988b8f3ce5fc"
GENESIS_PRE_FARM_FARMER_PUZZLE_HASH: "3d8765d3a597ec1d99663f6c9816d915b9f68613ac94009884c4addaefcce6af"
@ -35,7 +32,6 @@ network_overrides: &network_overrides
GENESIS_PRE_FARM_FARMER_PUZZLE_HASH: 3d8765d3a597ec1d99663f6c9816d915b9f68613ac94009884c4addaefcce6af
GENESIS_PRE_FARM_POOL_PUZZLE_HASH: d23da14695a188ae5708dd152263c4db883eb27edeb936178d4d988b8f3ce5fc
MIN_PLOT_SIZE: 18
NETWORK_TYPE: 1
MEMPOOL_BLOCK_BUFFER: 10
testnet4:
DIFFICULTY_CONSTANT_FACTOR: 10052721566054
@ -43,7 +39,6 @@ network_overrides: &network_overrides
GENESIS_PRE_FARM_FARMER_PUZZLE_HASH: 3d8765d3a597ec1d99663f6c9816d915b9f68613ac94009884c4addaefcce6af
GENESIS_PRE_FARM_POOL_PUZZLE_HASH: d23da14695a188ae5708dd152263c4db883eb27edeb936178d4d988b8f3ce5fc
MIN_PLOT_SIZE: 18
NETWORK_TYPE: 1
MEMPOOL_BLOCK_BUFFER: 10
EPOCH_BLOCKS: 768
DIFFICULTY_STARTING: 30
@ -53,7 +48,6 @@ network_overrides: &network_overrides
GENESIS_PRE_FARM_FARMER_PUZZLE_HASH: 3d8765d3a597ec1d99663f6c9816d915b9f68613ac94009884c4addaefcce6af
GENESIS_PRE_FARM_POOL_PUZZLE_HASH: d23da14695a188ae5708dd152263c4db883eb27edeb936178d4d988b8f3ce5fc
MIN_PLOT_SIZE: 18
NETWORK_TYPE: 1
MEMPOOL_BLOCK_BUFFER: 10
EPOCH_BLOCKS: 768
DIFFICULTY_STARTING: 30
@ -63,7 +57,6 @@ network_overrides: &network_overrides
GENESIS_PRE_FARM_FARMER_PUZZLE_HASH: 3d8765d3a597ec1d99663f6c9816d915b9f68613ac94009884c4addaefcce6af
GENESIS_PRE_FARM_POOL_PUZZLE_HASH: d23da14695a188ae5708dd152263c4db883eb27edeb936178d4d988b8f3ce5fc
MIN_PLOT_SIZE: 18
NETWORK_TYPE: 1
MEMPOOL_BLOCK_BUFFER: 50
EPOCH_BLOCKS: 768
DIFFICULTY_STARTING: 30
@ -77,7 +70,6 @@ network_overrides: &network_overrides
GENESIS_PRE_FARM_POOL_PUZZLE_HASH: d23da14695a188ae5708dd152263c4db883eb27edeb936178d4d988b8f3ce5fc
MEMPOOL_BLOCK_BUFFER: 10
MIN_PLOT_SIZE: 18
NETWORK_TYPE: 1
config:
mainnet:
address_prefix: "xch"

View File

@ -381,7 +381,7 @@ async def wallet_node_starting_height(self_hostname):
@pytest_asyncio.fixture(scope="function")
async def wallet_nodes_mainnet(db_version):
async_gen = setup_simulators_and_wallets(2, 1, {"NETWORK_TYPE": 0}, db_version=db_version)
async_gen = setup_simulators_and_wallets(2, 1, {}, db_version=db_version)
nodes, wallets, bt = await async_gen.__anext__()
full_node_1 = nodes[0]
full_node_2 = nodes[1]

View File

@ -21,7 +21,6 @@ testnet10 = {
),
"MEMPOOL_BLOCK_BUFFER": 10,
"MIN_PLOT_SIZE": 18,
"NETWORK_TYPE": 1,
}
constants = DEFAULT_CONSTANTS.replace(**testnet10)