Skip to content

Deposit improvements - #2282

Merged
v0d1ch merged 12 commits into
masterfrom
deposit-works-with-reference-scripts
Oct 10, 2025
Merged

Deposit improvements#2282
v0d1ch merged 12 commits into
masterfrom
deposit-works-with-reference-scripts

Conversation

@v0d1ch

@v0d1ch v0d1ch commented Sep 25, 2025

Copy link
Copy Markdown
Contributor

fix #2281
Work in this PR started as a bug report from our user which mentions they had problems depositing a script UTxO as a reference input. I wanted to test this and in the process of writing a test I realized the deposit code and the interaction with internal hydra-wallet were not capable of enabling this, a bit advanced, use case.

The way blueprint tx works now has changed and it is described in the docs.

This approach gives us enough flexibility to accommodate for use cases where more complex transactions are involved and also I got to delete a LOT of complex code to wrangle assets and lovelace in the UTxO that we needed before to implement partial tokens feature.


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

@v0d1ch v0d1ch self-assigned this Sep 25, 2025
@github-actions

github-actions Bot commented Sep 25, 2025

Copy link
Copy Markdown

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-10-09 14:06:29.686557036 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 a1442faf26d4ec409e2f62a685c1d4893f8d6bcbaf7bcb59d6fa1340 14599
μHead fd173b993e12103cd734ca6710d364e17120a5eb37a224c64ab2b188* 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 5836 10.19 3.22 0.51
2 6035 12.67 4.01 0.55
3 6239 14.90 4.72 0.58
5 6638 18.64 5.88 0.64
10 7647 28.92 9.11 0.79
43 14279 99.16 31.00 1.80

Commit transaction costs

This uses ada-only outputs for better comparability.

UTxO Tx size % max Mem % max CPU Min fee ₳
1 559 2.44 1.16 0.20
2 738 3.38 1.73 0.22
3 923 4.36 2.33 0.24
5 1283 6.41 3.60 0.28
10 2170 12.13 7.25 0.40
54 10055 98.61 68.52 1.88

CollectCom transaction costs

Parties UTxO (bytes) Tx size % max Mem % max CPU Min fee ₳
1 56 524 25.20 7.30 0.43
2 114 636 34.27 9.87 0.53
3 169 747 43.71 12.54 0.63
4 227 858 53.89 15.37 0.73
5 283 974 59.19 17.01 0.79
6 338 1081 72.02 20.52 0.93
7 394 1192 80.49 22.94 1.02
8 449 1303 83.09 24.02 1.05

Cost of Increment Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 1793 24.37 7.71 0.48
2 1970 26.92 9.08 0.52
3 2055 26.86 9.75 0.53
5 2417 31.11 12.27 0.60
10 3202 42.32 18.73 0.77
39 7545 98.83 53.78 1.67

Cost of Decrement Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 624 22.84 7.38 0.42
2 771 24.08 8.42 0.44
3 875 25.09 9.31 0.46
5 1162 28.16 11.51 0.51
10 1942 37.96 17.58 0.67
42 6644 98.72 55.82 1.64

Close transaction costs

Parties Tx size % max Mem % max CPU Min fee ₳
1 704 27.54 8.47 0.46
2 865 29.90 9.82 0.50
3 961 30.86 10.73 0.52
5 1161 33.70 12.84 0.57
10 2037 47.97 20.21 0.77
37 6092 98.58 52.46 1.59

Contest transaction costs

Parties Tx size % max Mem % max CPU Min fee ₳
1 690 33.87 10.16 0.53
2 825 35.88 11.39 0.56
3 1023 38.63 12.83 0.60
5 1252 42.57 15.26 0.66
10 2047 54.58 21.97 0.84
29 4800 97.14 46.44 1.48

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 5827 27.08 9.08 0.69
2 5923 36.01 12.12 0.79
3 6110 45.04 15.15 0.89
4 6333 56.09 18.95 1.02
5 6376 63.82 21.50 1.10
6 6596 72.48 24.48 1.20
7 6757 84.42 28.49 1.34
8 6847 89.72 30.29 1.39

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 5834 19.63 6.56 0.61
10 1 57 5868 19.45 6.61 0.61
10 5 285 6004 29.35 10.43 0.73
10 10 570 6174 39.69 14.52 0.85
10 20 1137 6511 60.42 22.68 1.09
10 30 1711 6857 80.04 30.46 1.32
10 38 2163 7125 97.33 37.23 1.52

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-10-09 14:09:22.730576915 UTC

