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

Add address query parameter to ws server #1739

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

Conversation

ffakenz
Copy link
Contributor

@ffakenz ffakenz commented Nov 11, 2024

To filter transaction server outputs by given address.

Fixes #1719

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

@ffakenz ffakenz self-assigned this Nov 11, 2024
@ffakenz ffakenz changed the title Add address query parameter to websocket Add address query parameter to ws server Nov 11, 2024
Copy link

Transaction cost differences

No cost or size differences found

Copy link

github-actions bot commented Nov 11, 2024

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 2024-11-15 13:29:41.040400713 UTC
Max. memory units 14000000
Max. CPU units 10000000000
Max. tx size (kB) 16384

Script summary

Name Hash Size (Bytes)
νInitial 00a6ddbc130ab92f5b7cb8d1ccd8d79eca5bfe25f6843c07b62841f0 2667
νCommit 3e5a776bcee213e3dfd15806952a10ac5590e3e97d09d62eb99266b2 690
νHead 00e0e6aceb51fcb4fcc5dc6032cc524a641163f0723b25d995de3ae8 12633
μHead 134f18365d53de72b07af2e703c96d8a6f0643c71d4c1a2050b8182a* 11111
νDeposit 2feb47889a4f658dc593cefcb0e37d584b9431944f08a687f3dab4af 4865
  • 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 11696 9.02 2.95 0.76
2 11897 10.44 3.40 0.78
3 12097 12.20 3.97 0.81
5 12497 15.72 5.11 0.86
10 13505 24.91 8.12 1.00
24 16322 49.67 16.16 1.39

Commit transaction costs

This uses ada-only outputs for better comparability.

UTxO Tx size % max Mem % max CPU Min fee ₳
1 561 2.45 1.17 0.20
2 738 3.40 1.74 0.22
3 917 4.39 2.34 0.24
5 1273 6.46 3.61 0.28
10 2183 12.24 7.28 0.40
54 10055 99.20 68.72 1.89

CollectCom transaction costs

Parties UTxO (bytes) Tx size % max Mem % max CPU Min fee ₳
1 57 560 23.94 7.01 0.42
2 113 671 33.57 9.71 0.52
3 170 782 39.42 11.51 0.59
4 226 897 48.83 14.18 0.69
5 284 1004 58.15 16.78 0.79
6 338 1116 74.25 21.15 0.95
7 394 1227 72.65 21.09 0.94
8 451 1338 79.63 23.16 1.02
9 504 1453 92.14 26.62 1.15
10 560 1560 96.54 27.89 1.20

Cost of Decrement Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 640 22.26 7.22 0.41
2 767 23.71 8.29 0.44
3 858 23.71 8.93 0.44
5 1232 28.65 11.65 0.52
10 1889 36.14 17.08 0.65
45 7025 97.74 57.68 1.66

Close transaction costs

Parties Tx size % max Mem % max CPU Min fee ₳
1 654 24.27 7.99 0.43
2 812 25.83 9.16 0.46
3 1063 28.53 10.89 0.51
5 1223 31.11 12.92 0.55
10 2128 41.02 19.83 0.72
45 7104 99.24 62.56 1.72

Contest transaction costs

Parties Tx size % max Mem % max CPU Min fee ₳
1 709 30.27 9.61 0.50
2 764 31.56 10.55 0.51
3 938 33.91 12.05 0.55
5 1205 37.71 14.56 0.61
10 1944 48.01 21.28 0.78
34 5518 98.02 53.62 1.57

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 11570 25.63 8.72 0.93
2 11673 30.93 10.48 0.99
3 11943 44.23 15.17 1.14
4 11932 48.91 16.64 1.19
5 12148 61.43 20.97 1.33
6 12208 66.89 22.74 1.39
7 12241 74.11 25.09 1.47
8 12485 82.14 27.94 1.56
9 12726 98.15 33.55 1.75

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 11692 16.98 5.80 0.84
10 1 57 11727 19.56 6.83 0.87
10 5 285 11862 26.97 9.88 0.96
10 10 567 12029 35.86 13.55 1.07
10 20 1139 12371 54.75 21.30 1.29
10 30 1705 12709 72.54 28.65 1.50
10 40 2276 13051 91.44 36.40 1.73
10 44 2506 13189 98.49 39.32 1.81

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 2024-11-15 13:32:36.343075125 UTC

