From 4d10eb9a89359d9f4918f8ed5a494a00a56b88be Mon Sep 17 00:00:00 2001 From: Martin Kourim Date: Fri, 10 Jan 2025 13:24:53 +0100 Subject: [PATCH 1/2] feat: update cardano-clusterlib version Updated cardano-clusterlib from 0.7.0a4 to 0.7.0 in poetry.lock and pyproject.toml. --- poetry.lock | 10 +++++----- pyproject.toml | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/poetry.lock b/poetry.lock index e37c1bdab..20e90c9ac 100644 --- a/poetry.lock +++ b/poetry.lock @@ -105,13 +105,13 @@ dev = ["freezegun (>=1.0,<2.0)", "pytest (>=6.0)", "pytest-cov"] [[package]] name = "cardano-clusterlib" -version = "0.7.0a4" +version = "0.7.0" description = "Python wrapper for cardano-cli for working with cardano cluster" optional = false -python-versions = ">=3.8" +python-versions = ">=3.9" files = [ - {file = "cardano_clusterlib-0.7.0a4-py3-none-any.whl", hash = "sha256:6d0b497f116c6060b4e16fb4bf028eb087e4f91d5ae0a3269a5b7b76253cce86"}, - {file = "cardano_clusterlib-0.7.0a4.tar.gz", hash = "sha256:37181fc3000bde7355dcf594e33ba787feebe903dccf1b1081ac059a349df422"}, + {file = "cardano_clusterlib-0.7.0-py3-none-any.whl", hash = "sha256:64122156c338466ce157fe85167ad15b39458d6eceb0e4a3fdb8ad68fbb6ed29"}, + {file = "cardano_clusterlib-0.7.0.tar.gz", hash = "sha256:c417b77e3c155b0e3ade86881ce688ac78f257de07a627df4e2744d4dff7ab8f"}, ] [package.dependencies] @@ -1961,4 +1961,4 @@ files = [ [metadata] lock-version = "2.0" python-versions = ">=3.10,<4.0" -content-hash = "63884c7d85200ddc793250f699e35677e28a1d6dceb34bb712926d31a924849b" +content-hash = "ab839f621340b26e2d96376204e8c407ee8f3ba47e8606bb08cff44254828f25" diff --git a/pyproject.toml b/pyproject.toml index 471321209..d5de0e452 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,7 +26,7 @@ packages = [{include = "cardano_node_tests"}] [tool.poetry.dependencies] python = ">=3.10,<4.0" allure-pytest = "^2.13.5" -cardano-clusterlib = "^0.7.0a4" +cardano-clusterlib = "^0.7.0" cbor2 = "^5.6.5" filelock = "^3.16.1" hypothesis = "^6.118.8" From e1c1dd6dc65dfddbf1f08a32d55e208ffafee01d Mon Sep 17 00:00:00 2001 From: Martin Kourim Date: Fri, 10 Jan 2025 13:25:35 +0100 Subject: [PATCH 2/2] feat: make confirm blocks configurable - Added configuration option CONFIRM_BLOCKS_NUM to set the number of new blocks before a transaction is considered confirmed. - Updated LocalCluster and TestnetCluster to use CONFIRM_BLOCKS_NUM. - Modified cluster_nodes.py and configuration.py to implement the new configuration. --- cardano_node_tests/tests/conftest.py | 2 ++ cardano_node_tests/utils/cluster_nodes.py | 11 +++++++++-- cardano_node_tests/utils/configuration.py | 3 +++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/cardano_node_tests/tests/conftest.py b/cardano_node_tests/tests/conftest.py index 3ab0f2693..fdb9d49c1 100644 --- a/cardano_node_tests/tests/conftest.py +++ b/cardano_node_tests/tests/conftest.py @@ -83,6 +83,8 @@ def pytest_configure(config: tp.Any) -> None: config.stash[metadata_key]["MIXED_P2P"] = str(configuration.MIXED_P2P) config.stash[metadata_key]["NUM_POOLS"] = str(configuration.NUM_POOLS) config.stash[metadata_key]["UTXO_BACKEND"] = configuration.UTXO_BACKEND + if configuration.CONFIRM_BLOCKS_NUM: + config.stash[metadata_key]["CONFIRM_BLOCKS_NUM"] = str(configuration.CONFIRM_BLOCKS_NUM) config.stash[metadata_key]["HAS_CC"] = str(configuration.HAS_CC) config.stash[metadata_key]["cardano-node-tests rev"] = helpers.get_current_commit() config.stash[metadata_key]["cardano-node-tests url"] = ( diff --git a/cardano_node_tests/utils/cluster_nodes.py b/cardano_node_tests/utils/cluster_nodes.py index e66e0eb3a..97b1bbd30 100644 --- a/cardano_node_tests/utils/cluster_nodes.py +++ b/cardano_node_tests/utils/cluster_nodes.py @@ -122,7 +122,11 @@ def get_cluster_obj(self, command_era: str = "") -> clusterlib.ClusterLib: command_era=command_era or cluster_env.command_era or clusterlib.CommandEras.LATEST, ) cluster_obj.overwrite_outfiles = not (configuration.DONT_OVERWRITE_OUTFILES) - cluster_obj._min_change_value = 2_000_000 # TODO: hardcoded `minUTxOValue` + # Overwrite default settings for number of new blocks before the Tx is considered confirmed + if configuration.CONFIRM_BLOCKS_NUM: + cluster_obj.confirm_blocks = configuration.CONFIRM_BLOCKS_NUM + # TODO: hardcoded `minUTxOValue` + cluster_obj._min_change_value = 2_000_000 return cluster_obj def create_addrs_data( @@ -235,7 +239,10 @@ def get_cluster_obj(self, command_era: str = "") -> clusterlib.ClusterLib: command_era=command_era or cluster_env.command_era or clusterlib.CommandEras.LATEST, ) cluster_obj.overwrite_outfiles = not (configuration.DONT_OVERWRITE_OUTFILES) - cluster_obj._min_change_value = 2_000_000 # TODO: hardcoded `minUTxOValue` + # Increase default number of new blocks before the Tx is considered confirmed + cluster_obj.confirm_blocks = configuration.CONFIRM_BLOCKS_NUM or 3 + # TODO: hardcoded `minUTxOValue` + cluster_obj._min_change_value = 2_000_000 return cluster_obj def create_addrs_data( diff --git a/cardano_node_tests/utils/configuration.py b/cardano_node_tests/utils/configuration.py index fd4ecaf1e..25e826431 100644 --- a/cardano_node_tests/utils/configuration.py +++ b/cardano_node_tests/utils/configuration.py @@ -43,6 +43,9 @@ def _check_cardano_node_socket_path() -> None: # Used also in startup scripts as `if [ -n "$VAR" ]...` HAS_CC = (os.environ.get("NO_CC") or "") == "" +# Number of new blocks before the Tx is considered confirmed. Use default value if set to 0. +CONFIRM_BLOCKS_NUM = int(os.environ.get("CONFIRM_BLOCKS_NUM") or 0) + # Used also in startup scripts as `if [ -n "$VAR" ]...` PV10 = (os.environ.get("PV10") or "") == ""