Skip to content

Blockfrost chain integration #1952

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

Open
wants to merge 51 commits into
base: blockfrost-time-handle
Choose a base branch
from

Conversation

v0d1ch
Copy link
Contributor

@v0d1ch v0d1ch commented Apr 16, 2025

  • Final step for the blockfrost integration.

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

@v0d1ch v0d1ch added this to the 0.22.0 milestone Apr 16, 2025
@v0d1ch v0d1ch self-assigned this Apr 16, 2025
@v0d1ch v0d1ch changed the base branch from master to blockfrost-time-handle April 16, 2025 09:25
@v0d1ch v0d1ch moved this from Triage 🏥 to In progress 🕐 in ☕ Hydra Team Work Apr 16, 2025
@v0d1ch v0d1ch force-pushed the blockfrost-time-handle branch from 246d10f to 5bd73a1 Compare April 16, 2025 11:49
@v0d1ch v0d1ch force-pushed the blockfrost-load-chain-context branch 2 times, most recently from 5e64ad8 to 05a0e8d Compare April 16, 2025 12:26
@v0d1ch v0d1ch force-pushed the blockfrost-time-handle branch from 5bd73a1 to 5a7a1cd Compare April 16, 2025 12:28
@v0d1ch v0d1ch force-pushed the blockfrost-load-chain-context branch from 05a0e8d to 255c4d0 Compare April 16, 2025 12:29
@v0d1ch v0d1ch marked this pull request as ready for review April 16, 2025 12:30
@v0d1ch v0d1ch force-pushed the blockfrost-load-chain-context branch from 255c4d0 to 216e88e Compare April 16, 2025 12:31
Copy link

github-actions bot commented Apr 16, 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 - - - -
43 - - - -

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

Cost of Increment Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 - - - -
2 - - - -
3 - - - -
5 - - - -
10 - - - -
43 - +0.38 +0.09 +0.01

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

Contest transaction costs

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

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

Copy link

github-actions bot commented Apr 16, 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-05-21 08:26:27.04559302 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 be6ebc744208c660bf0fdc1cfbb5157477cd305de5b1777e575cbb4c 14665
μHead 1f47a42d1d6edc32ccd834acb19d5db3b2a5232f0bd7eaa8908dc519* 5284
ν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 5837 10.81 3.44 0.52
2 6037 12.41 3.92 0.54
3 6236 14.73 4.66 0.58
5 6646 18.80 5.94 0.64
10 7646 29.09 9.17 0.79
43 14279 98.73 30.85 1.80

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 740 3.38 1.73 0.22
3 920 4.36 2.33 0.24
5 1280 6.41 3.60 0.28
10 2177 12.13 7.25 0.40
54 10056 98.61 68.52 1.88

CollectCom transaction costs

Parties UTxO (bytes) Tx size % max Mem % max CPU Min fee ₳
1 57 525 25.20 7.30 0.43
2 114 636 33.26 9.63 0.52
3 171 747 43.74 12.51 0.63
4 226 858 48.12 13.94 0.68
5 283 974 60.88 17.41 0.81
6 339 1081 68.27 19.58 0.89
7 395 1192 75.57 21.90 0.97
8 449 1303 98.92 27.76 1.21
9 508 1414 93.43 26.84 1.16

Cost of Increment Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 1810 24.16 8.03 0.48
2 1959 25.35 9.11 0.51
3 2021 26.18 9.93 0.52
5 2333 30.15 12.59 0.59
10 3218 41.31 19.75 0.77
39 7280 91.79 55.29 1.61

Cost of Decrement Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 589 22.50 7.27 0.41
2 756 23.59 8.21 0.43
3 878 24.98 9.27 0.46
5 1312 31.80 12.54 0.56
10 1896 38.62 17.75 0.67
40 6454 94.24 53.22 1.58

Close transaction costs

Parties Tx size % max Mem % max CPU Min fee ₳
1 665 28.99 9.24 0.48
2 774 28.43 9.71 0.48
3 986 33.22 11.99 0.55
5 1300 34.76 13.88 0.59
10 1956 43.79 20.12 0.74
38 6265 99.83 57.32 1.65

Contest transaction costs

Parties Tx size % max Mem % max CPU Min fee ₳
1 667 33.73 10.50 0.53
2 814 35.77 11.79 0.56
3 1042 39.09 13.67 0.61
5 1262 42.38 15.91 0.66
10 2036 54.33 23.17 0.85
30 4983 99.06 50.61 1.53

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 5789 26.97 9.03 0.69
2 5917 35.84 12.00 0.79
3 6128 46.41 15.63 0.91
4 6144 53.22 17.81 0.98
5 6352 64.87 21.75 1.11
6 6442 72.83 24.36 1.20
7 6700 85.63 28.87 1.34
8 6584 81.52 27.22 1.29

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 5835 19.19 6.41 0.61
10 1 57 5868 21.67 7.37 0.64
10 5 284 6003 29.10 10.35 0.72
10 10 569 6173 38.38 14.07 0.83
10 20 1139 6513 59.76 22.45 1.08
10 30 1707 6853 79.64 30.32 1.31
10 38 2164 7127 96.50 36.94 1.51

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-05-21 08:30:57.261396813 UTC

Baseline Scenario

Number of nodes 1
Number of txs 300
Avg. Confirmation Time (ms) 4.148266246
P99 5.730023859999962ms
P95 4.7965254ms
P50 4.012975ms
Number of Invalid txs 0

Memory data

