Skip to content

Commit

Permalink
Merge pull request #2710 from IntersectMBO/fix_rollback
Browse files Browse the repository at this point in the history
feat(tests): run test_consensus_reached only on mainnet
  • Loading branch information
mkoura authored Oct 30, 2024
2 parents e10f4ce + dd6b97d commit 2884630
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 12 deletions.
23 changes: 18 additions & 5 deletions cardano_node_tests/tests/test_rollback.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,14 @@ def node_wait_for_block(
os.environ["CARDANO_NODE_SOCKET_PATH"] = orig_socket

@allure.link(helpers.get_vcs_link())
# There's a submission delay of 60 sec. Therefore on testnet with low `securityParam`,
# it is not possible to restart the nodes, submit transaction, and still be under
# `securityParam` blocks.
@pytest.mark.skipif(
"mainnet_fast" not in configuration.SCRIPTS_DIRNAME,
reason="cannot run on testnet with low `securityParam`",
)
@pytest.mark.long
def test_consensus_reached(
self,
cluster_manager: cluster_management.ClusterManager,
Expand Down Expand Up @@ -306,11 +314,12 @@ def test_consensus_reached(
), "The Tx number 3 doesn't exist on cluster 2"

# Wait for new block to let chains progress.
# We can't wait for too long, because if both clusters has produced more than
# `securityParam` number of blocks while the topology was fragmented, it would not be
# possible to bring the the clusters back into global consensus. On local cluster,
# the value of `securityParam` is 10.
cluster.wait_for_new_block()
# If both clusters has produced more than `securityParam` number of blocks while
# the topology was fragmented, it would not be possible to bring the the clusters
# back into global consensus.
# On fast epoch local cluster, the value of `securityParam` is 10.
# On mainnet, the value of `securityParam` is 2160.
cluster.wait_for_new_block(new_blocks=15)

if ROLLBACK_PAUSE:
print("PHASE2: cluster with separated into cluster1 and cluster2")
Expand Down Expand Up @@ -361,6 +370,10 @@ def test_consensus_reached(
), "Neither Tx number 2 nor Tx number 3 was rolled back"

@allure.link(helpers.get_vcs_link())
@pytest.mark.skipif(
"mainnet" in configuration.SCRIPTS_DIRNAME,
reason="cannot run on testnet with high `securityParam`",
)
@pytest.mark.long
def test_permanent_fork(
self,
Expand Down
14 changes: 7 additions & 7 deletions scripts/test_rollbacks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ set -euo pipefail

TOP_DIR="$(readlink -m "${0%/*}/..")"

export NUM_POOLS="${NUM_POOLS:-"10"}"
export NUM_POOLS="${NUM_POOLS:-"10"}" CLUSTERS_COUNT=1 TEST_THREADS=0

if [ -n "${INTERACTIVE:-""}" ]; then
export ROLLBACK_PAUSE=1 SCRIPTS_DIRNAME="${SCRIPTS_DIRNAME:-mainnet_fast}" PYTEST_ARGS="-s -k test_consensus_reached"
export ROLLBACK_PAUSE=1 SCRIPTS_DIRNAME="mainnet_fast" PYTEST_ARGS="-s -k test_consensus_reached"
"$TOP_DIR/.github/regression.sh"
else
export SCRIPTS_DIRNAME="${SCRIPTS_DIRNAME:-conway_fast}" PYTEST_ARGS="-k TestRollback"
export SCRIPTS_DIRNAME="conway_fast" PYTEST_ARGS="-k test_permanent_fork"
"$TOP_DIR/.github/regression.sh" || exit "$?"
export SCRIPTS_DIRNAME="mainnet_fast" PYTEST_ARGS="-k test_consensus_reached"
"$TOP_DIR/.github/regression.sh"
fi

export CLUSTERS_COUNT=1 TEST_THREADS=0

"$TOP_DIR/.github/regression.sh"

0 comments on commit 2884630

Please sign in to comment.