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

Calculate min utxo value #1176

Merged
merged 8 commits into from
Nov 23, 2023
Merged

Calculate min utxo value #1176

merged 8 commits into from
Nov 23, 2023

Conversation

ch1bo
Copy link
Collaborator

@ch1bo ch1bo commented Nov 22, 2023

  • Alternative to Bump hardcoded deposit of script outputs to 2.2 #1175

  • BREAKING changes initial script as it was checking for equality, but we have now non-constant ADA between spending and producing side of the commitTx, even if we commit nothing.

  • Updated the specification with to match this interpretation (unclear if $\supset$ or $>=$ is better used there?)

  • Some modifications to the healthy commit mutation case to simulate this situation.


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

@ch1bo ch1bo added this to the 0.14.0 milestone Nov 22, 2023
Copy link

github-actions bot commented Nov 22, 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-23 10:23:11.019038405 UTC
Max. memory units 14000000
Max. CPU units 10000000000
Max. tx size (kB) 16384

Script summary

Name Hash Size (Bytes)
νInitial 4868d5365af5120ae0b3c93b819d3452a3cbdcc98595da2a7ae765b5 4069
νCommit 171a1e6bdbc8aa96d957a65b3f505517386af06ba265e3f784741f67 2050
νHead e89b0c4a6155bac2434d1e500bd49c155b2b56744ccf5a0efa72a82e 9092
μHead 6849328242b5912ad218f134378e6baff11f3e74f7e36dcf8e13d53e* 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 4583 10.87 4.31 0.47
2 4787 13.23 5.22 0.51
3 4985 15.19 5.96 0.54
5 5388 19.85 7.74 0.60
10 6396 30.94 11.98 0.77
41 12626 99.66 38.20 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 532 12.22 4.81 0.31
2 724 15.93 6.48 0.36
3 912 19.77 8.20 0.41
5 1285 27.87 11.80 0.52
10 2223 50.58 21.69 0.81
18 3712 94.20 40.16 1.36

Cost of CollectCom Transaction

Parties UTxO (bytes) Tx size % max Mem % max CPU Min fee ₳
1 57 480 22.88 9.12 0.42
2 114 590 33.84 13.66 0.55
3 171 700 48.07 19.52 0.71
4 226 814 61.73 25.30 0.87
5 281 920 78.08 32.17 1.05
6 338 1031 97.97 40.49 1.28

Cost of Close Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 490 17.33 8.00 0.37
2 742 19.38 9.93 0.41
3 908 21.31 11.62 0.45
5 1309 24.77 14.87 0.52
10 2127 32.48 22.27 0.67
50 8827 94.82 82.24 1.90

Cost of Contest Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 565 21.33 9.69 0.42
2 789 23.23 11.41 0.45
3 831 24.18 12.33 0.47
5 1258 28.67 16.22 0.55
10 2189 38.04 24.53 0.73
44 8088 99.99 79.60 1.89

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 4534 20.18 8.78 0.58
2 4713 33.82 14.90 0.74
3 4799 44.83 19.63 0.87
4 5028 69.86 31.05 1.16
5 5230 93.44 41.55 1.43

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 4417 8.98 3.78 0.44
5 1 57 4452 10.28 4.57 0.46
5 5 285 4597 15.70 7.84 0.54
5 10 569 4776 22.18 11.81 0.62
5 20 1139 5135 35.02 19.70 0.80
5 30 1708 5496 48.14 27.70 0.98
5 40 2276 5855 61.12 35.65 1.16
5 50 2843 6211 74.11 43.60 1.34
5 69 3927 6897 98.80 58.72 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-23 10:15:39.912574073 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) 28.929706300
P99 233.61178194ms
P95 38.356440149999955ms
P50 21.62099ms
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) 5.215786493
P99 7.155019919999992ms
P95 6.471073700000001ms
P50 5.2095865ms
Number of Invalid txs 0

CHANGELOG.md Outdated Show resolved Hide resolved
hydra-cardano-api/hydra-cardano-api.cabal Show resolved Hide resolved
hydra-node/test/Hydra/Chain/Direct/WalletSpec.hs Outdated Show resolved Hide resolved
forAll arbitrary $ \txOut -> do
let txOutWithoutADA = txOut & coinTxOutL .~ mempty
let newTx = tx & bodyTxL . outputsTxBodyL <>~ StrictSeq.singleton txOutWithoutADA
case coverFee_ Fixture.pparams Fixture.systemStart Fixture.epochInfo lookupUTxO walletUTxO newTx of
Copy link
Contributor

Choose a reason for hiding this comment

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

With the Fixture. prefix, this looks cluttered, perhaps a good time to group those parameters together?

lockedValue == initialValue + committedValue
-- NOTE: Ada in initialValue is usually lower than in the locked ADA due
-- to higher deposit needed for commit output than for initial output
lockedValue `geq` (initialValue + committedValue)
Copy link
Contributor

Choose a reason for hiding this comment

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

I did not see a change to the Commit mutations exposing this, am I missing something?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The healthy case will fail with == now.

hydra-cardano-api/src/Hydra/Cardano/Api/TxOut.hs Outdated Show resolved Hide resolved
ch1bo and others added 8 commits November 23, 2023 11:11
Avoiding the hard-coded value reduces the locked funds to a minimum and
makes transaction creation functions more flexible.
Using the cardano-ledger-api we can easily modify the transaction
outputs to hold enough ADA to satisfy ledger rules.
This is needed as the locked ada might be lower on the spending side
than on the producing side due to min utxo value deposits.
This is crucial for most of the hydra protocol transactions as we
actively capture value in the outputs!
Co-authored-by: Arnaud Bailly <[email protected]>
Co-authored-by: Sasha Bogicevic <[email protected]>
Copy link

Test Results

369 tests  +1   364 ✔️ +1   21m 40s ⏱️ -19s
124 suites ±0       5 💤 ±0 
    5 files   ±0       0 ±0 

Results for commit 1b7e1f6. ± Comparison against base commit d411872.

This pull request removes 1 and adds 2 tests. Note that renamed tests count towards both.
Hydra.Chain.Direct.Wallet/newTinyWallet ‑ prefers largest utxo
Hydra.Chain.Direct.Wallet/coverFee ‑ prefers largest utxo
Hydra.Chain.Direct.Wallet/coverFee ‑ sets min utxo values

@ch1bo ch1bo merged commit 8f4aedc into master Nov 23, 2023
20 checks passed
@ch1bo ch1bo deleted the calculate-min-utxo-value branch November 23, 2023 11:05
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.

None yet

3 participants