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

HTTP chain observer #1815

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open

HTTP chain observer #1815

wants to merge 17 commits into from

Conversation

ch1bo
Copy link
Member

@ch1bo ch1bo commented Jan 31, 2025

Extends hydra-chain-observer to submit observations to a hydra-explorer instance with the new observer API.

See https://github.com/cardano-scaling/hydra-explorer/blob/observer-backend/README.md#architecture for an architectural overview.

  • 🔍 Adds --explorer option to hydra-chain-observer which submits observations using HTTP. This uses the OnChainTx type, so there are new roundtrip tests and golden files.

  • 🔍 Make hydra-chain-observer aware of its --version (also via embedding git revs using nix).

  • 🔍 Switch on --node-socket or --blockfrost-project-path in hydra-chain-observer instead of subcommands. This allows us to re-use more code and the help text becomes easier to understand. See hydra-chain-observer/README.md for how to invoke the binary now.

  • 🔍 Extracts a common.yaml from API definitions so we can reference it from hydra-explorer API specs / schemas

  • 🔍 Moves observation code from hydra-node to hydra-tx, this improves dependency closure for hydra-explorer, especially once we move Hydra.Chain out of hydra-node (e.g. by inverting the dependency of hydra-chain-observer?)

    • This requires
  • Adds orphan instances to hydra-cardano-api as needed by the hydra-explorer, see Observer API backend hydra-explorer#18

TODO:

  • Client-side serialization tests against observer openapi

  • CHANGELOG updated
  • Documentation updated (README, no user guide)
  • Haddocks updated
  • New TODOs explained herafter

Copy link

github-actions bot commented Jan 31, 2025

Transaction cost differences

Script summary

Name Size (Bytes)
νInitial -
νCommit -
νHead -
μHead -
νDeposit -

Init transaction costs

Parties Tx size % max Mem % max CPU Min fee ₳
1 - - - -
2 - - - -
3 - - - -
5 - - - -
10 - - - -
44 - - - -

Commit transaction costs

UTxO Tx size % max Mem % max CPU Min fee ₳
1 - - - -
2 - - - -
3 - - - -
5 - - - -
10 - - - -
54 - - - -

CollectCom transaction costs

Parties UTxO (bytes) Tx size % max Mem % max CPU Min fee ₳
1 - - - - -
2 - - - - -
3 - - - - -
4 - - - - -
5 - - - - -
6 - - - - -
7 - - - - -
8 - - - - -
9 - - - - -
10 - - - - -

Cost of Increment Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 - - - -
2 - - - -
3 - +0.38 +0.09 -
5 - $${\color{green}-0.39}$$ $${\color{green}-0.09}$$ -
10 - +0.38 +0.1 -
43 - - - -

Cost of Decrement Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 - - - -
2 - - - -
3 - - - -
5 - - - -
10 - - - -
45 - - - -

Close transaction costs

Parties Tx size % max Mem % max CPU Min fee ₳
1 - - - -
2 - - - -
3 - - - -
5 - - - -
10 - - - -
41 - - - -

Contest transaction costs

Parties Tx size % max Mem % max CPU Min fee ₳
1 - - - -
2 - - - -
3 - - - -
5 - - - -
10 - - - -
33 - - - -

FanOut transaction costs

UTxO, Parties UTxO (bytes) Tx size % max Mem % max CPU Min fee ₳
(0, 10) - - - - -
(1, 10) - - - - -
(5, 10) - - - - -
(10, 10) - - - - -
(20, 10) - - - - -
(40, 10) - - - - -
(41, 10) - - - - -

Copy link

github-actions bot commented Jan 31, 2025

Transaction 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 2025-01-31 23:25:07.694218213 UTC
Max. memory units 14000000
Max. CPU units 10000000000
Max. tx size (kB) 16384

Script summary

Name Hash Size (Bytes)
νInitial c8a101a5c8ac4816b0dceb59ce31fc2258e387de828f02961d2f2045 2652
νCommit 61458bc2f297fff3cc5df6ac7ab57cefd87763b0b7bd722146a1035c 685
νHead 5350e9d521552ebfd9e846fd70c3b801f716fc14296134ec0fb71e97 14492
μHead 6b49dc4e571207d615dba01996548cb610b0caa85c30423d169d0091* 5612
νDeposit ae01dade3a9c346d5c93ae3ce339412b90a0b8f83f94ec6baa24e30c 1102
  • The minting policy hash is only usable for comparison. As the script is parameterized, the actual script is unique per head.

Init transaction costs

Parties Tx size % max Mem % max CPU Min fee ₳
1 6162 10.17 3.24 0.53
2 6366 12.04 3.82 0.56
3 6567 14.57 4.64 0.59
5 6969 18.74 5.96 0.65
10 7974 28.50 8.99 0.80
44 14811 98.38 30.98 1.82

Commit transaction costs

This uses ada-only outputs for better comparability.

