Skip to content

Commit

Permalink
Merge pull request #2576 from IntersectMBO/xfail_on_dbsync_issue_1825
Browse files Browse the repository at this point in the history
Make a dbsync Plutus cost check xfail on issue 1825
  • Loading branch information
mkoura authored Aug 23, 2024
2 parents 1b92058 + e4db057 commit 7676f28
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 11 deletions.
5 changes: 5 additions & 0 deletions cardano_node_tests/tests/issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@
repo="IntersectMBO/cardano-db-sync",
message="Blocks count don't match between tables.",
)
dbsync_1825 = blockers.GH(
issue=1825,
repo="IntersectMBO/cardano-db-sync",
message="Wrong PlutusV2 script cost when the same script is used twice.",
)

ledger_3731 = blockers.GH(
issue=3731,
Expand Down
30 changes: 19 additions & 11 deletions cardano_node_tests/tests/tests_plutus/test_delegation.py
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ def test_delegate_deregister( # noqa: C901

# Submit registration certificate and delegate to pool
try:
tx_raw_delegation_out, plutus_cost_deleg = register_delegate_stake_addr(
tx_delegation_out, plutus_cost_deleg = register_delegate_stake_addr(
cluster_obj=cluster,
temp_template=temp_template,
txins=deleg_utxos,
Expand Down Expand Up @@ -797,9 +797,7 @@ def test_delegate_deregister( # noqa: C901
cluster.g_query.get_epoch() == init_epoch
), "Delegation took longer than expected and would affect other checks"

tx_db_record = dbsync_utils.check_tx(
cluster_obj=cluster, tx_raw_output=tx_raw_delegation_out
)
tx_db_record = dbsync_utils.check_tx(cluster_obj=cluster, tx_raw_output=tx_delegation_out)
delegation.db_check_delegation(
pool_user=pool_user,
db_record=tx_db_record,
Expand Down Expand Up @@ -831,7 +829,7 @@ def test_delegate_deregister( # noqa: C901

# Submit deregistration certificate and withdraw rewards
try:
tx_raw_deregister_out, __ = deregister_stake_addr(
tx_deregister_out, __ = deregister_stake_addr(
cluster_obj=cluster,
temp_template=temp_template,
txins=dereg_utxos,
Expand All @@ -850,14 +848,24 @@ def test_delegate_deregister( # noqa: C901
raise AssertionError(reward_error)

# Check tx_view of step 2 and step 3
tx_view.check_tx_view(cluster_obj=cluster, tx_raw_output=tx_raw_delegation_out)
tx_view.check_tx_view(cluster_obj=cluster, tx_raw_output=tx_raw_deregister_out)
tx_view.check_tx_view(cluster_obj=cluster, tx_raw_output=tx_delegation_out)
tx_view.check_tx_view(cluster_obj=cluster, tx_raw_output=tx_deregister_out)

# Compare cost of Plutus script with data from db-sync
if tx_db_record and use_build_cmd:
dbsync_utils.check_plutus_costs(
redeemer_records=tx_db_record.redeemers, cost_records=plutus_cost_deleg
)
if tx_db_record and plutus_cost_deleg:
try:
dbsync_utils.check_plutus_costs(
redeemer_records=tx_db_record.redeemers, cost_records=plutus_cost_deleg
)
except AssertionError as exc:
if (
VERSIONS.transaction_era >= VERSIONS.CONWAY
and len(tx_db_record.redeemers) == 2
and tx_db_record.redeemers[0].unit_steps == tx_db_record.redeemers[1].unit_steps
and "space:" in str(exc)
):
issues.dbsync_1825.finish_test()
raise

@allure.link(helpers.get_vcs_link())
@pytest.mark.dbsync
Expand Down

0 comments on commit 7676f28

Please sign in to comment.