Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Map and debug PlutusFailure cases of ApplyTx #1789

Merged
merged 2 commits into from
Jan 21, 2025
Merged

Map and debug PlutusFailure cases of ApplyTx #1789

merged 2 commits into from
Jan 21, 2025

Conversation

ch1bo
Copy link
Member

@ch1bo ch1bo commented Jan 16, 2025

When submitting transactions which spend from scripts to the L2 cardano ledger, we can use debugPlutus to re-evaluate the script and dump debug information.

This does not fix the formatting though (newlines in Text).

TODO: a test would be good. @noonio you had a e2e scenario where we spend a script on the L2 recently?

This commit is also back-ported onto doom to benefit the hydra-doom project.


  • CHANGELOG updated
  • Documentation updated or not needed
  • Haddocks update not needed
  • No new TODOs introduced

When submitting transactions which spend from scripts to the L2 cardano
ledger, we can use debugPlutus to re-evaluate the script and dump debug
information.

This does not fix the formatting though (newlines in Text).
@ch1bo ch1bo requested review from Quantumplation and a team January 16, 2025 21:12
Copy link
Contributor

@noonio noonio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@ch1bo
Copy link
Member Author

ch1bo commented Jan 17, 2025

Looks great!

@noonio think we should merge without a test case? Was manually confirmed working by hydra doom people, but without a test it's (too) easy to remove when ledger types will change and annoy (definitely going to happen).

@noonio
Copy link
Contributor

noonio commented Jan 17, 2025

Looks great!

@noonio think we should merge without a test case? Was manually confirmed working by hydra doom people, but without a test it's (too) easy to remove when ledger types will change and annoy (definitely going to happen).

We can't merge the test-case I have; but I'm happy to rebase and see how it plays out with that one once it's in.

I'm happy to merge as-is; (when it compiles 😅).

If you have in mind a much simpler test-case than an end-to-end one I'm very open to that!

It's not clear why debugPlutus would need to be an IO action, it does
not have any side effects.

See also IntersectMBO/cardano-ledger@8b5fa4a
Copy link

Transaction cost differences

Script summary

Name Size (Bytes)
νInitial -
νCommit -
νHead -
μHead -
νDeposit -

Init transaction costs

Parties Tx size % max Mem % max CPU Min fee ₳
1 - - - -
2 - - - -
3 - - - -
5 - - - -
10 - - - -
44 - - - -

Commit transaction costs

UTxO Tx size % max Mem % max CPU Min fee ₳
1 - - - -
2 - - - -
3 - - - -
5 - - - -
10 - - - -
54 - - - -

CollectCom transaction costs

Parties UTxO (bytes) Tx size % max Mem % max CPU Min fee ₳
1 - - - - -
2 - - - - -
3 - - - - -
4 - - - - -
5 - - - - -
6 - - - - -
7 - - - - -
8 - - - - -
9 - - - - -
10 - - - - -

Cost of Increment Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 - - - -
2 - - - -
3 - +0.38 +0.09 -
5 - - - -
10 - $${\color{green}-0.38}$$ $${\color{green}-0.10}$$ -
43 - - - -

Cost of Decrement Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 - - - -
2 - - - -
3 - - - -
5 - - - -
10 - - - -
45 - - - -

Close transaction costs

Parties Tx size % max Mem % max CPU Min fee ₳
1 - - - -
2 - - - -
3 - - - -
5 - - - -
10 - - - -
41 - - - -

Contest transaction costs

Parties Tx size % max Mem % max CPU Min fee ₳
1 - - - -
2 - - - -
3 - - - -
5 - - - -
10 - - - -
33 - - - -

FanOut transaction costs

UTxO, Parties UTxO (bytes) Tx size % max Mem % max CPU Min fee ₳
(0, 10) - - - - -
(1, 10) - - - - -
(5, 10) - - - - -
(10, 10) - - - - -
(20, 10) - - - - -
(40, 10) - - - - -
(41, 10) - - - - -

Copy link

Transaction costs

Sizes and execution budgets for Hydra protocol transactions. Note that unlisted parameters are currently using arbitrary values and results are not fully deterministic and comparable to previous runs.

Metadata
Generated at 2025-01-20 19:49:31.441888985 UTC
Max. memory units 14000000
Max. CPU units 10000000000
Max. tx size (kB) 16384

Script summary

Name Hash Size (Bytes)
νInitial c8a101a5c8ac4816b0dceb59ce31fc2258e387de828f02961d2f2045 2652
νCommit 61458bc2f297fff3cc5df6ac7ab57cefd87763b0b7bd722146a1035c 685
νHead 5350e9d521552ebfd9e846fd70c3b801f716fc14296134ec0fb71e97 14492
μHead 6b49dc4e571207d615dba01996548cb610b0caa85c30423d169d0091* 5612
νDeposit ae01dade3a9c346d5c93ae3ce339412b90a0b8f83f94ec6baa24e30c 1102
  • The minting policy hash is only usable for comparison. As the script is parameterized, the actual script is unique per head.

Init transaction costs

