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

Reuse functions from Cardano.Api.Tx.Body and match nomenclature. #1761

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

locallycompact
Copy link
Contributor

@locallycompact locallycompact commented Dec 8, 2024

These functions that modify TxBodyContent can now be upstreamed to Cardano.Api.Tx.Body.

These can be removed after IntersectMBO/cardano-api#704 is merged.


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

@locallycompact locallycompact force-pushed the lc/defaultTxBodyContent branch from 72e1391 to b2103f4 Compare December 8, 2024 10:41
Copy link

github-actions bot commented Dec 8, 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-12-08 12:06:10.234433674 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 8fc2a74df32d01d1db56b3acb561831ef9c9970123079423abfcb86e 12622
μHead c40e78e78083a4c137734abe9ac4070cc978842e9755fe88e0c7b922* 11133
ν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 11683 9.08 2.98 0.76
2 11884 10.53 3.43 0.78
3 12082 12.38 4.03 0.81
5 12491 15.90 5.18 0.87
10 13490 24.90 8.11 1.00
24 16306 49.27 16.01 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 743 3.40 1.74 0.22
3 920 4.39 2.34 0.24
5 1279 6.46 3.61 0.28
10 2180 12.24 7.28 0.40
54 10045 99.20 68.72 1.89

CollectCom transaction costs

Parties UTxO (bytes) Tx size % max Mem % max CPU Min fee ₳
1 56 524 24.83 7.22 0.43
2 114 636 32.69 9.48 0.51
3 170 747 40.50 11.74 0.60
4 228 862 47.30 13.76 0.67
5 282 969 55.39 16.11 0.76
6 338 1081 73.33 20.81 0.94
7 396 1192 73.00 21.08 0.94
8 450 1303 79.47 23.12 1.02
9 507 1414 89.92 26.02 1.13

Cost of Decrement Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 597 22.63 7.30 0.41
2 784 25.34 8.73 0.45
3 827 23.84 8.96 0.44
5 1139 27.74 11.39 0.51
10 2126 42.48 18.86 0.72
43 6756 96.18 55.92 1.63

Close transaction costs

Parties Tx size % max Mem % max CPU Min fee ₳
1 622 24.38 8.02 0.43
2 761 25.94 9.18 0.46
3 905 27.54 10.36 0.49
5 1217 31.06 12.92 0.55
10 2032 40.43 19.53 0.71
43 7007 98.88 61.32 1.70

Contest transaction costs

Parties Tx size % max Mem % max CPU Min fee ₳
1 662 30.42 9.64 0.49
2 844 32.96 11.19 0.53
3 946 34.83 12.42 0.56
5 1132 37.22 14.29 0.60
10 2053 49.42 21.92 0.80
34 5665 99.00 54.24 1.59

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 11566 25.63 8.72 0.93
2 11683 34.10 11.58 1.02
3 11928 44.27 15.16 1.14
4 12029 52.76 18.02 1.24
5 12316 63.72 21.84 1.36
6 12202 69.34 23.56 1.42
7 12393 76.14 25.93 1.50
8 12402 83.92 28.44 1.58
9 12609 93.64 31.90 1.69
10 12555 96.99 32.89 1.72

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 11679 17.34 5.93 0.85
10 1 57 11713 19.56 6.83 0.87
10 5 285 11849 25.14 9.21 0.94
10 10 569 12019 36.54 13.80 1.07
10 20 1135 12355 52.92 20.63 1.27
10 30 1707 12699 73.27 28.92 1.51
10 40 2275 13036 90.71 36.14 1.72
10 44 2508 13177 98.49 39.32 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-12-08 12:08:49.438515007 UTC

Baseline Scenario

Number of nodes 1
Number of txs 300
Avg. Confirmation Time (ms) 4.259944640
P99 8.907863879999999ms
P95 5.244689450000001ms
P50 4.0672565ms
Number of Invalid txs 0

Three local nodes

Number of nodes 3
Number of txs 900
Avg. Confirmation Time (ms) 22.604736463
P99 40.66356677ms
P95 31.799586649999984ms
P50 21.0593485ms
Number of Invalid txs 0

Copy link

github-actions bot commented Dec 8, 2024

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}-35.00}$$ - - -
2 $${\color{green}-35.00}$$ - - -
3 $${\color{green}-35.00}$$ - - -
5 $${\color{green}-35.00}$$ - - -
10 $${\color{green}-35.00}$$ - - -
24 $${\color{green}-35.00}$$ - - $${\color{green}-0.01}$$

Commit transaction costs

UTxO Tx size % max Mem % max CPU Min fee ₳
1 - - - -
2 - - - -
3 - - - -
5 - - - -
10 - - - -
54 $${\color{green}-1.00}$$ - - -

CollectCom transaction costs

Parties UTxO (bytes) Tx size % max Mem % max CPU Min fee ₳
1 - $${\color{green}-35.00}$$ $${\color{green}-0.75}$$ $${\color{green}-0.18}$$ $${\color{green}-0.01}$$
2 - $${\color{green}-35.00}$$ $${\color{green}-1.98}$$ $${\color{green}-0.47}$$ $${\color{green}-0.02}$$
3 - $${\color{green}-35.00}$$ +1.27 +0.31 +0.01
4 - $${\color{green}-35.00}$$ $${\color{green}-1.39}$$ $${\color{green}-0.33}$$ $${\color{green}-0.02}$$
5 - $${\color{green}-35.00}$$ +4.28 +1.03 +0.04
6 - $${\color{green}-35.00}$$ $${\color{green}-1.60}$$ $${\color{green}-0.38}$$ $${\color{green}-0.02}$$
7 - $${\color{green}-35.00}$$ $${\color{green}-1.39}$$ $${\color{green}-0.33}$$ $${\color{green}-0.02}$$
8 - $${\color{green}-35.00}$$ $${\color{green}-7.99}$$ $${\color{green}-1.91}$$ $${\color{green}-0.08}$$