Baseline Scenario

Number of nodes 1
Number of txs 300
Avg. Confirmation Time (ms) 5.415010526
P99 9.664848279999992ms
P95 6.65408965ms
P50 5.150206000000001ms
Number of Invalid txs 0

Memory data

Time Used Free
2025-10-09 14:08:02.519782403 UTC 1157M 7097M
2025-10-09 14:08:03.519615774 UTC 1216M 7037M
2025-10-09 14:08:04.519781023 UTC 1281M 6945M
2025-10-09 14:08:05.519691172 UTC 1300M 6926M
2025-10-09 14:08:06.519623162 UTC 1299M 6922M
2025-10-09 14:08:07.519608406 UTC 1291M 6927M
2025-10-09 14:08:08.519624611 UTC 1268M 6950M
2025-10-09 14:08:09.519638161 UTC 1268M 6950M
2025-10-09 14:08:10.519620793 UTC 1268M 6950M
2025-10-09 14:08:11.51965883 UTC 1268M 6950M
2025-10-09 14:08:12.519629247 UTC 1271M 6946M
2025-10-09 14:08:13.519602303 UTC 1271M 6946M
2025-10-09 14:08:14.519623071 UTC 1271M 6946M
2025-10-09 14:08:15.519634888 UTC 1271M 6946M
2025-10-09 14:08:16.519609193 UTC 1271M 6946M
2025-10-09 14:08:17.519618824 UTC 1271M 6946M
2025-10-09 14:08:18.519618551 UTC 1271M 6946M
2025-10-09 14:08:19.519651471 UTC 1271M 6946M
2025-10-09 14:08:20.519628244 UTC 1271M 6946M
2025-10-09 14:08:21.519574894 UTC 1273M 6944M
2025-10-09 14:08:22.519592255 UTC 1275M 6942M
2025-10-09 14:08:23.519609349 UTC 1275M 6942M
2025-10-09 14:08:24.519616932 UTC 1275M 6942M
2025-10-09 14:08:25.519634905 UTC 1275M 6942M
2025-10-09 14:08:26.519623389 UTC 1275M 6942M
2025-10-09 14:08:27.519601085 UTC 1274M 6942M
2025-10-09 14:08:28.51958334 UTC 1275M 6942M
2025-10-09 14:08:29.519614285 UTC 1275M 6942M

Three local nodes

Number of nodes 3
Number of txs 900
Avg. Confirmation Time (ms) 42.500678645
P99 80.86607118ms
P95 64.83375414999996ms
P50 40.706797ms
Number of Invalid txs 0

Memory data

Time Used Free
2025-10-09 14:08:40.695422122 UTC 1189M 7065M
2025-10-09 14:08:41.695265517 UTC 1189M 7065M
2025-10-09 14:08:42.695209467 UTC 1205M 7048M
2025-10-09 14:08:43.695201316 UTC 1382M 6791M
2025-10-09 14:08:44.695244724 UTC 1405M 6768M
2025-10-09 14:08:45.695676917 UTC 1450M 6723M
2025-10-09 14:08:46.697480723 UTC 1473M 6694M
2025-10-09 14:08:47.695300892 UTC 1496M 6661M
2025-10-09 14:08:48.696349078 UTC 1507M 6638M
2025-10-09 14:08:49.696728325 UTC 1517M 6618M
2025-10-09 14:08:50.698816314 UTC 1519M 6607M
2025-10-09 14:08:51.695961793 UTC 1528M 6590M
2025-10-09 14:08:52.697213425 UTC 1542M 6570M
2025-10-09 14:08:53.695358111 UTC 1560M 6546M
2025-10-09 14:08:54.695812711 UTC 1559M 6542M
2025-10-09 14:08:55.695858462 UTC 1560M 6533M
2025-10-09 14:08:56.697600306 UTC 1565M 6521M
2025-10-09 14:08:57.695369039 UTC 1569M 6510M
2025-10-09 14:08:58.6952393 UTC 1589M 6481M
2025-10-09 14:08:59.695215505 UTC 1603M 6463M
2025-10-09 14:09:00.695188764 UTC 1603M 6463M
2025-10-09 14:09:01.695206141 UTC 1603M 6463M
2025-10-09 14:09:02.695221255 UTC 1604M 6461M
2025-10-09 14:09:03.695209625 UTC 1605M 6461M
2025-10-09 14:09:04.695188428 UTC 1604M 6461M
2025-10-09 14:09:05.695231059 UTC 1639M 6425M
2025-10-09 14:09:06.695171423 UTC 1635M 6429M
2025-10-09 14:09:07.695180253 UTC 1629M 6435M
2025-10-09 14:09:08.695213776 UTC 1629M 6436M
2025-10-09 14:09:09.695175591 UTC 1628M 6436M
2025-10-09 14:09:10.6951856 UTC 1628M 6436M
2025-10-09 14:09:11.695202243 UTC 1628M 6435M
2025-10-09 14:09:12.695212597 UTC 1628M 6435M
2025-10-09 14:09:13.695185053 UTC 1628M 6435M
2025-10-09 14:09:14.69520179 UTC 1631M 6432M
2025-10-09 14:09:15.695224473 UTC 1631M 6432M
2025-10-09 14:09:16.695243493 UTC 1631M 6432M
2025-10-09 14:09:17.695236038 UTC 1631M 6431M
2025-10-09 14:09:18.695244933 UTC 1631M 6431M
2025-10-09 14:09:19.695236725 UTC 1631M 6431M
2025-10-09 14:09:20.695192534 UTC 1632M 6430M
2025-10-09 14:09:21.695189049 UTC 1632M 6430M

