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

Refactor ConfirmedSnapshot #533

Merged
merged 7 commits into from
Oct 10, 2022
Merged

Refactor ConfirmedSnapshot #533

merged 7 commits into from
Oct 10, 2022

Conversation

pgrange
Copy link
Contributor

@pgrange pgrange commented Oct 4, 2022

An InitialSnapshot always has number 0 and an empty list of confirmed transactions.
So we make it explicit in the type system to avoid issues with that.

@pgrange pgrange requested a review from ch1bo October 4, 2022 16:46
@pgrange pgrange marked this pull request as draft October 4, 2022 16:54
@github-actions
Copy link

github-actions bot commented Oct 4, 2022

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 2022-10-10 12:32:57.52295167 UTC
Max. memory units 14000000
Max. CPU units 10000000000
Max. tx size (kB) 16384

Cost of Init Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 4832 11.06 4.39 0.48
2 5037 12.95 5.12 0.51
3 5243 13.91 5.46 0.53
5 5652 20.15 7.93 0.62
10 6677 28.55 11.12 0.75
45 13855 99.77 38.62 1.84

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 5768 19.92 8.05 0.62

Cost of CollectCom Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 13058 20.60 8.25 0.95
2 13522 38.08 15.44 1.16
3 13780 56.09 22.89 1.37
4 14135 77.87 31.97 1.63

Cost of Close Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 9327 8.19 3.36 0.65
2 9363 8.05 3.16 0.65
3 9694 10.14 4.42 0.69
5 10055 12.14 5.49 0.73
10 10845 15.65 7.60 0.81
30 14219 32.63 17.16 1.16
71 16305 42.00 15.90 1.32

Cost of Contest Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 9365 8.56 3.49 0.66
2 9485 8.94 3.79 0.67
3 9692 10.12 4.40 0.69
5 10022 11.72 5.32 0.72
10 10882 16.06 7.75 0.81
30 14213 32.32 17.03 1.16
43 16358 42.60 22.95 1.38

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 13704 25.73 10.91 1.04
2 13816 38.20 16.25 1.18
3 13927 52.63 22.47 1.35
4 14037 69.21 29.65 1.54
5 14433 97.27 42.48 1.88

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 13415 9.88 4.31 0.85
2 13452 11.40 5.19 0.87
3 13492 13.22 6.19 0.90
5 13564 15.96 7.83 0.93
10 13743 23.82 12.33 1.04
50 15182 84.80 47.57 1.85
60 15540 99.99 56.37 2.05

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.

This is already a good improvement!

Maybe we can make some access onto this structure simpler in the HeadLogic module (number . getSnapshot) confirmedSnapshot + 1 == sn is a bit verbose), but that can be story of another PR.

hydra-node/src/Hydra/Chain/Direct/Context.hs Show resolved Hide resolved
hydra-node/src/Hydra/Snapshot.hs Outdated Show resolved Hide resolved
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.

The tests are failing because you need to update the api.yaml with the new JSON schema for ConfirmedSnapshot, here https://github.com/input-output-hk/hydra-poc/blob/5681f52646fc17224453be6b1624a61794cbbcd7/hydra-node/json-schemas/api.yaml#L610

@pgrange pgrange force-pushed the pascal/refactor_intial_snapshot branch from 658efbd to 667469c Compare October 5, 2022 17:54
@github-actions
Copy link

github-actions bot commented Oct 5, 2022

Unit Test Results

257 tests  ±0   251 ✔️ ±0   14m 59s ⏱️ + 1m 0s
  91 suites ±0       6 💤 ±0 
    5 files   ±0       0 ±0 

Results for commit 3bd7fac. ± Comparison against base commit 4027ca0.

♻️ This comment has been updated with latest results.

@pgrange pgrange marked this pull request as ready for review October 6, 2022 08:57
@pgrange pgrange self-assigned this Oct 6, 2022
@pgrange pgrange marked this pull request as draft October 6, 2022 09:28
@pgrange
Copy link
Contributor Author

pgrange commented Oct 6, 2022

I convert it back to a draft as I'd like to go through some checklist proposal:

Pre-submit checklist

  • No errors in the CI (don't state the obvious)
  • CHANGELOG is up to date

@ghost
Copy link

ghost commented Oct 6, 2022

I would argue that No Errors in the CI should not be part of the checklist as it's automatically tested in the PR. I mean you won't merge a PR when CI is red would you (except in exceptional circumstnaces like the ones we faced with this failing ci/hydra job...)

CHANGELOG.md Show resolved Hide resolved
@pgrange pgrange marked this pull request as ready for review October 6, 2022 13:13
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.

Still approve :)

@ch1bo ch1bo force-pushed the pascal/refactor_intial_snapshot branch from 19ff3c4 to 682af05 Compare October 7, 2022 11:39
@pgrange pgrange force-pushed the pascal/refactor_intial_snapshot branch from 682af05 to f84b488 Compare October 10, 2022 07:05
pgrange and others added 7 commits October 10, 2022 14:21
An InitialSnapshot always has number 0 and an empty list of
confirmed transaction. So we make it explicit in the type system
to avoid issues with that.
Co-authored-by: Sebastian Nagel <ch1bo@users.noreply.github.com>
On os x if jsonschema is not installed the error message was cryptic.
This code is working with jsonschema 4.16.0 so I'm releasing the
constraint here to just check that jsonschema versio is higher
than 3.2.0
They might be usefull to fix tests but don't belong to git repo.
@pgrange pgrange force-pushed the pascal/refactor_intial_snapshot branch from f84b488 to 3bd7fac Compare October 10, 2022 12:21
@pgrange pgrange merged commit 3b6dbec into master Oct 10, 2022
@pgrange pgrange deleted the pascal/refactor_intial_snapshot branch October 10, 2022 14:03
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