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

Fix /protocol-parameters JSON response #1241

Merged
merged 11 commits into from
Jan 10, 2024
Merged

Conversation

ch1bo
Copy link
Collaborator

@ch1bo ch1bo commented Jan 9, 2024

  • Fixes a regression where usage of the ledger PParams would change the schema available on /protocol-parameters endpoing.

  • Adds "our" JSON schema for ProtocolParameters as the one from https://github.com/CardanoSolutions/cardanonical (currently) does not match

  • Add tests for schema conformance of /protocol-parameters

  • Add test of schema conformance of cardano-cli query protocol-parameters

  • Move JSONSchema utility into new public sub-library of hydra-node to re-use it everywhere and.

  • Creates a new validateJSON utility function in JSONSchema module to do directed schema tests. See the hydra-cluster changes, which would produce with an intentionally wrong schema:

image


  • CHANGELOG updated or not needed
  • Documentation updated or not needed
  • Haddocks updated or not needed
  • No new TODOs introduced or explained herafter
    • Kept several notes where cardanonical ProtocolParamters is different from our definition right now.

@ch1bo ch1bo requested review from a team and KtorZ January 9, 2024 09:55
Copy link

github-actions bot commented Jan 9, 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-01-09 17:09:02.660157422 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 4379 10.35 3.99 0.46
2 4576 12.72 4.90 0.49
3 4777 14.89 5.72 0.52
5 5183 19.37 7.42 0.59
10 6182 30.20 11.51 0.75
41 12418 99.34 37.73 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 531 11.37 4.44 0.30
2 724 15.04 6.07 0.35
3 912 18.85 7.75 0.40
5 1282 26.90 11.27 0.51
10 2223 49.55 20.97 0.80
19 3914 99.43 41.75 1.43

Cost of CollectCom Transaction

Parties UTxO (bytes) Tx size % max Mem % max CPU Min fee ₳
1 57 484 21.78 8.51 0.41
2 113 590 34.07 13.41 0.55
3 170 704 44.86 17.90 0.67
4 226 810 61.64 24.66 0.86
5 282 920 74.55 30.14 1.01

Cost of Close Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 552 16.68 7.69 0.36
2 726 18.45 9.30 0.40
3 891 20.22 10.92 0.43
5 1220 23.18 13.79 0.49
10 2233 32.73 22.43 0.67
50 5657 84.64 44.06 1.40

Cost of Contest Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 574 20.27 8.98 0.40
2 741 22.26 10.67 0.44
3 926 24.28 12.39 0.48
5 1340 28.24 15.84 0.55
10 2152 37.86 24.04 0.72
43 8015 99.68 78.05 1.87

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 4323 19.02 8.19 0.55
2 4488 31.96 13.93 0.71
3 4575 42.38 18.36 0.83
4 4829 66.69 29.33 1.11
5 5023 87.10 38.46 1.35

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 4205 8.05 3.37 0.42
5 1 57 4239 9.07 4.04 0.44
5 5 285 4375 14.19 7.18 0.51
5 10 568 4543 20.34 10.99 0.59
5 20 1136 4882 32.72 18.65 0.76
5 30 1704 5222 45.15 26.34 0.93
5 40 2279 5567 57.04 33.79 1.10
5 50 2845 5902 69.77 41.61 1.27
5 74 4209 6714 99.22 59.90 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 2024-01-09 17:13:02.039092048 UTC

Baseline Scenario

Number of nodes 3
Number of txs 9000
Avg. Confirmation Time (ms) 22.970190852
P99 103.30065386000021ms
P95 31.835910799999994ms
P50 20.354036999999998ms
Number of Invalid txs 0

Baseline Scenario

Number of nodes 1
Number of txs 3000
Avg. Confirmation Time (ms) 4.524280661
P99 9.437391979999989ms
P95 6.254591949999999ms
P50 4.244736ms
Number of Invalid txs 0

@ch1bo ch1bo force-pushed the ch1bo/fix-protocol-parameters-api branch from 12069b5 to b0fbf51 Compare January 9, 2024 14:35
Copy link

github-actions bot commented Jan 9, 2024

Test Results

401 tests  +8   394 ✅ +9   17m 16s ⏱️ - 1m 53s
134 suites +2     7 💤  - 1 
  5 files   ±0     0 ❌ ±0 

Results for commit 9c13146. ± Comparison against base commit 3c8f217.

This pull request removes 1 and adds 9 tests. Note that renamed tests count towards both.
Hydra.API.HTTPServer/API should respond correctly ‑ GET /protocol-parameters works
Hydra.API.HTTPServer/API should respond correctly/GET /protocol-parameters ‑ matches schema
Hydra.API.HTTPServer/API should respond correctly/GET /protocol-parameters ‑ responds given parameters
Hydra.JSONSchema/prop_validateJSONSchema ‑ works with api.yaml and UTCTime
Hydra.JSONSchema/validateJSON withJsonSpecifications ‑ fails on non-existing schema file
Hydra.JSONSchema/validateJSON withJsonSpecifications ‑ fails with missing tool
Hydra.JSONSchema/validateJSON withJsonSpecifications ‑ produces helpful errors
Hydra.JSONSchema/validateJSON withJsonSpecifications ‑ resolves refs
Hydra.JSONSchema/validateJSON withJsonSpecifications ‑ selects a sub-schema correctly
Hydra.JSONSchema/validateJSON withJsonSpecifications ‑ works using identity selector and Null input

♻️ This comment has been updated with latest results.

Draft a test which checks the schema of the /protocol-parameters
endpoint response using a re-usable validateJSON function. The function
signature is kept similar to [openapi3](https://hackage.haskell.org/package/openapi3-3.2.4/docs/Data-OpenApi-Schema-Validation.html#v:validateJSON)
to allow migration to an openapi 'Schema' later.
We need to copy the schema files correctly into the temporary working
directory of validateJSON.
This is the one implemented by cardano-cli and the same format the
hydra-node expects on the command line.
This matches now what we also accept on the command line and what the
cardano-cli is giving us.
This allows us to re-use this functionality from hydra-cluster tests,
while still using package-specific functionality from
hydra-node (accessing schema files) and avoids moving this into the
production code base.
This test suite is now also running check-jsonschema and hence needs
this binary available.
@ch1bo ch1bo force-pushed the ch1bo/fix-protocol-parameters-api branch from 1498149 to b2061f0 Compare January 9, 2024 17:05
@ch1bo ch1bo force-pushed the ch1bo/fix-protocol-parameters-api branch from b2061f0 to 9c13146 Compare January 9, 2024 17:06
Copy link
Contributor

@ffakenz ffakenz left a comment

Choose a reason for hiding this comment

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

great one! 👏

@ch1bo ch1bo merged commit 4f5f841 into master Jan 10, 2024
21 checks passed
@ch1bo ch1bo deleted the ch1bo/fix-protocol-parameters-api branch January 10, 2024 09:28
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.

/protocol-parameters inconsistent with json schema and --ledger-protocol-parameters
2 participants