From f5366ff0c06442a9b7165554cd2b2bdfe1f45571 Mon Sep 17 00:00:00 2001 From: arvidn Date: Fri, 24 May 2024 11:34:45 +0200 Subject: [PATCH 1/2] clean up some code kept around just to support testnet10 --- chia/_tests/conftest.py | 1 - chia/_tests/core/mempool/test_mempool.py | 4 ++-- chia/_tests/core/test_cost_calculation.py | 2 +- chia/_tests/util/test_replace_str_to_bytes.py | 4 ++-- chia/_tests/util/test_testnet_overrides.py | 5 ----- chia/consensus/block_body_validation.py | 9 +-------- chia/consensus/default_constants.py | 6 +----- chia/full_node/mempool_check_conditions.py | 9 +++------ chia/simulator/block_tools.py | 6 +----- chia/util/initial-config.yaml | 4 ---- 10 files changed, 11 insertions(+), 39 deletions(-) diff --git a/chia/_tests/conftest.py b/chia/_tests/conftest.py index fdb3bb518f24..3d7668cf5072 100644 --- a/chia/_tests/conftest.py +++ b/chia/_tests/conftest.py @@ -211,7 +211,6 @@ def blockchain_constants(consensus_mode: ConsensusMode) -> ConsensusConstants: if consensus_mode >= ConsensusMode.HARD_FORK_2_0: ret = ret.replace( HARD_FORK_HEIGHT=uint32(2), - HARD_FORK_FIX_HEIGHT=uint32(2), PLOT_FILTER_128_HEIGHT=uint32(10), PLOT_FILTER_64_HEIGHT=uint32(15), PLOT_FILTER_32_HEIGHT=uint32(20), diff --git a/chia/_tests/core/mempool/test_mempool.py b/chia/_tests/core/mempool/test_mempool.py index 71bca0d4fcf1..104eb71adca7 100644 --- a/chia/_tests/core/mempool/test_mempool.py +++ b/chia/_tests/core/mempool/test_mempool.py @@ -2122,7 +2122,7 @@ def test_create_coin_cost(self, softfork_height): # CREATE_COIN puzzle_hash = "abababababababababababababababab" - if softfork_height >= test_constants.HARD_FORK_FIX_HEIGHT: + if softfork_height >= test_constants.HARD_FORK_HEIGHT: generator_base_cost = 40 else: generator_base_cost = 20470 @@ -2163,7 +2163,7 @@ def test_create_coin_cost(self, softfork_height): def test_agg_sig_cost(self, condition, softfork_height): pubkey = "0x" + bytes(G1Element.generator()).hex() - if softfork_height >= test_constants.HARD_FORK_FIX_HEIGHT: + if softfork_height >= test_constants.HARD_FORK_HEIGHT: generator_base_cost = 40 else: generator_base_cost = 20512 diff --git a/chia/_tests/core/test_cost_calculation.py b/chia/_tests/core/test_cost_calculation.py index 39e665a75555..7eb63aff75ae 100644 --- a/chia/_tests/core/test_cost_calculation.py +++ b/chia/_tests/core/test_cost_calculation.py @@ -94,7 +94,7 @@ async def test_basics(softfork_height: int, bt: BlockTools) -> None: assert spend_info.puzzle == coin_spend.puzzle_reveal assert spend_info.solution == coin_spend.solution - if softfork_height >= bt.constants.HARD_FORK_FIX_HEIGHT: + if softfork_height >= bt.constants.HARD_FORK_HEIGHT: clvm_cost = 27360 else: clvm_cost = 404560 diff --git a/chia/_tests/util/test_replace_str_to_bytes.py b/chia/_tests/util/test_replace_str_to_bytes.py index 88d552337520..66f9c51e4451 100644 --- a/chia/_tests/util/test_replace_str_to_bytes.py +++ b/chia/_tests/util/test_replace_str_to_bytes.py @@ -47,10 +47,10 @@ MAX_GENERATOR_SIZE=uint32(1000000), MAX_GENERATOR_REF_LIST_SIZE=uint32(512), POOL_SUB_SLOT_ITERS=uint64(37600000000), - SOFT_FORK2_HEIGHT=uint32(0), + SOFT_FORK2_HEIGHT=uint32(0), # unused SOFT_FORK4_HEIGHT=uint32(5650000), HARD_FORK_HEIGHT=uint32(5496000), - HARD_FORK_FIX_HEIGHT=uint32(5496000), + HARD_FORK_FIX_HEIGHT=uint32(0), # unused PLOT_FILTER_128_HEIGHT=uint32(10542000), PLOT_FILTER_64_HEIGHT=uint32(15592000), PLOT_FILTER_32_HEIGHT=uint32(20643000), diff --git a/chia/_tests/util/test_testnet_overrides.py b/chia/_tests/util/test_testnet_overrides.py index a40916d4b641..e001a8fabcf5 100644 --- a/chia/_tests/util/test_testnet_overrides.py +++ b/chia/_tests/util/test_testnet_overrides.py @@ -9,10 +9,8 @@ def test_testnet10() -> None: overrides: Dict[str, Any] = {} update_testnet_overrides("testnet10", overrides) assert overrides == { - "SOFT_FORK2_HEIGHT": 3000000, "SOFT_FORK4_HEIGHT": 4465000, "HARD_FORK_HEIGHT": 2997292, - "HARD_FORK_FIX_HEIGHT": 3426000, "PLOT_FILTER_128_HEIGHT": 3061804, "PLOT_FILTER_64_HEIGHT": 8010796, "PLOT_FILTER_32_HEIGHT": 13056556, @@ -30,17 +28,14 @@ def test_testnet11() -> None: def test_testnet10_existing() -> None: overrides: Dict[str, Any] = { "HARD_FORK_HEIGHT": 42, - "HARD_FORK_FIX_HEIGHT": 3426000, "PLOT_FILTER_128_HEIGHT": 42, "PLOT_FILTER_64_HEIGHT": 42, "PLOT_FILTER_32_HEIGHT": 42, } update_testnet_overrides("testnet10", overrides) assert overrides == { - "SOFT_FORK2_HEIGHT": 3000000, "SOFT_FORK4_HEIGHT": 4465000, "HARD_FORK_HEIGHT": 42, - "HARD_FORK_FIX_HEIGHT": 3426000, "PLOT_FILTER_128_HEIGHT": 42, "PLOT_FILTER_64_HEIGHT": 42, "PLOT_FILTER_32_HEIGHT": 42, diff --git a/chia/consensus/block_body_validation.py b/chia/consensus/block_body_validation.py index 03257b5a6e64..5ccff03e5fcf 100644 --- a/chia/consensus/block_body_validation.py +++ b/chia/consensus/block_body_validation.py @@ -496,18 +496,11 @@ async def validate_block_body( if npc_result is not None: assert npc_result.conds is not None - block_timestamp: uint64 - if height < constants.SOFT_FORK2_HEIGHT: - # this does not happen on mainnet. testnet10 only - block_timestamp = block.foliage_transaction_block.timestamp # pragma: no cover - else: - block_timestamp = prev_transaction_block_timestamp - error = mempool_check_time_locks( removal_coin_records, npc_result.conds, prev_transaction_block_height, - block_timestamp, + prev_transaction_block_timestamp, ) if error: return error, None diff --git a/chia/consensus/default_constants.py b/chia/consensus/default_constants.py index f41916b57fce..7715d943986e 100644 --- a/chia/consensus/default_constants.py +++ b/chia/consensus/default_constants.py @@ -66,7 +66,7 @@ SOFT_FORK4_HEIGHT=uint32(5716000), # June 2024 HARD_FORK_HEIGHT=uint32(5496000), - HARD_FORK_FIX_HEIGHT=uint32(5496000), + HARD_FORK_FIX_HEIGHT=uint32(0), # June 2027 PLOT_FILTER_128_HEIGHT=uint32(10542000), # June 2030 @@ -80,14 +80,10 @@ def update_testnet_overrides(network_id: str, overrides: Dict[str, Any]) -> None if network_id == "testnet10": # activate softforks immediately on testnet # these numbers are supposed to match initial-config.yaml - if "SOFT_FORK2_HEIGHT" not in overrides: - overrides["SOFT_FORK2_HEIGHT"] = 3000000 if "SOFT_FORK4_HEIGHT" not in overrides: overrides["SOFT_FORK4_HEIGHT"] = 4465000 if "HARD_FORK_HEIGHT" not in overrides: overrides["HARD_FORK_HEIGHT"] = 2997292 - if "HARD_FORK_FIX_HEIGHT" not in overrides: - overrides["HARD_FORK_FIX_HEIGHT"] = 3426000 if "PLOT_FILTER_128_HEIGHT" not in overrides: overrides["PLOT_FILTER_128_HEIGHT"] = 3061804 if "PLOT_FILTER_64_HEIGHT" not in overrides: diff --git a/chia/full_node/mempool_check_conditions.py b/chia/full_node/mempool_check_conditions.py index 054a53f411a9..090352113fe6 100644 --- a/chia/full_node/mempool_check_conditions.py +++ b/chia/full_node/mempool_check_conditions.py @@ -40,16 +40,13 @@ def get_flags_for_height_and_constants(height: int, constants: ConsensusConstants) -> int: - flags = 0 - - if height >= constants.SOFT_FORK2_HEIGHT: - flags = flags | NO_RELATIVE_CONDITIONS_ON_EPHEMERAL + flags = NO_RELATIVE_CONDITIONS_ON_EPHEMERAL if height >= constants.SOFT_FORK4_HEIGHT: flags = flags | ENABLE_MESSAGE_CONDITIONS if height >= constants.HARD_FORK_HEIGHT: - # the hard-fork initiated with 2.0. To activate June 2024 + # the hard-fork initiated with 2.1. To activate June 2024 # * costs are ascribed to some unknown condition codes, to allow for # soft-forking in new conditions with cost # * a new condition, SOFTFORK, is added which takes a first parameter to @@ -89,7 +86,7 @@ def get_name_puzzle_conditions( if mempool_mode: flags = flags | MEMPOOL_MODE - if height >= constants.HARD_FORK_FIX_HEIGHT: + if height >= constants.HARD_FORK_HEIGHT: run_block = run_block_generator2 try: diff --git a/chia/simulator/block_tools.py b/chia/simulator/block_tools.py index 659762965ee6..83d34cd3a61e 100644 --- a/chia/simulator/block_tools.py +++ b/chia/simulator/block_tools.py @@ -150,10 +150,6 @@ # Allows creating blockchains with timestamps up to 10 days in the future, for testing MAX_FUTURE_TIME2=uint32(3600 * 24 * 10), MEMPOOL_BLOCK_BUFFER=uint8(6), - # we deliberately make this different from HARD_FORK_HEIGHT in the - # tests, to ensure they operate independently (which they need to do for - # testnet10) - HARD_FORK_FIX_HEIGHT=uint32(5496100), ) @@ -1966,7 +1962,7 @@ def compute_cost_test(generator: BlockGenerator, constants: ConsensusConstants, condition_cost = 0 clvm_cost = 0 - if height >= constants.HARD_FORK_FIX_HEIGHT: + if height >= constants.HARD_FORK_HEIGHT: blocks = [bytes(g) for g in generator.generator_refs] cost, result = generator.program._run(INFINITE_COST, MEMPOOL_MODE | ALLOW_BACKREFS, [DESERIALIZE_MOD, blocks]) clvm_cost += cost diff --git a/chia/util/initial-config.yaml b/chia/util/initial-config.yaml index f90b530c6061..8f207a1e9ee6 100644 --- a/chia/util/initial-config.yaml +++ b/chia/util/initial-config.yaml @@ -73,13 +73,10 @@ network_overrides: &network_overrides GENESIS_PRE_FARM_POOL_PUZZLE_HASH: d23da14695a188ae5708dd152263c4db883eb27edeb936178d4d988b8f3ce5fc MEMPOOL_BLOCK_BUFFER: 10 MIN_PLOT_SIZE: 18 - SOFT_FORK2_HEIGHT: 3000000 SOFT_FORK4_HEIGHT: 4465000 # planned 2.0 release is July 26, height 2965036 on testnet # 1 week later HARD_FORK_HEIGHT: 2997292 - # November 2023 - HARD_FORK_FIX_HEIGHT: 3426000 # another 2 weeks later PLOT_FILTER_128_HEIGHT: 3061804 # 3 years later @@ -100,7 +97,6 @@ network_overrides: &network_overrides SUB_SLOT_ITERS_STARTING: 67108864 # Forks activated from the beginning on this network HARD_FORK_HEIGHT: 0 - HARD_FORK_FIX_HEIGHT: 0 SOFT_FORK4_HEIGHT: 641500 PLOT_FILTER_128_HEIGHT: 6029568 PLOT_FILTER_64_HEIGHT: 11075328 From 0744cfe5ff985c3e52abd711eafe5509542a961f Mon Sep 17 00:00:00 2001 From: arvidn Date: Thu, 30 May 2024 17:55:29 +0200 Subject: [PATCH 2/2] remove configs and overrides for unsupported testnets --- chia/_tests/util/test_testnet_overrides.py | 29 --------- chia/consensus/default_constants.py | 13 ---- chia/util/initial-config.yaml | 74 ---------------------- 3 files changed, 116 deletions(-) diff --git a/chia/_tests/util/test_testnet_overrides.py b/chia/_tests/util/test_testnet_overrides.py index e001a8fabcf5..84ac0dc45844 100644 --- a/chia/_tests/util/test_testnet_overrides.py +++ b/chia/_tests/util/test_testnet_overrides.py @@ -5,18 +5,6 @@ from chia.consensus.default_constants import update_testnet_overrides -def test_testnet10() -> None: - overrides: Dict[str, Any] = {} - update_testnet_overrides("testnet10", overrides) - assert overrides == { - "SOFT_FORK4_HEIGHT": 4465000, - "HARD_FORK_HEIGHT": 2997292, - "PLOT_FILTER_128_HEIGHT": 3061804, - "PLOT_FILTER_64_HEIGHT": 8010796, - "PLOT_FILTER_32_HEIGHT": 13056556, - } - - def test_testnet11() -> None: overrides: Dict[str, Any] = {} update_testnet_overrides("testnet11", overrides) @@ -25,23 +13,6 @@ def test_testnet11() -> None: } -def test_testnet10_existing() -> None: - overrides: Dict[str, Any] = { - "HARD_FORK_HEIGHT": 42, - "PLOT_FILTER_128_HEIGHT": 42, - "PLOT_FILTER_64_HEIGHT": 42, - "PLOT_FILTER_32_HEIGHT": 42, - } - update_testnet_overrides("testnet10", overrides) - assert overrides == { - "SOFT_FORK4_HEIGHT": 4465000, - "HARD_FORK_HEIGHT": 42, - "PLOT_FILTER_128_HEIGHT": 42, - "PLOT_FILTER_64_HEIGHT": 42, - "PLOT_FILTER_32_HEIGHT": 42, - } - - def test_mainnet() -> None: overrides: Dict[str, Any] = {} update_testnet_overrides("mainnet", overrides) diff --git a/chia/consensus/default_constants.py b/chia/consensus/default_constants.py index 7715d943986e..a02d2527f72e 100644 --- a/chia/consensus/default_constants.py +++ b/chia/consensus/default_constants.py @@ -77,19 +77,6 @@ def update_testnet_overrides(network_id: str, overrides: Dict[str, Any]) -> None: - if network_id == "testnet10": - # activate softforks immediately on testnet - # these numbers are supposed to match initial-config.yaml - if "SOFT_FORK4_HEIGHT" not in overrides: - overrides["SOFT_FORK4_HEIGHT"] = 4465000 - if "HARD_FORK_HEIGHT" not in overrides: - overrides["HARD_FORK_HEIGHT"] = 2997292 - if "PLOT_FILTER_128_HEIGHT" not in overrides: - overrides["PLOT_FILTER_128_HEIGHT"] = 3061804 - if "PLOT_FILTER_64_HEIGHT" not in overrides: - overrides["PLOT_FILTER_64_HEIGHT"] = 8010796 - if "PLOT_FILTER_32_HEIGHT" not in overrides: - overrides["PLOT_FILTER_32_HEIGHT"] = 13056556 if network_id == "testnet11": if "SOFT_FORK4_HEIGHT" not in overrides: overrides["SOFT_FORK4_HEIGHT"] = 641500 diff --git a/chia/util/initial-config.yaml b/chia/util/initial-config.yaml index 8f207a1e9ee6..1f4e98a7edca 100644 --- a/chia/util/initial-config.yaml +++ b/chia/util/initial-config.yaml @@ -23,66 +23,6 @@ network_overrides: &network_overrides GENESIS_CHALLENGE: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 GENESIS_PRE_FARM_POOL_PUZZLE_HASH: "d23da14695a188ae5708dd152263c4db883eb27edeb936178d4d988b8f3ce5fc" GENESIS_PRE_FARM_FARMER_PUZZLE_HASH: "3d8765d3a597ec1d99663f6c9816d915b9f68613ac94009884c4addaefcce6af" - testnet2: - MIN_PLOT_SIZE: 18 - GENESIS_CHALLENGE: ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad - DIFFICULTY_CONSTANT_FACTOR: 10052721566054 - GENESIS_PRE_FARM_POOL_PUZZLE_HASH: "d23da14695a188ae5708dd152263c4db883eb27edeb936178d4d988b8f3ce5fc" - GENESIS_PRE_FARM_FARMER_PUZZLE_HASH: "3d8765d3a597ec1d99663f6c9816d915b9f68613ac94009884c4addaefcce6af" - testnet3: - DIFFICULTY_CONSTANT_FACTOR: 10052721566054 - GENESIS_CHALLENGE: ca7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015af - GENESIS_PRE_FARM_FARMER_PUZZLE_HASH: 3d8765d3a597ec1d99663f6c9816d915b9f68613ac94009884c4addaefcce6af - GENESIS_PRE_FARM_POOL_PUZZLE_HASH: d23da14695a188ae5708dd152263c4db883eb27edeb936178d4d988b8f3ce5fc - MIN_PLOT_SIZE: 18 - MEMPOOL_BLOCK_BUFFER: 10 - testnet4: - DIFFICULTY_CONSTANT_FACTOR: 10052721566054 - GENESIS_CHALLENGE: dd7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015af - GENESIS_PRE_FARM_FARMER_PUZZLE_HASH: 3d8765d3a597ec1d99663f6c9816d915b9f68613ac94009884c4addaefcce6af - GENESIS_PRE_FARM_POOL_PUZZLE_HASH: d23da14695a188ae5708dd152263c4db883eb27edeb936178d4d988b8f3ce5fc - MIN_PLOT_SIZE: 18 - MEMPOOL_BLOCK_BUFFER: 10 - EPOCH_BLOCKS: 768 - DIFFICULTY_STARTING: 30 - testnet5: - DIFFICULTY_CONSTANT_FACTOR: 10052721566054 - GENESIS_CHALLENGE: ee7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015af - GENESIS_PRE_FARM_FARMER_PUZZLE_HASH: 3d8765d3a597ec1d99663f6c9816d915b9f68613ac94009884c4addaefcce6af - GENESIS_PRE_FARM_POOL_PUZZLE_HASH: d23da14695a188ae5708dd152263c4db883eb27edeb936178d4d988b8f3ce5fc - MIN_PLOT_SIZE: 18 - MEMPOOL_BLOCK_BUFFER: 10 - EPOCH_BLOCKS: 768 - DIFFICULTY_STARTING: 30 - testnet7: - DIFFICULTY_CONSTANT_FACTOR: 10052721566054 - GENESIS_CHALLENGE: 117816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015af - GENESIS_PRE_FARM_FARMER_PUZZLE_HASH: 3d8765d3a597ec1d99663f6c9816d915b9f68613ac94009884c4addaefcce6af - GENESIS_PRE_FARM_POOL_PUZZLE_HASH: d23da14695a188ae5708dd152263c4db883eb27edeb936178d4d988b8f3ce5fc - MIN_PLOT_SIZE: 18 - MEMPOOL_BLOCK_BUFFER: 50 - EPOCH_BLOCKS: 768 - DIFFICULTY_STARTING: 30 - testnet10: - AGG_SIG_ME_ADDITIONAL_DATA: ae83525ba8d1dd3f09b277de18ca3e43fc0af20d20c4b3e92ef2a48bd291ccb2 - DIFFICULTY_CONSTANT_FACTOR: 10052721566054 - DIFFICULTY_STARTING: 30 - EPOCH_BLOCKS: 768 - GENESIS_CHALLENGE: ae83525ba8d1dd3f09b277de18ca3e43fc0af20d20c4b3e92ef2a48bd291ccb2 - GENESIS_PRE_FARM_FARMER_PUZZLE_HASH: 3d8765d3a597ec1d99663f6c9816d915b9f68613ac94009884c4addaefcce6af - GENESIS_PRE_FARM_POOL_PUZZLE_HASH: d23da14695a188ae5708dd152263c4db883eb27edeb936178d4d988b8f3ce5fc - MEMPOOL_BLOCK_BUFFER: 10 - MIN_PLOT_SIZE: 18 - SOFT_FORK4_HEIGHT: 4465000 - # planned 2.0 release is July 26, height 2965036 on testnet - # 1 week later - HARD_FORK_HEIGHT: 2997292 - # another 2 weeks later - PLOT_FILTER_128_HEIGHT: 3061804 - # 3 years later - PLOT_FILTER_64_HEIGHT: 8010796 - # 3 years later - PLOT_FILTER_32_HEIGHT: 13056556 testnet11: AGG_SIG_ME_ADDITIONAL_DATA: 37a90eb5185a9c4439a91ddc98bbadce7b4feba060d50116a067de66bf236615 DIFFICULTY_CONSTANT_FACTOR: 10052721566054 @@ -108,20 +48,6 @@ network_overrides: &network_overrides testnet0: address_prefix: "txch" default_full_node_port: 58444 - testnet1: - address_prefix: "txch" - testnet2: - address_prefix: "txch" - testnet3: - address_prefix: "txch" - testnet4: - address_prefix: "txch" - testnet7: - address_prefix: "txch" - default_full_node_port: 58444 - testnet10: - address_prefix: "txch" - default_full_node_port: 58444 testnet11: address_prefix: "txch" default_full_node_port: 58444