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

Initial contract in aiken + plutus V3 #1734

Merged
merged 24 commits into from
Nov 11, 2024
Merged

Initial contract in aiken + plutus V3 #1734

merged 24 commits into from
Nov 11, 2024

Conversation

v0d1ch
Copy link
Contributor

@v0d1ch v0d1ch commented Nov 5, 2024

Why

When working on incremental commits feature our head script grew so hydra scripts publishing became an issue (we pre-publish initial, commit and head scripts). In order to work around this constraint we decided to rewrite the initial validator using aiken since it typically produces smaller script sizes. While doing this work we realized that we can't construct a valid redeemer from haskell land unless we bump to plutus V3 (which is what aiken expects). Therefore we came up with this PR which should enable us to continue work on incremental commits (very possibly we still need to reduce script sizes further or just publish the scripts in separate transactions).


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

Copy link

github-actions bot commented Nov 5, 2024

Transaction cost differences

Script summary

Name Size (Bytes)
νInitial $${\color{green}-1302.00}$$
νCommit $${\color{green}-2.00}$$
νHead +1836
μHead +6603
νDeposit +1769

Init transaction costs

Parties Tx size % max Mem % max CPU Min fee ₳
1 6599 3.18 0.65 0.32
2 6599 3.45 0.64 0.32
3 6599 3.86 0.68 0.33
5 6598 4.73 0.76 0.34
10 6599 6.63 0.89 0.35

Commit transaction costs

UTxO Tx size % max Mem % max CPU Min fee ₳
1 $${\color{green}-8.00}$$ $${\color{green}-8.39}$$ $${\color{green}-3.09}$$ $${\color{green}-0.09}$$
2 $${\color{green}-16.00}$$ $${\color{green}-10.91}$$ $${\color{green}-4.06}$$ $${\color{green}-0.12}$$
3 $${\color{green}-24.00}$$ $${\color{green}-13.53}$$ $${\color{green}-5.05}$$ $${\color{green}-0.15}$$
5 $${\color{green}-40.00}$$ $${\color{green}-19.10}$$ $${\color{green}-7.12}$$ $${\color{green}-0.21}$$
10 $${\color{green}-80.00}$$ $${\color{green}-34.87}$$ $${\color{green}-12.69}$$ $${\color{green}-0.37}$$

CollectCom transaction costs

Parties UTxO (bytes) Tx size % max Mem % max CPU Min fee ₳
1 - - +4.85 $${\color{green}-0.39}$$ +0.04
2 - - +2.66 $${\color{green}-1.77}$$ +0.01
3 - - +2.69 $${\color{green}-2.60}$$ +0.01
4 - - +9.77 $${\color{green}-1.09}$$ +0.07
5 - - +2.48 $${\color{green}-4.53}$$ $${\color{green}-0.01}$$
6 - - $${\color{green}-0.57}$$ $${\color{green}-6.25}$$ $${\color{green}-0.05}$$
7 - - +11.41 $${\color{green}-3.85}$$ +0.07
8 - - $${\color{green}-7.39}$$ $${\color{green}-10.03}$$ $${\color{green}-0.13}$$
9 - - +10.42 $${\color{green}-4.50}$$ +0.05

Cost of Decrement Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 - 3.86 $${\color{green}-0.89}$$ 0.02
2 - 4.14 $${\color{green}-1.16}$$ 0.02
3 - 4.28 $${\color{green}-1.38}$$ 0.03
5 - 3.93 $${\color{green}-1.89}$$ 0.02
10 - 5.21 $${\color{green}-3.02}$$ 0.02

Close transaction costs

Parties Tx size % max Mem % max CPU Min fee ₳
1 - 3.44 $${\color{green}-1.32}$$ 0.02
2 - 3.49 $${\color{green}-1.63}$$ 0.02
3 - 3.86 $${\color{green}-1.94}$$ 0.02
5 - 3.59 $${\color{green}-2.42}$$ 0.01
10 - 4.89 $${\color{green}-3.98}$$ 0.01

Contest transaction costs