Parties Tx size % max Mem % max CPU Min fee ₳
1 6164 10.00 3.17 0.53
2 6370 12.04 3.82 0.56
3 6571 14.09 4.46 0.59
5 6969 18.36 5.81 0.65
10 7972 28.76 9.09 0.80
44 14811 98.18 30.91 1.82

Commit transaction costs

This uses ada-only outputs for better comparability.

UTxO Tx size % max Mem % max CPU Min fee ₳
1 561 2.44 1.16 0.20
2 740 3.38 1.73 0.22
3 920 4.36 2.33 0.24
5 1281 6.41 3.60 0.28
10 2172 12.13 7.25 0.40
54 10064 98.61 68.52 1.88

CollectCom transaction costs

Parties UTxO (bytes) Tx size % max Mem % max CPU Min fee ₳
1 57 525 24.20 7.07 0.42
2 114 636 34.03 9.82 0.52
3 171 747 42.15 12.15 0.61
4 228 858 47.82 13.90 0.67
5 282 969 57.13 16.55 0.77
6 337 1081 65.29 18.87 0.86
7 396 1192 75.23 21.64 0.97
8 450 1303 86.75 24.80 1.09
10 561 1525 95.34 27.64 1.19

Cost of Increment Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 1802 24.05 8.01 0.48
2 1996 26.10 9.43 0.52
3 2013 26.11 9.92 0.52
5 2346 29.51 12.44 0.58
10 3091 39.42 19.01 0.74
42 7988 97.16 59.75 1.72

Cost of Decrement Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 602 22.68 7.32 0.41
2 802 25.31 8.72 0.45
3 1023 28.11 10.16 0.50
5 1177 29.90 12.00 0.53
10 1936 38.17 17.64 0.67
43 7032 97.67 56.37 1.66

Close transaction costs

Parties Tx size % max Mem % max CPU Min fee ₳
1 689 26.95 8.71 0.46
2 823 28.68 9.91 0.49
3 1033 31.11 11.50 0.53
5 1244 36.20 14.29 0.60
10 1936 45.45 20.60 0.75
37 5986 92.45 54.52 1.55

Contest transaction costs

Parties Tx size % max Mem % max CPU Min fee ₳
1 682 33.31 10.41 0.52
2 846 35.33 11.70 0.56
3 946 37.25 12.95 0.59
5 1277 41.86 15.80 0.66
10 1980 52.46 22.59 0.82
31 5258 98.77 51.82 1.55

Abort transaction costs

There is some variation due to the random mixture of initial and already committed outputs.

Parties Tx size % max Mem % max CPU Min fee ₳
1 5966 22.41 7.45 0.65
2 6235 35.58 12.09 0.80
3 6341 44.28 15.02 0.90
4 6400 52.06 17.57 0.98
5 6602 58.96 20.04 1.06
6 6757 71.03 24.10 1.20
7 6815 76.52 25.89 1.25
8 6966 85.70 28.95 1.36
9 7211 97.93 33.38 1.50
10 7072 99.04 33.31 1.50

FanOut transaction costs

Involves spending head output and burning head tokens. Uses ada-only UTXO for better comparability.

Parties UTxO UTxO (bytes) Tx size % max Mem % max CPU Min fee ₳
10 0 0 6162 17.66 6.02 0.61
10 1 57 6197 20.35 7.07 0.64
10 5 285 6333 27.98 10.15 0.73
10 10 570 6503 36.88 13.76 0.83
10 30 1704 7178 76.42 29.65 1.30
10 40 2276 7520 96.75 37.80 1.54
10 41 2333 7555 97.98 38.32 1.55

End-to-end benchmark results

This page is intended to collect the latest end-to-end benchmark results produced by Hydra's continuous integration (CI) system from the latest master code.

Please note that these results are approximate as they are currently produced from limited cloud VMs and not controlled hardware. Rather than focusing on the absolute results, the emphasis should be on relative results, such as how the timings for a scenario evolve as the code changes.

Generated at 2025-01-20 19:52:31.650401592 UTC

Baseline Scenario

Number of nodes 1
Number of txs 300
Avg. Confirmation Time (ms) 5.578594316
P99 13.629715269999965ms
P95 7.4937844ms
P50 5.0770095ms
Number of Invalid txs 0

Three local nodes

Number of nodes 3
Number of txs 900
Avg. Confirmation Time (ms) 23.588730693
P99 38.01662711999945ms
P95 29.76306815ms
P50 22.0468415ms
Number of Invalid txs 0

Copy link

Test Results

  5 files  ±0  165 suites  ±0   31m 16s ⏱️ + 1m 50s
561 tests ±0  559 ✅ ±0  2 💤 ±0  0 ❌ ±0 
563 runs  ±0  561 ✅ ±0  2 💤 ±0  0 ❌ ±0 

Results for commit 36d6314. ± Comparison against base commit af5c305.

@v0d1ch v0d1ch added this pull request to the merge queue Jan 21, 2025
Merged via the queue into master with commit aaf1159 Jan 21, 2025
27 checks passed
@v0d1ch v0d1ch deleted the l2-debug-plutus branch January 21, 2025 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants