Skip to content

Commit

Permalink
clean up some code kept around just to support testnet10
Browse files Browse the repository at this point in the history
  • Loading branch information
arvidn committed May 24, 2024
1 parent 32fd481 commit f5366ff
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 39 deletions.
1 change: 0 additions & 1 deletion chia/_tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
4 changes: 2 additions & 2 deletions chia/_tests/core/mempool/test_mempool.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion chia/_tests/core/test_cost_calculation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions chia/_tests/util/test_replace_str_to_bytes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
5 changes: 0 additions & 5 deletions chia/_tests/util/test_testnet_overrides.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
9 changes: 1 addition & 8 deletions chia/consensus/block_body_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 1 addition & 5 deletions chia/consensus/default_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
9 changes: 3 additions & 6 deletions chia/full_node/mempool_check_conditions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
6 changes: 1 addition & 5 deletions chia/simulator/block_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
)


Expand Down Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions chia/util/initial-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit f5366ff

Please sign in to comment.