Parties Tx size % max Mem % max CPU Min fee ₳
1 - 3.51 $${\color{green}-1.88}$$ 0.01
2 - 3.55 $${\color{green}-2.21}$$ 0.01
3 - 3.48 $${\color{green}-2.45}$$ 0.01
5 - 4 $${\color{green}-3.20}$$ 0.01
10 - 4.87 $${\color{green}-4.83}$$ 0.01

Abort transaction costs

Parties Tx size % max Mem % max CPU Min fee ₳
1 6603 10.37 2.18 0.39
2 6603 12.24 2.21 0.4
3 6603 13.12 2.51 0.42
4 6603 15.81 2.48 0.44
5 6603 17.86 2.46 0.45
6 6603 19.05 2.56 0.46
7 6603 22.36 2.56 0.49
8 6603 24.73 2.32 0.51
9 6603 25.93 2.51 0.52
10 6603 26.59 2.74 0.52

FanOut transaction costs

Parties UTxO UTxO (bytes) Tx size % max Mem % max CPU Min fee ₳
10 - - +6603 +7.35 +1.75 +0.36
10 $${\color{green}-1.00}$$ $${\color{green}-57.00}$$ +6570 +5.59 +0.78 +0.34
10 $${\color{green}-5.00}$$ $${\color{green}-285.00}$$ +6434 +1.31 $${\color{green}-1.94}$$ +0.28
10 $${\color{green}-10.00}$$ $${\color{green}-568.00}$$ +6265 $${\color{green}-4.33}$$ $${\color{green}-5.48}$$ +0.2
10 $${\color{green}-20.00}$$ $${\color{green}-1138.00}$$ +5926 $${\color{green}-15.90}$$ $${\color{green}-12.66}$$ +0.04
10 $${\color{green}-30.00}$$ $${\color{green}-1708.00}$$ +5584 $${\color{green}-28.10}$$ $${\color{green}-20.12}$$ $${\color{green}-0.12}$$
10 $${\color{green}-40.00}$$ $${\color{green}-2279.00}$$ +5243 $${\color{green}-39.59}$$ $${\color{green}-27.27}$$ $${\color{green}-0.28}$$
10 $${\color{green}-50.00}$$ $${\color{green}-2848.00}$$ +4904 $${\color{green}-50.51}$$ $${\color{green}-34.18}$$ $${\color{green}-0.44}$$
10 $${\color{green}-76.00}$$ $${\color{green}-4322.00}$$ +4027 $${\color{green}-81.54}$$ $${\color{green}-53.29}$$ $${\color{green}-0.86}$$
10 +1 +57 +6636 +10.3 +2.92 +0.39
10 - - +6603 +8.54 +1.95 +0.37
10 $${\color{green}-4.00}$$ $${\color{green}-228.00}$$ +6467 +4.26 $${\color{green}-0.77}$$ +0.31
10 $${\color{green}-9.00}$$ $${\color{green}-511.00}$$ +6298 $${\color{green}-1.38}$$ $${\color{green}-4.31}$$ +0.23
10 $${\color{green}-19.00}$$ $${\color{green}-1081.00}$$ +5959 $${\color{green}-12.95}$$ $${\color{green}-11.49}$$ +0.07
10 $${\color{green}-29.00}$$ $${\color{green}-1651.00}$$ +5617 $${\color{green}-25.15}$$ $${\color{green}-18.95}$$ $${\color{green}-0.09}$$
10 $${\color{green}-39.00}$$ $${\color{green}-2222.00}$$ +5276 $${\color{green}-36.64}$$ $${\color{green}-26.10}$$ $${\color{green}-0.25}$$
10 $${\color{green}-49.00}$$ $${\color{green}-2791.00}$$ +4937 $${\color{green}-47.56}$$ $${\color{green}-33.01}$$ $${\color{green}-0.41}$$
10 $${\color{green}-75.00}$$ $${\color{green}-4265.00}$$ +4060 $${\color{green}-78.59}$$ $${\color{green}-52.12}$$ $${\color{green}-0.83}$$
10 +5 +285 +6772 +16.98 +5.7 +0.47
10 +4 +228 +6739 +15.22 +4.73 +0.45
10 - - +6603 +10.94 +2.01 +0.39
10 $${\color{green}-5.00}$$ $${\color{green}-283.00}$$ +6434 +5.3 $${\color{green}-1.53}$$ +0.31
10 $${\color{green}-15.00}$$ $${\color{green}-853.00}$$ +6095 $${\color{green}-6.27}$$ $${\color{green}-8.71}$$ +0.15
10 $${\color{green}-25.00}$$ $${\color{green}-1423.00}$$ +5753 $${\color{green}-18.47}$$ $${\color{green}-16.17}$$ $${\color{green}-0.01}$$
10 $${\color{green}-35.00}$$ $${\color{green}-1994.00}$$ +5412 $${\color{green}-29.96}$$ $${\color{green}-23.32}$$ $${\color{green}-0.17}$$
10 $${\color{green}-45.00}$$ $${\color{green}-2563.00}$$ +5073 $${\color{green}-40.88}$$ $${\color{green}-30.23}$$ $${\color{green}-0.33}$$
10 $${\color{green}-71.00}$$ $${\color{green}-4037.00}$$ +4196 $${\color{green}-71.91}$$ $${\color{green}-49.34}$$ $${\color{green}-0.75}$$
10 +10 +568 +6941 +25.87 +9.37 +0.58
10 +9 +511 +6908 +24.11 +8.4 +0.56
10 +5 +283 +6772 +19.83 +5.68 +0.5
10 - - +6603 +14.19 +2.14 +0.42
10 $${\color{green}-10.00}$$ $${\color{green}-570.00}$$ +6264 +2.62 $${\color{green}-5.04}$$ +0.26
10 $${\color{green}-20.00}$$ $${\color{green}-1140.00}$$ +5922 $${\color{green}-9.58}$$ $${\color{green}-12.50}$$ +0.1
10 $${\color{green}-30.00}$$ $${\color{green}-1711.00}$$ +5581 $${\color{green}-21.07}$$ $${\color{green}-19.65}$$ $${\color{green}-0.06}$$
10 $${\color{green}-40.00}$$ $${\color{green}-2280.00}$$ +5242 $${\color{green}-31.99}$$ $${\color{green}-26.56}$$ $${\color{green}-0.22}$$
10 $${\color{green}-66.00}$$ $${\color{green}-3754.00}$$ +4365 $${\color{green}-63.02}$$ $${\color{green}-45.67}$$ $${\color{green}-0.64}$$
10 +20 +1138 +7280 +44.18 +16.91 +0.79
10 +19 +1081 +7247 +42.42 +15.94 +0.77
10 +15 +853 +7111 +38.14 +13.22 +0.71
10 +10 +570 +6942 +32.5 +9.68 +0.63
10 - - +6603 +20.93 +2.5 +0.47
10 $${\color{green}-10.00}$$ $${\color{green}-570.00}$$ +6261 +8.73 $${\color{green}-4.96}$$ +0.31
10 $${\color{green}-20.00}$$ $${\color{green}-1141.00}$$ +5920 $${\color{green}-2.76}$$ $${\color{green}-12.11}$$ +0.15
10 $${\color{green}-30.00}$$ $${\color{green}-1710.00}$$ +5581 $${\color{green}-13.68}$$ $${\color{green}-19.02}$$ $${\color{green}-0.01}$$
10 $${\color{green}-56.00}$$ $${\color{green}-3184.00}$$ +4704 $${\color{green}-44.71}$$ $${\color{green}-38.13}$$ $${\color{green}-0.43}$$
10 +30 +1708 +7622 +63.65 +24.87 +1.02
10 +29 +1651 +7589 +61.89 +23.9 +1.0
10 +25 +1423 +7453 +57.61 +21.18 +0.94
10 +20 +1140 +7284 +51.97 +17.64 +0.86
10 +10 +570 +6945 +40.4 +10.46 +0.7
10 - - +6603 +28.2 +3.0 +0.54
10 $${\color{green}-10.00}$$ $${\color{green}-571.00}$$ +6262 +16.71 $${\color{green}-4.15}$$ +0.38
10 $${\color{green}-20.00}$$ $${\color{green}-1140.00}$$ +5923 +5.79 $${\color{green}-11.06}$$ +0.22
10 $${\color{green}-46.00}$$ $${\color{green}-2614.00}$$ +5046 $${\color{green}-25.24}$$ $${\color{green}-30.17}$$ $${\color{green}-0.20}$$
10 +40 +2279 +7963 +81.82 +32.36 +1.24
10 +39 +2222 +7930 +80.06 +31.39 +1.22
10 +35 +1994 +7794 +75.78 +28.67 +1.16
10 +30 +1711 +7625 +70.14 +25.13 +1.08
10 +20 +1141 +7286 +58.57 +17.95 +0.92
10 +10 +571 +6944 +46.37 +10.49 +0.76
10 - - +6603 +34.88 +3.34 +0.6
10 $${\color{green}-10.00}$$ $${\color{green}-569.00}$$ +6264 +23.96 $${\color{green}-3.57}$$ +0.44
10 $${\color{green}-36.00}$$ $${\color{green}-2043.00}$$ +5387 $${\color{green}-7.07}$$ $${\color{green}-22.68}$$ +0.02
10 +44 +2502 +8095 +88.5 +35.14 +1.32
10 +43 +2445 +8062 +86.74 +34.17 +1.3
10 +39 +2217 +7926 +82.46 +31.45 +1.24
10 +34 +1934 +7757 +76.82 +27.91 +1.16
10 +24 +1364 +7418 +65.25 +20.73 +1.0
10 +14 +794 +7076 +53.05 +13.27 +0.84
10 +4 +223 +6735 +41.56 +6.12 +0.68
10 $${\color{green}-6.00}$$ $${\color{green}-346.00}$$ +6396 +30.64 $${\color{green}-0.79}$$ +0.52
10 $${\color{green}-32.00}$$ $${\color{green}-1820.00}$$ +5519 $${\color{green}-0.39}$$ $${\color{green}-19.90}$$ +0.1

