Skip to content

Separate orphan instances into cardano-api-orphans #1986

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

locallycompact
Copy link
Contributor

@locallycompact locallycompact commented May 2, 2025

Orphans should be separated by library to control inclusion.

The Arbitrary instances should be removed and both hydra and hydra-explorer should use the hedgehog-quickcheck compatibility function hedgehog gen<X> where gen<X> is taken from Test.Gen.Cardano.Api.Typed.

Copy link

github-actions bot commented May 2, 2025

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-05-02 18:30:48.285686273 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 be6ebc744208c660bf0fdc1cfbb5157477cd305de5b1777e575cbb4c 14665
μHead 1f47a42d1d6edc32ccd834acb19d5db3b2a5232f0bd7eaa8908dc519* 5284
ν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 5837 10.56 3.35 0.52
2 6035 12.96 4.12 0.55
3 6243 14.47 4.57 0.57
5 6640 18.59 5.86 0.63
10 7646 28.77 9.05 0.78
43 14282 98.53 30.78 1.80

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 921 4.36 2.33 0.24
5 1283 6.41 3.60 0.28
10 2174 12.13 7.25 0.40
54 10059 98.61 68.52 1.88

CollectCom transaction costs

Parties UTxO (bytes) Tx size % max Mem % max CPU Min fee ₳
1 57 525 25.24 7.32 0.43
2 114 636 32.24 9.37 0.51
3 171 747 40.21 11.69 0.59
4 226 858 53.67 15.27 0.73
5 284 974 57.90 16.73 0.78
6 340 1081 75.25 21.29 0.96
7 393 1192 75.03 21.72 0.97
8 450 1303 90.16 25.81 1.12

Cost of Increment Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 1798 24.16 8.03 0.48
2 1936 25.69 9.18 0.51
3 2103 28.02 10.65 0.55
5 2413 31.67 13.17 0.61
10 3130 40.32 19.35 0.75
41 7542 97.02 58.30 1.69

Cost of Decrement Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 623 22.73 7.33 0.41
2 758 23.97 8.35 0.44
3 883 25.75 9.50 0.47
5 1089 27.04 11.17 0.50
10 1923 37.39 17.41 0.66
41 6591 97.08 54.71 1.62

Close transaction costs

Parties Tx size % max Mem % max CPU Min fee ₳
1 697 27.37 8.81 0.47
2 870 29.74 10.31 0.50
3 977 33.26 11.99 0.55
5 1283 37.29 14.68 0.61
10 1939 46.52 20.85 0.76
36 5792 99.94 55.52 1.61

Contest transaction costs

Parties Tx size % max Mem % max CPU Min fee ₳
1 679 33.70 10.50 0.53
2 811 35.73 11.78 0.56
3 1060 39.09 13.67 0.61
5 1339 43.02 16.22 0.67
10 2219 55.48 23.77 0.87
30 4930 98.92 50.54 1.53

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 5737 26.92 9.02 0.69
2 5849 35.73 11.96 0.78
3 6078 46.80 15.75 0.91
4 6127 51.79 17.38 0.96
5 6136 61.50 20.54 1.07
6 6462 75.20 25.25 1.22
7 6743 86.86 29.40 1.36
8 6869 95.48 32.25 1.46
9 6677 97.39 32.57 1.47

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 5835 18.94 6.32 0.61
10 1 57 5869 21.67 7.37 0.64
10 5 285 6005 29.36 10.43 0.73
10 10 569 6173 39.08 14.30 0.84
10 30 1704 6850 79.64 30.32 1.31
10 39 2220 7159 99.62 38.11 1.54

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-05-02 18:32:55.500947837 UTC

Baseline Scenario

Number of nodes 1
Number of txs 300
Avg. Confirmation Time (ms) 4.496916846
P99 6.833260619999999ms
P95 5.629743500000001ms
P50 4.3027065ms
Number of Invalid txs 0

Memory data

Time Used Free
2025-05-02 18:31:38.858397559 UTC 904M 8106M
2025-05-02 18:31:43.858260172 UTC 1025M 7885M
2025-05-02 18:31:48.85826542 UTC 1026M 7884M
2025-05-02 18:31:53.858283747 UTC 1027M 7883M
2025-05-02 18:31:58.858279964 UTC 1031M 7878M
2025-05-02 18:32:03.858341871 UTC 1031M 7877M

Three local nodes

Number of nodes 3
Number of txs 900
Avg. Confirmation Time (ms) 28.243505088
P99 47.44409994ms
P95 38.76046494999999ms
P50 26.7397985ms
Number of Invalid txs 0

Memory data

Time Used Free
2025-05-02 18:32:17.596990468 UTC 957M 7961M
2025-05-02 18:32:22.597014753 UTC 1173M 7744M
2025-05-02 18:32:27.599396556 UTC 1232M 7629M
2025-05-02 18:32:32.597096973 UTC 1240M 7568M
2025-05-02 18:32:37.597079867 UTC 1242M 7565M
2025-05-02 18:32:42.597089205 UTC 1244M 7563M
2025-05-02 18:32:47.597032273 UTC 1247M 7559M
2025-05-02 18:32:52.597027063 UTC 1247M 7559M

Copy link

github-actions bot commented May 2, 2025

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 - - - -
43 - - - -

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 - - - - -

Cost of Increment Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 - - - -
2 - - - -
3 - - - -
5 - - - -
10 - +0.37 +0.09 -
43 - - - -

Cost of Decrement Transaction

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

Close transaction costs

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

Contest transaction costs

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

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) - - - - -
(38, 10) - - - - -

Copy link
Member

@ch1bo ch1bo left a comment

Choose a reason for hiding this comment

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

Orphans should be separated by library to control inclusion.

How is this separated if hydra-cardano-api pulls them in and with that all our other application packages?

I do agree that having orphan instances is bad and would love to see them gone. See also this coding standard i proposed: https://github.com/cardano-scaling/hydra/wiki/Coding-Standards#proposal-avoid-orphan-instances

Moving them to another package does not remove them.

@github-project-automation github-project-automation bot moved this from Triage 🏥 to In progress 🕐 in ☕ Hydra Team Work May 5, 2025
@locallycompact
Copy link
Contributor Author

It's /potentially/ separated, in that we can assess the impact at once by removing the dependency on the library. But if we want to try and remove them right now then yes I'm all for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In progress 🕐
Development

Successfully merging this pull request may close these issues.

2 participants