cardano-scaling / hydra

Implementation of the Hydra Head protocol
https://hydra.family/head-protocol/
Apache License 2.0
274 stars 84 forks source link

Introduce hydra-tx library #1587

Closed locallycompact closed 1 week ago

locallycompact commented 2 weeks ago

Introduces hydra-tx library.

Next:


github-actions[bot] commented 2 weeks ago

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 2024-09-03 08:58:03.981311306 UTC
Max. memory units 14000000
Max. CPU units 10000000000
Max. tx size (kB) 16384

Script summary

Name Hash Size (Bytes)
νInitial 2fac819a1f4f14e29639d1414220d2a18b6abd6b8e444d88d0dda8ff 3799
νCommit 2043a9f1a685bcf491413a5f139ee42e335157c8c6bc8d9e4018669d 1743
νHead bd9fad235c871fb7f837c767593018a84be3083ff80f9dab5f1c55f9 10194
μHead c8038945816586c4d38926ee63bba67821eb863794220ebbd0bf79ee* 4607
Parties Tx size % max Mem % max CPU Min fee ₳
1 5189 5.93 2.35 0.44
2 5390 7.07 2.79 0.46
3 5594 8.73 3.46 0.49
5 5994 11.22 4.43 0.54
10 6999 18.30 7.24 0.66
56 16251 81.53 32.25 1.76

Commit transaction costs

This uses ada-only outputs for better comparability.

UTxO Tx size % max Mem % max CPU Min fee ₳
1 559 10.52 4.15 0.29
2 748 13.86 5.65 0.34
3 934 17.33 7.20 0.38
5 1310 24.65 10.44 0.48
10 2244 45.22 19.36 0.75
20 4114 95.99 40.76 1.40

CollectCom transaction costs

Parties UTxO (bytes) Tx size % max Mem % max CPU Min fee ₳
1 56 548 22.14 8.66 0.42
2 114 659 32.21 12.78 0.53
3 170 769 45.11 18.07 0.68
4 227 883 62.73 25.22 0.88
5 283 989 76.54 31.08 1.04
6 337 1104 87.26 35.87 1.16

Cost of Decrement Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 614 17.71 7.79 0.38
2 770 19.11 9.07 0.40
3 941 21.67 10.77 0.44
5 1246 25.00 13.53 0.50
10 1941 32.07 19.95 0.64
50 7870 99.49 75.32 1.84

Close transaction costs

Parties Tx size % max Mem % max CPU Min fee ₳
1 666 20.98 9.42 0.42
2 774 22.49 10.81 0.44
3 1012 24.60 12.83 0.49
5 1129 26.40 14.65 0.52
10 1961 34.65 22.57 0.68
50 7762 97.54 82.38 1.87

Contest transaction costs

Parties Tx size % max Mem % max CPU Min fee ₳
1 673 27.14 11.66 0.48
2 824 28.98 13.22 0.52
3 1004 31.06 15.02 0.55
5 1230 34.07 17.66 0.61
10 1933 43.40 25.57 0.77
38 6377 98.41 72.79 1.75

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 4978 13.98 5.84 0.52
2 5144 25.24 10.92 0.66
3 5306 41.64 18.35 0.85
4 5602 60.85 27.14 1.08
5 5518 66.07 29.13 1.14
6 5639 90.12 39.98 1.41

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 ₳
5 0 0 5023 7.75 3.28 0.46
5 1 57 5056 8.88 3.99 0.47
5 5 284 5191 13.21 6.75 0.53
5 10 569 5361 19.06 10.39 0.62
5 20 1139 5701 30.78 17.68 0.78
5 30 1709 6043 41.90 24.72 0.93
5 40 2275 6379 52.84 31.67 1.09
5 50 2848 6723 64.17 38.80 1.24
5 81 4610 7771 99.53 61.01 1.74

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 2024-09-03 08:59:43.362845667 UTC

Baseline Scenario

Number of nodes 1
Number of txs 3000
Avg. Confirmation Time (ms) 5.295227732
P99 15.340362879999908ms
P95 6.3012115499999934ms
P50 4.4956935ms
Number of Invalid txs 0

Three local nodes

Number of nodes 3
Number of txs 9000
Avg. Confirmation Time (ms) 24.298693305
P99 115.59621286000002ms
P95 33.9496068ms
P50 21.4561185ms
Number of Invalid txs 0
github-actions[bot] commented 2 weeks ago

Test Results

464 tests   - 25   457 :white_check_mark:  - 25   16m 24s :stopwatch: - 1m 37s 139 suites  - 13     7 :zzz: ± 0    5 files   ± 0     0 :x: ± 0 

Results for commit 5d6d4b00. ± Comparison against base commit e3d94208.

This pull request removes 25 tests. ``` Hydra.Chain.Direct.Contract/Abort ‑ does not survive random adversarial mutations Hydra.Chain.Direct.Contract/Abort ‑ is healthy Hydra.Chain.Direct.Contract/CloseInitial ‑ does not survive random adversarial mutations Hydra.Chain.Direct.Contract/CloseInitial ‑ is healthy Hydra.Chain.Direct.Contract/CloseUnused ‑ does not survive random adversarial mutations Hydra.Chain.Direct.Contract/CloseUnused ‑ is healthy Hydra.Chain.Direct.Contract/CloseUsed ‑ does not survive random adversarial mutations Hydra.Chain.Direct.Contract/CloseUsed ‑ is healthy Hydra.Chain.Direct.Contract/CollectCom ‑ does not survive random adversarial mutations Hydra.Chain.Direct.Contract/CollectCom ‑ is healthy … ```

:recycle: This comment has been updated with latest results.

locallycompact commented 1 week ago

I would like to merge this despite the disagreements on module namespacing and Arbitrary instances that we can resolve over time so that we are not blocking others.