Copy link

github-actions bot commented Nov 6, 2024

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-11-11 11:38:12.72502406 UTC
Max. memory units 14000000
Max. CPU units 10000000000
Max. tx size (kB) 16384

Script summary

Name Hash Size (Bytes)
νInitial 00a6ddbc130ab92f5b7cb8d1ccd8d79eca5bfe25f6843c07b62841f0 2667
νCommit 3e5a776bcee213e3dfd15806952a10ac5590e3e97d09d62eb99266b2 690
νHead 00e0e6aceb51fcb4fcc5dc6032cc524a641163f0723b25d995de3ae8 12633
μHead 134f18365d53de72b07af2e703c96d8a6f0643c71d4c1a2050b8182a* 11111
νDeposit 2feb47889a4f658dc593cefcb0e37d584b9431944f08a687f3dab4af 4865
  • 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 11695 8.69 2.83 0.76
2 11894 10.44 3.40 0.78
3 12101 12.20 3.97 0.81
5 12504 15.72 5.11 0.86
10 13506 24.51 7.96 1.00
24 16322 49.43 16.07 1.38

Commit transaction costs

This uses ada-only outputs for better comparability.

UTxO Tx size % max Mem % max CPU Min fee ₳
1 561 2.45 1.17 0.20
2 739 3.40 1.74 0.22
3 918 4.39 2.34 0.24
5 1279 6.46 3.61 0.28
10 2175 12.24 7.28 0.40
54 10041 99.20 68.72 1.89

