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

Import cardano-ledger-conway and add ToAlonzoScript typeclass #1339

Closed
wants to merge 1 commit into from

Conversation

locallycompact
Copy link
Contributor

@locallycompact locallycompact commented Mar 5, 2024

Adds ToAlonzoScript typeclass for Babbage and Conway.


  • 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/to-alonzo-script branch 3 times, most recently from 1913102 to 030cd7a Compare March 5, 2024 18:57
Copy link

github-actions bot commented Mar 5, 2024

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 2024-03-07 08:06:33.693177056 UTC
Max. memory units 14000000
Max. CPU units 10000000000
Max. tx size (kB) 16384

Script summary

Name Hash Size (Bytes)
νInitial bccf2a430c016bc960fbf31b02694011cd399d20da8882aac9d33611 4110
νCommit 56b0f0b597150e619c76bed60683f3b1e42d7bc0685ed951b882bfc5 1975
νHead 86bff95ba20e9d1d1b34899a56d86bbacc9fed999260b27dcc92d128 9351
μHead 88f533cf67cd0fc93d7d9ccf0a8b1d69ffd1208a825efbebbc1d36ba* 4213
  • 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 4792 8.89 3.40 0.46
2 4996 10.61 4.05 0.49
3 5196 12.76 4.89 0.52
5 5599 16.53 6.33 0.58
10 6605 26.12 10.01 0.72
47 14043 98.02 37.62 1.83

Cost of Commit Transaction

This is using ada-only outputs for better comparability.

UTxO Tx size % max Mem % max CPU Min fee ₳
1 591 10.24 4.04 0.29
2 783 13.88 5.64 0.34
3 972 17.66 7.29 0.39
5 1347 25.66 10.74 0.49
10 2274 48.19 20.30 0.79
19 3967 97.83 40.79 1.41

Cost of CollectCom Transaction

Parties UTxO (bytes) Tx size % max Mem % max CPU Min fee ₳
1 57 544 16.56 6.55 0.36
2 114 654 26.34 10.52 0.47
3 170 764 39.00 15.66 0.61
4 226 874 53.15 21.47 0.77
5 282 984 69.44 28.17 0.96
6 340 1095 83.36 34.11 1.12
7 394 1205 99.90 41.13 1.31

Cost of Close Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 613 8.34 4.63 0.28
2 745 9.00 5.67 0.30
3 915 10.11 7.05 0.32
5 1258 11.89 9.53 0.37
10 1342 14.15 7.75 0.38
50 8178 50.00 63.23 1.37

Cost of Contest Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 638 8.65 4.74 0.28
2 757 9.42 5.82 0.30
3 888 10.03 6.84 0.32
5 1237 11.85 9.32 0.37
10 2048 16.91 15.77 0.49
50 8135 52.08 64.07 1.39

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 4679 17.00 7.36 0.55
2 4733 24.68 10.60 0.63
3 4818 36.32 15.67 0.77
4 5136 59.41 26.17 1.04
5 5178 76.12 33.46 1.23
6 5338 96.04 42.28 1.47

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 4627 7.64 3.19 0.44
5 1 57 4661 9.00 3.99 0.46
5 5 285 4798 13.82 6.93 0.52
5 10 569 4966 19.58 10.49 0.60
5 20 1138 5305 30.90 17.53 0.76
5 30 1707 5646 42.43 24.67 0.92
5 40 2276 5985 53.96 31.81 1.08
5 50 2849 6328 65.71 39.04 1.24
5 79 4499 7311 98.79 59.60 1.70

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 2024-03-07 08:08:45.03131775 UTC

Baseline Scenario

Number of nodes 3
Number of txs 9000
Avg. Confirmation Time (ms) 20.679459677
P99 49.22143266000008ms
P95 29.580960599999994ms
P50 18.446346ms
Number of Invalid txs 0

Baseline Scenario

Number of nodes 1
Number of txs 3000
Avg. Confirmation Time (ms) 3.484240407
P99 4.385678489999995ms
P95 3.91969385ms
P50 3.4363859999999997ms
Number of Invalid txs 0

Copy link

github-actions bot commented Mar 5, 2024

Test Results

418 tests  ±0   410 ✅ ±0   14m 57s ⏱️ + 1m 9s
139 suites ±0     8 💤 ±0 
  5 files   ±0     0 ❌ ±0 

Results for commit 0ab20a1. ± Comparison against base commit 7bfd3c5.

♻️ This comment has been updated with latest results.

Copy link
Collaborator

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

Nice solution. An observation I made: We actually only do convert PlutusScriptV2 scripts and we could also constrain the era to AlonzoEraScript to make the implementation possible for a variable era (but maybe partial still). Using a type class, however, is a lot less "fancy haskell" and I like the elegance of it.

class ToAlonzoScript lang era where
toLedgerScript ::
IsPlutusScriptLanguage lang =>
PlutusScript lang ->
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are these constraints needed?

@ch1bo
Copy link
Collaborator

ch1bo commented Mar 8, 2024

What happened?

@locallycompact
Copy link
Contributor Author

locallycompact commented Mar 8, 2024

We merged #1342

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