Skip to content

Commit

Permalink
Remove chip-13 test
Browse files Browse the repository at this point in the history
  • Loading branch information
emlowe committed Jul 26, 2023
1 parent a086d26 commit b197bed
Showing 1 changed file with 0 additions and 59 deletions.
59 changes: 0 additions & 59 deletions tests/blockchain/test_blockchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
from tests.blockchain.blockchain_test_utils import (
_validate_and_add_block,
_validate_and_add_block_multi_error,
_validate_and_add_block_multi_error_or_pass,
_validate_and_add_block_multi_result,
_validate_and_add_block_no_error,
)
Expand Down Expand Up @@ -3672,61 +3671,3 @@ async def test_reorg_flip_flop(empty_blockchain, bt):

for block in chain_b[40:]:
await _validate_and_add_block(b, block)


@pytest.mark.parametrize("unique_plots_window", [1, 2])
@pytest.mark.parametrize("bt_respects_soft_fork3", [True, False])
@pytest.mark.parametrize("soft_fork3_height", [0, 10, 10000])
@pytest.mark.asyncio
async def test_soft_fork3_activation(
consensus_mode, blockchain_constants, bt_respects_soft_fork3, soft_fork3_height, db_version, unique_plots_window
):
# We don't run Mode.SOFT_FORK3, since this is already parametrized by this test.
# Additionally, Mode.HARD_FORK_2_0 mode is incopatible with this test, since plot filter size would be zero,
# blocks won't ever be produced (we'll pass every consecutive plot filter, hence no block would pass CHIP-13).
if consensus_mode != Mode.PLAIN:
pytest.skip("Skipped test")
with TempKeyring() as keychain:
bt = await create_block_tools_async(
constants=blockchain_constants.replace(
SOFT_FORK3_HEIGHT=(0 if bt_respects_soft_fork3 else 10000),
UNIQUE_PLOTS_WINDOW=unique_plots_window,
),
keychain=keychain,
)
blockchain_constants = bt.constants.replace(SOFT_FORK3_HEIGHT=soft_fork3_height)
b, db_wrapper, db_path = await create_blockchain(blockchain_constants, db_version)
blocks = bt.get_consecutive_blocks(25)
for height, block in enumerate(blocks):
await _validate_and_add_block_multi_error_or_pass(b, block, [Err.INVALID_POSPACE])
peak = b.get_peak()
assert peak is not None
if peak.height != height:
break

peak = b.get_peak()
assert peak is not None

# We expect to add all blocks here (25 blocks), either because `unique_plots_window`=1 means we're not
# checking any extra plot filter, or `unique_plots_window`=True means `BlockTools` produced blocks
# that respect CHIP-13.
if bt_respects_soft_fork3 or unique_plots_window == 1:
assert peak.height == 24
else:
# Here we have `bt_respects_soft_fork3`=False, which means the produced blocks by `BlockTools` will not
# respect the CHIP-13 condition. We expect not adding blocks at some point after the soft fork 3
# activation height (`soft_fork3_height`).
if soft_fork3_height == 0:
# We're not adding all blocks, since at some point `BlockTools` will break the CHIP-13 condition with
# very high likelyhood.
assert peak.height < 24
elif soft_fork3_height == 10:
# We're not adding all blocks, but we've added all of them until the soft fork 3 activated (height 10)
assert peak.height < 24 and peak.height >= 9
else:
# Soft fork 3 will activate in the future (height 100), so we're adding all blocks.
assert peak.height == 24

await db_wrapper.close()
b.shut_down()
db_path.unlink()

0 comments on commit b197bed

Please sign in to comment.