CollectCom transaction costs

Parties UTxO (bytes) Tx size % max Mem % max CPU Min fee ₳
1 57 560 23.94 7.01 0.42
2 114 671 31.60 9.23 0.50
3 170 782 41.96 12.14 0.61
4 228 893 49.98 14.45 0.70
5 282 1004 57.06 16.59 0.78
6 337 1116 63.37 18.47 0.84
7 394 1227 75.55 21.83 0.97
8 451 1338 90.16 25.79 1.12

Cost of Decrement Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 645 22.54 7.29 0.41
2 774 23.30 8.15 0.43
3 963 26.58 9.75 0.48
5 1167 27.69 11.38 0.51
10 1954 36.79 17.27 0.66
43 6798 97.28 56.20 1.64

Close transaction costs

Parties Tx size % max Mem % max CPU Min fee ₳
1 649 24.27 7.99 0.43
2 795 25.83 9.16 0.46
3 876 26.70 10.00 0.48
5 1238 30.99 12.89 0.55
10 2053 39.89 19.28 0.70
43 7019 97.83 61.05 1.69

Contest transaction costs

Parties Tx size % max Mem % max CPU Min fee ₳
1 677 30.32 9.60 0.49
2 894 32.77 11.15 0.53
3 943 33.95 12.06 0.55
5 1263 38.29 14.84 0.62
10 2048 48.57 21.58 0.79
34 5619 98.13 53.76 1.58

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 11587 25.76 8.76 0.93
2 11657 33.24 11.24 1.01
3 11904 43.48 14.87 1.13
4 11937 51.35 17.44 1.22
5 12244 63.14 21.73 1.36
6 12230 66.61 22.72 1.39
7 12329 74.84 25.46 1.48
8 12582 85.81 29.30 1.61
9 12732 94.68 32.32 1.71

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 11692 17.87 6.13 0.85
10 1 57 11726 18.83 6.56 0.87
10 5 285 11863 26.97 9.88 0.96
10 10 569 12031 36.54 13.80 1.07
10 20 1140 12373 54.38 21.17 1.29
10 30 1710 12714 73.64 29.05 1.51
10 40 2278 13053 91.44 36.40 1.73
10 44 2507 13189 98.85 39.45 1.81

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-11-11 11:41:44.338487811 UTC

