cardano-scaling / hydra

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

Conway fee calculation #1553

Closed ch1bo closed 2 months ago

ch1bo commented 2 months ago

Makes the internal wallet use the right computation depending on the current era. We support Babbage and Conway in that part of the application now by making things a bit more polymorphic on the era.

Co-authored by @noonio and @ffakenz


ch1bo commented 2 months ago

We can verify this working correctly on our open head on preview too before merging this.

github-actions[bot] commented 2 months 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-08-08 12:32:51.116242166 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.71 2.25 0.44
2 5390 6.99 2.76 0.46
3 5591 8.55 3.38 0.49
5 5993 11.49 4.55 0.54
10 6998 18.34 7.26 0.66
56 16246 81.52 32.24 1.76

Commit transaction costs

This uses ada-only outputs for better comparability.

UTxO Tx size % max Mem % max CPU Min fee ₳
1 556 10.52 4.15 0.29
2 747 13.86 5.65 0.34
3 934 17.33 7.20 0.38
5 1302 24.65 10.44 0.48
10 2242 45.22 19.36 0.75
20 4116 95.99 40.76 1.40

CollectCom transaction costs

Parties UTxO (bytes) Tx size % max Mem % max CPU Min fee ₳
1 57 549 22.17 8.68 0.42
2 114 659 32.10 12.73 0.53
3 170 769 43.87 17.60 0.67
4 226 879 58.84 23.79 0.84
5 281 989 78.05 31.64 1.05
6 337 1100 88.51 36.36 1.18

Cost of Decrement Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 627 17.71 7.79 0.38
2 762 19.36 9.16 0.41
3 998 21.58 10.76 0.45
5 1158 22.65 12.58 0.47
10 2008 32.89 20.17 0.65
48 7790 99.38 73.78 1.83

Close transaction costs

Parties Tx size % max Mem % max CPU Min fee ₳
1 667 21.02 9.42 0.42
2 732 22.03 10.46 0.44
3 1062 24.79 12.94 0.49
5 1349 27.92 15.98 0.55
10 1921 35.04 22.69 0.68
49 7834 97.44 82.00 1.87

Contest transaction costs

Parties Tx size % max Mem % max CPU Min fee ₳
1 674 27.18 11.67 0.48
2 800 28.90 13.17 0.51
3 951 30.72 14.71 0.55
5 1276 34.68 18.08 0.62
10 2079 44.33 26.40 0.79
38 6397 98.31 72.66 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 5077 17.32 7.55 0.57
2 5158 24.98 10.82 0.66
3 5309 41.58 18.33 0.85
4 5470 57.94 25.71 1.04
5 5636 73.86 32.82 1.23
6 5723 92.23 40.99 1.44

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 5057 9.08 4.08 0.48
5 5 283 5190 13.60 6.92 0.54
5 10 569 5361 19.06 10.39 0.62
5 20 1135 5698 30.19 17.43 0.77
5 30 1709 6043 41.51 24.55 0.93
5 40 2274 6378 52.84 31.67 1.09
5 50 2847 6721 64.56 38.97 1.25
5 81 4610 7771 99.33 60.93 1.73

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-08-08 12:36:02.355106851 UTC

Baseline Scenario

Number of nodes 1
Number of txs 3000
Avg. Confirmation Time (ms) 3.989051055
P99 10.615034939999969ms
P95 4.876735899999997ms
P50 3.706972ms
Number of Invalid txs 0

Three local nodes

Number of nodes 3
Number of txs 9000
Avg. Confirmation Time (ms) 22.141608547
P99 46.06004053000003ms
P95 30.76002494999998ms
P50 20.121686ms
Number of Invalid txs 0
github-actions[bot] commented 2 months ago

Test Results

466 tests  ±0   459 :white_check_mark: ±0   17m 14s :stopwatch: -13s 148 suites  - 1     7 :zzz: ±0    5 files   ±0     0 :x: ±0 

Results for commit 1bab0c87. ± Comparison against base commit 70843d85.

This pull request removes 1 and adds 1 tests. Note that renamed tests count towards both. ``` Hydra.Chain.Direct.Tx/collectComTx ‑ cover fee correctly handles redeemers ``` ``` Test.EndToEnd/End-to-end on Cardano devnet/forking eras ‑ can start in conway era ```

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