cardano-scaling / hydra

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

Re-use contestation period as a deposit deadline #1702

Closed v0d1ch closed 1 month ago

v0d1ch commented 1 month ago

Depends on #1700

Reuse contestation deadline as a deposit deadline. This is a follow-up from offchain incremental commits where we just used the current time as the deposit deadline. Now the contestation period is re-used as a deposit deadline and on top of that we provide information about it in the CommitRecorded server output.


github-actions[bot] commented 1 month 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-10-14 10:53:26.467300954 UTC
Max. memory units 14000000
Max. CPU units 10000000000
Max. tx size (kB) 16384

Script summary

Name Hash Size (Bytes)
νInitial b512161ccb0652d7e9a0b540e4a3c808f73d6558a4bcabf374d85880 3969
νCommit ea444d37d226e71eef73ac78d149750da977feb588900135bf9e8221 692
νHead 2253ddd95837c7aacc8635a971caaea743434152dd8dd2849bdf4162 10797
μHead 4d648ca239040b0e87901835aa11423e7aa3bd947ce6befe7db1bae8* 4508
νDeposit 1a011f23b139a6426767026bde10319546485d553219a5848cdac4e5 2993
Parties Tx size % max Mem % max CPU Min fee ₳
1 5098 5.61 2.21 0.44
2 5295 7.40 2.93 0.46
3 5498 8.37 3.30 0.48
5 5899 11.21 4.43 0.53
10 6906 18.21 7.20 0.65
57 16355 83.00 32.84 1.78

Commit transaction costs

This uses ada-only outputs for better comparability.

UTxO Tx size % max Mem % max CPU Min fee ₳
1 569 10.84 4.26 0.29
2 756 14.31 5.80 0.34
3 947 17.92 7.39 0.39
5 1322 25.56 10.73 0.49
10 2254 47.11 19.97 0.77
19 3937 94.71 39.81 1.38

CollectCom transaction costs

Parties UTxO (bytes) Tx size % max Mem % max CPU Min fee ₳
1 57 560 19.84 7.58 0.39
2 113 671 27.93 10.64 0.48
3 171 782 37.63 14.30 0.59
4 226 893 44.25 16.83 0.67
5 283 1004 53.71 20.41 0.78
6 340 1120 59.94 22.80 0.85
7 394 1227 73.19 27.75 1.00
8 449 1338 73.49 27.98 1.00
9 506 1449 78.65 29.99 1.07
10 560 1560 90.74 34.51 1.20

Cost of Decrement Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 658 18.68 8.18 0.39
2 787 19.80 9.40 0.41
3 923 21.45 10.81 0.44
5 1262 25.57 13.94 0.51
10 1992 32.92 20.61 0.65
48 7706 98.76 75.63 1.83

Close transaction costs

Parties Tx size % max Mem % max CPU Min fee ₳
1 657 20.79 9.30 0.41
2 832 22.63 11.07 0.45
3 996 24.06 12.52 0.48
5 1253 27.05 15.43 0.54
10 1837 33.69 22.19 0.66
50 7858 98.15 85.16 1.90

Contest transaction costs

Parties Tx size % max Mem % max CPU Min fee ₳
1 699 26.81 11.50 0.48
2 761 28.20 12.71 0.50
3 999 30.39 14.72 0.55
5 1237 33.70 17.64 0.60
10 1999 43.99 26.55 0.79
39 6377 98.66 74.86 1.77

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 4994 15.51 6.64 0.54
2 5053 21.25 9.06 0.61
3 5254 29.14 12.65 0.71
4 5473 36.30 15.86 0.80
5 5636 43.55 19.10 0.89
6 5398 39.58 16.67 0.83
7 5818 54.69 23.79 1.02
8 5837 60.66 26.29 1.09
9 5914 63.88 27.52 1.12
10 6033 70.80 30.54 1.21
11 6450 87.58 38.41 1.42
12 6478 92.56 40.42 1.47
13 6555 93.89 40.85 1.49

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 5089 9.60 4.01 0.48
10 1 57 5123 10.76 4.73 0.50
10 5 284 5259 15.43 7.62 0.56
10 10 568 5427 21.67 11.41 0.65
10 20 1137 5767 33.13 18.54 0.81
10 30 1710 6112 45.13 25.91 0.97
10 40 2279 6450 56.93 33.20 1.13
10 50 2845 6786 68.44 40.36 1.29
10 76 4323 7667 98.97 59.26 1.71

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-10-14 10:55:04.440519324 UTC

Baseline Scenario

Number of nodes 1
Number of txs 300
Avg. Confirmation Time (ms) 4.652948246
P99 12.466295209999998ms
P95 8.0743129ms
P50 4.1299600000000005ms
Number of Invalid txs 0

Three local nodes

Number of nodes 3
Number of txs 900
Avg. Confirmation Time (ms) 25.063598587
P99 118.42610734ms
P95 31.281826199999994ms
P50 21.9528825ms
Number of Invalid txs 0
github-actions[bot] commented 1 month ago

Test Results

  7 files  ±0  164 suites  ±0   26m 42s :stopwatch: - 1m 29s 557 tests ±0  551 :white_check_mark: ±0  6 :zzz: ±0  0 :x: ±0  559 runs  ±0  553 :white_check_mark: ±0  6 :zzz: ±0  0 :x: ±0 

Results for commit fed456a1. ± Comparison against base commit 67b0d195.

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

github-actions[bot] commented 1 month ago

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 $${\color{green}-2.00}$$ +0.18 +0.08 -
2 +6 $${\color{green}-0.18}$$ $${\color{green}-0.08}$$ -
3 $${\color{green}-2.00}$$ +0.15 +0.07 +0.01
5 - +0.05 +0.02 -
10 $${\color{green}-1.00}$$ $${\color{green}-0.32}$$ $${\color{green}-0.14}$$ -
57 $${\color{green}-3.00}$$ $${\color{green}-0.10}$$ $${\color{green}-0.04}$$ -