Baseline Scenario

Number of nodes 1
Number of txs 300
Avg. Confirmation Time (ms) 4.992650610
P99 8.687073429999977ms
P95 6.328223500000003ms
P50 4.7747455ms
Number of Invalid txs 0

Three local nodes

Number of nodes 3
Number of txs 900
Avg. Confirmation Time (ms) 24.263493267
P99 114.10330288999998ms
P95 33.70941565ms
P50 21.8925235ms
Number of Invalid txs 0

@v0d1ch v0d1ch force-pushed the ffakenz/aiken-initial branch 4 times, most recently from 6bcb431 to a55d011 Compare November 6, 2024 20:53
@v0d1ch v0d1ch force-pushed the ffakenz/aiken-initial branch from a69412e to ac8a152 Compare November 6, 2024 22:01
@ffakenz ffakenz force-pushed the ffakenz/aiken-initial branch from 8ac0a3c to 4d4c776 Compare November 7, 2024 10:02
@v0d1ch v0d1ch force-pushed the ffakenz/aiken-initial branch from 4d4c776 to c266511 Compare November 7, 2024 14:51
@v0d1ch v0d1ch force-pushed the ffakenz/aiken-initial branch from c266511 to 32ccbc6 Compare November 7, 2024 14:54
@v0d1ch v0d1ch requested a review from a team November 7, 2024 14:55
@v0d1ch v0d1ch force-pushed the ffakenz/aiken-initial branch from b9e5e49 to cf1135d Compare November 8, 2024 10:43
Copy link

github-actions bot commented Nov 8, 2024

Test Results

  5 files  ±0  162 suites  ±0   30m 17s ⏱️ + 2m 57s
554 tests ±0  548 ✅ ±0  6 💤 ±0  0 ❌ ±0 
556 runs  ±0  550 ✅ ±0  6 💤 ±0  0 ❌ ±0 

Results for commit ea6d674. ± Comparison against base commit ed8e0b7.

This pull request removes 1 and adds 1 tests. Note that renamed tests count towards both.
Hydra.Options/Hydra Node RunOptions ‑ validateRunOptions: using more than 8 parties should error out
Hydra.Options/Hydra Node RunOptions ‑ validateRunOptions: using more than 7 parties should error out

♻️ This comment has been updated with latest results.

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.

Looking great!

@ffakenz ffakenz force-pushed the ffakenz/aiken-initial branch from 7758fc9 to 42eef1a Compare November 11, 2024 08:26
@noonio noonio force-pushed the ffakenz/aiken-initial branch from cb0bc5b to ea6d674 Compare November 11, 2024 11:33
@v0d1ch v0d1ch added this pull request to the merge queue Nov 11, 2024
Merged via the queue into master with commit 3be7b22 Nov 11, 2024
26 checks passed
@v0d1ch v0d1ch deleted the ffakenz/aiken-initial branch November 11, 2024 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants