Skip to content

Not observe invalid transactions - #1953

Merged
ch1bo merged 1 commit into
masterfrom
fix-observation-of-invalid-tx
Apr 17, 2025
Merged

ch1bo merged 1 commit into
masterfrom
fix-observation-of-invalid-tx

Conversation

@ch1bo

@ch1bo ch1bo commented Apr 16, 2025

Copy link
Copy Markdown
Member

Fixes hydra-tx observations used in hydra-node and hydra-explorer to never make an observation on invalid transactions.

This avoids situations where adversaries may create transactions that do not pass on-chain validators, but deliberately mark the transaction with isValid = false to trick off-chain components.


  • CHANGELOG update not needed
  • Documentation update not needed
  • Haddocks update not needed
  • No new TODOs introduced

@ch1bo
ch1bo requested a review from a team April 16, 2025 19:47
@ch1bo ch1bo self-assigned this Apr 16, 2025
@ch1bo ch1bo moved this from Triage 🏥 to In review 👀 in ☕ Hydra Team Work Apr 16, 2025
Fixes hydra-tx observations used in hydra-node and hydra-explorer to
never make an observation on invalid transactions.

This avoids situations where adversaries may create transactions that do
not pass on-chain validators, but deliberately mark the transaction with
isValid = false to trick off-chain components.
@ch1bo
ch1bo force-pushed the fix-observation-of-invalid-tx branch from b5cbbd2 to c06345f Compare April 16, 2025 19:50
@github-actions

Copy link
Copy Markdown

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-04-16 19:54:47.64085825 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 0e35115a2c7c13c68ecd8d74e4987c04d4539e337643be20bb3274bd 14756
μHead 57166715eadb8d3135964325c016eea546c21e1c0aae974ca67df9a5* 5541
ν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 6091 11.23 3.50 0.53
2 6292 13.04 4.04 0.56
3 6493 15.28 4.73 0.59
5 6897 20.34 6.30 0.66
10 7904 31.40 9.68 0.82
40 13936 98.39 30.22 1.78

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 743 3.38 1.73 0.22
3 923 4.36 2.33 0.24
5 1277 6.41 3.60 0.28
10 2170 12.13 7.25 0.40
54 10059 98.61 68.52 1.88

CollectCom transaction costs

Parties UTxO (bytes) Tx size % max Mem % max CPU Min fee ₳
1 57 525 25.64 7.39 0.43
2 114 636 34.81 9.96 0.53
3 171 751 45.86 13.00 0.65
4 226 858 49.99 14.38 0.70
5 283 969 60.72 17.40 0.81
6 338 1081 79.34 22.25 1.00
7 396 1192 88.85 24.89 1.10
8 450 1303 98.25 27.48 1.20

Cost of Increment Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 1807 25.12 8.24 0.49
2 1886 25.98 9.08 0.51
3 2059 28.65 10.64 0.55
5 2364 32.51 13.26 0.61
10 3176 43.44 20.19 0.79
36 7145 97.54 55.07 1.65

Cost of Decrement Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 617 23.71 7.55 0.42
2 730 24.81 8.48 0.44
3 824 25.31 9.28 0.46
5 1129 30.37 12.03 0.53
10 1919 41.59 18.46 0.70
38 6046 94.64 51.72 1.55

Close transaction costs

Parties Tx size % max Mem % max CPU Min fee ₳
1 711 29.19 9.23 0.48
2 775 32.84 10.92 0.53
3 949 32.77 11.64 0.54
5 1377 40.77 15.64 0.65
10 2001 50.54 21.96 0.80
31 5193 96.83 50.84 1.53

Contest transaction costs

Parties Tx size % max Mem % max CPU Min fee ₳
1 696 35.95 11.01 0.55
2 768 37.49 12.02 0.57
3 1058 41.69 14.26 0.64
5 1248 45.21 16.53 0.69
10 2025 57.32 23.70 0.87
27 4645 99.41 48.43 1.51

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 5987 28.20 9.30 0.71
2 6138 38.45 12.72 0.82
3 6206 46.51 15.35 0.91
4 6445 57.94 19.21 1.04
5 6372 58.51 19.24 1.04
6 6805 78.78 26.11 1.27
7 6895 87.79 29.18 1.37
8 6993 96.66 31.96 1.47
9 6959 95.27 31.43 1.45

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 6091 20.58 6.77 0.63
10 5 285 6261 30.97 10.82 0.75
10 10 569 6430 40.96 14.72 0.87
10 38 2162 7381 99.70 37.55 1.55

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-04-16 19:56:14.407067516 UTC

Baseline Scenario

Number of nodes 1
Number of txs 300
Avg. Confirmation Time (ms) 4.476598286
P99 6.682495559999993ms
P95 5.108360500000001ms
P50 4.1440725ms
Number of Invalid txs 0

Memory data

Time Used Free
2025-04-16 19:54:58.658304677 UTC 908M 6323M
2025-04-16 19:55:03.65829799 UTC 1026M 6112M
2025-04-16 19:55:08.65826024 UTC 1029M 6110M
2025-04-16 19:55:13.658338883 UTC 1029M 6109M
2025-04-16 19:55:18.658305667 UTC 1037M 6101M
2025-04-16 19:55:23.658310364 UTC 1038M 6100M

Three local nodes

Number of nodes 3
Number of txs 900
Avg. Confirmation Time (ms) 31.210330968
P99 72.91683242999997ms
P95 54.807220650000005ms
P50 27.5184135ms
Number of Invalid txs 0

Memory data

Time Used Free
2025-04-16 19:55:37.49487945 UTC 965M 6182M
2025-04-16 19:55:42.496047425 UTC 1210M 5930M
2025-04-16 19:55:47.497614397 UTC 1267M 5808M
2025-04-16 19:55:52.494973485 UTC 1273M 5764M
2025-04-16 19:55:57.494983348 UTC 1275M 5762M
2025-04-16 19:56:02.494915408 UTC 1279M 5757M
2025-04-16 19:56:07.494902967 UTC 1279M 5756M
2025-04-16 19:56:12.49493856 UTC 1281M 5753M

@github-actions

Copy link
Copy Markdown

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 - - - -
40 - - - -

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

Cost of Increment Transaction

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

Cost of Decrement Transaction

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

Close transaction costs

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

Contest transaction costs

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

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) - - - - -
(37, 10) - - - - -

@ffakenz ffakenz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👼

@ch1bo
ch1bo enabled auto-merge April 16, 2025 20:44
@ch1bo
ch1bo merged commit c3c641c into master Apr 17, 2025
@ch1bo
ch1bo deleted the fix-observation-of-invalid-tx branch April 17, 2025 06:40
@github-project-automation github-project-automation Bot moved this from In review 👀 to Done ✔ in ☕ Hydra Team Work Apr 17, 2025
@ch1bo ch1bo added this to the 0.21.0 milestone Apr 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants