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

Provide a simple program to inject arbitrary messages in the Hydra network #1006

Merged
merged 20 commits into from
Aug 7, 2023

Conversation

abailly-iohk
Copy link
Contributor

This PR is the outcome of my experiments implementing a network injector to "attack" a Hydra cluster and DoS a Head which lead to catastrophic demo on July 27th. It provides a hydra-net executable that can connect to any node and inject ReqSn messages. Of course, because the message is now signed it does not lead to the Head being stalled anymore, unless the signing key of one of the Hydra head participants are compromised.


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

@github-actions
Copy link

github-actions bot commented Jul 31, 2023

Test Results

359 tests  ±0   354 ✔️ ±0   19m 46s ⏱️ - 3m 21s
119 suites ±0       5 💤 ±0 
    6 files   ±0       0 ±0 

Results for commit a3c07b7. ± Comparison against base commit d2efe7c.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Jul 31, 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-08-07 17:37:59.916358102 UTC
Max. memory units 14000000
Max. CPU units 10000000000
Max. tx size (kB) 16384

Script summary

Name Hash Size (Bytes)
νInitial 7ceb53f05e444cfdabfd0a37a0590090066da457a1f1db30d613b8bd 4289
νCommit 70e70fc13217bfde96932956656c1d540a743b1588c845ca09dc3723 2124
νHead cda51d313c1c8285b6925ce2413def012db27f544e2bbd79b8173000 9185
μHead 1c0b665fc49bc2e9e2ce4e8252c8f37fe84dd75bd8e086abfdb92685* 4149
  • 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 4740 11.99 4.67 0.49
2 4948 17.67 6.89 0.56
3 5153 17.19 6.64 0.56
5 5562 25.12 9.70 0.67
10 6585 36.47 13.96 0.84
36 11919 98.22 37.20 1.74

Cost of Commit Transaction

This is using ada-only outputs for better comparability.

UTxO Tx size % max Mem % max CPU Min fee ₳
1 599 15.06 5.76 0.34
2 787 19.66 7.73 0.40
3 972 24.76 9.87 0.46
5 1345 36.28 14.63 0.61
10 2288 72.00 28.94 1.04
13 2852 98.24 39.22 1.35

Cost of CollectCom Transaction

Parties UTxO (bytes) Tx size % max Mem % max CPU Min fee ₳
1 57 815 28.09 10.90 0.49
2 113 1133 43.86 17.14 0.68
3 169 1455 61.89 24.35 0.89
4 227 1775 82.43 32.58 1.13

Cost of Close Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 639 18.98 8.46 0.39
2 812 20.08 9.60 0.42
3 969 21.78 10.97 0.45
5 1299 24.57 13.49 0.50
10 2132 31.27 19.66 0.64
50 8721 87.25 69.99 1.74

Cost of Contest Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 669 24.87 10.67 0.46
2 840 26.59 12.04 0.49
3 1006 27.88 13.24 0.52
5 1335 31.75 16.15 0.58
10 2161 40.34 23.01 0.74
44 7764 98.37 69.48 1.79

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 4857 22.60 9.44 0.61
2 5177 36.97 15.65 0.79
3 5497 54.22 23.14 1.00
4 5676 69.31 29.49 1.17
5 6139 97.57 41.97 1.51

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 4765 8.72 3.59 0.46
5 1 57 4801 10.12 4.41 0.48
5 5 285 4945 15.71 7.72 0.55
5 10 568 5120 22.69 11.84 0.64
5 20 1138 5483 36.67 20.11 0.83
5 30 1707 5842 50.65 28.38 1.02
5 40 2277 6201 64.63 36.65 1.21
5 50 2847 6560 78.62 44.92 1.40
5 65 3701 7104 99.62 57.34 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-08-07 17:31:56.217725976 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) 104.103611876
P99 256.16463107ms
P95 228.80363999999994ms
P50 107.5649885ms
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) 3.959913890
P99 12.460638239999978ms
P95 9.039291ms
P50 2.8134285ms
Number of Invalid txs 0

# NOTE: Make sure to use the same image in ./seed-devnet.sh
image: ghcr.io/input-output-hk/hydra-node:0.11.0
# NOTE: Make sure to use the same image in ./seed-devnet.sh
image: ghcr.io/input-output-hk/hydra-node:unstable
Copy link
Contributor

Choose a reason for hiding this comment

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

We would overwrite these hydra-node versions upon each release. I guess you needed to use the latest on master for the demo and also it should be ok to keep it as is here since 0.12 will update it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correct

Copy link
Contributor

@v0d1ch v0d1ch left a comment

Choose a reason for hiding this comment

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

BAM!

@ch1bo ch1bo force-pushed the abailly-iohk/network-injector branch from 9949ddf to b5d8c34 Compare August 2, 2023 06:17
This is showing a less "cryptic" error and can still be located easily
in the code base.
This will improve help messages on the command line.
Copy link
Member

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

Was already a great PR. Improved the help messages myself a bit and definitely can approve this.

@ch1bo
Copy link
Member

ch1bo commented Aug 7, 2023

Could run the executable against the demo setup, but obviously MessageDropped :)

@ch1bo
Copy link
Member

ch1bo commented Aug 7, 2023

Merging this in spite of https://github.com/input-output-hk/hydra/actions/runs/5788084058/job/15686670468#step:4:131 as this is unrelated.

@ch1bo ch1bo merged commit 15cb3e4 into master Aug 7, 2023
31 of 33 checks passed
@ch1bo ch1bo deleted the abailly-iohk/network-injector branch August 7, 2023 17:42
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