Commit transaction costs

UTxO Tx size % max Mem % max CPU Min fee ₳
1 +3 - - -
2 - - - -
3 $${\color{green}-3.00}$$ - - -
5 +8 - - -
10 +2 - - -
19 $${\color{green}-4.00}$$ - - -

CollectCom transaction costs

Parties UTxO (bytes) Tx size % max Mem % max CPU Min fee ₳
1 - $${\color{green}-4.00}$$ $${\color{green}-0.74}$$ $${\color{green}-0.27}$$ $${\color{green}-0.01}$$
2 - - +2.08 +0.77 +0.02
3 +2 - $${\color{green}-3.78}$$ $${\color{green}-1.40}$$ $${\color{green}-0.04}$$
4 $${\color{green}-1.00}$$ - +0.75 +0.26 +0.01
5 $${\color{green}-2.00}$$ - +6.79 +2.5 +0.07
6 - - $${\color{green}-6.60}$$ $${\color{green}-2.41}$$ $${\color{green}-0.07}$$
7 - - +2.24 +0.85 +0.03
8 $${\color{green}-3.00}$$ - $${\color{green}-6.28}$$ $${\color{green}-2.30}$$ $${\color{green}-0.07}$$
9 +2 - +5.03 +1.84 +0.05

Cost of Decrement Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 +12 - - -
2 +93 +2.53 +1.01 +0.03
3 +61 $${\color{green}-0.21}$$ $${\color{green}-0.15}$$ -
5 +27 $${\color{green}-0.71}$$ $${\color{green}-0.34}$$ -
10 $${\color{green}-48.00}$$ $${\color{green}-1.35}$$ $${\color{green}-0.50}$$ $${\color{green}-0.02}$$
49 $${\color{green}-143.00}$$ $${\color{green}-0.54}$$ $${\color{green}-0.19}$$ $${\color{green}-0.01}$$

Close transaction costs

Parties Tx size % max Mem % max CPU Min fee ₳
1 +67 +0.41 +0.36 +0.01
2 +11 $${\color{green}-0.05}$$ $${\color{green}-0.01}$$ -
3 $${\color{green}-62.00}$$ $${\color{green}-0.87}$$ $${\color{green}-0.67}$$ $${\color{green}-0.02}$$
5 $${\color{green}-37.00}$$ $${\color{green}-0.52}$$ $${\color{green}-0.38}$$ -
10 +117 +1.39 +1.05 +0.03
49 $${\color{green}-235.00}$$ +0.08 $${\color{green}-0.78}$$ $${\color{green}-0.02}$$

Contest transaction costs

Parties Tx size % max Mem % max CPU Min fee ₳
1 $${\color{green}-12.00}$$ $${\color{green}-0.09}$$ $${\color{green}-0.04}$$ -
2 +8 - +0.02 -
3 $${\color{green}-111.00}$$ $${\color{green}-0.41}$$ $${\color{green}-0.38}$$ $${\color{green}-0.01}$$
5 +98 +0.52 +0.42 +0.01
10 +96 +0.21 +0.31 +0.01
39 +30 +1.34 +0.63 +0.01

Abort transaction costs

Parties Tx size % max Mem % max CPU Min fee ₳
1 +33.0 - +0.01 -
2 +9.0 $${\color{green}-2.13}$$ $${\color{green}-0.96}$$ $${\color{green}-0.02}$$
3 $${\color{green}-75.00}$$ $${\color{green}-3.47}$$ $${\color{green}-1.71}$$ $${\color{green}-0.04}$$
4 +85.0 +0.59 +0.35 +0.02
5 +4.0 +0.33 +0.13 -
6 +67.0 +1.2 +0.6 +0.02
7 $${\color{green}-62.00}$$ $${\color{green}-3.38}$$ $${\color{green}-1.66}$$ $${\color{green}-0.04}$$
8 +58.0 +3.75 +1.73 +0.04
9 $${\color{green}-146.00}$$ $${\color{green}-9.22}$$ $${\color{green}-4.31}$$ $${\color{green}-0.11}$$
10 +147.0 +4.96 +2.41 +0.07
11 +82.0 +1.47 +0.7 +0.02
12 $${\color{green}-31.00}$$ +1.33 +0.44 +0.01
13 +197.0 +2.06 +1.25 +0.04

FanOut transaction costs

Parties UTxO UTxO (bytes) Tx size % max Mem % max CPU Min fee ₳
10 - - +1 +0.4 +0.17 +0.01
10 - - - $${\color{green}-0.20}$$ $${\color{green}-0.09}$$ -
10 - $${\color{green}-1.00}$$ $${\color{green}-2.00}$$ $${\color{green}-0.20}$$ $${\color{green}-0.08}$$ -
10 - $${\color{green}-1.00}$$ $${\color{green}-1.00}$$ +0.39 +0.17 -
10 - +2 +2 +0.79 +0.34 +0.01
10 - - +1 $${\color{green}-0.39}$$ $${\color{green}-0.17}$$ -
10 - $${\color{green}-2.00}$$ $${\color{green}-1.00}$$ $${\color{green}-0.20}$$ $${\color{green}-0.09}$$ -
10 - $${\color{green}-2.00}$$ $${\color{green}-2.00}$$ $${\color{green}-0.19}$$ $${\color{green}-0.09}$$ $${\color{green}-0.01}$$
10 +1 +56 +32 +1.37 +0.81 +0.02
v0d1ch commented 1 month ago

yes, now we also provide the information about the deadline