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

Protocol change: Inline datums #1162

Merged
merged 19 commits into from
Nov 16, 2023
Merged

Protocol change: Inline datums #1162

merged 19 commits into from
Nov 16, 2023

Conversation

ch1bo
Copy link
Member

@ch1bo ch1bo commented Nov 14, 2023

🍠 Switch the Hydra Head protocol to rely on inline datums. Before there was already the convention that Hydra transactions would include the datum in the tx producing some output.

🍠 This removed some lookup cases from the validators and prompted some refinement in the mutation tests (we were failing for a semi-wrong reason in one)

🍠 The tx creation could requires much less information about the UTxO now. In fact, all of the script data kept around can get rid of.

🍠 Transaction sizes became smaller as we only need to put the datum in the producing transaction, not the consuming one. Most transactions in our tx-cost benchmark are ~200 bytes smaller, the abortTx however became about 100 bytes bigger.. per participant 🐼

🍠 Cleaned up unused error codes (as this is already a breaking change in scripts).


  • CHANGELOG updated or not needed
  • Documentation updated or not needed
  • Haddocks updated or not needed
  • No new TODOs introduced or explained herafter
    • One TODO about improving error handling. The error ("SNAFU") was there before and we will be tackling the tx creation in this area soon anyways.

Copy link

github-actions bot commented Nov 14, 2023

Transactions 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 2023-11-15 16:09:59.667296731 UTC
Max. memory units 14000000
Max. CPU units 10000000000
Max. tx size (kB) 16384

Script summary

Name Hash Size (Bytes)
νInitial 57dd0a3aba3f4477afed74e7d12b6e86d7abad22ee51612ff81b4194 4059
νCommit 171a1e6bdbc8aa96d957a65b3f505517386af06ba265e3f784741f67 2050
νHead 785fb7d2e0637dab5de29ae5dff02769d92ab381810010fcec3dfc9e 9116
μHead 173a04061fe85f5115e4b2c6f26633eb43c4ed55b9ee1ca45b419a4e* 4062
  • The minting policy hash is only usable for comparison. As the script is parameterized, the actual script is unique per Head.

Cost of Init Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 4594 11.13 4.42 0.47
2 4802 12.97 5.11 0.50
3 5007 15.29 6.00 0.54
5 5415 19.62 7.65 0.60
10 6440 30.99 12.00 0.77
41 12796 99.61 38.18 1.79

Cost of Commit Transaction

This is using ada-only outputs for better comparability.

UTxO Tx size % max Mem % max CPU Min fee ₳
1 537 12.23 4.81 0.31
2 720 15.93 6.48 0.36
3 911 19.77 8.20 0.41
5 1286 27.87 11.80 0.52
10 2222 50.58 21.69 0.81
18 3722 94.20 40.16 1.36

Cost of CollectCom Transaction

Parties UTxO (bytes) Tx size % max Mem % max CPU Min fee ₳
1 57 483 22.91 9.13 0.42
2 114 593 33.91 13.69 0.55
3 171 703 49.21 19.94 0.72
4 226 813 63.50 25.95 0.89
5 281 927 84.49 34.54 1.12
6 339 1034 99.40 41.00 1.29

Cost of Close Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 560 17.74 8.35 0.38
2 580 17.57 7.83 0.37
3 896 21.30 11.60 0.45
5 1282 24.45 14.74 0.51
10 2047 32.43 22.25 0.66
50 8661 93.71 81.74 1.88

Cost of Contest Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 576 21.32 9.70 0.42
2 797 23.30 11.45 0.46
3 977 25.19 13.13 0.49
5 1276 28.70 16.26 0.56
10 2178 37.94 24.48 0.73
44 7875 95.91 76.99 1.83

Cost of Abort Transaction

Some variation because of random mixture of still initial and already committed outputs.

Parties Tx size % max Mem % max CPU Min fee ₳
1 4520 20.24 8.79 0.58
2 4687 33.81 14.87 0.74
3 4904 50.25 22.28 0.93
4 5029 71.03 31.48 1.17
5 5112 85.82 37.93 1.34

Cost of FanOut Transaction

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 ₳
5 0 0 4416 8.69 3.67 0.44
5 1 57 4452 9.99 4.47 0.46
5 5 285 4596 15.17 7.64 0.53
5 10 567 4773 21.66 11.61 0.62
5 20 1136 5132 34.63 19.55 0.80
5 30 1706 5495 47.61 27.50 0.97
5 40 2278 5856 60.60 35.45 1.15
5 50 2847 6215 73.22 43.25 1.33
5 70 3983 6931 99.35 59.22 1.68

End-To-End Benchmark Results

This page is intended to collect the latest end-to-end benchmarks results produced by Hydra's Continuous Integration system from the latest master code.

Please take those results with a grain of salt as they are currently produced from very limited cloud VMs and not controlled hardware. Instead of focusing on the absolute results, the emphasis should be on relative results, eg. how the timings for a scenario evolve as the code changes.

Generated at 2023-11-15 16:02:30.912597058 UTC

3-nodes Scenario

A rather typical setup, with 3 nodes forming a Hydra head.

Number of nodes 3
Number of txs 900
Avg. Confirmation Time (ms) 22.962794273
P99 112.64089200999999ms
P95 31.957266749999995ms
P50 20.591295000000002ms
Number of Invalid txs 0

Baseline Scenario

This scenario represents a minimal case and as such is a good baseline against which to assess the overhead introduced by more complex setups. There is a single hydra-node d with a single client submitting single input and single output transactions with a constant UTxO set of 1.

Number of nodes 1
Number of txs 300
Avg. Confirmation Time (ms) 4.863570780
P99 7.155805419999997ms
P95 5.868994650000001ms
P50 4.758946ms
Number of Invalid txs 0

@ch1bo ch1bo self-assigned this Nov 15, 2023
@ch1bo ch1bo mentioned this pull request Nov 15, 2023
3 tasks
Copy link

github-actions bot commented Nov 15, 2023

Test Results

367 tests  ±0   362 ✔️ ±0   21m 11s ⏱️ +58s
124 suites ±0       5 💤 ±0 
    5 files   ±0       0 ±0 

Results for commit a4f9758. ± Comparison against base commit ac19103.

♻️ This comment has been updated with latest results.

@ch1bo ch1bo force-pushed the inline-datums branch 3 times, most recently from 5465dd0 to 7e1bf01 Compare November 15, 2023 07:55
@ch1bo ch1bo removed their assignment Nov 15, 2023
Before we supported both, datums in txs and inline datums.
This was working before because the ledger would resolve in-tx datums
for the plutus evaluator. While phase-2 valid, the transactions
themselves would not be compatible with the way we construct / observe
transactions in the hydra-node.
The tracked utxos do not contain datums anymore
@ch1bo ch1bo merged commit 704b67c into master Nov 16, 2023
20 of 23 checks passed
@ch1bo ch1bo deleted the inline-datums branch November 16, 2023 07:39
@ch1bo ch1bo added this to the 0.14.0 milestone Nov 17, 2023
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.

3 participants