Cost of Decrement Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 $${\color{green}-35.00}$$ - - -
2 $${\color{green}-35.00}$$ - - -
3 $${\color{green}-35.00}$$ - - -
5 $${\color{green}-35.00}$$ - - $${\color{green}-0.01}$$
10 $${\color{green}-35.00}$$ - - -
45 $${\color{green}-35.00}$$ - - -

Close transaction costs

Parties Tx size % max Mem % max CPU Min fee ₳
1 $${\color{green}-35.00}$$ - - -
2 $${\color{green}-35.00}$$ - - -
3 $${\color{green}-35.00}$$ - - -
5 $${\color{green}-35.00}$$ - - -
10 $${\color{green}-35.00}$$ - - -
43 $${\color{green}-35.00}$$ - - -

Contest transaction costs

Parties Tx size % max Mem % max CPU Min fee ₳
1 $${\color{green}-35.00}$$ - - $${\color{green}-0.01}$$
2 $${\color{green}-35.00}$$ - - $${\color{green}-0.01}$$
3 $${\color{green}-35.00}$$ - - $${\color{green}-0.01}$$
5 $${\color{green}-35.00}$$ - - -
10 $${\color{green}-35.00}$$ - - -
34 $${\color{green}-35.00}$$ - - -

Abort transaction costs

Parties Tx size % max Mem % max CPU Min fee ₳
1 $${\color{green}-35.00}$$ - - -
2 $${\color{green}-35.00}$$ - - $${\color{green}-0.01}$$
3 $${\color{green}-35.00}$$ +0.04 +0.01 -
4 $${\color{green}-35.00}$$ +0.04 +0.01 -
5 $${\color{green}-35.00}$$ $${\color{green}-0.44}$$ $${\color{green}-0.10}$$ $${\color{green}-0.01}$$
6 $${\color{green}-35.00}$$ $${\color{green}-0.06}$$ $${\color{green}-0.01}$$ $${\color{green}-0.01}$$
7 $${\color{green}-35.00}$$ +0.06 +0.02 -
8 $${\color{green}-35.00}$$ $${\color{green}-0.05}$$ $${\color{green}-0.01}$$ -
9 $${\color{green}-35.00}$$ $${\color{green}-0.17}$$ $${\color{green}-0.05}$$ $${\color{green}-0.01}$$
10 $${\color{green}-35.00}$$ +0.13 +0.03 -

FanOut transaction costs

Parties UTxO UTxO (bytes) Tx size % max Mem % max CPU Min fee ₳
10 - - $${\color{green}-35.00}$$ - - -
10 - - $${\color{green}-35.00}$$ - - -
10 - - $${\color{green}-35.00}$$ - - -
10 - - $${\color{green}-35.00}$$ - - -
10 - - $${\color{green}-35.00}$$ - - $${\color{green}-0.01}$$
10 - - $${\color{green}-35.00}$$ - - -
10 - - $${\color{green}-35.00}$$ - - -
10 - - $${\color{green}-35.00}$$ - - -

Copy link

github-actions bot commented Dec 8, 2024

Test Results

  5 files  ±0  162 suites  ±0   29m 48s ⏱️ - 3m 21s
555 tests ±0  548 ✅ ±0  7 💤 ±0  0 ❌ ±0 
557 runs  ±0  550 ✅ ±0  7 💤 ±0  0 ❌ ±0 

Results for commit 2b929b5. ± Comparison against base commit dd67f3d.

♻️ This comment has been updated with latest results.

@locallycompact locallycompact changed the title Replace emptyTxBody with defaultTxBodyContent from cardano-api Replace emptyTxBody with defaultTxBodyContent from cardano-api. Dec 8, 2024
@locallycompact locallycompact changed the title Replace emptyTxBody with defaultTxBodyContent from cardano-api. Reuse functions from Cardano.Api.Tx.Body and match nomenclature. Dec 8, 2024
@locallycompact locallycompact force-pushed the lc/defaultTxBodyContent branch from 57f83b0 to 2b929b5 Compare December 8, 2024 12:00
@locallycompact locallycompact requested a review from a team December 8, 2024 12:30
@locallycompact locallycompact force-pushed the lc/defaultTxBodyContent branch from 2b929b5 to 8e3aeaa Compare December 9, 2024 15:51
case txMintValue $ txBodyContent $ txBody tx of
TxMintValueNone -> error "expected minted value"
TxMintValue v _ -> fromList $ filter (not . isPT) $ toList v
case toList $ txMintValueToValue $ txMintValue $ txBodyContent $ txBody tx of
Copy link
Contributor

Choose a reason for hiding this comment

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

just a drive-by comment, but i think this was much clearer in the first version; what was the reason to change it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is it? It just dismisses the Nothing case.

But moreover, having played around with this a bit - I'd be tempted to do the mutations in terms of the cardano-api TxBodyContent type in general and use modTxMintValue.

@locallycompact locallycompact force-pushed the lc/defaultTxBodyContent branch from 8e3aeaa to 51e24d9 Compare December 9, 2024 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants