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

Support the withdraw zero trick #1909

Merged
merged 10 commits into from
Apr 2, 2025
Merged

Support the withdraw zero trick #1909

merged 10 commits into from
Apr 2, 2025

Conversation

ch1bo
Copy link
Member

@ch1bo ch1bo commented Mar 20, 2025

Closes #1795

We can mock the ledger's certificate state with reward accounts for all withdrawals with 0 value in a transaction. This will allow included scripts with Rewarding script purpose to run once for the transaction.

The idea of mocking the certificate state emerged in a discussion with @colll78.

We can remove this once CIP-112 is implemented in the cardano-ledger.


  • CHANGELOG updated
  • Documentation updated -> new How-to
  • Haddocks updated
  • No new TODOs introduced

@ch1bo ch1bo self-assigned this Mar 20, 2025
Copy link

github-actions bot commented Mar 20, 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 - - - -
40 - - - -

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

Cost of Increment Transaction

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

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

Contest transaction costs

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

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

Copy link

github-actions bot commented Mar 21, 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-04-02 12:25:44.450971537 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 0e35115a2c7c13c68ecd8d74e4987c04d4539e337643be20bb3274bd 14756
μHead 57166715eadb8d3135964325c016eea546c21e1c0aae974ca67df9a5* 5541
ν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 6093 10.80 3.35 0.53
2 6298 13.26 4.11 0.56
3 6495 15.71 4.88 0.60
5 6902 20.16 6.24 0.66
10 7904 31.40 9.68 0.82
40 13936 98.36 30.21 1.78

Commit transaction costs

This uses ada-only outputs for better comparability.

UTxO Tx size % max Mem % max CPU Min fee ₳
1 563 2.44 1.16 0.20
2 740 3.38 1.73 0.22
3 916 4.36 2.33 0.24
5 1279 6.41 3.60 0.28
10 2176 12.13 7.25 0.40
54 10065 98.61 68.52 1.88

CollectCom transaction costs

Parties UTxO (bytes) Tx size % max Mem % max CPU Min fee ₳
1 57 525 26.44 7.58 0.44
2 114 636 34.89 9.98 0.53
3 170 747 45.59 12.92 0.64
4 227 858 51.82 14.82 0.71
5 283 969 61.97 17.60 0.82
6 338 1081 75.13 21.17 0.96
7 396 1192 82.21 23.25 1.03
8 448 1303 94.36 26.65 1.16

Cost of Increment Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 1748 24.02 7.84 0.48
2 1933 26.61 9.37 0.52
3 2139 29.66 11.04 0.56
5 2455 33.52 13.66 0.63
10 3094 41.88 19.55 0.77
38 7348 97.87 56.39 1.67

Cost of Decrement Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 610 23.99 7.61 0.43
2 821 26.46 8.97 0.46
3 865 27.22 9.83 0.48
5 1242 32.91 12.73 0.56
10 1829 38.66 17.63 0.67
39 6270 98.51 53.45 1.61

Close transaction costs

Parties Tx size % max Mem % max CPU Min fee ₳
1 681 29.19 9.21 0.48
2 810 32.81 10.92 0.53
3 982 35.44 12.48 0.57
5 1290 37.22 14.44 0.61
10 1991 50.34 21.86 0.80
35 5716 99.11 54.39 1.59

Contest transaction costs

Parties Tx size % max Mem % max CPU Min fee ₳
1 629 35.29 10.70 0.54
2 823 38.19 12.34 0.58
3 960 40.32 13.64 0.62
5 1207 44.59 16.24 0.68
10 2073 58.02 24.01 0.88
27 4495 98.00 47.66 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 5972 28.33 9.33 0.71
2 6116 37.52 12.36 0.81
3 6310 47.80 15.80 0.93
4 6389 57.34 18.92 1.03
5 6356 60.17 19.75 1.06
6 6593 72.08 23.76 1.19
7 6641 78.64 25.80 1.26
8 6913 96.19 31.80 1.46

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 6092 19.20 6.31 0.62
10 10 569 6430 40.04 14.41 0.86
10 20 1138 6769 62.72 23.14 1.12
10 30 1709 7113 84.03 31.40 1.37
10 36 2050 7315 97.27 36.52 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-04-02 12:28:52.506188688 UTC

Baseline Scenario

Number of nodes 1
Number of txs 300
Avg. Confirmation Time (ms) 4.698691970
P99 11.233135149999995ms
P95 5.25166115ms
P50 4.2302990000000005ms
Number of Invalid txs 0

Memory data

Time Used Free
2025-04-02 12:27:36.928182985 UTC 925M 6240M
2025-04-02 12:27:41.927942659 UTC 1039M 6095M
2025-04-02 12:27:46.928023189 UTC 1040M 6094M
2025-04-02 12:27:51.927929422 UTC 1036M 6097M
2025-04-02 12:27:56.927894249 UTC 1036M 6097M
2025-04-02 12:28:01.927917248 UTC 1037M 6095M

Three local nodes

Number of nodes 3
Number of txs 900
Avg. Confirmation Time (ms) 28.716562657
P99 41.735164539999985ms
P95 38.37488275ms
P50 27.630542ms
Number of Invalid txs 0

Memory data

Time Used Free
2025-04-02 12:28:15.502637402 UTC 958M 6184M
2025-04-02 12:28:20.504687964 UTC 1214M 5924M
2025-04-02 12:28:25.503844147 UTC 1266M 5808M
2025-04-02 12:28:30.502693712 UTC 1272M 5758M
2025-04-02 12:28:35.502728172 UTC 1277M 5753M
2025-04-02 12:28:40.502882716 UTC 1278M 5752M
2025-04-02 12:28:45.502696098 UTC 1277M 5752M
2025-04-02 12:28:50.502981607 UTC 1278M 5750M

@ch1bo ch1bo force-pushed the withdraw-zero branch 6 times, most recently from 1b26a94 to 57cdb38 Compare March 25, 2025 12:10
@ch1bo ch1bo marked this pull request as ready for review March 25, 2025 12:23
@ch1bo ch1bo requested review from noonio and a team March 28, 2025 19:48
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.

Looks great; happy to merge with some minor changes to the docs.

Thanks!

ch1bo added 8 commits April 2, 2025 14:21
We can mock the ledger's certificate state with reward accounts for all
withdrawals with 0 value in a transaction. This will allow included
scripts with Rewarding script purpose to run once for the transaction.

We can remove this once CIP-112 is implemented in the cardano-ledger.
This proves that the withdraw zero implementation works, but a dedicated
script and test suite is needed before merging this.
The one we had was severely outdated. This is the one from preview
testnet with fees and prices set to 0
The dummy validator we use must also be able to certify if we want to
demonstrate the (not needed!) registration step.
@ch1bo ch1bo requested a review from noonio April 2, 2025 12:23
@ch1bo ch1bo merged commit 3f136bd into master Apr 2, 2025
20 checks passed
@ch1bo ch1bo deleted the withdraw-zero branch April 2, 2025 12:58
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.

Support Withdraw 0 trick in L2 ledger
3 participants