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

ADR: Stateless transaction observation & construction #1066

Merged
merged 5 commits into from
Sep 19, 2023

Conversation

ch1bo
Copy link
Member

@ch1bo ch1bo commented Sep 8, 2023

Drafts a way to make the chain layer use no head state specific information to construct and observe transactions. In fact, by using ResolvedTx, the observation becomes fully stateless. For constructing head protocol transactions, one still needs to keep relevant UTxO around and any information to be able to spend them (SpendableUTxO).

A rough proof of concept is currently available on branch ch1bo/stateless-hack.

TODO:

  • Gather ideas and resolve discussion points (TBD in document)

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

@ch1bo ch1bo requested review from a user, v0d1ch, ffakenz, pgrange and locallycompact September 8, 2023 10:37
@ch1bo ch1bo force-pushed the adr-stateless-chain branch 2 times, most recently from e3fa690 to b62f9a7 Compare September 8, 2023 10:44
@github-actions
Copy link

github-actions bot commented Sep 8, 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-18 15:19:30.994227559 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 4782 12.19 4.81 0.49
2 4985 14.24 5.57 0.52
3 5191 16.69 6.51 0.56
5 5598 21.25 8.24 0.63
10 6629 33.24 12.80 0.80
38 12367 99.85 38.14 1.78

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.37 8.42 0.42
5 1348 28.46 12.01 0.53
10 2288 51.35 21.96 0.82
18 3775 95.35 40.55 1.38

Cost of CollectCom Transaction

Parties UTxO (bytes) Tx size % max Mem % max CPU Min fee ₳
1 57 813 24.07 9.57 0.45
2 114 1136 36.88 14.81 0.61
3 169 1455 54.78 22.04 0.82
4 225 1775 69.98 28.43 1.00
5 282 2095 90.47 36.88 1.24

Cost of Close Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 694 19.27 8.85 0.40
2 945 20.74 10.36 0.43
3 1074 22.41 11.70 0.46
5 1590 26.36 15.24 0.54
10 2598 34.42 22.62 0.71
49 7211 82.09 42.56 1.44

Cost of Contest Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 739 23.18 10.34 0.44
2 951 25.14 11.99 0.48
3 1175 27.10 13.67 0.52
5 1580 30.54 16.62 0.59
10 2638 39.37 24.46 0.76
43 9461 99.52 76.05 1.92

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 4999 21.63 9.30 0.61
2 5179 31.54 13.46 0.73
3 5947 54.71 23.94 1.03
4 6112 69.28 30.16 1.20
5 6500 93.54 40.83 1.49

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 4800 8.80 3.70 0.46
5 1 57 4840 10.11 4.50 0.48
5 5 285 4984 15.10 7.59 0.55
5 10 569 5168 21.75 11.62 0.64
5 20 1138 5522 34.88 19.61 0.82
5 30 1707 5883 48.43 27.77 1.00
5 40 2275 6245 61.40 35.71 1.18
5 50 2846 6598 73.92 43.45 1.35
5 69 3925 7281 99.52 58.92 1.70

@github-actions
Copy link

github-actions bot commented Sep 8, 2023

Test Results

358 tests  ±0   353 ✔️ ±0   22m 18s ⏱️ +25s
121 suites ±0       5 💤 ±0 
    6 files   ±0       0 ±0 

Results for commit 5524d5b. ± Comparison against base commit ec6c7a2.

♻️ This comment has been updated with latest results.

@ch1bo ch1bo self-assigned this Sep 18, 2023
@ch1bo ch1bo force-pushed the adr-stateless-chain branch from b62f9a7 to 2735692 Compare September 18, 2023 12:16
@ch1bo ch1bo removed their assignment Sep 19, 2023
@ch1bo ch1bo merged commit b9864ac into master Sep 19, 2023
@ch1bo ch1bo deleted the adr-stateless-chain branch September 19, 2023 06:08
@ghost ghost mentioned this pull request Oct 3, 2023
3 tasks
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.

3 participants