Baseline Scenario

Number of nodes 1
Number of txs 300
Avg. Confirmation Time (ms) 5.645388593
P99 12.044378069999986ms
P95 7.506340649999999ms
P50 5.236215ms
Number of Invalid txs 0

Three local nodes

Number of nodes 3
Number of txs 900
Avg. Confirmation Time (ms) 25.359234310
P99 112.99988074999999ms
P95 33.9094576ms
P50 23.0616475ms
Number of Invalid txs 0

@ffakenz ffakenz force-pushed the server-outputs-filter-by-address branch 14 times, most recently from 4e93804 to 1190bb9 Compare November 13, 2024 15:55
@ffakenz ffakenz marked this pull request as ready for review November 13, 2024 15:55
Copy link

Test Results

  5 files  ±0  163 suites  +1   32m 49s ⏱️ +39s
558 tests +4  552 ✅ +4  6 💤 ±0  0 ❌ ±0 
560 runs  +4  554 ✅ +4  6 💤 ±0  0 ❌ ±0 

Results for commit 1190bb9. ± Comparison against base commit 3be7b22.

@ffakenz ffakenz force-pushed the server-outputs-filter-by-address branch 10 times, most recently from 16c8dcf to b8d6111 Compare November 15, 2024 09:54
@ffakenz ffakenz force-pushed the server-outputs-filter-by-address branch from fc3dfc2 to c5f57c0 Compare November 15, 2024 12:11
CHANGELOG.md Outdated Show resolved Hide resolved
@ffakenz ffakenz force-pushed the server-outputs-filter-by-address branch from 791268d to 9cd2af9 Compare November 15, 2024 12:47
hist <- STM.atomically (readTVar history)
forwardHistory con ServerOutputConfig{addressInTx} = do
rawHist <- STM.atomically (readTVar history)
let hist = flip filter rawHist $ \response ->
Copy link
Contributor

Choose a reason for hiding this comment

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

Kind of annoying that this is duplicated functionality, roughly, wit hthe code baove on line 143.

Any way to refactor so it's a bit cleaner? (I.e. only one case statement on addressInTx etc)

case output response of
TxValid{transaction} -> matchingAddr transaction address
TxInvalid{transaction} -> matchingAddr transaction address
_ -> True
Copy link
Contributor

Choose a reason for hiding this comment

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

It's kind of sad that we return True here; semantically this is not true: it's just that we don't want to run the filter at all for these items.

Is there a way to refactor to reflect that? Or, change the name slightly so that it's clear that these things are fine to pass as True always?

not . null $ flip filter (txOuts' tx) $ \(TxOut addr _ _ _) ->
unwrapAddress addr == address

-- TODO! move somewhere else
Copy link
Contributor

Choose a reason for hiding this comment

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

Also, probably worth just trying to find the right place to move these functions to; might help make it a bit more generic while we are thinking about that.

@@ -377,6 +377,12 @@ dummyChainHandle =
, submitTx = \_ -> error "unexpected call to submitTx"
}

dummyServerOutputFilter :: ServerOutputFilter tx
dummyServerOutputFilter =
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe rename this to allowEverythingServerOutputFilter or something; it's not really "dummy", it's doing something very useful!

Copy link
Contributor

@noonio noonio left a comment

Choose a reason for hiding this comment

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

Looking really nice; just a couple of small-ish refactors requested/suggested.

Great work!

Missing to check TxValid with new transaction field
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.

Filter api messages by UTxO address
2 participants