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

Remove protocol parameters from hydra-cluster #1214

Merged
merged 3 commits into from
Dec 24, 2023

Conversation

v0d1ch
Copy link
Contributor

@v0d1ch v0d1ch commented Dec 13, 2023

fix #1124


  • 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 Dec 13, 2023
@v0d1ch v0d1ch force-pushed the remove-pparams-from-hydra-cluster branch from e502616 to 6818374 Compare December 13, 2023 16:42
Copy link

github-actions bot commented Dec 13, 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-12-24 19:12:37.691642072 UTC
Max. memory units 14000000
Max. CPU units 10000000000
Max. tx size (kB) 16384

Script summary

Name Hash Size (Bytes)
νInitial 985245919fcc6c0c5cd116023cd2c947c43e80dcbb5075fe12433fbb 4072
νCommit 7cb20fa71eb4c563ca283566ebe0aa65859d96c3f8cba35c52c181fd 2043
νHead 7a36661f5c15e9f1783aeaab890812c59b7286cbbc6de762d3110772 8816
μHead 8b111ac12274e46314769295a1c5dcab1d260096fc469fd698065463* 3851
  • 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 4374 10.35 3.99 0.46
2 4573 12.68 4.88 0.49
3 4777 14.79 5.67 0.52
5 5180 19.33 7.40 0.59
10 6185 30.41 11.60 0.75
41 12418 99.19 37.67 1.77

Cost of Commit Transaction

This is using ada-only outputs for better comparability.

UTxO Tx size % max Mem % max CPU Min fee ₳
1 534 11.37 4.44 0.30
2 723 15.04 6.07 0.35
3 912 18.85 7.75 0.40
5 1284 26.90 11.27 0.51
10 2220 49.55 20.97 0.80
19 3895 99.43 41.75 1.43

Cost of CollectCom Transaction

Parties UTxO (bytes) Tx size % max Mem % max CPU Min fee ₳
1 57 480 21.78 8.51 0.41
2 114 590 34.16 13.45 0.55
3 169 700 47.39 18.83 0.70
4 225 810 60.41 24.21 0.85
5 282 920 80.92 32.46 1.08

Cost of Close Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 490 16.27 7.34 0.36
2 758 18.45 9.33 0.40
3 836 19.44 10.37 0.42
5 1242 23.44 13.91 0.49
10 2179 32.30 22.14 0.67
50 8794 98.55 83.61 1.94

Cost of Contest Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 579 20.27 8.98 0.40
2 757 22.26 10.69 0.44
3 838 23.51 11.82 0.46
5 1310 28.20 15.80 0.55
10 2274 38.18 24.40 0.73
42 7651 98.48 76.35 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 4325 18.89 8.14 0.55
2 4499 32.05 13.97 0.71
3 4644 47.47 20.83 0.89
4 4716 60.00 26.19 1.03
5 5032 87.33 38.55 1.36

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 4206 8.26 3.46 0.43
5 1 57 4240 9.28 4.13 0.44
5 5 285 4375 14.19 7.18 0.51
5 10 568 4543 20.55 11.08 0.60
5 20 1140 4885 32.85 18.71 0.77
5 30 1707 5224 44.94 26.25 0.93
5 40 2281 5568 57.25 33.88 1.10
5 50 2845 5902 69.77 41.61 1.27
5 74 4211 6717 99.13 59.87 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-12-24 19:19:48.929435015 UTC

Baseline Scenario

Number of nodes 3
Number of txs 9000
Avg. Confirmation Time (ms) 24.847731472
P99 48.289765170000116ms
P95 33.676254199999995ms
P50 23.199424999999998ms
Number of Invalid txs 0

Baseline Scenario

Number of nodes 1
Number of txs 3000
Avg. Confirmation Time (ms) 5.818853599
P99 9.94927190999998ms
P95 8.060196649999996ms
P50 5.622903ms
Number of Invalid txs 0

Copy link
Contributor

@abailly-iohk abailly-iohk left a comment

Choose a reason for hiding this comment

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

I like this PR is removing some cruft from the code repository, and this highlights some further refactoring

hydra-cluster/src/CardanoNode.hs Show resolved Hide resolved
@@ -215,11 +214,12 @@ withHydraCluster ::
[SigningKey HydraKey] ->
-- | Transaction id at which Hydra scripts should have been published.
TxId ->
ProtocolParameters ->
Copy link
Contributor

Choose a reason for hiding this comment

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

This list of parameters is starting to get quite large and unwieldy, perhaps an opportunity for more refactoring later?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes definitely

