Skip to content

Commit

Permalink
Merge pull request #2872 from IntersectMBO/make_confirm_blocks_config…
Browse files Browse the repository at this point in the history
…urable

Make confirm blocks configurable
  • Loading branch information
mkoura authored Jan 10, 2025
2 parents bffa680 + e1c1dd6 commit 5a82470
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 8 deletions.
2 changes: 2 additions & 0 deletions cardano_node_tests/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"] = (
Expand Down
11 changes: 9 additions & 2 deletions cardano_node_tests/utils/cluster_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down
3 changes: 3 additions & 0 deletions cardano_node_tests/utils/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 "") == ""

Expand Down
10 changes: 5 additions & 5 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 5a82470

Please sign in to comment.