@github-actions

Copy link
Copy Markdown

Transaction cost differences

No cost or size differences found

@v0d1ch
v0d1ch force-pushed the deposit-works-with-reference-scripts branch 4 times, most recently from 5e504cf to 61e4c5d Compare October 2, 2025 14:23
@v0d1ch
v0d1ch force-pushed the deposit-works-with-reference-scripts branch 3 times, most recently from 7d11ace to 3d63839 Compare October 6, 2025 14:25
@v0d1ch
v0d1ch requested a review from a team October 6, 2025 17:03
@v0d1ch
v0d1ch force-pushed the deposit-works-with-reference-scripts branch from ced18df to 7a04a83 Compare October 7, 2025 08:00
@v0d1ch v0d1ch changed the title Deposit works with reference scripts Deposit improvements Oct 8, 2025
@v0d1ch
v0d1ch force-pushed the deposit-works-with-reference-scripts branch 3 times, most recently from 16257c8 to 11352f4 Compare October 9, 2025 08:16
Comment thread CHANGELOG.md Outdated
Comment thread docs/docs/how-to/incremental-commit.md Outdated
Comment thread docs/docs/how-to/incremental-commit.md Outdated

@noonio noonio left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Very nice.

Just need to note that it is a breaking API change in the changelog.

v0d1ch added 9 commits October 9, 2025 15:38
I realized we could utilize blueprint tx outputs for the 
purpose of depositing in complex scenarios (like reference inputs,
script utxo). This brings in much flexibility and we get to delete 
a lot of code but the user experience will be much better and we reduced 
the amount of bugs we could produce.
We now resolve inputs of a deposit tx and make sure they 
are contained withing the UTxO we deposited. Ideally we would 
query the deposit address to find the expected deposit but we 
are not in IO in our observation code.
This field will be used to return any change from the deposit 
back to the user provided address.
Need to revisit this since it is not going through all values 
just naiively looks at outputs.
v0d1ch and others added 2 commits October 9, 2025 15:38
Remove unneeded imports/packages
Remove json type from non json code comment strings in the docs.

Signed-off-by: Sasha Bogicevic <sasha.bogicevic@iohk.io>
@v0d1ch
v0d1ch force-pushed the deposit-works-with-reference-scripts branch from 11352f4 to 875ee87 Compare October 9, 2025 13:38
Comment thread CHANGELOG.md Outdated
Comment thread CHANGELOG.md Outdated
Signed-off-by: Sasha Bogicevic <sasha.bogicevic@iohk.io>
@v0d1ch
v0d1ch enabled auto-merge October 10, 2025 07:49
@v0d1ch
v0d1ch merged commit dd520c1 into master Oct 10, 2025
23 checks passed
@v0d1ch
v0d1ch deleted the deposit-works-with-reference-scripts branch October 10, 2025 09:09
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.

Deposit using referenced script

3 participants