@@ -236,10 +236,11 @@ withConfiguredHydraCluster ::
TxId ->
-- | Modifies the `ChainConfig` passed to a node upon startup
(Int -> ChainConfig -> ChainConfig) ->
ProtocolParameters ->
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

@@ -293,11 +295,12 @@ withHydraNode ::
[Int] ->
-- | Transaction id at which Hydra scripts should have been published.
TxId ->
ProtocolParameters ->
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

@v0d1ch v0d1ch force-pushed the remove-pparams-from-hydra-cluster branch from 6818374 to 8b2f44d Compare December 14, 2023 07:45
@ch1bo ch1bo force-pushed the remove-pparams-from-hydra-cluster branch from b6ab1d9 to 59b2d18 Compare December 14, 2023 10:38
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.

This is a good start and I think we should just avoid using ProtocolParameters again and use PParams right away.

cardano-cli query protocol-parameters --testnet-magic 42 | jq '.txFeeFixed = 0 |.txFeePerByte = 0 | .executionUnitPrices.priceMemory = 0 | .executionUnitPrices.priceSteps = 0' \
> protocol-parameters.json
```

Copy link
Collaborator

Choose a reason for hiding this comment

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

Should: instead of explaining this we could just pull those from the network in seed-devnet.sh?

This would keep the demo as streamlined as before.

I like this section though and we should merge it with / replace the one in the quickstart: https://hydra.family/head-protocol/docs/getting-started/quickstart/#ledger-parameters

hydra-cluster/src/CardanoNode.hs Show resolved Hide resolved
, networkId
, protocolParameters =
zeroPParams $
Api.fromLedgerPParams Api.ShelleyBasedEraBabbage pparams
Copy link
Collaborator

Choose a reason for hiding this comment

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

Must: not use ProtocolParameters here and just leave them as ledger PParams.

We know that this type will go away from the cardano-api or is just a wrapping of the ledger PParams anyway.

This will remove this zeroPParams and conversion. We can do this because the only thing we do in hydra-cluster with these parameters is to write them to disk anyhow.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea. GHC has problems finding the json instance no matter what I try 2d4309e#diff-2192a085c660665079395143368226091c3c14c9943ad234dcedafb32d69630cR85

putTextLn "Seeding network"
let hydraTracer = contramap FromHydraNode tracer
hydraScriptsTxId <- seedNetwork node dataset (contramap FromFaucet tracer)
let contestationPeriod = UnsafeContestationPeriod 10
withHydraCluster hydraTracer workDir nodeSocket startingNodeId cardanoKeys hydraKeys hydraScriptsTxId contestationPeriod $ \(leader :| followers) -> do
withHydraCluster hydraTracer workDir nodeSocket startingNodeId cardanoKeys hydraKeys hydraScriptsTxId protocolParameters contestationPeriod $ \(leader :| followers) -> do
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could: Change withHydraCluster to take a RunningNode

Copy link

github-actions bot commented Dec 14, 2023

Test Results

388 tests  ±0   383 ✅ ±0   22m 7s ⏱️ +45s
132 suites ±0     5 💤 ±0 
  5 files   ±0     0 ❌ ±0 

Results for commit ac73f6b. ± Comparison against base commit f5b1e4f.

This pull request removes 1 and adds 1 tests. Note that renamed tests count towards both.
Test.Ledger.Cardano.Configuration/ProtocolParameters ‑ can be read from JSON
Hydra.Ledger.Cardano/PParams ‑ Same PParams before/after JSON encoding

♻️ This comment has been updated with latest results.

@v0d1ch v0d1ch force-pushed the remove-pparams-from-hydra-cluster branch 3 times, most recently from 05605e0 to 60b5c76 Compare December 19, 2023 16:00
@v0d1ch v0d1ch force-pushed the remove-pparams-from-hydra-cluster branch 4 times, most recently from 10fdcb2 to c2358f1 Compare December 23, 2023 09:37
The actuall file is needed just for the hydra offline mode. In the
rest of the codebase we query the pparams from carano-node.
@v0d1ch v0d1ch force-pushed the remove-pparams-from-hydra-cluster branch from c2358f1 to 32676cd Compare December 24, 2023 17:04
@v0d1ch v0d1ch merged commit f15b322 into master Dec 24, 2023
21 checks passed
@v0d1ch v0d1ch deleted the remove-pparams-from-hydra-cluster branch December 24, 2023 19:31
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.

Remove hardcoded protocol parameters file from demo
3 participants