UTxO Tx size % max Mem % max CPU Min fee ₳
1 561 2.44 1.16 0.20
2 738 3.38 1.73 0.22
3 923 4.36 2.33 0.24
5 1277 6.41 3.60 0.28
10 2176 12.13 7.25 0.40
54 10045 98.61 68.52 1.88

CollectCom transaction costs

Parties UTxO (bytes) Tx size % max Mem % max CPU Min fee ₳
1 57 525 24.20 7.07 0.42
2 114 640 32.00 9.33 0.50
3 170 747 42.14 12.15 0.61
4 227 858 51.93 14.87 0.71
5 281 969 56.79 16.41 0.77
6 340 1081 67.52 19.44 0.88
7 394 1192 76.78 22.16 0.98
8 450 1303 87.23 25.07 1.09

Cost of Increment Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 1799 24.13 8.02 0.48
2 1886 24.21 8.68 0.49
3 2060 26.64 10.19 0.53
5 2417 32.03 13.32 0.61
10 3157 40.93 19.63 0.76
42 7904 96.11 59.35 1.70

Cost of Decrement Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 625 22.72 7.33 0.41
2 763 23.93 8.35 0.44
3 898 25.66 9.49 0.47
5 1213 29.50 11.90 0.53
10 1931 38.05 17.61 0.67
42 6777 98.36 55.87 1.65

Close transaction costs

Parties Tx size % max Mem % max CPU Min fee ₳
1 691 27.03 8.73 0.46
2 818 28.68 9.92 0.49
3 991 32.67 11.86 0.54
5 1218 36.00 14.23 0.60
10 1917 45.17 20.52 0.75
41 6517 99.00 59.25 1.66

Contest transaction costs

Parties Tx size % max Mem % max CPU Min fee ₳
1 683 33.35 10.42 0.52
2 829 35.33 11.70 0.56
3 941 37.29 12.96 0.59
5 1325 42.38 16.07 0.67
10 1958 52.12 22.38 0.82
31 5229 98.19 51.59 1.55

Abort transaction costs

There is some variation due to the random mixture of initial and already committed outputs.

Parties Tx size % max Mem % max CPU Min fee ₳
1 6078 26.08 8.83 0.69
2 6168 34.73 11.74 0.79
3 6232 42.42 14.28 0.87
4 6422 52.01 17.55 0.98
5 6522 61.06 20.55 1.08
6 6775 71.50 24.26 1.20
7 6673 72.14 24.32 1.20
8 6837 84.92 28.61 1.34
9 6993 92.03 31.10 1.43

FanOut transaction costs

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 ₳
10 0 0 6163 17.66 6.02 0.61
10 1 57 6196 20.15 7.00 0.64
10 5 284 6332 27.82 10.09 0.73
10 40 2280 7525 97.12 37.93 1.54
10 42 2390 7588 99.94 39.10 1.57

End-to-end benchmark results

This page is intended to collect the latest end-to-end benchmark results produced by Hydra's continuous integration (CI) system from the latest master code.

Please note that these results are approximate as they are currently produced from limited cloud VMs and not controlled hardware. Rather than focusing on the absolute results, the emphasis should be on relative results, such as how the timings for a scenario evolve as the code changes.

Generated at 2025-01-31 23:28:07.652836981 UTC

Baseline Scenario

Number of nodes 1
Number of txs 300
Avg. Confirmation Time (ms) 4.395575290
P99 9.001001309999994ms
P95 5.614212500000006ms
P50 4.1872195ms
Number of Invalid txs 0

Three local nodes

Number of nodes 3
Number of txs 900
Avg. Confirmation Time (ms) 23.592436174
P99 114.81169518ms
P95 31.082840649999998ms
P50 20.7123965ms
Number of Invalid txs 0

@ch1bo ch1bo force-pushed the http-chain-observer branch 7 times, most recently from 689bc0f to 5e2fb2a Compare January 31, 2025 22:59
@ch1bo ch1bo requested a review from a team January 31, 2025 23:00
@ch1bo ch1bo marked this pull request as ready for review January 31, 2025 23:00
@ch1bo ch1bo linked an issue Jan 31, 2025 that may be closed by this pull request
4 tasks
ch1bo added 17 commits February 1, 2025 00:18
This allows the observation types to be easier re-used.
This makes documentation and implementation for common options like
"--start-chain-from" and (new) "--explorer" less redundant.
This type is used by hydra-chain-observer and hydra-explorer
respectively on the observations API
Cardano-api has instances for Network, but not NetworkMagic.
This data type is essential for the hydra-chain-observer ->
hydra-explorer API
The hydra-chain-observer now uses the hydraNodeVersion, which is either
patched into it or uses the git revision from the repository, and
reports this along with a network id to the explorer.
@ch1bo ch1bo force-pushed the http-chain-observer branch from 5e2fb2a to 74990db Compare January 31, 2025 23:18
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.

Hydra explorer supporting multiple hydra versions
1 participant