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

Use QueryTip for local state queries #1053

Merged
merged 4 commits into from Sep 15, 2023
Merged

Conversation

v0d1ch
Copy link
Contributor

@v0d1ch v0d1ch commented Sep 4, 2023

fix #560

  • Attempt to fix the issue of hydra-node crashing after doing a local query to cardano-node using retry strategy for 5 times.
    Note: Retry attempts should probably come from a configuration value.

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

@v0d1ch v0d1ch self-assigned this Sep 4, 2023
@github-actions
Copy link

github-actions bot commented Sep 4, 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-09-15 07:55:20.860153804 UTC
Max. memory units 14000000
Max. CPU units 10000000000
Max. tx size (kB) 16384

Script summary

Name Hash Size (Bytes)
νInitial 3ffaf6b87df35cb01a52eb23032b8f0b1a2a3ad3acf0930abc9c833a 4150
νCommit e4c32d6dc83b2917aa7805571f30437ad98b6d20d821d34d45943755 2093
νHead 8a43c1c4d5cb60c212e7aa540932f311cb914a1b6104f0f36a2aaaf0 8845
μHead efd460b736e8155861e909d6507760b24a5c28717591c6e98c26b104* 4187
  • 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 4784 11.77 4.63 0.49
2 4985 14.18 5.55 0.52
3 5191 16.77 6.54 0.56
5 5601 21.38 8.29 0.63
10 6626 33.21 12.79 0.80
37 12167 97.41 37.21 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 12.75 5.01 0.32
2 787 16.41 6.66 0.37
3 974 20.28 8.39 0.42
5 1348 28.55 12.04 0.53
10 2289 51.35 21.96 0.82
18 3781 95.35 40.55 1.38

Cost of CollectCom Transaction

Parties UTxO (bytes) Tx size % max Mem % max CPU Min fee ₳
1 57 814 24.71 9.81 0.46
2 114 1144 36.67 14.72 0.60
3 170 1463 51.94 21.01 0.79
4 227 1777 72.25 29.25 1.02
5 282 2095 86.53 35.41 1.20

Cost of Close Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 685 19.26 8.84 0.40
2 763 19.04 8.37 0.40
3 1142 22.85 12.05 0.47
5 1494 25.49 14.68 0.53
10 2557 34.44 22.65 0.70
50 10645 99.47 81.94 2.01

Cost of Contest Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 741 23.22 10.36 0.45
2 921 24.67 11.79 0.48
3 1145 26.78 13.44 0.51
5 1544 30.15 16.52 0.58
10 2524 39.27 24.12 0.75
43 9236 98.10 74.85 1.89

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 5023 21.57 9.28 0.61
2 5440 36.58 15.90 0.80
3 5935 55.11 24.10 1.03
4 6345 76.61 33.57 1.29

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 4803 8.80 3.70 0.46
5 1 56 4839 10.11 4.50 0.48
5 5 285 4984 15.36 7.69 0.55
5 10 570 5164 21.92 11.69 0.64
5 20 1139 5523 35.30 19.78 0.82
5 30 1707 5886 48.43 27.77 1.00
5 40 2278 6245 61.40 35.71 1.18
5 50 2846 6598 74.71 43.77 1.36
5 69 3929 7286 99.69 58.99 1.70

@github-actions
Copy link

github-actions bot commented Sep 4, 2023

Test Results

345 tests  ±0   340 ✔️ ±0   27m 22s ⏱️ + 6m 54s
117 suites ±0       5 💤 ±0 
    5 files   ±0       0 ±0 

Results for commit 198f3e8. ± Comparison against base commit fcb8897.

♻️ This comment has been updated with latest results.

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.

I'm really looking forward to find out which query is failing via the logs!

When we know, I think we can solve this at the root and change the query correctly to be not prone to some race condition!?

Marking this as request changes because we can't merge it like this because of the tracing though.

if n == (0 :: Int)
then throwIO $ QueryAcquireException err
else do
tracer ("Retrying query... " ++ show n <> " Query: " <> show query)
Copy link
Member

Choose a reason for hiding this comment

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

This will make our logs non-JSON and hence it can only be temporary / blocks merging of this IMO.

@v0d1ch
Copy link
Contributor Author

v0d1ch commented Sep 14, 2023

So far using query at the tip works. Let's wait one more day and say this is a fix if we don't see any Retrying query logs.

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.

Can you please rename the PR title? Change looks good!

@v0d1ch v0d1ch changed the title Retry on local query exception Use QueryTip for local state queries Sep 15, 2023
@v0d1ch v0d1ch merged commit ec6c7a2 into master Sep 15, 2023
18 checks passed
@v0d1ch v0d1ch deleted the retry-on-query-exception branch September 15, 2023 14:31
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 node crashed after a fork
2 participants