Time Used Free
2025-05-21 08:29:42.54098802 UTC 730M 6721M
2025-05-21 08:29:47.54090114 UTC 841M 6569M
2025-05-21 08:29:52.540869667 UTC 833M 6576M
2025-05-21 08:29:57.5408578 UTC 833M 6576M
2025-05-21 08:30:02.540848191 UTC 838M 6571M
2025-05-21 08:30:07.540765002 UTC 839M 6570M

Three local nodes

Number of nodes 3
Number of txs 900
Avg. Confirmation Time (ms) 26.894312210
P99 39.91703951ms
P95 35.39602984999999ms
P50 25.973728ms
Number of Invalid txs 0

Memory data

Time Used Free
2025-05-21 08:30:20.504030364 UTC 757M 6687M
2025-05-21 08:30:25.506700768 UTC 974M 6387M
2025-05-21 08:30:30.505757064 UTC 1029M 6266M
2025-05-21 08:30:35.504218951 UTC 1033M 6224M
2025-05-21 08:30:40.504291134 UTC 1034M 6221M
2025-05-21 08:30:45.504141598 UTC 1036M 6218M
2025-05-21 08:30:50.504284745 UTC 1035M 6218M
2025-05-21 08:30:55.504118425 UTC 1036M 6217M

@v0d1ch v0d1ch force-pushed the blockfrost-load-chain-context branch from 216e88e to e7abdd1 Compare April 16, 2025 13:01
@v0d1ch v0d1ch moved this from In progress 🕐 to In review 👀 in ☕ Hydra Team Work Apr 16, 2025
@v0d1ch v0d1ch requested a review from a team April 16, 2025 13:31
@ch1bo ch1bo added the stacked Stacked diff. Review it, but leave merging to the author. label Apr 17, 2025
@github-project-automation github-project-automation bot moved this from In review 👀 to In progress 🕐 in ☕ Hydra Team Work Apr 17, 2025
@v0d1ch v0d1ch requested a review from ch1bo April 17, 2025 08:08
@v0d1ch v0d1ch force-pushed the blockfrost-load-chain-context branch 6 times, most recently from 44147b7 to a86a429 Compare April 23, 2025 16:17
@v0d1ch v0d1ch force-pushed the blockfrost-load-chain-context branch from 5b31919 to c3b71c3 Compare April 24, 2025 14:00
v0d1ch added 16 commits May 20, 2025 10:36
Added function to wait for specific UTxO. I'd like to refactor
blockfrost client and keep only the least amount of code possible.

Signed-off-by: Sasha Bogicevic <[email protected]>
Also a small refactor in the faucet.

Signed-off-by: Sasha Bogicevic <[email protected]>
Make queryUTxOByTxIn take in tx hash as Text
Increase utxo amounts in test to cover for script execution.
Small refactors here and there

Signed-off-by: Sasha Bogicevic <[email protected]>
Problem was that we were starting from scratch each time because of
retry. Using TMVar to record block hash solved this problem.

Signed-off-by: Sasha Bogicevic <[email protected]>
Signed-off-by: Sasha Bogicevic <[email protected]>
This slightly improves the design by adding BackendOps
instances for underlying types and then have one instance for
ChainBackend. Too bad we can't derive this instance (yet).

Signed-off-by: Sasha Bogicevic <[email protected]>
Signed-off-by: Sasha Bogicevic <[email protected]>
Signed-off-by: Sasha Bogicevic <[email protected]>
Signed-off-by: Sasha Bogicevic <[email protected]>
@v0d1ch v0d1ch force-pushed the blockfrost-load-chain-context branch from 0d4048c to dc053c3 Compare May 20, 2025 09:40
"18a22e4400bb478fec5dcad29b32aabd00b822aa721dccf8c9821354aabea153",
"d0bafe586ebb838b9f8f8bb533892be0cb740a68d6f2b77b9f2d4f2c9ce08464",
"b6fa856a9c21da5be600bda4da3b31dbbe213b0fe97f62340551e465fea3d963",
"a726aedba74a0dc5f3ead4dc662fac9dfe1e566f88a9f7b9ebe7bf47e569df39"
Copy link
Contributor

Choose a reason for hiding this comment

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

What's happening here? Why so many script tx ids?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess the generator does it. I'll see if anything changed there.

Copy link
Contributor

@ffakenz ffakenz left a comment

Choose a reason for hiding this comment

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

nice job!

excited to see this in action already!

import Hydra.Chain.CardanoClient qualified as CardanoClient
import Hydra.Tx (ScriptRegistry)

class ChainBackend a where
Copy link
Contributor

Choose a reason for hiding this comment

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

in love with this type class! <3

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not a fan of this kind of lawless overloading, but if we must do this then it should be a monad class. methods should not have constraints in the context.

An example of this kind of style is in pandoc:

https://hackage-content.haskell.org/package/pandoc-3.7.0.1/docs/Text-Pandoc-Class.html#t:PandocMonad

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@locallycompact I lean towards your approach but even more I think handles would be appropriate considering the our coding style. Let's do the changes as a follow up if you agree since this PR is dragging for a long time.

@v0d1ch v0d1ch force-pushed the blockfrost-load-chain-context branch 6 times, most recently from 255cb60 to 5bf925f Compare May 20, 2025 13:10
v0d1ch added 2 commits May 20, 2025 15:25
Signed-off-by: Sasha Bogicevic <[email protected]>
Signed-off-by: Sasha Bogicevic <[email protected]>
@v0d1ch v0d1ch force-pushed the blockfrost-load-chain-context branch from 5bf925f to 8f29167 Compare May 20, 2025 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blockfrost stacked Stacked diff. Review it, but leave merging to the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants