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

Check that value is preserved in v_head #702

Merged
merged 10 commits into from
Feb 7, 2023

Conversation

v0d1ch
Copy link
Contributor

@v0d1ch v0d1ch commented Feb 3, 2023

Why

According to spec 5.5. rule 6 -> value is preserved there should be a validator check to make sure the head value is preserved. Note that checkAbort and checkFanout head transitions should not contain this check.

To check before merging:

  • CHANGELOG is up to date
  • Up to date with master

@github-actions
Copy link

github-actions bot commented Feb 3, 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-02-07 11:10:50.113544442 UTC
Max. memory units 14000000
Max. CPU units 10000000000
Max. tx size (kB) 16384

Script summary

Name Hash Size (Bytes)
νInitial 6e4ce2bd32260424babefe087c2a5ee0a414745fe0281d5608ae9bf8 5530
νCommit 03f2e29fd352f8c2961ad2f61d87a48f88bf01ea6c079b46a3184aee 2547
νHead ee7104256459ac3b45f71a12cdad0156f78385b3fbf7afc64e38620b 9993

Cost of Init Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 5017 10.77 4.27 0.49
2 5221 11.84 4.66 0.51
3 5427 14.16 5.56 0.54
5 5835 17.69 6.91 0.60
10 6861 28.99 11.30 0.77
45 14038 99.30 38.42 1.85

Cost of Commit Transaction

Currently only one UTxO per commit allowed (this is about to change soon)

UTxO Tx size % max Mem % max CPU Min fee ₳
1 630 21.10 8.53 0.41

Cost of CollectCom Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 13346 23.17 9.24 0.99
2 13697 38.77 15.61 1.18
3 14051 57.21 23.21 1.40
4 14331 76.79 31.33 1.63

Cost of Close Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 10590 17.97 6.95 0.81
2 10755 20.56 8.05 0.85
3 10921 22.77 9.00 0.88
5 11284 30.35 12.05 0.98
10 12148 52.00 20.66 1.25
19 13593 95.50 37.87 1.79

Cost of Contest Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 10618 18.59 7.16 0.82
2 10815 23.08 8.94 0.88
3 10949 23.69 9.33 0.89
5 11271 29.07 11.59 0.96
10 12139 50.08 19.98 1.23
19 13621 95.36 37.81 1.79

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 15122 28.55 12.06 1.13
2 15549 48.21 20.70 1.37
3 15547 60.18 25.56 1.50
4 15800 83.09 35.61 1.77
5 15592 95.37 40.58 1.90

Cost of FanOut Transaction

Involves spending head output and burning head tokens. Uses ada-only UTxO for better comparability.

UTxO Tx size % max Mem % max CPU Min fee ₳
1 14873 10.65 4.61 0.92
2 14974 12.55 5.64 0.95
3 15077 14.20 6.57 0.98
5 15011 16.49 8.03 1.00
10 15326 24.87 12.73 1.12
20 15490 38.98 21.09 1.30
44 16355 75.59 42.24 1.79

hydra-plutus/src/Hydra/Contract/Commit.hs Outdated Show resolved Hide resolved
hydra-plutus/src/Hydra/Contract/Head.hs Outdated Show resolved Hide resolved
@v0d1ch v0d1ch force-pushed the ensemble/check-that-value-is-preserved branch 3 times, most recently from 63d5a23 to c94d6cf Compare February 6, 2023 13:30
@v0d1ch v0d1ch requested a review from ch1bo February 6, 2023 13:36
@github-actions
Copy link

github-actions bot commented Feb 6, 2023

Test Results

274 tests   - 11   268 ✔️  - 11   11m 45s ⏱️ - 2m 23s
  93 suites  -   4       6 💤 ±  0 
    4 files    -   1       0 ±  0 

Results for commit 0ce2b93. ± Comparison against base commit 829332b.

This pull request removes 11 tests.
Hydra.TUI.Options ‑ parses --cardano-signing-key option
Hydra.TUI.Options ‑ parses --connect option
Hydra.TUI.Options ‑ parses --network-id option
Hydra.TUI.Options ‑ parses --node-socket option
Hydra.TUI/end-to-end smoke tests ‑ display feedback long enough
Hydra.TUI/end-to-end smoke tests ‑ doesn't allow multiple initializations
Hydra.TUI/end-to-end smoke tests ‑ starts & renders
Hydra.TUI/end-to-end smoke tests ‑ supports the full Head life cycle
Hydra.TUI/end-to-end smoke tests ‑ supports the init & abort Head life cycle
Hydra.TUI/text rendering errors ‑ should show not enough fuel message and suggestion
…

♻️ This comment has been updated with latest results.

@ch1bo ch1bo force-pushed the ensemble/check-that-value-is-preserved branch from 0124816 to 622db1c Compare February 6, 2023 17:22
Copy link
Collaborator

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

Changes look good, but what happened to the close and contest benchmarks? Only 10 parties there is a bit odd..

hydra-plutus/src/Hydra/Contract/Util.hs Outdated Show resolved Hide resolved
hydra-plutus/src/Hydra/Contract/Util.hs Outdated Show resolved Hide resolved
hydra-plutus/src/Hydra/Contract/Head.hs Outdated Show resolved Hide resolved
@ffakenz ffakenz force-pushed the ensemble/check-that-value-is-preserved branch from 622db1c to fdf6242 Compare February 6, 2023 19:35
@ffakenz ffakenz mentioned this pull request Feb 6, 2023
2 tasks
@@ -398,7 +398,7 @@ forAllFanout action =
in action utxo tx
& label ("Fanout size: " <> prettyLength (countAssets $ txOuts' tx))
where
maxSupported = 30
maxSupported = 39
Copy link
Collaborator

Choose a reason for hiding this comment

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

Benchmarks show 45, but there might be some delta between the generators used in tx-cost and these tests here. It's fine to only bump it to 39, although we could try higher numbers to test the limits more often.

@v0d1ch v0d1ch force-pushed the ensemble/check-that-value-is-preserved branch from 2e23df0 to 8207d16 Compare February 7, 2023 08:55
The transactions seem to be memory bound now.
The Eq Value instance is doing a lot of work to make two values equal
even if their actual contents (associative lists) are shuffled but consistent.
Copy link
Collaborator

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

Now as we know why the close/contest is much smaller I can approve.

@v0d1ch v0d1ch merged commit 6632086 into master Feb 7, 2023
@v0d1ch v0d1ch deleted the ensemble/check-that-value-is-preserved branch February 7, 2023 11:21
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.

4 participants