|
20 | 20 | import pytest_subtests |
21 | 21 | from _pytest.fixtures import FixtureRequest |
22 | 22 | from cardano_clusterlib import clusterlib |
| 23 | +from packaging import version |
23 | 24 |
|
24 | 25 | from cardano_node_tests.cluster_management import cluster_management |
25 | 26 | from cardano_node_tests.tests import common |
@@ -2047,7 +2048,8 @@ def pool_users( |
2047 | 2048 | num=2, |
2048 | 2049 | fund_idx=[0], |
2049 | 2050 | caching_key=helpers.get_current_line_str(), |
2050 | | - amount=600_000_000, |
| 2051 | + amount=900_000_000, |
| 2052 | + min_amount=600_000_000, |
2051 | 2053 | ) |
2052 | 2054 | return created_users |
2053 | 2055 |
|
@@ -2607,6 +2609,89 @@ def test_stake_pool_long_metadata_url( |
2607 | 2609 | in exc_value |
2608 | 2610 | ) |
2609 | 2611 |
|
| 2612 | + @allure.link(helpers.get_vcs_link()) |
| 2613 | + @pytest.mark.parametrize("era", ("shelley", "allegra", "mary", "alonzo", "babbage")) |
| 2614 | + @pytest.mark.testnets |
| 2615 | + @pytest.mark.smoke |
| 2616 | + def test_legacy_pool_registration_rejected_in_conway( |
| 2617 | + self, |
| 2618 | + cluster: clusterlib.ClusterLib, |
| 2619 | + pool_users: list[clusterlib.PoolUser], |
| 2620 | + testfile_temp_dir: pl.Path, |
| 2621 | + era: str, |
| 2622 | + request: FixtureRequest, |
| 2623 | + ): |
| 2624 | + """Reject legacy stake pool registration in Conway. |
| 2625 | +
|
| 2626 | + * Generate a stake pool registration certificate using the compatible CLI |
| 2627 | + for a legacy era. |
| 2628 | + * Attempt to submit the legacy certificate in a Conway-era transaction. |
| 2629 | + * Expect the transaction submission to fail with a TextEnvelope type error. |
| 2630 | + """ |
| 2631 | + rand_str = clusterlib.get_rand_str(4) |
| 2632 | + temp_template = f"{common.get_test_id(cluster)}_{rand_str}" |
| 2633 | + |
| 2634 | + node_vrf = cluster.g_node.gen_vrf_key_pair(f"{temp_template}_{era}_vrf") |
| 2635 | + node_cold = cluster.g_node.gen_cold_key_pair_and_counter(f"{temp_template}_{era}_cold") |
| 2636 | + |
| 2637 | + pool_data = clusterlib.PoolData( |
| 2638 | + pool_name=f"pool_{rand_str}", |
| 2639 | + pool_pledge=5, |
| 2640 | + pool_cost=cluster.g_query.get_protocol_params().get("minPoolCost", 500), |
| 2641 | + pool_margin=0.01, |
| 2642 | + ) |
| 2643 | + |
| 2644 | + era_api = getattr(cluster.g_compatible, era) |
| 2645 | + legacy_pool_reg_cert = era_api.stake_pool.gen_registration_cert( |
| 2646 | + name=f"{temp_template}_{era}", |
| 2647 | + pool_data=pool_data, |
| 2648 | + vrf_vkey_file=node_vrf.vkey_file, |
| 2649 | + cold_vkey_file=node_cold.vkey_file, |
| 2650 | + owner_stake_vkey_files=[pool_users[0].stake.vkey_file], |
| 2651 | + ) |
| 2652 | + |
| 2653 | + tx_files = clusterlib.TxFiles( |
| 2654 | + certificate_files=[legacy_pool_reg_cert], |
| 2655 | + signing_key_files=[ |
| 2656 | + pool_users[0].payment.skey_file, |
| 2657 | + pool_users[0].stake.skey_file, |
| 2658 | + node_cold.skey_file, |
| 2659 | + ], |
| 2660 | + ) |
| 2661 | + |
| 2662 | + err_str = "" |
| 2663 | + try: |
| 2664 | + cluster.g_transaction.send_tx( |
| 2665 | + src_address=pool_users[0].payment.address, |
| 2666 | + tx_name=f"{temp_template}_{era}_legacy_pool_reg", |
| 2667 | + tx_files=tx_files, |
| 2668 | + ) |
| 2669 | + except clusterlib.CLIError as exc: |
| 2670 | + err_str = str(exc) |
| 2671 | + |
| 2672 | + # Deregister stake pool in case it was unexpectedly registered |
| 2673 | + def _deregister(): |
| 2674 | + depoch = 1 if cluster.time_to_epoch_end() >= DEREG_BUFFER_SEC else 2 |
| 2675 | + with helpers.change_cwd(testfile_temp_dir): |
| 2676 | + cluster.g_stake_pool.deregister_stake_pool( |
| 2677 | + pool_owners=pool_users, |
| 2678 | + cold_key_pair=node_cold, |
| 2679 | + epoch=cluster.g_query.get_epoch() + depoch, |
| 2680 | + pool_name=pool_data.pool_name, |
| 2681 | + tx_name=f"{temp_template}_cleanup", |
| 2682 | + ) |
| 2683 | + |
| 2684 | + if not err_str: |
| 2685 | + request.addfinalizer(_deregister) |
| 2686 | + |
| 2687 | + if not err_str and VERSIONS.cli >= version.parse("10.14.0.0"): |
| 2688 | + issues.cli_1347.finish_test() |
| 2689 | + |
| 2690 | + assert err_str, "Expected transaction submission to fail, but it succeeded" |
| 2691 | + |
| 2692 | + with common.allow_unstable_error_messages(): |
| 2693 | + assert "TextEnvelope type error" in err_str, err_str |
| 2694 | + |
2610 | 2695 |
|
2611 | 2696 | @pytest.mark.skipif( |
2612 | 2697 | VERSIONS.transaction_era < VERSIONS.CONWAY, reason="runs only with Tx era >= Conway" |
|
0 commit comments